示例#1
0
        public override void Update()
        {
            base.Update();

            var residents = TransportUtil.GetResidentPassengerCount(LineID);
            var tourists  = TransportUtil.GetTouristPassengerCount(LineID);

            LineName         = TransportUtil.GetLineName(LineID);
            _name.text       = LineName;
            _stops.text      = TransportUtil.GetStopCount(LineID).ToString();
            _passengers.text = String.Format("{0}/{1}", residents, tourists);
            _trips.text      = String.Format("{0}%", TransportUtil.GetTripsSaved(LineID));
            _vehicles.text   = TransportUtil.GetVehicleCount(LineID).ToString();

            _color.selectedColor = TransportUtil.GetLineColor(LineID);
        }
        public override void Update()
        {
            base.Update();

            var residents = TransportUtil.GetResidentPassengerCount(LineID);
            var tourists  = TransportUtil.GetTouristPassengerCount(LineID);

            var lineName = TransportUtil.GetLineName(LineID);

            if (lineName != LineName)
            {
                var handlers = LineNameChanged;
                if (handlers != null)
                {
                    handlers(LineID);
                }
            }
            LineName = lineName;

            _name.text = LineName.Trim();

            /*bool clipped = false;
             * while (_name.width > 110)
             * {
             *  _name.text = _name.text.Remove(_name.text.Length - 1);
             *  clipped = true;
             * }
             * if (clipped)
             *  _name.text = _name.text.Trim() + "...";*/

            _stops.text      = Stops.ToString();
            _passengers.text = String.Format("{0}/{1}", residents, tourists);
            _trips.text      = String.Format("{0}%", Trips);
            _vehicles.text   = Vehicles.ToString();

            _color.selectedColor = TransportUtil.GetLineColor(LineID);
            IsChecked            = !TransportUtil.IsTransportLineHidden(LineID);
        }