public void SetupEquip() { treasureMain.m_prefIconInventry.SetActive(false); treasureMain.equip_treasure_list.Clear(); MonoBehaviourEx.DeleteObjects <IconInventry>(treasureMain.m_rootSettingTreasure); for (int i = 0; i < 3; i++) { IconInventry icon = PrefabManager.Instance.MakeScript <IconInventry>(treasureMain.m_prefIconInventry, treasureMain.m_rootSettingTreasure); DataTreasureParam equip_data = DataManager.Instance.dataTreasure.list.Find(p => p.equip == i + 1); if (equip_data != null) { MasterTreasureParam master = DataManager.Instance.masterTreasure.list.Find(p => p.treasure_id == equip_data.treasure_id); icon.Initialize(equip_data, master); } else { equip_data = new DataTreasureParam(); equip_data.equip = i + 1; equip_data.treasure_id = 0; icon.Initialize(equip_data, null); } treasureMain.equip_treasure_list.Add(icon); icon.OnClickTreasure.AddListener(OnSelectEquipBase); } treasureMain.SelectEquip(0); }
public override void OnEnter() { base.OnEnter(); treasureMain.m_txtListTitle.text = string.Format("おたから図鑑({0}/{1})", DataManager.Instance.dataTreasureAlbum.list.Count, DataManager.Instance.masterTreasure.list.Count); treasureMain.m_btnBack.gameObject.SetActive(true); treasureMain.m_btnBuy.gameObject.SetActive(false); treasureMain.m_btnGradeup.gameObject.SetActive(false); SetupEquip(); treasureMain.m_btnBack.onClick.AddListener(() => { Fsm.Event("back"); }); treasureMain.treasure_list.Clear(); MonoBehaviourEx.DeleteObjects <IconInventry>(treasureMain.m_goListContents); foreach (DataTreasureParam treasure in DataManager.Instance.dataTreasureAlbum.list) { IconInventry icon = PrefabManager.Instance.MakeScript <IconInventry>(treasureMain.m_prefIconInventry, treasureMain.m_goListContents); MasterTreasureParam master = DataManager.Instance.masterTreasure.list.Find(p => p.treasure_id == treasure.treasure_id); icon.Initialize(treasure, master); treasureMain.treasure_list.Add(icon); icon.OnClickTreasure.AddListener(OnSelectListTreasure); } }
public override void OnEnter() { base.OnEnter(); int iNum = DataManager.Instance.dataWeaponAlbum.list.Count; main.m_txtListTitle.text = string.Format("武器アルバム({0}/{1})", iNum, DataManager.Instance.masterWeapon.list.Count); main.m_btnEquip.gameObject.SetActive(false); main.m_btnAlbum.gameObject.SetActive(false); main.m_btnBuy.gameObject.SetActive(false); main.m_btnGradeup.gameObject.SetActive(false); main.m_btnBulk.gameObject.SetActive(false); main.m_btnList.gameObject.SetActive(true); main.m_btnList.onClick.AddListener(() => { Finish(); }); main.weapon_list.Clear(); MonoBehaviourEx.DeleteObjects <IconInventry>(main.m_goListContents); foreach (DataWeaponParam data in DataManager.Instance.dataWeaponAlbum.list) { IconInventry icon = PrefabManager.Instance.MakeScript <IconInventry>( main.m_prefIconInventry, main.m_goListContents); MasterWeaponParam master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data.weapon_id); icon.Initialize(data, master); main.weapon_list.Add(icon); icon.OnClickWeapon.AddListener(OnSelectListWeapon); } }
public void Setup(DataWeaponParam _data, MasterWeaponParam _master) { m_icon.Initialize(_data, _master); if (_master != null) { m_txtName.text = _master.name; m_txtOutline.text = _master.name; } else { m_txtName.text = "なし"; m_txtOutline.text = "-----"; } if (10 <= _data.level) { m_txtGradeupPrice.text = "強化上限"; m_btnGradeup.interactable = false; } else { if (_master != null) { int price = MasterWeapon.GetGradeupPrice(_data, _master); m_txtGradeupPrice.text = price.ToString(); m_btnGradeup.interactable = price <= DataManager.Instance.GetCoin(); } else { m_txtGradeupPrice.text = "-----"; m_btnGradeup.interactable = false; } } m_btnBuyCheck.interactable = _data.weapon_id != 0 && _data.equip == 0; if (_master != null) { MasterWeaponParam equip_level = _master.GetParam(_data.level); m_txtAttack.text = equip_level.attack.ToString(); m_txtSpeed.text = equip_level.speed.ToString(); } else { m_txtAttack.text = "---"; m_txtSpeed.text = "---"; } }
public void Setup(DataTreasureParam _data, MasterTreasureParam _master) { m_icon.Initialize(_data, _master); if (_master != null) { m_txtName.text = _master.name; m_txtOutline.text = _master.GetOutline(_data.level); } else { m_txtName.text = "なし"; m_txtOutline.text = "-----"; } if (10 <= _data.level) { m_txtGradeupPrice.text = "強化上限"; m_btnGradeup.interactable = false; } else { if (_master != null) { int price = MasterTreasure.GetGradeupPrice(_data, _master); m_txtGradeupPrice.text = price.ToString(); m_btnGradeup.interactable = price <= DataManager.Instance.GetCoin(); } else { m_txtGradeupPrice.text = "-----"; m_btnGradeup.interactable = false; } } m_btnBuyCheck.interactable = _data.treasure_id != 0 && _data.equip == 0; }
public override void OnEnter() { base.OnEnter(); treasure_serial.Value = 0; int iNum = DataManager.Instance.dataTreasure.list.Count; treasureMain.m_txtListTitle.text = string.Format("所持おたから一覧({0}/{1})", iNum, Defines.TREASURE_NUM_LIMIT); treasureMain.m_goBuyWindow.SetActive(false); treasureMain.m_treasureInfo.Setup(new DataTreasureParam(0, 0), null); treasureMain.m_btnBuy.gameObject.SetActive(true); treasureMain.m_btnGradeup.gameObject.SetActive(true); treasureMain.m_btnGradeup.onClick.AddListener(() => { DataTreasureParam data = DataManager.Instance.dataTreasure.list.Find(p => p.serial == treasure_serial.Value); MasterTreasureParam master = DataManager.Instance.masterTreasure.list.Find(p => p.treasure_id == data.treasure_id); DataManager.Instance.UseCoin(MasterTreasure.GetGradeupPrice(data, master)); data.level += 1; treasureMain.m_treasureInfo.Setup(data, master); foreach (IconInventry icon in treasureMain.treasure_list) { if (icon.m_dataTreasure.serial == data.serial) { icon.Initialize(data, master); icon.SelectTreasure(data.serial); } } foreach (IconInventry icon in treasureMain.equip_treasure_list) { if (icon.m_dataTreasure.serial == data.serial) { icon.Initialize(data, master); icon.SelectTreasure(data.serial); } } DataManager.Instance.dataTreasure.Save(); DataManager.Instance.user_data.Save(); }); treasureMain.m_btnBuy.onClick.AddListener(() => { Fsm.Event("buy"); }); treasureMain.m_btnEdit.gameObject.SetActive(true); treasureMain.m_btnAlbum.gameObject.SetActive(true); treasureMain.m_btnEdit.onClick.AddListener(() => { Fsm.Event("edit"); }); treasureMain.m_btnAlbum.onClick.AddListener(() => { Fsm.Event("album"); }); treasureMain.m_btnMenuBulk.gameObject.SetActive(true); treasureMain.m_btnMenuBulk.onClick.AddListener(() => { Fsm.Event("bulk"); }); SetupEquip(); treasureMain.treasure_list.Clear(); MonoBehaviourEx.DeleteObjects <IconInventry>(treasureMain.m_goListContents); foreach (DataTreasureParam treasure in DataManager.Instance.dataTreasure.list) { IconInventry icon = PrefabManager.Instance.MakeScript <IconInventry>(treasureMain.m_prefIconInventry, treasureMain.m_goListContents); MasterTreasureParam master = DataManager.Instance.masterTreasure.list.Find(p => p.treasure_id == treasure.treasure_id); icon.Initialize(treasure, master); treasureMain.treasure_list.Add(icon); icon.OnClickTreasure.AddListener(OnSelectListTreasure); } }
public override void OnEnter() { base.OnEnter(); int iNum = DataManager.Instance.dataTreasure.list.Count; treasureMain.m_txtListTitle.text = string.Format("おたから編集({0}/{1})", iNum, Defines.TREASURE_NUM_LIMIT); equip_position = -1; treasure_serial = -1; SetupEquip(); treasureMain.m_btnBuy.gameObject.SetActive(false); treasureMain.m_btnGradeup.gameObject.SetActive(false); treasureMain.m_btnGradeup.onClick.AddListener(() => { DataTreasureParam data = DataManager.Instance.dataTreasure.list.Find(p => p.serial == treasure_serial); MasterTreasureParam master = DataManager.Instance.masterTreasure.list.Find(p => p.treasure_id == data.treasure_id); DataManager.Instance.UseCoin(MasterTreasure.GetGradeupPrice(data, master)); data.level += 1; treasureMain.m_treasureInfo.Setup(data, master); foreach (IconInventry icon in treasureMain.treasure_list) { if (icon.m_dataTreasure.serial == data.serial) { icon.Initialize(data, master); icon.SelectTreasure(data.serial); } } foreach (IconInventry icon in treasureMain.equip_treasure_list) { if (icon.m_dataTreasure.serial == data.serial) { icon.Initialize(data, master); icon.SelectTreasure(data.serial); } } DataManager.Instance.dataTreasure.Save(); DataManager.Instance.user_data.Save(); }); treasureMain.m_btnSet.gameObject.SetActive(true); treasureMain.m_btnBack.gameObject.SetActive(true); treasureMain.m_btnSet.interactable = false; treasureMain.m_btnSet.onClick.AddListener(() => { DataTreasureParam temp_data = DataManager.Instance.dataTreasure.list.Find(p => p.serial == treasure_serial); DataTreasureParam preset_data = DataManager.Instance.dataTreasure.list.Find(p => p.equip == equip_position); if (temp_data != null) { if (preset_data != null) { int temp_position = temp_data.equip; preset_data.equip = temp_position; } temp_data.equip = equip_position; } else { if (preset_data != null) { preset_data.equip = 0; } } /* * if(preset_data != null && temp_data != null) * { * if( preset_data.serial == temp_data.serial) * { * // なにもしない * } * else if(temp_data.equip != 0) * { * int temp_position = temp_data.equip; * temp_data.equip = preset_data.equip; * preset_data.equip = temp_position; * } * else * { * temp_data.equip = equip_position; * } * } * else if( temp_data != null) * { * temp_data.equip = equip_position; * } * else if(preset_data != null && temp_data == null) * { * // 外す * preset_data.equip = 0; * } * else * { * // 入らないんじゃない? * } */ DataManager.Instance.dataTreasure.Save(); Fsm.Event("equip"); }); treasureMain.m_btnBack.onClick.RemoveAllListeners(); treasureMain.m_btnBack.onClick.AddListener(() => { Fsm.Event("back"); }); treasureMain.treasure_list.Clear(); MonoBehaviourEx.DeleteObjects <IconInventry>(treasureMain.m_goListContents); IconInventry remove_icon = PrefabManager.Instance.MakeScript <IconInventry>(treasureMain.m_prefIconInventry, treasureMain.m_goListContents); remove_icon.Initialize(new DataTreasureParam(0, 0), null); remove_icon.m_txtNotInventry.text = "はずす"; remove_icon.OnClickTreasure.AddListener(OnSelectListTreasure); treasureMain.treasure_list.Add(remove_icon); foreach (DataTreasureParam treasure in DataManager.Instance.dataTreasure.list) { IconInventry icon = PrefabManager.Instance.MakeScript <IconInventry>(treasureMain.m_prefIconInventry, treasureMain.m_goListContents); MasterTreasureParam master = DataManager.Instance.masterTreasure.list.Find(p => p.treasure_id == treasure.treasure_id); icon.Initialize(treasure, master); treasureMain.treasure_list.Add(icon); icon.OnClickTreasure.AddListener(OnSelectListTreasure); } }
public override void OnEnter() { base.OnEnter(); main.m_btnQuest.onClick.RemoveAllListeners(); main.m_btnQuest.onClick.AddListener(() => { Fsm.Event("quest"); }); // charaview main.m_charaView.Initialize(); // weapon DataWeaponParam data_equip = DataManager.Instance.dataWeapon.list.Find(p => 0 < p.equip); MasterWeaponParam master_equip = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data_equip.weapon_id); main.m_weaponInfo.Setup(data_equip, master_equip); // treasure main.m_prefIconTreasure.SetActive(false); main.treasure_list.Clear(); MonoBehaviourEx.DeleteObjects <IconInventry>(main.m_goTreasureRoot); for (int i = 0; i < 3; i++) { IconInventry icon = PrefabManager.Instance.MakeScript <IconInventry>(main.m_prefIconTreasure, main.m_goTreasureRoot); DataTreasureParam equip_data = DataManager.Instance.dataTreasure.list.Find(p => p.equip == i + 1); if (equip_data != null) { MasterTreasureParam master = DataManager.Instance.masterTreasure.list.Find(p => p.treasure_id == equip_data.treasure_id); icon.Initialize(equip_data, master); } else { equip_data = new DataTreasureParam(); equip_data.equip = i + 1; equip_data.treasure_id = 0; icon.Initialize(equip_data, null); } main.treasure_list.Add(icon); } // armor main.icon_armor_list.Clear(); main.m_prefIconArmor.SetActive(false); MonoBehaviourEx.DeleteObjects <IconArmor>(main.m_goArmorLeft); MonoBehaviourEx.DeleteObjects <IconArmor>(main.m_goArmorRight); for (int i = 0; i < 4; i++) { IconArmor script = PrefabManager.Instance.MakeScript <IconArmor>(main.m_prefIconArmor, main.m_goArmorLeft); main.icon_armor_list.Add(script); } for (int i = 0; i < 4; i++) { IconArmor script = PrefabManager.Instance.MakeScript <IconArmor>(main.m_prefIconArmor, main.m_goArmorRight); main.icon_armor_list.Add(script); } for (int i = 0; i < MasterArmor.ArmorPositionArr.Length; i++) { DataArmorParam data = DataManager.Instance.dataArmor.list.Find(p => p.position == MasterArmor.ArmorPositionArr[i]); main.icon_armor_list[i].Initialize(data, DataManager.Instance.masterArmor.list); } main.m_panelStage.gameObject.SetActive(false); ShowParamsTotal(); Finish(); }
public override void OnEnter() { base.OnEnter(); //weapon_serial.Value = 0; int iNum = DataManager.Instance.dataWeapon.list.Count; main.m_txtListTitle.text = string.Format("所持武器一覧({0}/{1})", iNum, Defines.WEAPON_NUM_LIMIT); main.m_goBulkBuyWindow.SetActive(false); if (weapon_serial.Value == 0) { main.m_weaponInfo.Setup(new DataWeaponParam(0, 0), null); } else { DataWeaponParam data = DataManager.Instance.dataWeapon.list.Find(p => p.serial == weapon_serial.Value); MasterWeaponParam master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data.weapon_id); main.m_weaponInfo.Setup(data, master); } main.m_btnList.gameObject.SetActive(false); main.m_btnBulk.gameObject.SetActive(true); main.m_btnBulk.onClick.AddListener(() => { weapon_serial.Value = 0; Fsm.Event("bulk"); }); main.m_btnBuy.gameObject.SetActive(true); main.m_btnBuy.onClick.AddListener(() => { Fsm.Event("buy"); }); main.m_btnGradeup.gameObject.SetActive(true); main.m_btnGradeup.onClick.AddListener(() => { DataWeaponParam data = DataManager.Instance.dataWeapon.list.Find(p => p.serial == weapon_serial.Value); MasterWeaponParam master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data.weapon_id); DataManager.Instance.UseCoin(MasterWeapon.GetGradeupPrice(data, master)); data.level += 1; main.m_weaponInfo.Setup(data, master); foreach (IconInventry icon in main.weapon_list) { if (icon.m_dataWeapon.serial == data.serial) { icon.Initialize(data, master); icon.SelectTreasure(data.serial); } } DataManager.Instance.dataWeapon.Save(); DataManager.Instance.user_data.Save(); }); main.m_btnEquip.gameObject.SetActive(true); main.m_btnEquip.interactable = false; main.m_btnEquip.onClick.AddListener(() => { DataWeaponParam data_equip_pre = DataManager.Instance.dataWeapon.list.Find(p => 0 < p.equip); data_equip_pre.equip = 0; DataWeaponParam data_equip = DataManager.Instance.dataWeapon.list.Find(p => p.serial == weapon_serial.Value); data_equip.equip = 1; MasterWeaponParam master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data_equip.weapon_id); main.m_weaponInfo.Setup(data_equip, master); foreach (IconInventry icon in main.weapon_list) { if (icon.m_dataWeapon.serial == data_equip_pre.serial) { icon.m_goEquip.SetActive(false); } if (icon.m_dataWeapon.serial == data_equip.serial) { icon.m_goEquip.SetActive(true); } } main.m_btnEquip.interactable = false; DataManager.Instance.dataWeapon.Save(); }); main.m_btnAlbum.gameObject.SetActive(true); main.m_btnAlbum.onClick.AddListener(() => { Fsm.Event("album"); }); main.weapon_list.Clear(); MonoBehaviourEx.DeleteObjects <IconInventry>(main.m_goListContents); foreach (DataWeaponParam data in DataManager.Instance.dataWeapon.list) { IconInventry icon = PrefabManager.Instance.MakeScript <IconInventry>( main.m_prefIconInventry, main.m_goListContents); MasterWeaponParam master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data.weapon_id); icon.Initialize(data, master); main.weapon_list.Add(icon); icon.OnClickWeapon.AddListener(OnSelectListWeapon); } main.SelectListData(weapon_serial.Value); }