public static TaskType ParseTaskType(this Config.missionCell missionCell) { if (missionCell == null) { return(TaskType.Unknown); } return((TaskType)missionCell.tasktype); }
public static string GetAdTag(this Config.missionCell missionCell) { if (missionCell == null || missionCell.ParseTaskType() != TaskType.AdWatch) { return(string.Empty); } return(missionCell.taskparam1); }
public static EntryGateProperty ParseEntryGateProperty(this Config.missionCell missionCell) { if (missionCell == null || missionCell.ParseTaskType() != TaskType.EntryGateLevelup) { return(EntryGateProperty.None); } return((EntryGateProperty)missionCell.taskparam2); }
public static ParkingProperty ParseParkingProperty(this Config.missionCell missionCell) { if (missionCell == null || missionCell.ParseTaskType() != TaskType.ParkingLevelup) { return(ParkingProperty.None); } return((ParkingProperty)missionCell.taskparam2); }
public static LittleZooProperty ParseLittleZooProperty(this Config.missionCell missionCell) { if (missionCell == null || missionCell.ParseTaskType() != TaskType.LittleZooLevelup) { return(LittleZooProperty.None); } return((LittleZooProperty)missionCell.taskparam2); }
private void NextTask(int taskId) { Config.missionCell missionCell = missionModel.GetTaskCell(taskId); if (missionCell != null) { int nextTaskId = missionCell.nextid; ReceiveTask(nextTaskId); } }
/// <summary> /// 获取某个任务奖励道具 /// </summary> /// <param name="taskId"></param> /// <returns></returns> public Config.itemCell GetTaskRewardItem(int taskId) { Config.missionCell missionCell = GetTaskCell(taskId); if (missionCell != null) { return(Config.itemConfig.getInstace().getCell(missionCell.reward)); } return(null); }
private void OnBuildingUnlock(Message message) { int buildingId = (message as BuildingUnlock).buildingId; Config.missionCell missionCell = missionModel.GetTaskCell(missionModel.currTaskId); if (missionCell != null && missionCell.ParseTaskType() == TaskType.LittleZooLevelup && missionCell.GetBuildingId() == buildingId) { missionModel.SetTaskProgress(missionModel.currTaskId, missionModel.ResolveTaskProgress(missionModel.currTaskId)); GuideMissionStateChanged.Send(missionModel.currTaskId, GuideMissionStateChanged.ChangeDetail_TaskProgress); } }
public static int GetEntryGateId(this Config.missionCell missionCell) { if (missionCell == null || missionCell.ParseTaskType() != TaskType.EntryGateLevelup) { return(-1); } int ret; int.TryParse(missionCell.taskparam1, out ret); return(ret); }
public static int GetLittleZooId(this Config.missionCell missionCell) { if (missionCell == null || (missionCell.ParseTaskType() != TaskType.LittleZooLevelup && missionCell.ParseTaskType() != TaskType.LittleZooVisit)) { return(-1); } int ret; int.TryParse(missionCell.taskparam1, out ret); return(ret); }
private void PositionToTask(int taskId) { Config.missionCell missionCell = missionModel.GetTaskCell(taskId); if (missionCell != null && missionCell.skip > 0) { int progress, goal; missionModel.GetTaskProgress(taskId, out progress, out goal); if (progress < 1 && missionCell.ParseTaskType() == TaskType.LittleZooLevelup) // 此动物栏还未开启 { return; } CloseOthersPageAndTaskPanel(); TaskType taskType = missionCell.ParseTaskType(); int buildingId = missionCell.GetBuildingId(); if (taskType == TaskType.ParkingLevelup) { PageMgr.ShowPage <UIParkPage>(); UIInteractive.GetInstance().iPage = new UIParkPage(); PostionSceneTo(GlobalDataManager.GetInstance().zooGameSceneData.GetParkingFocusPoint(buildingId)); } else if (taskType == TaskType.EntryGateLevelup) { PageMgr.ShowPage <UIEntryPage>(); UIInteractive.GetInstance().iPage = new UIEntryPage(); PostionSceneTo(GlobalDataManager.GetInstance().zooGameSceneData.GetEntryGateGroupFocusPoint()); } else if (taskType == TaskType.LittleZooLevelup) { PageMgr.ShowPage <UIZooPage>(buildingId); UIInteractive.GetInstance().iPage = new UIZooPage(); PostionSceneTo(GlobalDataManager.GetInstance().zooGameSceneData.GetLittleZooFocusPoint(buildingId)); } else if (taskType == TaskType.LittleZooVisit) { // 不跳转 } else if (taskType == TaskType.AdWatch) { //PageMgr.ShowPage<UIAdvertActivityPage>(); PageMgr.ShowPage <UINewCurrencyAdvertPage>(AdTagFM.Add_Double_Advert); } else if (taskType == TaskType.OpenNewLittleZoo) { PageMgr.ShowPage <UIBuildOpenPage>(buildingId); //开启新的动物园交互 UIInteractive.GetInstance().iPage = new UIZooPage(); PostionSceneTo(GlobalDataManager.GetInstance().zooGameSceneData.GetLittleZooFocusPoint(buildingId)); } } }
public static int GetBuildingId(this Config.missionCell missionCell) { if (missionCell == null) { return(-1); } if (missionCell.ParseTaskType() == TaskType.AdWatch) { return(-1); } int ret; int.TryParse(missionCell.taskparam1, out ret); return(ret); }
private void CheckTasksProgressForVisitorReceiveComplete(int littleZooId) { Config.missionCell missionCell = missionModel.GetTaskCell(missionModel.currTaskId); if (missionCell != null && missionCell.ParseTaskType() == TaskType.LittleZooVisit) { if (littleZooId == missionCell.GetLittleZooId()) { int progress, goal; missionModel.GetTaskProgress(missionModel.currTaskId, out progress, out goal); missionModel.SetTaskProgress(missionModel.currTaskId, progress + 1); GuideMissionStateChanged.Send(missionModel.currTaskId, GuideMissionStateChanged.ChangeDetail_TaskProgress); SetTaskStateVars(); } } }
/// <summary> /// 获取某个任务进度 /// </summary> /// <returns></returns> public bool GetTaskProgress(int taskId, out int progress, out int goal) { progress = 0; goal = GetTaskGoal(taskId); Config.missionCell missionCell = GetTaskCell(taskId); if (missionCell != null) { goal = missionCell.need; } GuideMissionPlayerDataMSS.TaskStateMSS taskState = GetTaskState(taskId); if (taskState != null) { progress = taskState.progress; } return(progress >= goal); }
private void CheckTasksProgressForBuildingLevelup(TaskType taskType, int buildingProperty, int buildingId, int achieveLevel) { Config.missionCell missionCell = missionModel.GetTaskCell(missionModel.currTaskId); if (missionCell != null) { TaskType tstype = missionCell.ParseTaskType(); if (tstype == taskType && buildingProperty == missionCell.ParseBuildingProperty() && buildingId == missionCell.GetBuildingId()) { if (!missionModel.IsTaskCleared(missionModel.currTaskId)) { missionModel.SetTaskProgress(missionModel.currTaskId, achieveLevel); GuideMissionStateChanged.Send(missionModel.currTaskId, GuideMissionStateChanged.ChangeDetail_TaskProgress); } SetTaskStateVars(); } } #region -- old /*var allCell = missionModel.GetAllTaskCell(); * Config.missionCell missionCell; * TaskType tstype; * int progress, goal; * int intKey = 0; * foreach (string key in allCell.Keys) * { * missionCell = allCell[key]; * intKey = int.Parse(key); * tstype = missionCell.ParseTaskType(); * if (taskType == TaskType.Unknown || taskType == TaskType.AdWatch || taskType == TaskType.LittleZooVisit) * continue; * * if (tstype == taskType && buildingProperty == missionCell.ParseBuildingProperty() && buildingId == missionCell.GetBuildingId()) * { * missionModel.GetTaskProgress(missionModel.currTaskId, out progress, out goal); * if (!missionModel.IsTaskCleared(intKey)) * { * missionModel.SetTaskProgress(missionModel.currTaskId, achieveLevel); * if (intKey == missionModel.currTaskId) // 只有当前进行的任务发送消息 * GuideMissionStateChanged.Send(missionModel.currTaskId, GuideMissionStateChanged.ChangeDetail_TaskProgress); * } * } * }*/ #endregion }
private void CheckTasksProgressForOpenNewLittleZoo(int littleZooId) { Config.missionCell missionCell = missionModel.GetTaskCell(missionModel.currTaskId); if (missionCell != null && missionCell.ParseTaskType() == TaskType.OpenNewLittleZoo) { int progress, goal; bool IsTaskCleared = missionModel.IsTaskCleared(missionModel.currTaskId); if (!missionModel.IsTaskCleared(missionModel.currTaskId)) { missionModel.GetTaskProgress(missionModel.currTaskId, out progress, out goal); missionModel.SetTaskProgress(missionModel.currTaskId, progress + 1); GuideMissionStateChanged.Send(missionModel.currTaskId, GuideMissionStateChanged.ChangeDetail_TaskProgress); } SetTaskStateVars(); } }
private void CheckTasksProgressForAdWatchComplete(string adTag) { Config.missionCell missionCell = missionModel.GetTaskCell(missionModel.currTaskId); if (missionCell != null) { if (adTag == missionCell.GetAdTag()) { int progress, goal; if (!missionModel.IsTaskCleared(missionModel.currTaskId)) { missionModel.GetTaskProgress(missionModel.currTaskId, out progress, out goal); missionModel.SetTaskProgress(missionModel.currTaskId, progress + 1); GuideMissionStateChanged.Send(missionModel.currTaskId, GuideMissionStateChanged.ChangeDetail_TaskProgress); } SetTaskStateVars(); } } }
public static int ParseBuildingProperty(this Config.missionCell missionCell) { if (missionCell == null) { return(0); } if (missionCell.ParseTaskType() == TaskType.ParkingLevelup) { return((int)missionCell.ParseParkingProperty()); } if (missionCell.ParseTaskType() == TaskType.LittleZooLevelup) { return((int)missionCell.ParseLittleZooProperty()); } if (missionCell.ParseTaskType() == TaskType.EntryGateLevelup) { return((int)missionCell.ParseEntryGateProperty()); } return(0); }
/// <summary> /// 根据用户数据获取任务进度 /// </summary> /// <param name="taskId"></param> /// <returns></returns> public int ResolveTaskProgress(int taskId) { Config.missionCell missionCell = GetTaskCell(taskId); if (missionCell == null) { return(0); } TaskType taskType = missionCell.ParseTaskType(); if (taskType == TaskType.AdWatch || taskType == TaskType.LittleZooVisit) { return(0); } if (taskType == TaskType.LittleZooLevelup) { int litzooId = missionCell.GetLittleZooId(); LittleZooModuleDataMSS litzooData = null; try { litzooData = playerData.GetLittleZooModuleData(litzooId); } catch (Exception e) { string.Format("动物栏[{0}]还未开启", litzooId); } if (litzooData != null) { LittleZooProperty zooProp = missionCell.ParseLittleZooProperty(); if (zooProp == LittleZooProperty.TicketPrice) { return(litzooData.littleZooTicketsLevel); } else if (zooProp == LittleZooProperty.Capacity) { return(litzooData.littleZooVisitorSeatLevel); } else if (zooProp == LittleZooProperty.VisitSpeed) { return(litzooData.littleZooEnterVisitorSpawnLevel); } } return(0); } else if (taskType == TaskType.ParkingLevelup) { ParkingProperty parkProp = missionCell.ParseParkingProperty(); if (parkProp == ParkingProperty.Revenue) { return(playerData.GetParkingCenterDataIDIndexOfDataIdx().parkingProfitLevel); } else if (parkProp == ParkingProperty.Capacity) { return(playerData.GetParkingCenterDataIDIndexOfDataIdx().parkingSpaceLevel); } else if (parkProp == ParkingProperty.VisitorFlowSpeed) { return(playerData.GetParkingCenterDataIDIndexOfDataIdx().parkingEnterCarSpawnLevel); } } else if (taskType == TaskType.EntryGateLevelup) { EntryGateProperty entryProp = missionCell.ParseEntryGateProperty(); if (entryProp == EntryGateProperty.TicketPrice) { return(playerData.GetEntryDateDataIDIndexOfDataIdx().entryTicketsLevel); } else if (entryProp == EntryGateProperty.Entrance) { GateData entryData = null; int entryId = missionCell.GetEntryGateId(); try { entryData = playerData.GetEntryGateIDIndexOfDataIdx(entryId); } catch (Exception e) { string.Format("售票口[{0}]还未开启", entryId); } return(entryData != null ? entryData.level : 0); } } return(0); }
/// <summary> /// 获取某个任务的目标 /// </summary> /// <param name="taskId"></param> /// <returns></returns> public int GetTaskGoal(int taskId) { Config.missionCell missionCell = GetTaskCell(taskId); return(missionCell == null ? int.MaxValue : missionCell.need); }