コード例 #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);
        }
コード例 #2
0
        private static void ObserveForInfo(ushort buildingId, TransportInfo transportInfo)
        {
            if (transportInfo == null || !DepotUtil.IsValidDepot(ref BuildingManager.instance.m_buildings.m_buffer[buildingId], transportInfo))
            {
                return;
            }
            var itemClassTriplet = new ItemClassTriplet(transportInfo.GetService(), transportInfo.GetSubService(),
                                                        transportInfo.GetClassLevel());

            if (!_depotMap.TryGetValue(itemClassTriplet, out HashSet <ushort> depots))
            {
                depots = new HashSet <ushort>();
                _depotMap.Add(itemClassTriplet, depots);
            }
            if (depots.Contains(buildingId))
            {
                return;
            }
            depots.Add(buildingId);
            OnDepotAdded?.Invoke(itemClassTriplet.Service, itemClassTriplet.SubService, itemClassTriplet.Level);
        }
コード例 #3
0
        private static void ObserveBuilding(ushort buildingId)
        {
            TransportInfo transportInfo = null;

            if (!DepotUtil.IsValidDepot(ref BuildingManager.instance.m_buildings.m_buffer[buildingId],
                                        ref transportInfo,
                                        out ItemClass.Service service, out ItemClass.SubService subService, out ItemClass.Level level))
            {
                return;
            }
            var itemClassTriplet = new ItemClassTriplet(service, subService, level);

            if (!_depotMap.TryGetValue(itemClassTriplet, out HashSet <ushort> depots))
            {
                depots = new HashSet <ushort>();
                _depotMap.Add(itemClassTriplet, depots);
            }
            if (depots.Contains(buildingId))
            {
                return;
            }
            depots.Add(buildingId);
            OnDepotAdded?.Invoke(service, subService, level);
        }