public Model_Mission GetMission(int missionMagicId) { DataConfig.MISSION_DIFFICULTY difficulty = DataMission.GetDifficulty(missionMagicId); int stageId = DataMission.GetStageId(missionMagicId); int missionId = DataMission.GetMissionId(missionMagicId); return(GetMission(difficulty, stageId, missionId)); }
public void TryUnlockNextMission(int battleMissionId) { /* * if (battleMissionId == 0) { * return TryUnlockFirstMission (); * } */ DataConfig.MISSION_DIFFICULTY difficulty = DataMission.GetDifficulty(battleMissionId); Model_Mission lastUnlockMission = GetLastUnlockMission(difficulty, 1); int stageId = lastUnlockMission.stageId; int missionId = lastUnlockMission.missionId; Campaign campaign = GetCampaign(difficulty, stageId); if (campaign.list.Count == missionId) { //it is last mission in campaign Chapters chapters = GetChapters(difficulty); if (stageId < chapters.list.Count) { if (difficulty == DataConfig.MISSION_DIFFICULTY.NORMAL) { Campaign nextCampaign = GetCampaign(difficulty, stageId + 1); Model_Mission nextMission = nextCampaign.list [0]; if (CheckMissionUnlock(nextMission)) { nextMission.actived = true; } } // return nextMission.referenceMission.magicId; } } else { int nextMissionIndex = missionId; Model_Mission nextMission = campaign.list[nextMissionIndex]; if (CheckMissionUnlock(nextMission)) { nextMission.actived = true; } // return nextMission.magicId; } if (difficulty == DataConfig.MISSION_DIFFICULTY.NORMAL) { TryUnlockEliteFirstMission(battleMissionId); } }
public bool IsMissionUnlock(int magicId) { int stageId = DataMission.GetStageId(magicId); DataConfig.MISSION_DIFFICULTY difficulty = DataMission.GetDifficulty(magicId); int missionId = DataMission.GetMissionId(magicId); Model_Mission model_Mission = GetMission(difficulty, stageId, missionId); bool isUnlcok = model_Mission.actived; return(isUnlcok); }
// 更新Mission列表 public void UpdateMissionList() { List <Model_Mission> model_missions; Model_User model_User = InstancePlayer.instance.model_User; Model_Level model_level = InstancePlayer.instance.model_User.model_level; DataConfig.MISSION_DIFFICULTY difficulty = DataMission.GetDifficulty(_missionMagicId); int stageId = DataMission.GetStageId(_missionMagicId); Model_Level.Campaign campaign = model_level.GetCampaign(difficulty, stageId); model_missions = campaign.list; int n = model_missions.Count; int currentSelectId = 0; GameObject cell_prefab = Resources.Load(MISSION_CELL_PATH) as GameObject; for (int i = 0; i < n; ++i) { GameObject cell = NGUITools.AddChild(grid_Mission.gameObject, cell_prefab); grid_Mission.AddChild(cell.transform); cell.name = UIHelper.GetItemSuffix(i); Model_Mission model_Mission = model_missions [i]; MissionCellUI cellUI = cell.GetComponent <MissionCellUI> (); cellUI.missionDetialUI = missionDetialUI; cellUI.missionPanel = this; cellUI.isUnlock = model_Mission.actived; // 当前关卡选中项 if (_missionMagicId == model_Mission.magicId) { cellUI.isSelected = true; } // Boss if (i == n - 1) { cellUI.isBoss = true; } cellUI.UpdateUI(model_Mission); mission_cell_list.Add(cellUI); } grid_Mission.animateSmoothly = false; grid_Mission.repositionNow = true; }
public void UpdateUI(Model_Mission model_Mission) { _model_Mission = model_Mission; int magicId = model_Mission.magicId; DataMission dataMission = DataManager.instance.dataMissionGroup.GetMission(magicId); int power = InstancePlayer.instance.model_User.model_Formation.CalcPower(); if (dataMission != null) { Mission_Name_Label.text = dataMission.name; int fightNum = 0; if (model_Mission.difficulty == DataConfig.MISSION_DIFFICULTY.NORMAL) { fightNum = Model_Mission.FIGHT_NUM_NORMAL; } else { fightNum = Model_Mission.FIGHT_NUM_ELITE; } total_fight_num = fightNum; left_fight_num = model_Mission.remainFightNum; Left_Count.text = model_Mission.remainFightNum + "/" + fightNum; Recommend_Power.text = dataMission.evaluate + ""; Need_Energy.text = dataMission.EnergyCost + ""; Current_Power.text = power + ""; Honor_Label.text = dataMission.honor + ""; Exp_Label.text = dataMission.exp + ""; // 更新可掉落Item UpdateItem(dataMission.itemsId); } int stageId = DataMission.GetStageId(magicId); DataConfig.MISSION_DIFFICULTY difficulty = DataMission.GetDifficulty(magicId); int allStarCount = InstancePlayer.instance.model_User.model_level.GetAllMissionsStar(difficulty, stageId); Star_Label.text = allStarCount + ""; Energy_Label.text = power + ""; // 更新星级 UpdateStar(_model_Mission.starCount); }
/* * public Model_Mission(DataConfig.MISSION_DIFFICULTY difficulty, int stageId, int missionId) * { * magicId = (int)(difficulty + 1) * 10000 + stageId * 100 + missionId; * * this.difficulty = difficulty; * this.stageId = stageId; * this.missionId = missionId; * * InitRemainFightNum (); * } */ public Model_Mission(int magicId) { this.magicId = magicId; difficulty = DataMission.GetDifficulty(magicId); stageId = DataMission.GetStageId(magicId); missionId = DataMission.GetMissionId(magicId); InitRemainFightNum(); _referenceMission = DataManager.instance.dataMissionGroup.GetMission(magicId); Assert.assert(_referenceMission != null); }
public void TryUnlockEliteFirstMission(int battleMissionId) { Assert.assert(DataMission.GetDifficulty(battleMissionId) == DataConfig.MISSION_DIFFICULTY.NORMAL); DataConfig.MISSION_DIFFICULTY difficulty = DataConfig.MISSION_DIFFICULTY.ELITE; int stageId = DataMission.GetStageId(battleMissionId); int missionId = DataMission.GetMissionId(battleMissionId); Campaign campaign = GetCampaign(difficulty, stageId); if (campaign.list.Count == missionId) { Model_Mission mission = GetMission(difficulty, stageId, 1); mission.actived = true; } }
public void UpdatePageUI(int missionMagicId) { FreeMapControl(); DataConfig.MISSION_DIFFICULTY difficulty = DataMission.GetDifficulty(missionMagicId); int stageId = DataMission.GetStageId(missionMagicId); int missionId = DataMission.GetMissionId(missionMagicId); // TODO 强制战役背景资源 ID 为1 // stageId = 1; DataMissionGroup.DataCampaign campaign = DataManager.instance.dataMissionGroup.GetCampaign(difficulty, stageId); mapControl = new CampaignMapControl(campaign, missionId - 1); int tileIndex = missionId - 1; if (tileIndex >= 0) { mapControl.SelectTile(tileIndex); } }
public void UpdateSelectedMission(int selectedMagicId) { _missionSelection.difficulty = DataMission.GetDifficulty(selectedMagicId); }