public void UpdateBattleResult(battle_result data) { this.DropShipName = data.api_get_ship?.api_ship_name; switch (data.api_win_rank) { case "S": this.BattleResult = this.FriendLostGauge > 0 ? BattleResultRank.勝利S : BattleResultRank.完全勝利S; break; case "A": this.BattleResult = BattleResultRank.勝利A; break; case "B": this.BattleResult = BattleResultRank.戦術的勝利B; break; case "C": this.BattleResult = BattleResultRank.戦術的敗北C; break; case "D": this.BattleResult = BattleResultRank.敗北D; break; case "E": this.BattleResult = BattleResultRank.敗北E; break; } }
public void UpdateEnemyName(battle_result result) { if (result?.api_enemy_info == null) { return; } if (this.EnemyData.EnemyNames.Update(this.currentEnemyID, result.api_enemy_info.api_deck_name)) { this.provider.Save(); } }
public void init(int money, Item[] get_items) { dataCenter = MainData.dataCenter; battleResult = gameObject.GetComponentInParent<battle_result> (); items = get_items; get_money = money; now_money = dataCenter.money; update_money (get_money, now_money); foreach (Text item in items_text) { item.text = ""; } }
public void UpdateEnemyName(battle_result result) { if (result?.api_enemy_info == null) { return; } if (this.EnemyData.EnemyNames.ContainsKey(this.currentEnemyID)) { this.EnemyData.EnemyNames[this.currentEnemyID] = result.api_enemy_info.api_deck_name; } else { this.EnemyData.EnemyNames.Add(this.currentEnemyID, result.api_enemy_info.api_deck_name); } this.EnemyData.Save(); }
public void init(int[] cids, bool[] live, int patch_exp) { battleResult = gameObject.GetComponentInParent<battle_result> (); player_cids = cids; player_show = new BattleResultPlayer[transform.childCount]; exp_get = new int[live.Length]; exp_max = new int[live.Length]; exp_add = new int[live.Length]; exp_now = new int[live.Length]; lv_now = new int[live.Length]; CharacterGroup characterGroup = MainData.dataCenter.characters; int idx = 0; foreach (Transform child in transform) { if( idx >= cids.Length ){ child.gameObject.SetActive(false); continue; } int cid = cids[idx]; if( cid >= 0 ){ BattleResultPlayer player = child.gameObject.GetComponent<BattleResultPlayer>(); var character = MainData.dataCenter.characters.character_data[cid]; player.head_pic.sprite = character.head_pic; player.lv.text = "Lv. "+character.lv; int exp = character.exp; int max_exp = characterGroup.get_next_lv_exp(character.lv_id, character.lv); lv_now[idx] = character.lv; exp_now[idx] = exp; exp_max[idx] = max_exp; exp_get[idx] = ( live[idx] )? patch_exp : 0 ; player_show[idx] = player; // draw text and bar update_exp_num(idx, exp, max_exp); if( live[idx] ) exp_add[idx] = ( patch_exp/30 < 1)? 1 : patch_exp/30; } idx++; } }
public void UpdateBattleResult(battle_result data) { this.DropShipName = data.api_get_ship?.api_ship_name; switch (data.api_win_rank) { case "S": this.BattleResult = this.FriendFleetStatus.LostGauge > 0 ? BattleResultRank.勝利S : BattleResultRank.完全勝利S; break; case "A": this.BattleResult = BattleResultRank.勝利A; break; case "B": this.BattleResult = BattleResultRank.戦術的勝利B; break; case "C": this.BattleResult = BattleResultRank.戦術的敗北C; break; case "D": this.BattleResult = BattleResultRank.敗北D; break; case "E": this.BattleResult = BattleResultRank.敗北E; break; } this.FriendFleet.Fleets[1].UpdateMVP(data.api_mvp); this.FriendFleet.Fleets[2]?.UpdateMVP(data.api_mvp_combined); }
public void Update(battle_result data) { this.DropShipName = data.api_get_ship?.api_ship_name; }
private void Update(battle_result result) { this.provider.UpdateEnemyName(result); }
public void BattleStart() { // ActStoper var path = string.Format ("Prefab/BattleUI/ActStoper"); var ActStoper = Instantiate ( Resources.Load<GameObject> (path) ) as GameObject; act_stoper = ActStoper.GetComponent<ActStoper> (); // BackGround path = string.Format ("Prefab/BattleUI/Background"); var Background = Instantiate ( Resources.Load<GameObject> (path) ) as GameObject; Background.transform.SetParent(canvas, false); // Background setting //RectTransform BackgroundRT = Background.GetComponent<RectTransform> (); //BackgroundRT.localPosition = new Vector3 (4, 194, 0); //BackgroundRT.localScale = new Vector3 (1, 1, 1); // Skill var Skill = data_center.skills.gameObject; SkillList skill_list = data_center.skills; foreach (Transform child in Skill.transform) { child.gameObject.GetComponent<Skill>().gameMgr = this; } // Skillline path = string.Format ("Prefab/BattleUI/SkillLine"); var SkillLine = Instantiate ( Resources.Load<GameObject> (path) ) as GameObject; SkillLine.transform.SetParent(canvas, false); // SkillLine setting RectTransform SkillLineRT = SkillLine.GetComponent<RectTransform> (); //SkillLineRT.localPosition = new Vector3 (400, -410, 0); SkillLineRT.localScale = new Vector3 (0.6667F, 0.6667F, 0.6667F); // PlayerGroup path = string.Format ("Prefab/BattleUI/PlayGroup"); var PlayerGroup = Instantiate ( Resources.Load<GameObject> (path) ) as GameObject; PlayerGroup.transform.SetParent (canvas); // PlayerGroup setting PlayerGroup.transform.localPosition = new Vector3 (0, 0, 0); PlayerGroup.transform.localScale = new Vector3 (0.6667F, 0.6667F, 0.6667F); Group group = PlayerGroup.gameObject.GetComponent<Group> (); playerGroup = group; group.act_stoper = act_stoper; group.GameMgr = this; // ControlPlayer setting ControlPlayer control = PlayerGroup.gameObject.GetComponent<ControlPlayer> (); control.skill_list = skill_list; int i = 0; foreach (Transform skill_transform in SkillLine.transform) control.skill_button [i++] = skill_transform.gameObject; int k = 0; foreach (Transform child in SkillLine.transform) { int tmp = k; Button skill_button = child.gameObject.GetComponent<Button>(); skill_button.onClick.AddListener( () => { control.SetSkill(tmp); }); k++; } //init PlayerGroup int idx = 0; cids = new int[data_center.character_team.Length]; group.player_group = new Player[data_center.character_team.Length]; foreach(Transform child in PlayerGroup.transform){ if( idx >= data_center.character_team.Length ){ child.gameObject.SetActive(false); } else { Player toPlayer = child.gameObject.AddComponent<Player>(); int cid = data_center.character_team[idx]; PlayerStruct battler = data_center.characters.get_game_player(cid); toPlayer.info = battler; cids[idx] = cid; child.FindChild("Head_pic").GetComponent<Image>().sprite = toPlayer.info.head_pic; child.FindChild("Head").GetComponent<Image>().sprite = toPlayer.info.head_pic; group.player_group [idx] = toPlayer; idx++; } } group.init (); foreach (Player player in group.player_group) { player.skill_list = skill_list; player.init (); } // EnemyGroup string group_id = MainData.dataCenter.enemy_group_name; path = string.Format ("Prefab/BattleUI/MonsterGroup/{0}",group_id); var EnemyGroup = Instantiate ( Resources.Load<GameObject> (path) ) as GameObject; EnemyGroup.transform.SetParent (canvas); // 初始化敵人群組 EnemyGroup.transform.localPosition = new Vector3 (198, 171, 0); EnemyGroup.transform.localScale = new Vector3 (0.6667F, 0.6667F, 0.6667F); Group enemy_group = EnemyGroup.gameObject.GetComponent<Group> (); enemy_group.act_stoper = act_stoper; group.enemy_group = enemy_group; enemy_group.enemy_group = group; enemy_group.GameMgr = this; enemy_group.init (); // 初始化敵人群組裡的敵人 k = 0; int[] enemy_ids = MainData.dataCenter.enemy_ids; foreach (Player enemy in enemy_group.player_group) { int enemy_id = enemy_ids[k]; enemy.info = data_center.enemys.get_enemy_data(enemy_id); // slime enemy.skill_list = skill_list; enemy.gameObject.GetComponent<Image>().sprite = enemy.info.head_pic; enemy.transform.FindChild("Head").GetComponent<Image>().sprite = enemy.info.head_pic; enemy.init (); int tmp = k; Button enemy_button = enemy.gameObject.GetComponent<Button>(); enemy_button.onClick.AddListener( () => { control.SetTarget(tmp); }); k++; } // 計算掉落物 calc_drop (enemy_ids); control.init (); control.SetControl (0); // 取得每個敵人的顯示動畫 enemy_anime = new Animator[enemy_group.player_group.Length]; int anime_idx = 0; foreach (Transform child in EnemyGroup.transform) { Animator anime = child.gameObject.GetComponentInChildren<Animator>(); enemy_anime[anime_idx++] = anime; } // SkillAnimeManager path = string.Format ("Prefab/skill/SkillAnimeManager"); var SkillAnimeManager = Instantiate ( Resources.Load<GameObject> (path) ) as GameObject; SkillAnimeManager.transform.SetParent(canvas); SkillAnimeMgr = SkillAnimeManager.GetComponent<SkillAnimeManager>(); // Number Manager path = string.Format ("Prefab/numbers/NumberManager"); var NumberManager = Instantiate ( Resources.Load<GameObject> (path) ) as GameObject; NumberManager.transform.SetParent(canvas); NumberMgr = NumberManager.GetComponent<NumberManager>(); // game_start path = string.Format ("Prefab/BattleUI/anime_prefab/game_start"); var game_start = Instantiate ( Resources.Load<GameObject> (path) ) as GameObject; game_start.transform.SetParent(canvas, false); game_start_anime = game_start.GetComponent<Animator> (); // game_over_win path = string.Format ("Prefab/BattleUI/anime_prefab/game_over_win"); var game_over_win = Instantiate ( Resources.Load<GameObject> (path) ) as GameObject; game_over_win.transform.SetParent(canvas, false); game_over_win_anime = game_over_win.GetComponent<Animator> (); game_over_win.SetActive (false); // result anime path = string.Format ("Prefab/BattleUI/battle_result"); var battleResultObj = Instantiate (Resources.Load<GameObject> (path)) as GameObject; battleResult = battleResultObj.GetComponent<battle_result> (); battleResult.transform.SetParent (canvas, false); battleResultObj.SetActive (false); // 播放開始動畫 game_start_anime_show (); }