void OnDestroy() { if (mapControl != null) { mapControl.Free(); mapControl = null; } }
private void FreeMapControl() { if (mapControl != null) { mapControl.Free(); mapControl = null; } }
// Use this for initialization void Start() { DataManager.instance.InitData(); DataConfig.MISSION_DIFFICULTY difficulty = DataConfig.MISSION_DIFFICULTY.NORMAL; int stageId = 1; DataMissionGroup.DataCampaign campaign = DataManager.instance.dataMissionGroup.GetCampaign(difficulty, stageId); mapControl = new CampaignMapControl(campaign, 0); GameObject camera = GameObject.FindGameObjectWithTag(AppConfig.TAB_MAIN_CAMERA); _campaignCamera = camera.GetComponent <CampaignCamera> (); }
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); } }