Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
        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);
            }
        }