예제 #1
0
        //--------------------------------------------------------------------------------
        // Init
        //--------------------------------------------------------------------------------
        public void Init(string _sFamily)
        {
            if (String.IsNullOrWhiteSpace(_sFamily))
            {
                return;
            }

            for (int i = 0; i < content.childCount; ++i)
            {
                Destroy(content.GetChild(i).gameObject);
            }

            tmpls.Clear();
            sFamily         = _sFamily;
            headerText.text = sFamily;

            foreach (TemplateAspect tmpl in DataManager.dictAspect.Values)
            {
                if (tmpl.family == sFamily)
                {
                    tmpls.Add(tmpl);
                }
            }

            if (tmpls.Count > 0)
            {
                TemplateAspect defaultTemplate = null;

                foreach (TemplateAspect tmpl in tmpls)
                {
                    if (!defaultTemplate)
                    {
                        defaultTemplate = tmpl;
                    }

                    GameObject uiObject = Instantiate(slotPrefab);
                    uiObject.GetComponent <OM_UI_SlotAspect>().Init(tmpl);
                    uiObject.SetActive(true);
                    uiObject.transform.SetParent(content.transform, false);
                }

                if (!parentPanel)
                {
                    parentPanel = FindObjectOfType <OM_UI_PanelActorCreate>();
                }
                parentPanel.SetAspect(defaultTemplate);
            }

            Show();
        }
예제 #2
0
        // -------------------------------------------------------------------------------
        // SetAspect
        // -------------------------------------------------------------------------------
        public void SetAspect(TemplateAspect tmpl)
        {
            if (dictAspects.ContainsKey(tmpl.family))
            {
                dictAspects.Remove(tmpl.family);
            }

            dictAspects.Add(tmpl.family, tmpl);

            foreach (ActorAspects actorAspect in actorAspects)
            {
                if (actorAspect.aspectFamily == tmpl.family)
                {
                    actorAspect.aspectSlot.Init(tmpl);
                }
            }

            UpdateActorObject();
        }
예제 #3
0
        //--------------------------------------------------------------------------------
        // Init
        //--------------------------------------------------------------------------------
        public void Init(TemplateAspect _tmpl)
        {
            if (_tmpl == null)
            {
                return;
            }

            if (!parentPanel)
            {
                parentPanel = FindObjectOfType <OM_UI_PanelActorCreate>();
            }

            tmpl = _tmpl;

            button.GetComponent <Image>().sprite = tmpl.icon;

            button.onClick.AddListener(() => {
                ClickButton();
            });

            GenerateTooltip(tmpl.GenerateToolTip);
        }