Beispiel #1
0
        private void SetTransportType(TransportInfo.TransportType transportType, VehicleInfo selectedPrefab = null)
        {
            Color            transportColor = Singleton <TransportManager> .instance.m_properties.m_transportColors[(int)transportType];
            ItemClassTriplet classTriplet   = VehicleEditor.GetItemClasses(transportType)[0];

            this._selectedService      = classTriplet.Service;
            this._selectedSubService   = classTriplet.SubService;
            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);
        }
Beispiel #2
0
 public override void Update()
 {
     base.Update();
     if (OptionsWrapper <Settings> .Options.HideVehicleEditor != this._hide)
     {
         this._hide     = OptionsWrapper <Settings> .Options.HideVehicleEditor;
         this.isVisible = !this._hide;
     }
     if (OptionsWrapper <Settings> .Options.VehicleEditorPosition != this._position)
     {
         this._position = OptionsWrapper <Settings> .Options.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();
         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() + " " + OptionsWrapper <Settings> .Options.SpeedString;
     }
 }
 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);
     }
     base.OnDestroy();
 }