Пример #1
0
        private void UpdateBindings()
        {
            ushort netNode = this.m_InstanceID.NetNode;
            byte   max;
            int    num1 = PanelExtenderLine.CountWaitingPassengers(netNode, TransportLine.GetNextStop(netNode), out max);
            byte   num2 = (byte)((uint)byte.MaxValue - (uint)max);

            this.m_PassengerCount.text         = string.Format(Localization.Get("STOP_PANEL_WAITING_PEOPLE"), (object)num1);
            this.m_BoredCountdown.text         = string.Format(Localization.Get("STOP_PANEL_BORED_TIMER"), (object)ColorUtility.ToHtmlStringRGB(this.GetColor(num2)), (object)num2);
            this.m_passengersInCurrent.text    = NetManagerMod.m_cachedNodeData[(int)netNode].PassengersIn.ToString();
            this.m_passengersInLast.text       = NetManagerMod.m_cachedNodeData[(int)netNode].LastWeekPassengersIn.ToString();
            this.m_passengersInAverage.text    = NetManagerMod.m_cachedNodeData[(int)netNode].AveragePassengersIn.ToString();
            this.m_passengersOutCurrent.text   = NetManagerMod.m_cachedNodeData[(int)netNode].PassengersOut.ToString();
            this.m_passengersOutLast.text      = NetManagerMod.m_cachedNodeData[(int)netNode].LastWeekPassengersOut.ToString();
            this.m_passengersOutAverage.text   = NetManagerMod.m_cachedNodeData[(int)netNode].AveragePassengersOut.ToString();
            this.m_passengersTotalCurrent.text = NetManagerMod.m_cachedNodeData[(int)netNode].PassengersTotal.ToString();
            this.m_passengersTotalLast.text    = NetManagerMod.m_cachedNodeData[(int)netNode].LastWeekPassengersTotal.ToString();
            this.m_passengersTotalAverage.text = NetManagerMod.m_cachedNodeData[(int)netNode].AveragePassengersTotal.ToString();
            if ((int)ImprovedPublicTransportMod.Settings.IntervalAggressionFactor == 0)
            {
                this.m_unbunching.Disable();
                this.m_unbunching.isChecked  = false;
                this.m_unbunching.label.text = Localization.Get("UNBUNCHING_DISABLED");
                this.m_unbunching.size       = new Vector2(this.m_unbunching.label.width + 22f, 16f);
                this.m_closeStopsUnbunching.Hide();
            }
            else
            {
                this.m_unbunching.Enable();
                this.m_unbunching.isChecked  = NetManagerMod.m_cachedNodeData[(int)netNode].Unbunching;
                this.m_unbunching.label.text = Localization.Get("UNBUNCHING_ENABLED");
                this.m_unbunching.size       = new Vector2(this.m_unbunching.label.width + 22f, 16f);
                this.m_closeStopsUnbunching.Show();
            }
        }
        public override void Update()
        {
            base.Update();
            if (!this.isVisible || (int)this.StopID == 0)
            {
                return;
            }
            string name = Singleton <InstanceManager> .instance.GetName(this._instanceID);

            if (this._cachedName != name)
            {
                this._cachedName = name;
                Utils.Truncate(this._stopName, GenerateStopName(name, this._instanceID.NetNode, this.StopIndex));
            }
            if ((double)this._delta >= 1.0)
            {
                this._delta = 0.0f;
                byte max;
                this._stopCount.text = PanelExtenderLine.CountWaitingPassengers(this.StopID, this.NextStopID, out max).ToString();
            }
            this._delta = this._delta + Singleton <SimulationManager> .instance.m_simulationTimeDelta;
        }
        protected override void OnMouseEnter(UIMouseEventParameter p)
        {
            byte max;

            this.tooltip = string.Format(Localization.Get("STOP_LIST_BOX_ROW_TOOLTIP"), (object)GenerateStopName(Singleton <InstanceManager> .instance.GetName(this._instanceID), this._instanceID.NetNode, this.StopIndex), (object)PanelExtenderLine.CountWaitingPassengers(this.StopID, this.NextStopID, out max));
            if (!this.IsSelected)
            {
                this.backgroundSprite = "ListItemHover";
            }
            base.OnMouseEnter(p);
        }
        private bool ArriveAtTarget(ushort vehicleID, ref Vehicle data)
        {
            if ((int)data.m_targetBuilding == 0 || (data.m_flags & Vehicle.Flags.DummyTraffic) != ~(Vehicle.Flags.Created | Vehicle.Flags.Deleted | Vehicle.Flags.Spawned | Vehicle.Flags.Inverted | Vehicle.Flags.TransferToTarget | Vehicle.Flags.TransferToSource | Vehicle.Flags.Emergency1 | Vehicle.Flags.Emergency2 | Vehicle.Flags.WaitingPath | Vehicle.Flags.Stopped | Vehicle.Flags.Leaving | Vehicle.Flags.Arriving | Vehicle.Flags.Reversed | Vehicle.Flags.TakingOff | Vehicle.Flags.Flying | Vehicle.Flags.Landing | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo | Vehicle.Flags.GoingBack | Vehicle.Flags.WaitingTarget | Vehicle.Flags.Importing | Vehicle.Flags.Exporting | Vehicle.Flags.Parking | Vehicle.Flags.CustomName | Vehicle.Flags.OnGravel | Vehicle.Flags.WaitingLoading | Vehicle.Flags.Congestion | Vehicle.Flags.DummyTraffic | Vehicle.Flags.Underground | Vehicle.Flags.Transition | Vehicle.Flags.InsideBuilding | Vehicle.Flags.LeftHandDrive))
            {
                Singleton <VehicleManager> .instance.ReleaseVehicle(vehicleID);

                return(true);
            }
            ushort targetBuilding = data.m_targetBuilding;
            ushort nextStop       = 0;

            if ((int)data.m_transportLine != 0)
            {
                nextStop = TransportLine.GetNextStop(data.m_targetBuilding);
            }
            else if ((data.m_flags & (Vehicle.Flags.Importing | Vehicle.Flags.Exporting)) != ~(Vehicle.Flags.Created | Vehicle.Flags.Deleted | Vehicle.Flags.Spawned | Vehicle.Flags.Inverted | Vehicle.Flags.TransferToTarget | Vehicle.Flags.TransferToSource | Vehicle.Flags.Emergency1 | Vehicle.Flags.Emergency2 | Vehicle.Flags.WaitingPath | Vehicle.Flags.Stopped | Vehicle.Flags.Leaving | Vehicle.Flags.Arriving | Vehicle.Flags.Reversed | Vehicle.Flags.TakingOff | Vehicle.Flags.Flying | Vehicle.Flags.Landing | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo | Vehicle.Flags.GoingBack | Vehicle.Flags.WaitingTarget | Vehicle.Flags.Importing | Vehicle.Flags.Exporting | Vehicle.Flags.Parking | Vehicle.Flags.CustomName | Vehicle.Flags.OnGravel | Vehicle.Flags.WaitingLoading | Vehicle.Flags.Congestion | Vehicle.Flags.DummyTraffic | Vehicle.Flags.Underground | Vehicle.Flags.Transition | Vehicle.Flags.InsideBuilding | Vehicle.Flags.LeftHandDrive))
            {
                nextStop = TransportLine.GetNextStop(data.m_targetBuilding);
                Vector3 lastFramePosition = data.GetLastFramePosition();
                byte    max;
                if ((double)Mathf.Max(Mathf.Abs(lastFramePosition.x), Mathf.Abs(lastFramePosition.z)) > 4800.0 && PanelExtenderLine.CountWaitingPassengers(targetBuilding, nextStop, out max) == 0)
                {
                    nextStop = (ushort)0;
                }
            }
            ushort transferSize1 = data.m_transferSize;

            PassengerShipAIMod.UnloadPassengers(data.Info.m_vehicleAI as PassengerShipAI, vehicleID, ref data, targetBuilding, nextStop);
            ushort num1 = (ushort)((uint)transferSize1 - (uint)data.m_transferSize);

            VehicleManagerMod.m_cachedVehicleData[(int)vehicleID].LastStopGonePassengers = (int)num1;
            VehicleManagerMod.m_cachedVehicleData[(int)vehicleID].CurrentStop            = targetBuilding;
            NetManagerMod.m_cachedNodeData[(int)targetBuilding].PassengersOut           += (int)num1;
            if ((int)nextStop == 0)
            {
                data.m_waitCounter = (byte)0;
                data.m_flags      |= Vehicle.Flags.WaitingLoading;
            }
            else
            {
                data.m_targetBuilding = nextStop;
                if (!this.StartPathFind(vehicleID, ref data))
                {
                    return(true);
                }
                ushort transferSize2 = data.m_transferSize;
                PassengerShipAIMod.LoadPassengers(data.Info.m_vehicleAI as PassengerShipAI, vehicleID, ref data, targetBuilding, nextStop);
                ushort num2        = (ushort)((uint)data.m_transferSize - (uint)transferSize2);
                int    ticketPrice = data.Info.m_vehicleAI.GetTicketPrice(vehicleID, ref data);
                VehicleManagerMod.m_cachedVehicleData[(int)vehicleID].Add((int)num2, ticketPrice);
                NetManagerMod.m_cachedNodeData[(int)targetBuilding].PassengersIn += (int)num2;
                data.m_flags      &= Vehicle.Flags.Created | Vehicle.Flags.Deleted | Vehicle.Flags.Spawned | Vehicle.Flags.Inverted | Vehicle.Flags.TransferToTarget | Vehicle.Flags.TransferToSource | Vehicle.Flags.Emergency1 | Vehicle.Flags.Emergency2 | Vehicle.Flags.WaitingPath | Vehicle.Flags.Stopped | Vehicle.Flags.Leaving | Vehicle.Flags.Reversed | Vehicle.Flags.TakingOff | Vehicle.Flags.Flying | Vehicle.Flags.Landing | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo | Vehicle.Flags.GoingBack | Vehicle.Flags.WaitingTarget | Vehicle.Flags.Importing | Vehicle.Flags.Exporting | Vehicle.Flags.Parking | Vehicle.Flags.CustomName | Vehicle.Flags.OnGravel | Vehicle.Flags.WaitingLoading | Vehicle.Flags.Congestion | Vehicle.Flags.DummyTraffic | Vehicle.Flags.Underground | Vehicle.Flags.Transition | Vehicle.Flags.InsideBuilding | Vehicle.Flags.LeftHandDrive;
                data.m_flags      |= Vehicle.Flags.Stopped;
                data.m_waitCounter = (byte)0;
            }
            return(false);
        }