示例#1
0
 public override void Update()
 {
     base.Update();
     if (ImprovedPublicTransportMod.Settings.HideVehicleEditor != this._hide)
     {
         this._hide     = ImprovedPublicTransportMod.Settings.HideVehicleEditor;
         this.isVisible = !this._hide;
     }
     if (ImprovedPublicTransportMod.Settings.VehicleEditorPosition != this._position)
     {
         this._position = ImprovedPublicTransportMod.Settings.VehicleEditorPosition;
         if (this.isVisible)
         {
             this.UpdatePosition();
         }
     }
     if (!this._initialized)
     {
         this._publicTransportInfoViewPanel = GameObject.Find("(Library) PublicTransportInfoViewPanel").GetComponent <PublicTransportInfoViewPanel>();
         if (!((UnityEngine.Object) this._publicTransportInfoViewPanel != (UnityEngine.Object)null))
         {
             return;
         }
         this._publicTransportInfoViewPanel.component.eventVisibilityChanged += new PropertyChangedEventHandler <bool>(this.ParentVisibilityChanged);
         this._publicTransportInfoViewPanel.component.eventPositionChanged   += new PropertyChangedEventHandler <Vector2>(this.ParentPositionChanged);
         this.CreatePanel();
         this._settingsPanel    = this.AddUIComponent <SettingsPanel>();
         VehicleEditor.Instance = this;
         this._initialized      = true;
     }
     else if (this._initialized && this.isVisible && this._firstShow)
     {
         this.FirstShowInit(TransportInfo.TransportType.Bus, (VehicleInfo)null);
     }
     else
     {
         if (!this._initialized || !this.isVisible)
         {
             return;
         }
         this._rightSidePanel.Find <UILabel>("MaintenanceCostLabel").text = (Utils.ToSingle(this._rightSidePanel.Find <UITextField>("MaintenanceCost").text) * 0.01f).ToString(ColossalFramework.Globalization.Locale.Get("MONEY_FORMAT"), (IFormatProvider)LocaleManager.cultureInfo);
         this._rightSidePanel.Find <UILabel>("TicketPriceLabel").text     = (Utils.ToSingle(this._rightSidePanel.Find <UITextField>("TicketPrice").text) * 0.01f).ToString(ColossalFramework.Globalization.Locale.Get("MONEY_FORMAT"), (IFormatProvider)LocaleManager.cultureInfo);
         this._rightSidePanel.Find <UILabel>("MaxSpeedLabel").text        = (Utils.ToInt32(this._rightSidePanel.Find <UITextField>("MaxSpeed").text) * 5).ToString() + " " + ImprovedPublicTransportMod.Settings.SpeedString;
     }
 }
示例#2
0
        private void SetTransportType(TransportInfo.TransportType transportType, VehicleInfo selectedPrefab = null)
        {
            Color transportColor = Singleton <TransportManager> .instance.m_properties.m_transportColors[(int)transportType];

            this._selectedSubService   = VehicleEditor.GetSubService(transportType);
            this._rightSidePanel.color = (Color32)transportColor;
            UIComponent uiComponent = this._rightSidePanel.Find("CaptionPanel");
            UIPanel     uiPanel1    = this._rightSidePanel.Find <UIPanel>("MaintenanceRow");
            UILabel     uiLabel1    = this._rightSidePanel.Find <UILabel>("CapacityLabel");
            UITextField uiTextField = this._rightSidePanel.Find <UITextField>("Capacity");
            UILabel     uiLabel2    = this._rightSidePanel.Find <UILabel>("TicketPriceLabel2");
            UIPanel     uiPanel2    = this._rightSidePanel.Find <UIPanel>("EngineRow");

            this._rightSidePanel.Find <UIPanel>("ButtonRow");
            Color32 color32 = (Color32)transportColor;

            uiComponent.color = color32;
            if (this._selectedSubService == ItemClass.SubService.PublicTransportTaxi)
            {
                uiPanel1.enabled    = false;
                uiPanel2.enabled    = false;
                uiLabel1.text       = Localization.Get("VEHICLE_EDITOR_CAPACITY_TAXI");
                uiTextField.tooltip = Localization.Get("VEHICLE_EDITOR_CAPACITY_TAXI_TOOLTIP");
                uiLabel2.text       = Localization.Get("VEHICLE_EDITOR_PRICE_PER_KILOMETER");
            }
            else
            {
                uiPanel1.enabled = true;
                if (this._selectedSubService == ItemClass.SubService.PublicTransportTrain)
                {
                    uiPanel2.enabled = true;
                }
                else
                {
                    uiPanel2.enabled = false;
                }
                uiLabel1.text       = Localization.Get("VEHICLE_EDITOR_CAPACITY");
                uiTextField.tooltip = "";
                uiLabel2.text       = Localization.Get("VEHICLE_EDITOR_TICKET_PRICE");
            }
            (this._rightSidePanel.Find("CaptionLabel") as UILabel).text = string.Format(Localization.Get("VEHICLE_EDITOR_SUB_TITLE"), (object)ColossalFramework.Globalization.Locale.Get(VehicleEditor.GetLocaleID(transportType)));
            this.PopulateAssetDropDown(selectedPrefab);
        }
示例#3
0
 public override void OnDestroy()
 {
     this._initialized      = false;
     VehicleEditor.Instance = (VehicleEditor)null;
     if ((UnityEngine.Object) this._publicTransportInfoViewPanel != (UnityEngine.Object)null)
     {
         this._publicTransportInfoViewPanel.component.eventVisibilityChanged -= new PropertyChangedEventHandler <bool>(this.ParentVisibilityChanged);
         this._publicTransportInfoViewPanel.component.eventPositionChanged   -= new PropertyChangedEventHandler <Vector2>(this.ParentPositionChanged);
     }
     if ((UnityEngine.Object) this._containerPanel != (UnityEngine.Object)null)
     {
         UnityEngine.Object.Destroy((UnityEngine.Object) this._containerPanel.gameObject);
     }
     if ((UnityEngine.Object) this._rightSidePanel != (UnityEngine.Object)null)
     {
         UnityEngine.Object.Destroy((UnityEngine.Object) this._rightSidePanel.gameObject);
     }
     if ((UnityEngine.Object) this._settingsPanel != (UnityEngine.Object)null)
     {
         UnityEngine.Object.Destroy((UnityEngine.Object) this._settingsPanel.gameObject);
     }
     base.OnDestroy();
 }