Exemplo n.º 1
0
        private void createInfoView()
        {
            //line info painel

            KlyteMonoUtils.CreateUIElement(out m_buildingInfoPanel, gameObject.transform);
            m_buildingInfoPanel.Hide();
            m_buildingInfoPanel.relativePosition  = new Vector3(394.0f, 70.0f);
            m_buildingInfoPanel.width             = 650;
            m_buildingInfoPanel.height            = 290;
            m_buildingInfoPanel.zOrder            = 50;
            m_buildingInfoPanel.color             = new Color32(255, 255, 255, 255);
            m_buildingInfoPanel.backgroundSprite  = "MenuPanel2";
            m_buildingInfoPanel.name              = "BuildingInfoPanel";
            m_buildingInfoPanel.autoLayoutPadding = new RectOffset(5, 5, 10, 10);
            m_buildingInfoPanel.autoLayout        = false;
            m_buildingInfoPanel.useCenter         = true;
            m_buildingInfoPanel.wrapLayout        = false;
            m_buildingInfoPanel.canFocus          = true;
            KlyteMonoUtils.CreateDragHandle(m_buildingInfoPanel, m_buildingInfoPanel, 35f);



            KlyteMonoUtils.CreateUIElement(out buildingTypeIcon, m_buildingInfoPanel.transform);
            buildingTypeIcon.autoSize             = false;
            buildingTypeIcon.relativePosition     = new Vector3(10f, 7f);
            buildingTypeIcon.width                = 30;
            buildingTypeIcon.height               = 30;
            buildingTypeIcon.name                 = "BuildingTypeIcon";
            buildingTypeIcon.clipChildren         = true;
            buildingTypeIcon.foregroundSpriteMode = UIForegroundSpriteMode.Scale;
            KlyteMonoUtils.CreateDragHandle(buildingTypeIcon, m_buildingInfoPanel);

            KlyteMonoUtils.CreateUIElement(out buildingTypeIconFg, buildingTypeIcon.transform);
            buildingTypeIconFg.autoSize         = false;
            buildingTypeIconFg.relativePosition = new Vector3(0, 0);
            buildingTypeIconFg.width            = 30;
            buildingTypeIconFg.height           = 30;
            buildingTypeIconFg.name             = "BuildingTypeIconFg";
            buildingTypeIconFg.clipChildren     = true;
            KlyteMonoUtils.CreateDragHandle(buildingTypeIconFg, m_buildingInfoPanel);

            KlyteMonoUtils.CreateUIElement(out buildingNameField, m_buildingInfoPanel.transform);
            buildingNameField.autoSize            = false;
            buildingNameField.relativePosition    = new Vector3(160f, 10f);
            buildingNameField.horizontalAlignment = UIHorizontalAlignment.Center;
            buildingNameField.text      = "NOME";
            buildingNameField.width     = 450;
            buildingNameField.height    = 25;
            buildingNameField.name      = "BuildingNameLabel";
            buildingNameField.maxLength = 256;
            buildingNameField.textScale = 1.5f;
            KlyteMonoUtils.UiTextFieldDefaults(buildingNameField);
            buildingNameField.eventGotFocus += (component, eventParam) =>
            {
                lastDepotName = buildingNameField.text;
            };
            buildingNameField.eventTextSubmitted += (component, eventParam) =>
            {
                if (lastDepotName != buildingNameField.text)
                {
                    saveBuildingName(buildingNameField);
                }
            };

            KlyteMonoUtils.CreateUIElement(out vehiclesInUseLabel, m_buildingInfoPanel.transform);
            vehiclesInUseLabel.autoSize         = false;
            vehiclesInUseLabel.relativePosition = new Vector3(10f, 60f);
            vehiclesInUseLabel.textAlignment    = UIHorizontalAlignment.Left;
            vehiclesInUseLabel.text             = "";
            vehiclesInUseLabel.width            = 550;
            vehiclesInUseLabel.height           = 25;
            vehiclesInUseLabel.name             = "VehiclesInUseLabel";
            vehiclesInUseLabel.textScale        = 0.8f;
            vehiclesInUseLabel.prefix           = Locale.Get("K45_VMC_VEHICLE_CAPACITY_LABEL") + ": ";

            KlyteMonoUtils.CreateUIElement(out upkeepCost, m_buildingInfoPanel.transform);
            upkeepCost.autoSize         = false;
            upkeepCost.relativePosition = new Vector3(10f, 75);
            upkeepCost.textAlignment    = UIHorizontalAlignment.Left;
            upkeepCost.width            = 250;
            upkeepCost.height           = 25;
            upkeepCost.name             = "UpkeepLabel";
            upkeepCost.textScale        = 0.8f;

            KlyteMonoUtils.CreateUIElement(out UIButton voltarButton2, m_buildingInfoPanel.transform);
            voltarButton2.relativePosition = new Vector3(m_buildingInfoPanel.width - 33f, 5f);
            voltarButton2.width            = 28;
            voltarButton2.height           = 28;
            KlyteMonoUtils.InitButton(voltarButton2, true, "DeleteLineButton");
            voltarButton2.name        = "LineInfoCloseButton";
            voltarButton2.eventClick += closeBuildingInfo;

            workerChart = new TLMWorkerChartPanel(panelTransform, new Vector3(400f, 90f));
            m_uiHelper  = new UIHelperExtension(m_buildingInfoPanel);
        }