public void top(bool _bInit) { if (_bInit) { menu_items.gameObject.SetActive(false); m_prefCharaSlot.SetActive(false); List <DataCharaParam> party_list = DataManager.Instance.data_chara.list.FindAll(p => 0 < p.position); party_list.Sort((a, b) => (a.position - b.position)); foreach (DataCharaParam data in party_list) { MasterCharaParam master = DataManager.Instance.master_chara.list.Find(p => p.chara_id == data.chara_id); GameObject instance = GameObject.Instantiate( m_prefCharaSlot, Vector3.zero, new Quaternion(0, 0, 0, 0), m_rootCharaSlot.transform); instance.SetActive(true); CharaSlot script = instance.GetComponent <CharaSlot>(); script.Initialize(master, data); } } }
public void Initialize(MasterCharaParam _master, DataCharaParam _data) { if (m_btn == null) { m_btn = gameObject.GetComponent<Button>(); } m_txtName.text = _master.name; m_txtLevel.text = _data.level.ToString(); }
public void Build(int _iLevel, MasterCharaParam _master) { level = _iLevel; hp_max = build_param_level(_master.hp_base, _iLevel); sp_max = build_param_level(_master.sp_base, _iLevel); hp_current = hp_max; sp_current = sp_max; strength = build_param_level(_master.strength_base, _iLevel); vital = build_param_level(_master.vital_base, _iLevel); }
public void Initialize(MasterCharaParam _master, DataCharaParam _data) { if (m_btn == null) { m_btn = gameObject.GetComponent <Button>(); } m_txtName.text = _master.name; m_txtLevel.text = _data.level.ToString(); m_slHP.value = (float)(_data.hp_current / _data.hp_max); m_slSP.value = (float)(_data.sp_current / _data.sp_max); m_txtHP.text = string.Format("{0}/{1}", _data.hp_current, _data.hp_max); m_txtSP.text = string.Format("{0}/{1}", _data.sp_current, _data.sp_max); }
private void clear_charaslot() { if (chara_slot_list != null) { foreach (CharaSlot slot in chara_slot_list) { Destroy(slot.gameObject); } chara_slot_list.Clear(); } List <DataCharaParam> party_list = DataManager.Instance.data_chara.list.FindAll(p => 0 < p.position); party_list.Sort((a, b) => (a.position - b.position)); chara_slot_list = new List <CharaSlot>(); foreach (DataCharaParam data in party_list) { MasterCharaParam master = DataManager.Instance.master_chara.list.Find(p => p.chara_id == data.chara_id); GameObject instance = GameObject.Instantiate( m_prefCharaSlot, Vector3.zero, new Quaternion(0, 0, 0, 0), m_rootItemsCharaSlot.transform); instance.SetActive(true); CharaSlot script = instance.GetComponent <CharaSlot>(); script.Initialize(master, data); script.m_btn.interactable = false; script.m_btn.onClick.AddListener(() => { m_btnUse.interactable = true; }); chara_slot_list.Add(script); } }