private void createInfoView() { //line info painel SVMUtils.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; SVMUtils.createDragHandle(m_buildingInfoPanel, m_buildingInfoPanel, 35f); SVMUtils.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; SVMUtils.createDragHandle(buildingTypeIcon, m_buildingInfoPanel); SVMUtils.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; buildingTypeIconFg.atlas = SVMController.taSVM; SVMUtils.createDragHandle(buildingTypeIconFg, m_buildingInfoPanel); SVMUtils.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; SVMUtils.uiTextFieldDefaults(buildingNameField); buildingNameField.eventGotFocus += (component, eventParam) => { lastDepotName = buildingNameField.text; }; buildingNameField.eventTextSubmitted += (component, eventParam) => { if (lastDepotName != buildingNameField.text) { saveBuildingName(buildingNameField); } }; SVMUtils.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("SVM_VEHICLE_CAPACITY_LABEL") + ": "; SVMUtils.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; SVMUtils.createUIElement(out UIButton voltarButton2, m_buildingInfoPanel.transform); voltarButton2.relativePosition = new Vector3(m_buildingInfoPanel.width - 33f, 5f); voltarButton2.width = 28; voltarButton2.height = 28; SVMUtils.initButton(voltarButton2, true, "DeleteLineButton"); voltarButton2.name = "LineInfoCloseButton"; voltarButton2.eventClick += closeBuildingInfo; workerChart = new TLMWorkerChartPanel(this.panelTransform, new Vector3(400f, 90f)); m_uiHelper = new UIHelperExtension(m_buildingInfoPanel); }
private void createInfoView() { //line info painel TLMUtils.createUIElement(out depotInfoPanel, m_controller.mainRef.transform); depotInfoPanel.Hide(); depotInfoPanel.relativePosition = new Vector3(394.0f, 0.0f); depotInfoPanel.width = 650; depotInfoPanel.height = 290; depotInfoPanel.zOrder = 50; depotInfoPanel.color = new Color32(255, 255, 255, 255); depotInfoPanel.backgroundSprite = "MenuPanel2"; depotInfoPanel.name = "DepotInfoPanel"; depotInfoPanel.autoLayoutPadding = new RectOffset(5, 5, 10, 10); depotInfoPanel.autoLayout = false; depotInfoPanel.useCenter = true; depotInfoPanel.wrapLayout = false; depotInfoPanel.canFocus = true; TLMUtils.createDragHandle(depotInfoPanel, depotInfoPanel, 35f); TLMUtils.createUIElement(out lineTransportIconTypeLabel, depotInfoPanel.transform); lineTransportIconTypeLabel.autoSize = false; lineTransportIconTypeLabel.relativePosition = new Vector3(10f, 12f); lineTransportIconTypeLabel.width = 30; lineTransportIconTypeLabel.height = 20; lineTransportIconTypeLabel.name = "DepotTransportIcon"; lineTransportIconTypeLabel.clipChildren = true; lineTransportIconTypeLabel.eventClick += (x, y) => { openDepotInfo(m_buildingIdSelecionado.Building, !m_secondary); }; TLMUtils.createDragHandle(lineTransportIconTypeLabel, depotInfoPanel); TLMUtils.createUIElement(out depotNameField, depotInfoPanel.transform); depotNameField.autoSize = false; depotNameField.relativePosition = new Vector3(160f, 10f); depotNameField.horizontalAlignment = UIHorizontalAlignment.Center; depotNameField.text = "NOME"; depotNameField.width = 450; depotNameField.height = 25; depotNameField.name = "DepotNameLabel"; depotNameField.maxLength = 256; depotNameField.textScale = 1.5f; TLMUtils.uiTextFieldDefaults(depotNameField); depotNameField.eventGotFocus += (component, eventParam) => { lastDepotName = depotNameField.text; }; depotNameField.eventLostFocus += (component, eventParam) => { if (lastDepotName != depotNameField.text) { saveDepotName(depotNameField); } }; TLMUtils.createUIElement(out vehiclesInUseLabel, depotInfoPanel.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; TLMUtils.createUIElement(out passengersLastWeek, depotInfoPanel.transform); passengersLastWeek.autoSize = false; passengersLastWeek.relativePosition = new Vector3(10f, 90); passengersLastWeek.textAlignment = UIHorizontalAlignment.Left; passengersLastWeek.text = ""; passengersLastWeek.width = 550; passengersLastWeek.height = 25; passengersLastWeek.name = "PassengersLastWeek"; passengersLastWeek.textScale = 0.8f; TLMUtils.createUIElement(out upkeepCost, depotInfoPanel.transform); upkeepCost.autoSize = false; upkeepCost.relativePosition = new Vector3(10f, 75); upkeepCost.textAlignment = UIHorizontalAlignment.Left; upkeepCost.width = 250; upkeepCost.height = 25; upkeepCost.name = "AvoidedTravelsLabel"; upkeepCost.textScale = 0.8f; TLMUtils.createUIElement(out prefixesSpawned, depotInfoPanel.transform); prefixesSpawned.autoSize = false; prefixesSpawned.relativePosition = new Vector3(10f, 120f); prefixesSpawned.textAlignment = UIHorizontalAlignment.Left; prefixesSpawned.localeID = "TLM_PREFIXES_SPAWNED_DEPOT"; prefixesSpawned.suffix = ":"; prefixesSpawned.width = 350; prefixesSpawned.height = 25; prefixesSpawned.name = "TouristAndPassagersLabel"; prefixesSpawned.textScale = 0.8f; TLMUtils.createUIElement(out UIPanel prefixesPanel, depotInfoPanel.transform); prefixesPanel.autoSize = false; prefixesPanel.relativePosition = new Vector3(10f, 135f); prefixesPanel.width = 630; prefixesPanel.height = 100; prefixesPanel.name = "Prefixes Panel"; prefixesPanel.autoLayout = true; prefixesPanel.wrapLayout = true; prefixesCheckboxes = new Dictionary <uint, UICheckBox>(); for (uint i = 0; i <= 65; i++) { prefixesCheckboxes[i] = prefixesPanel.AttachUIComponent(UITemplateManager.GetAsGameObject("OptionsCheckBoxTemplate")) as UICheckBox; prefixesCheckboxes[i].text = i == 0 ? Locale.Get("TLM_UNPREFIXED") : i == 65 ? Locale.Get("TLM_REGIONAL") : i.ToString(); prefixesCheckboxes[i].width = 50; prefixesCheckboxes[i].GetComponentInChildren <UILabel>().relativePosition = new Vector3(20, 2); uint j = i; prefixesCheckboxes[i].eventCheckChanged += (x, y) => { if (TLMSingleton.instance != null && TLMSingleton.debugMode) { TLMUtils.doLog("prefixesCheckboxes[i].eventCheckChanged; j = {0}; check = {1}; loading = {2}", j, y, isLoading); } if (!isLoading) { togglePrefix(j, y, m_secondary); } }; } prefixesCheckboxes[0].width = prefixesPanel.width / 2.1f; prefixesCheckboxes[65].width = prefixesPanel.width / 2.1f; prefixesCheckboxes[65].zOrder = 0; TLMUtils.createUIElement(out UIButton voltarButton2, depotInfoPanel.transform); voltarButton2.relativePosition = new Vector3(depotInfoPanel.width - 33f, 5f); voltarButton2.width = 28; voltarButton2.height = 28; TLMUtils.initButton(voltarButton2, true, "DeleteLineButton"); voltarButton2.name = "LineInfoCloseButton"; voltarButton2.eventClick += closeDepotInfo; workerChart = new TLMWorkerChartPanel(this.panelTransform, new Vector3(400f, 60f)); TLMUtils.createUIElement(out UIButton addAllPrefixesButton, panelTransform); addAllPrefixesButton.relativePosition = new Vector3(300, 100f); addAllPrefixesButton.localeID = "TLM_ADD_ALL"; addAllPrefixesButton.isLocalized = true; addAllPrefixesButton.textScale = 0.6f; addAllPrefixesButton.width = 80; addAllPrefixesButton.height = 15; addAllPrefixesButton.tooltipLocaleID = "TLM_ADD_ALL_PREFIX_TOOLTIP"; TLMUtils.initButton(addAllPrefixesButton, true, "ButtonMenu"); addAllPrefixesButton.name = "AddAll"; addAllPrefixesButton.isVisible = true; addAllPrefixesButton.eventClick += (component, eventParam) => { TLMDepotAI.addAllPrefixesToDepot(m_buildingIdSelecionado.Building, m_secondary); updateCheckboxes(); }; TLMUtils.createUIElement(out UIButton removeAllPrefixesButton, panelTransform); removeAllPrefixesButton.relativePosition = new Vector3(300, 120f); removeAllPrefixesButton.localeID = "TLM_REMOVE_ALL"; removeAllPrefixesButton.isLocalized = true; removeAllPrefixesButton.textScale = 0.6f; removeAllPrefixesButton.width = 80; removeAllPrefixesButton.height = 15; removeAllPrefixesButton.tooltipLocaleID = "TLM_REMOVE_ALL_PREFIX_TOOLTIP"; TLMUtils.initButton(removeAllPrefixesButton, true, "ButtonMenu"); removeAllPrefixesButton.name = "RemoveAll"; removeAllPrefixesButton.isVisible = true; removeAllPrefixesButton.eventClick += (component, eventParam) => { TLMDepotAI.removeAllPrefixesFromDepot(m_buildingIdSelecionado.Building, m_secondary); updateCheckboxes(); }; }