public void Add(MasterBattleBonusParam _master, int _iCharaId) { battle_bonus_list.Add(_master); chara_id_list.Add(_iCharaId); IconBattleBonus icon = PrefabManager.Instance.MakeScript <IconBattleBonus>(m_prefIcon, m_goRoot); icon.Initialize(_master, _iCharaId); icon_battle_bonus_list.Add(icon); }
public void Initialize(int _iNum, int _iStage, int _iWave, int[] _iCharaIdArr) { m_prefBattleBonusHolder.SetActive(false); BattleBonusHolder[] arr = m_goRootBBHolder.GetComponentsInChildren <BattleBonusHolder>(); foreach (BattleBonusHolder c in arr) { if (m_prefBattleBonusHolder != c.gameObject) { GameObject.Destroy(c.gameObject); } } battle_bonus_holder_list.Clear(); List <MasterStageBattleBonusParam> stage_bb_list = DataManagerGame.Instance.masterStageBattleBonus.list.FindAll(p => p.stage_id == _iStage && p.wave == _iWave); if (stage_bb_list.Count == 0) { stage_bb_list = DataManagerGame.Instance.masterStageBattleBonus.list.FindAll(p => p.stage_id == _iStage && p.wave == 0); } if (stage_bb_list.Count == 0) { stage_bb_list = DataManagerGame.Instance.masterStageBattleBonus.list.FindAll(p => p.stage_id == 0 && p.wave == _iWave); } int[] prob_arr = new int[stage_bb_list.Count]; for (int i = 0; i < stage_bb_list.Count; i++) { prob_arr[i] = stage_bb_list[i].prob; //Debug.Log(string.Format("index={0} prob={1}", i, prob_arr[i])); } for (int set_index = 0; set_index < _iNum; set_index++) { BattleBonusHolder holder = PrefabManager.Instance.MakeScript <BattleBonusHolder>(m_prefBattleBonusHolder, m_goRootBBHolder); holder.Reset(set_index + 1); for (int party_index = 0; party_index < _iCharaIdArr.Length; party_index++) { int index = UtilRand.GetIndex(prob_arr); //Debug.Log(index); MasterBattleBonusParam master_bb = DataManagerGame.Instance.masterBattleBonus.list.Find(p => p.battle_bonus_id == stage_bb_list[index].battle_bonus_id); holder.Add(master_bb, _iCharaIdArr[party_index]); } battle_bonus_holder_list.Add(holder); holder.OnClick.AddListener((int _iIndex) => { OnClickHolder.Invoke(_iIndex); }); } }
public override void OnEnter() { base.OnEnter(); List <MasterStageBattleBonusParam> stage_bb_list = simulator.masterStageBattleBonus.list.FindAll(p => p.stage_id == stage_id.Value && p.wave == wave.Value); if (stage_bb_list.Count == 0) { stage_bb_list = simulator.masterStageBattleBonus.list.FindAll(p => p.stage_id == stage_id.Value && p.wave == 0); } if (stage_bb_list.Count == 0) { stage_bb_list = simulator.masterStageBattleBonus.list.FindAll(p => p.stage_id == 0 && p.wave == wave.Value); } int[] prob_arr = new int[stage_bb_list.Count]; for (int i = 0; i < stage_bb_list.Count; i++) { prob_arr[i] = stage_bb_list[i].prob; //Debug.Log(string.Format("index={0} prob={1}", i, prob_arr[i])); } foreach (DataUnitParam unit in simulator.dataUnit.list.FindAll(p => p.unit == "chara")) { int index = UtilRand.GetIndex(prob_arr); //Debug.Log(index); MasterBattleBonusParam master_bb = simulator.masterBattleBonus.list.Find(p => p.battle_bonus_id == stage_bb_list[index].battle_bonus_id); //Debug.Log(master_bb.battle_bonus_id); //Debug.Log(master_bb.field); //Debug.Log(master_bb.param); simulator.dataUnit.AddAssist(unit, "bb", "バトルボーナス", unit.chara_id, master_bb.field, master_bb.param, -1); } Finish(); }
public void Initialize(MasterBattleBonusParam _master, int _iCharaId) { m_btn.onClick.RemoveAllListeners(); m_imgFaceIcon.sprite = SpriteManager.Instance.Get(string.Format(Defines.STR_FORMAT_FACEICON, _iCharaId)); //Debug.Log(_master); //Debug.Log(_master.field); string name = _master.field.ToUpper(); if (_master.field == "hp_max") { name = "最大HP"; } m_txtBonus.text = string.Format("{0}+{1}", name, _master.param); m_masterBB = _master; m_btn.onClick.AddListener(() => { OnIconClicked.Invoke(m_masterBB); }); }