private void ReceiveTask(int taskId) { missionModel.currTaskId = taskId; missionModel.SetTaskProgress(taskId, missionModel.ResolveTaskProgress(taskId)); SetTaskStateVars(); GuideMissionStateChanged.Send(missionModel.currTaskId, GuideMissionStateChanged.ChangeDetail_NewTask); }
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); } }
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(); } } }
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 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(); } } }
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(); } }