Пример #1
0
 // -------------------------------------------------------------------------------
 // OnChildEnable
 // -------------------------------------------------------------------------------
 public override void OnChildEnable()
 {
     if (!parentPanel)
     {
         parentPanel = FindObjectOfType <OM_UI_PanelActorCreate>();
     }
 }
Пример #2
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();
        }
Пример #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);
        }
Пример #4
0
        //--------------------------------------------------------------------------------
        // OnChildEnable
        //--------------------------------------------------------------------------------
        public override void OnChildEnable()
        {
            if (!panelActorCreate)
            {
                panelActorCreate = FindObjectOfType <OM_UI_PanelActorCreate>();
            }
            if (!panelAccountOptions)
            {
                panelAccountOptions = FindObjectOfType <OM_UI_PanelAccountOptions>();
            }
            if (!panelMain)
            {
                panelMain = FindObjectOfType <OM_UI_PanelMain>();
            }
            if (!panelOverlay)
            {
                panelOverlay = FindObjectOfType <OM_UI_PanelOverlay>();
            }
            if (!panelMessage)
            {
                panelMessage = FindObjectOfType <OM_UI_PanelMessage>();
            }

            buttonActorDelete.interactable = false;
            buttonActorLogin.interactable  = false;

            if (buttonActorCreate != null)
            {
                buttonActorCreate.GetComponentInChildren <Text>().text = String.Format(labelButtonCreate, clientManager.actorsRemaining);
                if (clientManager.actorsRemaining < 1)
                {
                    buttonActorCreate.interactable = false;
                }
            }
            else
            {
                Debug.LogWarning(Constants.STR_ERROR_MISSING_UI + this.name);
            }

            if (!_cameraPositionObject)
            {
                _cameraPositionObject = GameObject.Find(cameraPositionObject);
            }
            if (!_cameraTargetObject)
            {
                _cameraTargetObject = GameObject.Find(cameraTargetObject);
            }

            _actorPositionObject = new GameObject[actorPositionObject.Length];

            for (int i = 0; i < actorPositionObject.Length; ++i)
            {
                _actorPositionObject[i] = GameObject.Find(actorPositionObject[i]);
            }

            _actorObject = new GameObject[actorPositionObject.Length];

            Camera.main.transform.position = _cameraPositionObject.transform.position;

            iTween.LookTo(Camera.main.gameObject, _cameraTargetObject.transform.position, 0f);
        }