示例#1
0
        public void Update()
        {
            if (!_initialized)
            {
                var go = GameObject.Find("(Library) CityServiceWorldInfoPanel");
                if (go == null)
                {
                    return;
                }

                var infoPanel = go.GetComponent <CityServiceWorldInfoPanel>();
                if (infoPanel == null)
                {
                    return;
                }

                _cityServiceInfoPanel = infoPanel;
                m_dropdownResource    = Utils.UIUtils.CreateDropDown(_cityServiceInfoPanel.component);
                m_dropdownResource.relativePosition = new Vector3(105, 267);
                m_dropdownResource.width            = 250;
                m_dropdownMode = Utils.UIUtils.CreateDropDown(_cityServiceInfoPanel.component);
                m_dropdownMode.relativePosition = new Vector3(110 + m_dropdownResource.width, 267);
                m_dropdownMode.width            = 120;
                RefreshDropdownLists();
                this.m_dropdownResource.eventSelectedIndexChanged += OnDropdownResourceChanged;
                this.m_dropdownMode.eventSelectedIndexChanged     += OnDropdownModeChanged;
                _initialized = true;
            }

            if (!_cityServiceInfoPanel.component.isVisible)
            {
                m_dropdownResource.ClosePopup();
                m_dropdownMode.ClosePopup();
                return;
            }

            SetUpSwapButton();
        }