コード例 #1
0
 private void Init()
 {
     this._publicTransportVehicleWorldInfoPanel = GameObject.Find("(Library) PublicTransportVehicleWorldInfoPanel").GetComponent <PublicTransportVehicleWorldInfoPanel>();
     if (!((UnityEngine.Object) this._publicTransportVehicleWorldInfoPanel != (UnityEngine.Object)null))
     {
         return;
     }
     this._status                = this._publicTransportVehicleWorldInfoPanel.Find <UILabel>("Status");
     this._target                = this._publicTransportVehicleWorldInfoPanel.Find <UIButton>("Target");
     this._target.eventClick    += new MouseEventHandler(this.OnTargetClick);
     this._distance              = this._publicTransportVehicleWorldInfoPanel.Find <UILabel>("Distance");
     this._distanceTraveled      = Utils.GetPrivate <UIProgressBar>((object)this._publicTransportVehicleWorldInfoPanel, "m_DistanceTraveled");
     this._distanceProgress      = Utils.GetPrivate <UILabel>((object)this._publicTransportVehicleWorldInfoPanel, "m_DistanceProgress");
     this._cachedCurrentProgress = this._publicTransportVehicleWorldInfoPanel.GetType().GetField("m_cachedCurrentProgress", BindingFlags.Instance | BindingFlags.NonPublic);
     this._cachedTotalProgress   = this._publicTransportVehicleWorldInfoPanel.GetType().GetField("m_cachedTotalProgress", BindingFlags.Instance | BindingFlags.NonPublic);
     this._cachedProgressVehicle = this._publicTransportVehicleWorldInfoPanel.GetType().GetField("m_cachedProgressVehicle", BindingFlags.Instance | BindingFlags.NonPublic);
     this.AddPanelControls();
     this._initialized = true;
 }
コード例 #2
0
        private void AddPanelControls()
        {
            UILabel uiLabel1 = Utils.GetPrivate <UILabel>((object)this._publicTransportVehicleWorldInfoPanel, "m_Type");
            int     num1     = 132;

            uiLabel1.anchor = (UIAnchorStyle)num1;
            UIPanel    parent     = (UIPanel)uiLabel1.parent;
            RectOffset rectOffset = new RectOffset(0, 10, 0, 0);

            parent.autoLayoutPadding = rectOffset;
            double num2 = 25.0;

            parent.height = (float)num2;
            int num3 = 1;

            parent.useCenter = num3 != 0;
            UIButton button1 = UIUtils.CreateButton((UIComponent)parent);

            button1.name        = "EditType";
            button1.autoSize    = true;
            button1.anchor      = UIAnchorStyle.Left | UIAnchorStyle.Right | UIAnchorStyle.CenterVertical;
            button1.textPadding = new RectOffset(10, 10, 4, 2);
            button1.text        = Localization.Get("VEHICLE_PANEL_EDIT_TYPE");
            button1.tooltip     = string.Format(Localization.Get("VEHICLE_PANEL_EDIT_TYPE_TOOLTIP"));
            button1.textScale   = 0.75f;
            button1.eventClick += new MouseEventHandler(this.OnEditTypeClick);
            button1.isVisible   = !OptionsWrapper <Settings> .Options.HideVehicleEditor;
            this._editType      = button1;
            UILabel uiLabel2 = Utils.GetPrivate <UILabel>((object)this._publicTransportVehicleWorldInfoPanel, "m_Passengers");
            UIPanel uiPanel1 = this._publicTransportVehicleWorldInfoPanel.component.Find <UIPanel>("Panel");
            UIPanel uiPanel2 = uiPanel1.AddUIComponent <UIPanel>();

            uiPanel2.autoLayout          = true;
            uiPanel2.autoLayoutDirection = LayoutDirection.Horizontal;
            uiPanel2.autoLayoutPadding   = new RectOffset(0, 0, 0, 0);
            uiPanel2.height      = uiLabel2.parent.height;
            uiPanel2.width       = uiLabel2.parent.width;
            uiPanel2.zOrder      = 4;
            this._passengerPanel = uiPanel2;
            UILabel uiLabel3 = uiPanel2.AddUIComponent <UILabel>();

            uiLabel3.name          = "LastStopExchange";
            uiLabel3.font          = uiLabel2.font;
            uiLabel3.textColor     = uiLabel2.textColor;
            uiLabel3.textScale     = uiLabel2.textScale;
            uiLabel3.processMarkup = true;
            this._lastStopExchange = uiLabel3;
            UIPanel uiPanel3 = uiPanel1.AddUIComponent <UIPanel>();

            uiPanel3.name                = "PassengerStats";
            uiPanel3.anchor              = UIAnchorStyle.Top | UIAnchorStyle.Left | UIAnchorStyle.Right;
            uiPanel3.autoLayout          = true;
            uiPanel3.autoLayoutDirection = LayoutDirection.Vertical;
            uiPanel3.autoLayoutPadding   = new RectOffset(0, 0, 0, 0);
            uiPanel3.autoLayoutStart     = LayoutStart.TopLeft;
            uiPanel3.size                = new Vector2(349f, 60f);
            uiPanel3.zOrder              = 5;
            this._statsPanel             = uiPanel3;
            UILabel label1;
            UILabel label2;
            UILabel label3;
            UILabel label4;

            PublicTransportStopWorldInfoPanel.CreateStatisticRow((UIComponent)uiPanel3, out label1, out label2, out label3, out label4, true);
            label2.text    = Localization.Get("CURRENT_WEEK");
            label3.text    = Localization.Get("LAST_WEEK");
            label4.text    = Localization.Get("AVERAGE");
            label4.tooltip = string.Format(Localization.Get("AVERAGE_TOOLTIP"), (object)OptionsWrapper <Settings> .Options.StatisticWeeks);
            PublicTransportStopWorldInfoPanel.CreateStatisticRow((UIComponent)uiPanel3, out label1, out this._passengersCurrentWeek, out this._passengersLastWeek, out this._passengersAverage, false);
            label1.text = Localization.Get("VEHICLE_PANEL_PASSENGERS");
            PublicTransportStopWorldInfoPanel.CreateStatisticRow((UIComponent)uiPanel3, out label1, out this._earningsCurrentWeek, out this._earningsLastWeek, out this._earningsAverage, false);
            label1.text    = Localization.Get("VEHICLE_PANEL_EARNINGS");
            label1.tooltip = Localization.Get("VEHICLE_PANEL_EARNINGS_TOOLTIP");
            UIPanel uiPanel4 = uiPanel1.AddUIComponent <UIPanel>();

            uiPanel4.name                = "Buttons";
            uiPanel4.anchor              = UIAnchorStyle.Top | UIAnchorStyle.Left | UIAnchorStyle.Right;
            uiPanel4.autoLayout          = true;
            uiPanel4.autoLayoutDirection = LayoutDirection.Horizontal;
            uiPanel4.autoLayoutPadding   = new RectOffset(0, 5, 0, 0);
            uiPanel4.autoLayoutStart     = LayoutStart.TopLeft;
            uiPanel4.size                = new Vector2(345f, 32f);
            this._buttonPanel            = uiPanel4;
            UIButton button2 = UIUtils.CreateButton((UIComponent)uiPanel4);

            button2.name        = "PreviousVehicle";
            button2.textPadding = new RectOffset(10, 10, 4, 0);
            button2.text        = Localization.Get("VEHICLE_PANEL_PREVIOUS");
            button2.tooltip     = Localization.Get("VEHICLE_PANEL_PREVIOUS_TOOLTIP");
            button2.textScale   = 0.75f;
            button2.size        = new Vector2(110f, 32f);
            button2.wordWrap    = true;
            button2.eventClick += new MouseEventHandler(this.OnChangeVehicleClick);
            UIButton button3 = UIUtils.CreateButton((UIComponent)uiPanel4);

            button3.name             = "RemoveVehicle";
            button3.textPadding      = new RectOffset(10, 10, 4, 0);
            button3.text             = Localization.Get("VEHICLE_PANEL_REMOVE_VEHICLE");
            button3.textScale        = 0.75f;
            button3.size             = new Vector2(100f, 32f);
            button3.wordWrap         = true;
            button3.hoveredTextColor = (Color32)Color.red;
            button3.focusedTextColor = (Color32)Color.red;
            button3.pressedTextColor = (Color32)Color.red;
            button3.eventClick      += new MouseEventHandler(this.OnRemoveVehicleClick);
            UIButton button4 = UIUtils.CreateButton((UIComponent)uiPanel4);

            button4.name        = "NextVehicle";
            button4.textPadding = new RectOffset(10, 10, 4, 0);
            button4.text        = Localization.Get("VEHICLE_PANEL_NEXT");
            button4.tooltip     = Localization.Get("VEHICLE_PANEL_NEXT_TOOLTIP");
            button4.textScale   = 0.75f;
            button4.size        = new Vector2(110f, 32f);
            button4.wordWrap    = true;
            button4.eventClick += new MouseEventHandler(this.OnChangeVehicleClick);
        }