Example #1
0
        /// <summary>
        /// Builds up the custom UI objects for the info panel.
        /// </summary>
        /// <returns><c>true</c> on success; otherwise, <c>false</c>.</returns>
        protected override bool InitializeCore()
        {
            bool result = base.InitializeCore();

            if (!result)
            {
                return(result);
            }

            wealthPanel = UIComponentTools.CreateCopy(OriginPanel, ItemsPanel);
            wealthLabel = UIComponentTools.CreateCopy(OriginLabel, wealthPanel, WealthComponentId);

            wealthLabel.text      = string.Empty;
            wealthPanel.isVisible = false;

            return(true);
        }
Example #2
0
        /// <summary>
        /// Builds up the custom UI objects for the info panel.
        /// </summary>
        /// <returns><c>true</c> on success; otherwise, <c>false</c>.</returns>
        protected override bool InitializeCore()
        {
            if (!GetUIObjects(InfoPanelName, ItemsPanel, out var targetPanel, out var targetLabel, out var targetButton))
            {
                return(false);
            }

            OriginPanel  = UIComponentTools.CreateCopy(targetPanel, ItemsPanel);
            OriginLabel  = UIComponentTools.CreateCopy(targetLabel, OriginPanel, OriginComponentId + targetLabel.name);
            OriginButton = UIComponentTools.CreateCopy(targetButton, OriginPanel, OriginComponentId + targetButton.name);

            OriginButton.eventClick += OriginButtonClick;
            OriginLabel.text         = "▣";
            OriginPanel.isVisible    = false;

            return(true);
        }
        /// <summary>
        /// Builds up the custom UI objects for the info panel.
        /// </summary>
        /// <returns><c>true</c> on success; otherwise, <c>false</c>.</returns>
        protected override bool InitializeCore()
        {
            bool result = base.InitializeCore();

            if (!result)
            {
                return(result);
            }

            carPanel  = UIComponentTools.CreateCopy(OriginPanel, ItemsPanel);
            carLabel  = UIComponentTools.CreateCopy(OriginLabel, carPanel, CarComponentId + "Label");
            carButton = UIComponentTools.CreateCopy(OriginButton, carPanel, CarComponentId + "Button");

            carButton.eventClick += CarButtonClick;
            carLabel.text         = "| P| ";
            carPanel.isVisible    = false;

            return(true);
        }
Example #4
0
        private void Initialize(string panelName)
        {
            GetUIObjects(panelName, out UIComponent itemsPanel, out UIPanel targetPanel, out UILabel targetLabel, out UIButton targetButton);

            if (itemsPanel == null || targetPanel == null || targetLabel == null || targetButton == null)
            {
                return;
            }

            defaultHeight = itemsPanel.parent?.height ?? 0;

            string buttonId = ButtonId + GetType().Name;

            originPanel  = UIComponentTools.CreateCopy(targetPanel, itemsPanel);
            originLabel  = UIComponentTools.CreateCopy(targetLabel, originPanel, buttonId);
            originButton = UIComponentTools.CreateCopy(targetButton, originPanel, buttonId);

            newHeight = defaultHeight + originPanel.height + originPanel.padding.bottom + originPanel.padding.top;

            originButton.eventClick += OriginButtonClick;
            originLabel.text         = "▣";
            originPanel.isVisible    = false;
        }