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 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); }
public override void Initialize() { base.Initialize(); master_quest = new MasterQuest(); master_quest.Load(m_taMasterQuest); master_item = new MasterItem(); master_item.Load(m_taMasterItem); master_chara = new MasterChara(); master_chara.Load(m_taMasterChara); data_quest = new DataQuest(); data_quest.SetSaveFilename("data/data_quest"); if (data_quest.Load() == false) { Debug.Log("loaderror.data_quest"); } data_item_consume = new DataItem(); data_item_consume.SetSaveFilename("data/data_item_consume"); if (data_item_consume.Load() == false) { DataItemParam item = new DataItemParam { item_id = 1 }; data_item_consume.AddItem(item); DataItemParam item2 = new DataItemParam { item_id = 1 }; data_item_consume.AddItem(item2); Debug.Log("loaderror.data_item_consume"); } data_item_equip = new DataItem(); data_item_equip.SetSaveFilename("data/data_item_equip"); if (data_item_equip.Load() == false) { Debug.Log("loaderror.data_item_equip"); } data_chara = new DataChara(); data_chara.SetSaveFilename("data/data_chara"); if (data_chara.Load() == false) { DataCharaParam slime = new DataCharaParam { chara_id = 1, position = 1 }; slime.Build(1, master_chara.list.Find(p => p.chara_id == 1)); data_chara.list.Add(slime); DataCharaParam fairy = new DataCharaParam { chara_id = 3, position = 2 }; fairy.Build(1, master_chara.list.Find(p => p.chara_id == 3)); data_chara.list.Add(fairy); } gold = 100; Initialized = true; }