public void Initialize(DataFloorParam _data, MasterFloorParam _master) { if (_data != null) { floor_id = _data.floor_id; } else { floor_id = 0; } m_txtFloorNo.text = string.Format("{0}F", _master.floor_no); if (_data != null && _data.status == 1) { m_txtStatus.text = "挑戦中"; } else if (_data != null && _data.status == 2) { m_txtStatus.text = "<color=#0FF>クリア</color>"; } else { m_txtStatus.text = "<color=#F00>未開放</color>"; m_btn.gameObject.SetActive(false); } }
private void create_enemies(int _iCurrentFloor, string _strDungeonId) { gameMain.ClearEnemy(); MasterFloorParam floor_param = DataManager.Instance.masterFloor.list.Find(p => p.dungeon_id == _strDungeonId && (p.start <= _iCurrentFloor && _iCurrentFloor <= p.end)); int[] enemy_index_prob = floor_param.GetEnemyIndexProb(); int enemy_num = UtilRand.GetRand(10, 3); int[] pos_index = new int[enemy_num]; int[] pos_index_prob = new int[10]; for (int i = 0; i < 10; i++) { pos_index_prob[i] = 100; } for (int i = 0; i < enemy_num; i++) { int iResult = UtilRand.GetIndex(pos_index_prob); pos_index[i] = iResult; pos_index_prob[iResult] = 0; //Debug.Log(iResult); } for (int i = 0; i < enemy_num; i++) { //float x = UtilRand.GetRange(8.5f, 3.5f); float x = 3.5f + ((8.5f - 3.5f) / 10.0f) * pos_index[i]; int index = UtilRand.GetIndex(enemy_index_prob); int enemy_id = floor_param.GetEnemyId_fromIndex(index); MasterEnemyParam enemy = DataManager.Instance.masterEnemy.list.Find(p => p.enemy_id == enemy_id); gameMain.CreateEnemy(enemy, x, false); } if (_iCurrentFloor % 10 == 0) { MasterEnemyParam boss = DataManager.Instance.masterEnemy.list.Find(p => p.enemy_id == floor_param.boss); DataEnemyParam data = gameMain.CreateEnemy(boss, 9.0f, true); gameMain.panelBossStatus.Initialize(data, boss); } else { gameMain.panelBossStatus.Disable(); } }
public override void OnEnter() { base.OnEnter(); int floor_id = DataManager.Instance.game_data.ReadInt("floor_id"); MasterFloorParam current_floor = DataManager.Instance.masterFloor.list.Find(p => p.floor_id == floor_id); if (0 < current_floor.next_floor_id) { DataManager.Instance.game_data.WriteInt("floor_id", current_floor.next_floor_id); DataManager.Instance.game_data.Save(); } Finish(); }
public override void OnEnter() { base.OnEnter(); bool bFirstClear = false; int floor_id = DataManager.Instance.game_data.ReadInt("floor_id"); MasterFloorParam current_floor = DataManager.Instance.masterFloor.list.Find(p => p.floor_id == floor_id); MasterStageParam current_stage = DataManager.Instance.masterStage.list.Find(p => p.stage_id == current_floor.stage_id); DataFloorParam data_floor = DataManager.Instance.dataFloor.list.Find(p => p.floor_id == current_floor.floor_id); if (data_floor == null) { data_floor = new DataFloorParam(); DataManager.Instance.dataFloor.list.Add(data_floor); data_floor.floor_id = floor_id; } data_floor.count += 1; // 初クリア判定は2(クリア状態じゃなければ) bFirstClear = data_floor.status != 2; data_floor.status = 2; if (DataManager.Instance.IsTest) { // マジックナンバーか! DataManager.Instance.armor_interval = 5; DataWeaponParam weapon = DataManager.Instance.dataWeapon.list.Find(p => 0 < p.equip); data_floor.test_weapon_id = weapon.weapon_id; data_floor.test_weapon_level = weapon.level; DataArmorParam armor = DataManager.Instance.dataArmor.list[0]; data_floor.test_armor_level = armor.level; } // 次のフロアが必要な場合 if (0 < current_floor.next_floor_id) { DataFloorParam data_next_floor = DataManager.Instance.dataFloor.list.Find(p => p.floor_id == current_floor.next_floor_id); if (data_next_floor == null) { MasterFloorParam master_next_floor = DataManager.Instance.masterFloor.list.Find(p => p.floor_id == current_floor.next_floor_id); data_next_floor = new DataFloorParam(); data_next_floor.floor_id = master_next_floor.floor_id; data_next_floor.stage_id = master_next_floor.stage_id; data_next_floor.status = 1; data_next_floor.count = 0; DataManager.Instance.dataFloor.list.Add(data_next_floor); // ステージが異なる場合はここで追加 if (current_floor.stage_id != master_next_floor.stage_id) { DataStageParam data_new_stage = DataManager.Instance.dataStage.list.Find(p => p.stage_id == master_next_floor.stage_id); if (data_new_stage == null) { data_new_stage = new DataStageParam(); data_new_stage.stage_id = master_next_floor.stage_id; data_new_stage.status = 1; DataManager.Instance.dataStage.list.Add(data_new_stage); } } } } // 現在のフロア攻略チェック DataFloorParam check_stage_complete = DataManager.Instance.dataFloor.list.Find(p => p.stage_id == current_floor.stage_id && p.status != 2); if (check_stage_complete == null) { DataStageParam data_current_stage = DataManager.Instance.dataStage.list.Find(p => p.stage_id == current_floor.stage_id); data_current_stage.status = 2; } DataManager.Instance.dataStage.Save(); DataManager.Instance.dataFloor.Save(); DataManager.Instance.dataPotion.Save(); // 獲得Coinの補正 DataItemParam data_item_coin = DataManager.Instance.dataGetItem.list.Find(p => p.item_id == Defines.ITEM_ID_COIN); int get_coin_num = 0; if (data_item_coin != null) { get_coin_num = data_item_coin.num; } get_coin_num = Mathf.CeilToInt((float)get_coin_num * (float)((float)gamemain.player_chara.m_dataUnitParam.coin / 100.0f)); gamemain.m_goFadePanel.SetActive(true); gamemain.m_panelResult.Initialize(floor_id, (int)gamemain.m_fGameTime); gamemain.m_panelResult.gameObject.SetActive(true); foreach (DataItemParam get in DataManager.Instance.dataGetItem.list) { if (get.item_id == 1) { DataManager.Instance.AddCoin(get.num); } else if (get.item_id == 2) { DataManager.Instance.AddGem(get.num); } else if (get.item_id == 3) { DataManager.Instance.AddKey(get.num); } else if (get.item_id == 4) { DataManager.Instance.AddGoldKey(get.num); } else { DataManager.Instance.dataItem.Add(get.item_id, get.num); } } DataManager.Instance.dataItem.Save(); DataManager.Instance.dataGetItem.list.Clear(); DataManager.Instance.user_data.Save(); gamemain.m_panelResult.m_btnCamp.onClick.RemoveAllListeners(); gamemain.m_panelResult.m_btnCamp.onClick.AddListener(() => { Fsm.Event("camp"); }); gamemain.m_panelResult.m_btnRetry.onClick.RemoveAllListeners(); gamemain.m_panelResult.m_btnRetry.onClick.AddListener(() => { Fsm.Event("retry"); }); gamemain.m_panelResult.m_btnRetry10.onClick.RemoveAllListeners(); gamemain.m_panelResult.m_btnRetry10.onClick.AddListener(() => { Fsm.Event("retry10"); }); gamemain.m_panelResult.m_btnNext.interactable = 0 < current_floor.next_floor_id; gamemain.m_panelResult.m_btnNext.onClick.RemoveAllListeners(); gamemain.m_panelResult.m_btnNext.onClick.AddListener(() => { Fsm.Event("next"); }); gamemain.m_panelResult.m_btnContinueEnd.onClick.RemoveAllListeners(); gamemain.m_panelResult.m_btnContinueEnd.onClick.AddListener(() => { button_active(true); continue_count.Value = 0; }); gamemain.m_panelResult.m_btnQuickNext.onClick.RemoveAllListeners(); gamemain.m_panelResult.m_btnQuickNext.onClick.AddListener(() => { Fsm.Event("retry"); }); if (0 < continue_count.Value) { button_active(false); StartCoroutine(auto_retry()); } else { button_active(true); } if (DataManager.Instance.IsTest) { Fsm.Event("retry"); } if (current_floor.next_floor_id == 0 && bFirstClear) { Fsm.Event("ending"); } }