public void Initialize()
        {
            this.emoteUI = this.transform.GetComponentInParent <UIEmote>();
            if (this.emoteUI == null)
            {
                return;
            }
            emotionType = emoteUI.activeEmotion;
            emoteIndex  = emoteUI.character.emotes.getIndex(emotionType);

            Transform itemparent = this.transform.Find("List/Content");
            Dictionary <string, List <Part> > parts = getAvailableParts();
            Part assignedpart = emoteIndex.getPart(slotCategory);

            clearItems();
            selectionObj.gameObject.SetActive(false);

            //..add null
            EmotePartItem partitem = Instantiate <EmotePartItem>(emotePartItem, itemparent);

            partitem.Initialize(null);
            if (assignedpart == null)
            {
                selectedItem = partitem;
                if (this.gameObject.activeInHierarchy)
                {
                    StopCoroutine("ie_initselected");
                    StartCoroutine("ie_initselected", selectedItem);
                }
            }
            //add null..

            foreach (string packagename in parts.Keys)
            {
                PackageItem packitem = Instantiate <PackageItem>(packageItem, itemparent);
                packitem.Initialize(packagename);

                foreach (Part part in parts[packagename])
                {
                    partitem = Instantiate <EmotePartItem>(emotePartItem, itemparent);
                    partitem.Initialize(part);
                    if (part == assignedpart)
                    {
                        selectedItem = partitem;
                        if (this.gameObject.activeInHierarchy)
                        {
                            StopCoroutine("ie_initselected");
                            StartCoroutine("ie_initselected", selectedItem);
                        }
                    }
                }
            }
        }
Beispiel #2
0
 void Awake()
 {
     emoteUI    = GetComponentInParent <UIEmote>();
     itemParent = this.transform.Find("List/Content");
 }
 void Awake()
 {
     emoteUI = GetComponentInParent <UIEmote>();
 }