//ACOES private void saveDepotName(UITextField u) { string value = u.text; Singleton <BuildingManager> .instance.StartCoroutine(TLMUtils.setBuildingName(m_buildingIdSelecionado.Building, value, () => { depotNameField.text = Singleton <BuildingManager> .instance.GetBuildingName(m_buildingIdSelecionado.Building, default(InstanceID)); })); }
//ACOES private void saveDepotName(UITextField u) { string value = u.text; TLMUtils.setBuildingName(m_buildingIdSelecionado.Building, value, () => { }); }
private void OnRename(UIComponent comp, string text) { TLMUtils.setBuildingName(this.m_buildingID, text, () => { }); }
private void OnRename(UIComponent comp, string text) { Singleton <BuildingManager> .instance.StartCoroutine(TLMUtils.setBuildingName(this.m_buildingID, text, () => { })); }
private void Awake() { TLMUtils.clearAllVisibilityEvents(this.GetComponent <UIPanel>()); base.component.eventZOrderChanged += delegate(UIComponent c, int r) { this.SetBackgroundColor(); }; GameObject.Destroy(base.Find <UICheckBox>("LineVisible").gameObject); GameObject.Destroy(base.Find <UIColorField>("LineColor").gameObject); GameObject.Destroy(base.Find <UIPanel>("WarningIncomplete")); this.m_depotName = base.Find <UILabel>("LineName"); this.m_depotNameField = this.m_depotName.Find <UITextField>("LineNameField"); this.m_depotNameField.maxLength = 256; this.m_depotNameField.eventTextChanged += new PropertyChangedEventHandler <string>(this.OnRename); this.m_depotName.eventMouseEnter += delegate(UIComponent c, UIMouseEventParameter r) { this.m_depotName.backgroundSprite = "TextFieldPanelHovered"; }; this.m_depotName.eventMouseLeave += delegate(UIComponent c, UIMouseEventParameter r) { this.m_depotName.backgroundSprite = string.Empty; }; this.m_depotName.eventClick += delegate(UIComponent c, UIMouseEventParameter r) { this.m_depotNameField.Show(); this.m_depotNameField.text = this.m_depotName.text; this.m_depotNameField.Focus(); }; this.m_depotNameField.eventLeaveFocus += delegate(UIComponent c, UIFocusEventParameter r) { this.m_depotNameField.Hide(); Singleton <BuildingManager> .instance.StartCoroutine(TLMUtils.setBuildingName(this.m_buildingID, this.m_depotNameField.text, () => { this.m_depotName.text = this.m_depotNameField.text; Invalidate(); })); }; GameObject.Destroy(base.Find <UICheckBox>("DayLine").gameObject); GameObject.Destroy(base.Find <UICheckBox>("NightLine").gameObject); GameObject.Destroy(base.Find <UICheckBox>("DayNightLine").gameObject); GameObject.Destroy(base.Find <UILabel>("LinePassengers").gameObject); m_districtName = base.Find <UILabel>("LineStops"); m_districtName.minimumSize = new Vector2(140, 18); m_districtName.relativePosition = new Vector3(0, 10); m_districtName.pivot = UIPivotPoint.TopLeft; m_districtName.wordWrap = false; m_districtName.autoSize = true; TLMUtils.LimitWidth(m_districtName, (uint)m_districtName.minimumSize.x); if (Singleton <T> .instance.GetTSD().isShelterAiDepot()) { GameObject.Destroy(base.Find <UILabel>("LineVehicles").gameObject); } else { CreatePrefixSelectorUI(); } this.m_Background = base.Find("Background"); this.m_BackgroundColor = this.m_Background.color; this.m_mouseIsOver = false; base.component.eventMouseEnter += new MouseEventHandler(this.OnMouseEnter); base.component.eventMouseLeave += new MouseEventHandler(this.OnMouseLeave); GameObject.Destroy(base.Find <UIButton>("DeleteLine").gameObject); base.Find <UIButton>("ViewLine").eventClick += delegate(UIComponent c, UIMouseEventParameter r) { if (this.m_buildingID != 0) { Vector3 position = Singleton <BuildingManager> .instance.m_buildings.m_buffer[(int)this.m_buildingID].m_position; InstanceID instanceID = default(InstanceID); instanceID.Building = this.m_buildingID; ToolsModifierControl.cameraController.SetTarget(instanceID, position, true); if (!Singleton <T> .instance.GetTSD().isShelterAiDepot()) { TLMController.instance.depotInfoPanel.openDepotInfo(m_buildingID, secondary); TLMController.instance.CloseTLMPanel(); } } }; base.component.eventVisibilityChanged += delegate(UIComponent c, bool v) { if (v) { if (m_prefixOptions != null) { m_prefixOptions.items = new string[] { } } ; RefreshData(); } }; }
private void Awake() { TLMUtils.clearAllVisibilityEvents(this.GetComponent <UIPanel>()); base.component.eventZOrderChanged += delegate(UIComponent c, int r) { this.SetBackgroundColor(); }; GameObject.Destroy(base.Find <UICheckBox>("LineVisible").gameObject); GameObject.Destroy(base.Find <UIColorField>("LineColor").gameObject); GameObject.Destroy(base.Find <UIPanel>("WarningIncomplete")); this.m_depotName = base.Find <UILabel>("LineName"); this.m_depotNameField = this.m_depotName.Find <UITextField>("LineNameField"); this.m_depotNameField.maxLength = 256; this.m_depotNameField.eventTextChanged += new PropertyChangedEventHandler <string>(this.OnRename); this.m_depotName.eventMouseEnter += delegate(UIComponent c, UIMouseEventParameter r) { this.m_depotName.backgroundSprite = "TextFieldPanelHovered"; }; this.m_depotName.eventMouseLeave += delegate(UIComponent c, UIMouseEventParameter r) { this.m_depotName.backgroundSprite = string.Empty; }; this.m_depotName.eventClick += delegate(UIComponent c, UIMouseEventParameter r) { this.m_depotNameField.Show(); this.m_depotNameField.text = this.m_depotName.text; this.m_depotNameField.Focus(); }; this.m_depotNameField.eventLeaveFocus += delegate(UIComponent c, UIFocusEventParameter r) { this.m_depotNameField.Hide(); Singleton <BuildingManager> .instance.StartCoroutine(TLMUtils.setBuildingName(this.m_buildingID, this.m_depotNameField.text, () => { this.m_depotName.text = this.m_depotNameField.text; })); }; GameObject.Destroy(base.Find <UICheckBox>("DayLine").gameObject); GameObject.Destroy(base.Find <UICheckBox>("NightLine").gameObject); GameObject.Destroy(base.Find <UICheckBox>("DayNightLine").gameObject); this.m_prefixOptions = UIHelperExtension.CloneBasicDropDownNoLabel(new string[] { }, onChangePrefixSelected, gameObject.GetComponent <UIPanel>()); m_prefixOptions.area = new Vector4(600, 3, 80, 33); var m_DayLine = base.Find <UICheckBox>("DayLine"); GameObject.Destroy(base.Find <UICheckBox>("NightLine").gameObject); GameObject.Destroy(base.Find <UICheckBox>("DayNightLine").gameObject); GameObject.Destroy(m_DayLine.gameObject); m_districtName = base.Find <UILabel>("LineStops"); m_districtName.size = new Vector2(175, 18); m_districtName.relativePosition = new Vector3(0, 10); m_districtName.pivot = UIPivotPoint.MiddleCenter; m_districtName.wordWrap = true; m_districtName.autoHeight = true; GameObject.Destroy(base.Find <UILabel>("LinePassengers").gameObject); this.m_prefixesServed = base.Find <UILabel>("LineVehicles"); this.m_prefixesServed.size = new Vector2(220, 35); this.m_prefixesServed.autoHeight = true; this.m_prefixesServed.maximumSize = new Vector2(0, 36); this.m_prefixesServed.textScale = 0.7f; this.m_prefixesServed.width = 170; this.m_Background = base.Find("Background"); this.m_BackgroundColor = this.m_Background.color; this.m_mouseIsOver = false; base.component.eventMouseEnter += new MouseEventHandler(this.OnMouseEnter); base.component.eventMouseLeave += new MouseEventHandler(this.OnMouseLeave); GameObject.Destroy(base.Find <UIButton>("DeleteLine").gameObject); base.Find <UIButton>("ViewLine").eventClick += delegate(UIComponent c, UIMouseEventParameter r) { if (this.m_buildingID != 0) { Vector3 position = Singleton <BuildingManager> .instance.m_buildings.m_buffer[(int)this.m_buildingID].m_position; InstanceID instanceID = default(InstanceID); instanceID.Building = this.m_buildingID; TLMController.instance.depotInfoPanel.openDepotInfo(m_buildingID, secondary); ToolsModifierControl.cameraController.SetTarget(instanceID, position, true); TLMController.instance.defaultListingLinesPanel.Hide(); } }; base.component.eventVisibilityChanged += delegate(UIComponent c, bool v) { if (v) { this.m_prefixOptions.items = new string[] { }; this.RefreshData(); } }; //Buttons TLMUtils.createUIElement(out m_addPrefixButton, transform); m_addPrefixButton.pivot = UIPivotPoint.TopRight; m_addPrefixButton.relativePosition = new Vector3(730, 2); m_addPrefixButton.text = Locale.Get("TLM_ADD"); m_addPrefixButton.textScale = 0.6f; m_addPrefixButton.width = 50; m_addPrefixButton.height = 15; m_addPrefixButton.tooltip = Locale.Get("TLM_ADD_PREFIX_TOOLTIP"); TLMUtils.initButton(m_addPrefixButton, true, "ButtonMenu"); m_addPrefixButton.name = "Add"; m_addPrefixButton.isVisible = true; m_addPrefixButton.eventClick += (component, eventParam) => { uint prefix = m_prefixOptions.selectedIndex == m_prefixOptions.items.Length - 1 ? 65 : (uint)m_prefixOptions.selectedIndex; TLMDepotAI.addPrefixToDepot(buildingId, prefix, secondary); m_addPrefixButton.isVisible = false; m_removePrefixButton.isVisible = true; }; TLMUtils.createUIElement(out m_removePrefixButton, transform); m_removePrefixButton.pivot = UIPivotPoint.TopRight; m_removePrefixButton.relativePosition = new Vector3(780, 2); m_removePrefixButton.text = Locale.Get("TLM_REMOVE"); m_removePrefixButton.textScale = 0.6f; m_removePrefixButton.width = 50; m_removePrefixButton.height = 15; m_removePrefixButton.tooltip = Locale.Get("TLM_REMOVE_PREFIX_TOOLTIP"); TLMUtils.initButton(m_removePrefixButton, true, "ButtonMenu"); m_removePrefixButton.name = "Remove"; m_removePrefixButton.isVisible = true; m_removePrefixButton.eventClick += (component, eventParam) => { uint prefix = m_prefixOptions.selectedIndex == m_prefixOptions.items.Length - 1 ? 65 : (uint)m_prefixOptions.selectedIndex; TLMDepotAI.removePrefixFromDepot(buildingId, prefix, secondary); m_addPrefixButton.isVisible = true; m_removePrefixButton.isVisible = false; }; TLMUtils.createUIElement(out m_addAllPrefixesButton, transform); m_addAllPrefixesButton.pivot = UIPivotPoint.TopRight; m_addAllPrefixesButton.relativePosition = new Vector3(730, 20); m_addAllPrefixesButton.text = Locale.Get("TLM_ADD_ALL_SHORT"); ; m_addAllPrefixesButton.textScale = 0.6f; m_addAllPrefixesButton.width = 50; m_addAllPrefixesButton.height = 15; m_addAllPrefixesButton.tooltip = Locale.Get("TLM_ADD_ALL_PREFIX_TOOLTIP"); TLMUtils.initButton(m_addAllPrefixesButton, true, "ButtonMenu"); m_addAllPrefixesButton.name = "AddAll"; m_addAllPrefixesButton.isVisible = true; m_addAllPrefixesButton.eventClick += (component, eventParam) => { TLMDepotAI.addAllPrefixesToDepot(buildingId, secondary); m_addPrefixButton.isVisible = false; m_removePrefixButton.isVisible = true; }; TLMUtils.createUIElement(out m_removeAllPrefixesButton, transform); m_removeAllPrefixesButton.pivot = UIPivotPoint.TopRight; m_removeAllPrefixesButton.relativePosition = new Vector3(780, 20); m_removeAllPrefixesButton.text = Locale.Get("TLM_REMOVE_ALL_SHORT"); m_removeAllPrefixesButton.textScale = 0.6f; m_removeAllPrefixesButton.width = 50; m_removeAllPrefixesButton.height = 15; m_removeAllPrefixesButton.tooltip = Locale.Get("TLM_REMOVE_ALL_PREFIX_TOOLTIP"); TLMUtils.initButton(m_removeAllPrefixesButton, true, "ButtonMenu"); m_removeAllPrefixesButton.name = "RemoveAll"; m_removeAllPrefixesButton.isVisible = true; m_removeAllPrefixesButton.eventClick += (component, eventParam) => { TLMDepotAI.removeAllPrefixesFromDepot(buildingId, secondary); m_addPrefixButton.isVisible = true; m_removePrefixButton.isVisible = false; }; }