static TextureResources() { // missing image NoImageTexture2D = LoadDllResource("noimage.png", 64, 64); // main menu icon MainMenuButtonTexture2D = LoadDllResource("MenuButton.png", 300, 50); MainMenuButtonTexture2D.name = "TMPE_MainMenuButtonIcon"; // main menu buttons MainMenuButtonsTexture2D = LoadDllResource("mainmenu-btns.png", 960, 30); MainMenuButtonsTexture2D.name = "TMPE_MainMenuButtons"; // simple RedLightTexture2D = LoadDllResource("light_1_1.png", 103, 243); YellowRedLightTexture2D = LoadDllResource("light_1_2.png", 103, 243); GreenLightTexture2D = LoadDllResource("light_1_3.png", 103, 243); // forward RedLightStraightTexture2D = LoadDllResource("light_2_1.png", 103, 243); YellowLightStraightTexture2D = LoadDllResource("light_2_2.png", 103, 243); GreenLightStraightTexture2D = LoadDllResource("light_2_3.png", 103, 243); // right RedLightRightTexture2D = LoadDllResource("light_3_1.png", 103, 243); YellowLightRightTexture2D = LoadDllResource("light_3_2.png", 103, 243); GreenLightRightTexture2D = LoadDllResource("light_3_3.png", 103, 243); // left RedLightLeftTexture2D = LoadDllResource("light_4_1.png", 103, 243); YellowLightLeftTexture2D = LoadDllResource("light_4_2.png", 103, 243); GreenLightLeftTexture2D = LoadDllResource("light_4_3.png", 103, 243); // forwardright RedLightForwardRightTexture2D = LoadDllResource("light_5_1.png", 103, 243); YellowLightForwardRightTexture2D = LoadDllResource("light_5_2.png", 103, 243); GreenLightForwardRightTexture2D = LoadDllResource("light_5_3.png", 103, 243); // forwardleft RedLightForwardLeftTexture2D = LoadDllResource("light_6_1.png", 103, 243); YellowLightForwardLeftTexture2D = LoadDllResource("light_6_2.png", 103, 243); GreenLightForwardLeftTexture2D = LoadDllResource("light_6_3.png", 103, 243); // yellow YellowLightTexture2D = LoadDllResource("light_yellow.png", 103, 243); // pedestrian PedestrianRedLightTexture2D = LoadDllResource("pedestrian_light_1.png", 73, 123); PedestrianGreenLightTexture2D = LoadDllResource("pedestrian_light_2.png", 73, 123); // light mode LightModeTexture2D = LoadDllResource(Translation.GetTranslatedFileName("light_mode.png"), 103, 95); LightCounterTexture2D = LoadDllResource(Translation.GetTranslatedFileName("light_counter.png"), 103, 95); // pedestrian mode PedestrianModeAutomaticTexture2D = LoadDllResource("pedestrian_mode_1.png", 73, 70); PedestrianModeManualTexture2D = LoadDllResource("pedestrian_mode_2.png", 73, 73); // priority signs PrioritySignTextures = new TinyDictionary <PriorityType, Texture2D>(); PrioritySignTextures[PriorityType.None] = LoadDllResource("sign_none.png", 200, 200); PrioritySignTextures[PriorityType.Main] = LoadDllResource("sign_priority.png", 200, 200); PrioritySignTextures[PriorityType.Stop] = LoadDllResource("sign_stop.png", 200, 200); PrioritySignTextures[PriorityType.Yield] = LoadDllResource("sign_yield.png", 200, 200); // delete priority sign SignRemoveTexture2D = LoadDllResource("remove_signs.png", 256, 256); // timer ClockPlayTexture2D = LoadDllResource("clock_play.png", 512, 512); ClockPauseTexture2D = LoadDllResource("clock_pause.png", 512, 512); ClockTestTexture2D = LoadDllResource("clock_test.png", 512, 512); SpeedLimitTextures = new TinyDictionary <ushort, Texture2D>(); foreach (ushort speedLimit in SpeedLimitManager.Instance.AvailableSpeedLimits) { SpeedLimitTextures.Add(speedLimit, LoadDllResource(speedLimit.ToString() + ".png", 200, 200)); } VehicleRestrictionTextures = new TinyDictionary <ExtVehicleType, IDictionary <bool, Texture2D> >(); VehicleRestrictionTextures[ExtVehicleType.Bus] = new TinyDictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.CargoTrain] = new TinyDictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.CargoTruck] = new TinyDictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.Emergency] = new TinyDictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.PassengerCar] = new TinyDictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.PassengerTrain] = new TinyDictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.Service] = new TinyDictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.Taxi] = new TinyDictionary <bool, Texture2D>(); foreach (KeyValuePair <ExtVehicleType, IDictionary <bool, Texture2D> > e in VehicleRestrictionTextures) { foreach (bool b in new bool[] { false, true }) { string suffix = b ? "allowed" : "forbidden"; e.Value[b] = LoadDllResource(e.Key.ToString().ToLower() + "_" + suffix + ".png", 200, 200); } } ParkingRestrictionTextures = new TinyDictionary <bool, Texture2D>(); ParkingRestrictionTextures[true] = LoadDllResource("parking_allowed.png", 200, 200); ParkingRestrictionTextures[false] = LoadDllResource("parking_disallowed.png", 200, 200); LaneChangeAllowedTexture2D = LoadDllResource("lanechange_allowed.png", 200, 200); LaneChangeForbiddenTexture2D = LoadDllResource("lanechange_forbidden.png", 200, 200); UturnAllowedTexture2D = LoadDllResource("uturn_allowed.png", 200, 200); UturnForbiddenTexture2D = LoadDllResource("uturn_forbidden.png", 200, 200); EnterBlockedJunctionAllowedTexture2D = LoadDllResource("enterblocked_allowed.png", 200, 200); EnterBlockedJunctionForbiddenTexture2D = LoadDllResource("enterblocked_forbidden.png", 200, 200); PedestrianCrossingAllowedTexture2D = LoadDllResource("crossing_allowed.png", 200, 200); PedestrianCrossingForbiddenTexture2D = LoadDllResource("crossing_forbidden.png", 200, 200); VehicleInfoSignTextures = new TinyDictionary <ExtVehicleType, Texture2D>(); VehicleInfoSignTextures[ExtVehicleType.Bicycle] = LoadDllResource("bicycle_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.Bus] = LoadDllResource("bus_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.CargoTrain] = LoadDllResource("cargotrain_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.CargoTruck] = LoadDllResource("cargotruck_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.Emergency] = LoadDllResource("emergency_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.PassengerCar] = LoadDllResource("passengercar_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.PassengerTrain] = LoadDllResource("passengertrain_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.RailVehicle] = VehicleInfoSignTextures[ExtVehicleType.PassengerTrain]; VehicleInfoSignTextures[ExtVehicleType.Service] = LoadDllResource("service_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.Taxi] = LoadDllResource("taxi_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.Tram] = LoadDllResource("tram_infosign.png", 449, 411); RemoveVehicleButtonTexture2D = LoadDllResource("remove-vehicle-btn.png", 150, 30); }
static TrafficLightToolTextureResources() { // simple RedLightTexture2D = LoadDllResource("light_1_1.png", 103, 243); YellowRedLightTexture2D = LoadDllResource("light_1_2.png", 103, 243); GreenLightTexture2D = LoadDllResource("light_1_3.png", 103, 243); // forward RedLightStraightTexture2D = LoadDllResource("light_2_1.png", 103, 243); YellowLightStraightTexture2D = LoadDllResource("light_2_2.png", 103, 243); GreenLightStraightTexture2D = LoadDllResource("light_2_3.png", 103, 243); // right RedLightRightTexture2D = LoadDllResource("light_3_1.png", 103, 243); YellowLightRightTexture2D = LoadDllResource("light_3_2.png", 103, 243); GreenLightRightTexture2D = LoadDllResource("light_3_3.png", 103, 243); // left RedLightLeftTexture2D = LoadDllResource("light_4_1.png", 103, 243); YellowLightLeftTexture2D = LoadDllResource("light_4_2.png", 103, 243); GreenLightLeftTexture2D = LoadDllResource("light_4_3.png", 103, 243); // forwardright RedLightForwardRightTexture2D = LoadDllResource("light_5_1.png", 103, 243); YellowLightForwardRightTexture2D = LoadDllResource("light_5_2.png", 103, 243); GreenLightForwardRightTexture2D = LoadDllResource("light_5_3.png", 103, 243); // forwardleft RedLightForwardLeftTexture2D = LoadDllResource("light_6_1.png", 103, 243); YellowLightForwardLeftTexture2D = LoadDllResource("light_6_2.png", 103, 243); GreenLightForwardLeftTexture2D = LoadDllResource("light_6_3.png", 103, 243); // yellow YellowLightTexture2D = LoadDllResource("light_yellow.png", 103, 243); // pedestrian PedestrianRedLightTexture2D = LoadDllResource("pedestrian_light_1.png", 73, 123); PedestrianGreenLightTexture2D = LoadDllResource("pedestrian_light_2.png", 73, 123); // light mode LightModeTexture2D = LoadDllResource(Translation.GetTranslatedFileName("light_mode.png"), 103, 95); LightCounterTexture2D = LoadDllResource(Translation.GetTranslatedFileName("light_counter.png"), 103, 95); // pedestrian mode PedestrianModeAutomaticTexture2D = LoadDllResource("pedestrian_mode_1.png", 73, 70); PedestrianModeManualTexture2D = LoadDllResource("pedestrian_mode_2.png", 73, 73); // priority signs SignStopTexture2D = LoadDllResource("sign_stop.png", 200, 200); SignYieldTexture2D = LoadDllResource("sign_yield.png", 200, 200); SignPriorityTexture2D = LoadDllResource("sign_priority.png", 200, 200); SignNoneTexture2D = LoadDllResource("sign_none.png", 200, 200); // delete priority sign SignRemoveTexture2D = LoadDllResource("remove_signs.png", 256, 256); // timer ClockPlayTexture2D = LoadDllResource("clock_play.png", 512, 512); ClockPauseTexture2D = LoadDllResource("clock_pause.png", 512, 512); ClockTestTexture2D = LoadDllResource("clock_test.png", 512, 512); SpeedLimitTextures = new Dictionary <ushort, Texture2D>(); foreach (ushort speedLimit in SpeedLimitManager.AvailableSpeedLimits) { SpeedLimitTextures.Add(speedLimit, LoadDllResource(speedLimit.ToString() + ".png", 200, 200)); } VehicleRestrictionTextures = new Dictionary <ExtVehicleType, Dictionary <bool, Texture2D> >(); VehicleRestrictionTextures[ExtVehicleType.Bus] = new Dictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.CargoTrain] = new Dictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.CargoTruck] = new Dictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.Emergency] = new Dictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.PassengerCar] = new Dictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.PassengerTrain] = new Dictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.Service] = new Dictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.Taxi] = new Dictionary <bool, Texture2D>(); foreach (KeyValuePair <ExtVehicleType, Dictionary <bool, Texture2D> > e in VehicleRestrictionTextures) { foreach (bool b in new bool[] { false, true }) { string suffix = b ? "allowed" : "forbidden"; e.Value[b] = LoadDllResource(e.Key.ToString().ToLower() + "_" + suffix + ".png", 200, 200); } } LaneChangeAllowedTexture2D = LoadDllResource("lanechange_allowed.png", 200, 200); LaneChangeForbiddenTexture2D = LoadDllResource("lanechange_forbidden.png", 200, 200); VehicleInfoSignTextures = new Dictionary <ExtVehicleType, Texture2D>(); VehicleInfoSignTextures[ExtVehicleType.Bicycle] = LoadDllResource("bicycle_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.Bus] = LoadDllResource("bus_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.CargoTrain] = LoadDllResource("cargotrain_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.CargoTruck] = LoadDllResource("cargotruck_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.Emergency] = LoadDllResource("emergency_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.PassengerCar] = LoadDllResource("passengercar_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.PassengerTrain] = LoadDllResource("passengertrain_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.Service] = LoadDllResource("service_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.Taxi] = LoadDllResource("taxi_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.Tram] = LoadDllResource("tram_infosign.png", 449, 411); }
static TextureResources() { // missing image NoImageTexture2D = LoadDllResource("noimage.png", 64, 64); // main menu icon MainMenuButtonTexture2D = LoadDllResource("MenuButton.png", 300, 50); MainMenuButtonTexture2D.name = "TMPE_MainMenuButtonIcon"; // main menu buttons MainMenuButtonsTexture2D = LoadDllResource("mainmenu-btns.png", 960, 30); MainMenuButtonsTexture2D.name = "TMPE_MainMenuButtons"; // simple RedLightTexture2D = LoadDllResource("light_1_1.png", 103, 243); YellowRedLightTexture2D = LoadDllResource("light_1_2.png", 103, 243); GreenLightTexture2D = LoadDllResource("light_1_3.png", 103, 243); // forward RedLightStraightTexture2D = LoadDllResource("light_2_1.png", 103, 243); YellowLightStraightTexture2D = LoadDllResource("light_2_2.png", 103, 243); GreenLightStraightTexture2D = LoadDllResource("light_2_3.png", 103, 243); // right RedLightRightTexture2D = LoadDllResource("light_3_1.png", 103, 243); YellowLightRightTexture2D = LoadDllResource("light_3_2.png", 103, 243); GreenLightRightTexture2D = LoadDllResource("light_3_3.png", 103, 243); // left RedLightLeftTexture2D = LoadDllResource("light_4_1.png", 103, 243); YellowLightLeftTexture2D = LoadDllResource("light_4_2.png", 103, 243); GreenLightLeftTexture2D = LoadDllResource("light_4_3.png", 103, 243); // forwardright RedLightForwardRightTexture2D = LoadDllResource("light_5_1.png", 103, 243); YellowLightForwardRightTexture2D = LoadDllResource("light_5_2.png", 103, 243); GreenLightForwardRightTexture2D = LoadDllResource("light_5_3.png", 103, 243); // forwardleft RedLightForwardLeftTexture2D = LoadDllResource("light_6_1.png", 103, 243); YellowLightForwardLeftTexture2D = LoadDllResource("light_6_2.png", 103, 243); GreenLightForwardLeftTexture2D = LoadDllResource("light_6_3.png", 103, 243); // yellow YellowLightTexture2D = LoadDllResource("light_yellow.png", 103, 243); // pedestrian PedestrianRedLightTexture2D = LoadDllResource("pedestrian_light_1.png", 73, 123); PedestrianGreenLightTexture2D = LoadDllResource("pedestrian_light_2.png", 73, 123); // light mode LightModeTexture2D = LoadDllResource(Translation.GetTranslatedFileName("light_mode.png"), 103, 95); LightCounterTexture2D = LoadDllResource(Translation.GetTranslatedFileName("light_counter.png"), 103, 95); // pedestrian mode PedestrianModeAutomaticTexture2D = LoadDllResource("pedestrian_mode_1.png", 73, 70); PedestrianModeManualTexture2D = LoadDllResource("pedestrian_mode_2.png", 73, 73); // priority signs PrioritySignTextures = new TinyDictionary <PriorityType, Texture2D>(); PrioritySignTextures[PriorityType.None] = LoadDllResource("sign_none.png", 200, 200); PrioritySignTextures[PriorityType.Main] = LoadDllResource("sign_priority.png", 200, 200); PrioritySignTextures[PriorityType.Stop] = LoadDllResource("sign_stop.png", 200, 200); PrioritySignTextures[PriorityType.Yield] = LoadDllResource("sign_yield.png", 200, 200); // delete priority sign SignRemoveTexture2D = LoadDllResource("remove_signs.png", 256, 256); // timer ClockPlayTexture2D = LoadDllResource("clock_play.png", 512, 512); ClockPauseTexture2D = LoadDllResource("clock_pause.png", 512, 512); ClockTestTexture2D = LoadDllResource("clock_test.png", 512, 512); // TODO: Split loading here into dynamic sections, static enforces everything to stay in this ctor SpeedLimitTexturesKmph = new TinyDictionary <int, Texture2D>(); SpeedLimitTexturesMphUS = new TinyDictionary <int, Texture2D>(); SpeedLimitTexturesMphUK = new TinyDictionary <int, Texture2D>(); // Load shared speed limit signs for Kmph and Mph // Assumes that signs from 0 to 140 with step 5 exist, 0 denotes no limit sign for (var speedLimit = 0; speedLimit <= 140; speedLimit += 5) { var resource = LoadDllResource($"SpeedLimits.Kmh.{speedLimit}.png", 200, 200); SpeedLimitTexturesKmph.Add(speedLimit, resource ?? SpeedLimitTexturesKmph[5]); } // Signs from 0 to 90 for MPH for (var speedLimit = 0; speedLimit <= 90; speedLimit += 5) { // Load US textures, they are rectangular var resourceUs = LoadDllResource($"SpeedLimits.Mph_US.{speedLimit}.png", 200, 250); SpeedLimitTexturesMphUS.Add(speedLimit, resourceUs ?? SpeedLimitTexturesMphUS[5]); // Load UK textures, they are square var resourceUk = LoadDllResource($"SpeedLimits.Mph_UK.{speedLimit}.png", 200, 200); SpeedLimitTexturesMphUK.Add(speedLimit, resourceUk ?? SpeedLimitTexturesMphUK[5]); } VehicleRestrictionTextures = new TinyDictionary <ExtVehicleType, IDictionary <bool, Texture2D> >(); VehicleRestrictionTextures[ExtVehicleType.Bus] = new TinyDictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.CargoTrain] = new TinyDictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.CargoTruck] = new TinyDictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.Emergency] = new TinyDictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.PassengerCar] = new TinyDictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.PassengerTrain] = new TinyDictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.Service] = new TinyDictionary <bool, Texture2D>(); VehicleRestrictionTextures[ExtVehicleType.Taxi] = new TinyDictionary <bool, Texture2D>(); foreach (KeyValuePair <ExtVehicleType, IDictionary <bool, Texture2D> > e in VehicleRestrictionTextures) { foreach (bool b in new bool[] { false, true }) { string suffix = b ? "allowed" : "forbidden"; e.Value[b] = LoadDllResource(e.Key.ToString().ToLower() + "_" + suffix + ".png", 200, 200); } } ParkingRestrictionTextures = new TinyDictionary <bool, Texture2D>(); ParkingRestrictionTextures[true] = LoadDllResource("parking_allowed.png", 200, 200); ParkingRestrictionTextures[false] = LoadDllResource("parking_disallowed.png", 200, 200); LaneChangeAllowedTexture2D = LoadDllResource("lanechange_allowed.png", 200, 200); LaneChangeForbiddenTexture2D = LoadDllResource("lanechange_forbidden.png", 200, 200); UturnAllowedTexture2D = LoadDllResource("uturn_allowed.png", 200, 200); UturnForbiddenTexture2D = LoadDllResource("uturn_forbidden.png", 200, 200); RightOnRedAllowedTexture2D = LoadDllResource("right_on_red_allowed.png", 200, 200); RightOnRedForbiddenTexture2D = LoadDllResource("right_on_red_forbidden.png", 200, 200); LeftOnRedAllowedTexture2D = LoadDllResource("left_on_red_allowed.png", 200, 200); LeftOnRedForbiddenTexture2D = LoadDllResource("left_on_red_forbidden.png", 200, 200); EnterBlockedJunctionAllowedTexture2D = LoadDllResource("enterblocked_allowed.png", 200, 200); EnterBlockedJunctionForbiddenTexture2D = LoadDllResource("enterblocked_forbidden.png", 200, 200); PedestrianCrossingAllowedTexture2D = LoadDllResource("crossing_allowed.png", 200, 200); PedestrianCrossingForbiddenTexture2D = LoadDllResource("crossing_forbidden.png", 200, 200); VehicleInfoSignTextures = new TinyDictionary <ExtVehicleType, Texture2D>(); VehicleInfoSignTextures[ExtVehicleType.Bicycle] = LoadDllResource("bicycle_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.Bus] = LoadDllResource("bus_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.CargoTrain] = LoadDllResource("cargotrain_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.CargoTruck] = LoadDllResource("cargotruck_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.Emergency] = LoadDllResource("emergency_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.PassengerCar] = LoadDllResource("passengercar_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.PassengerTrain] = LoadDllResource("passengertrain_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.RailVehicle] = VehicleInfoSignTextures[ExtVehicleType.PassengerTrain]; VehicleInfoSignTextures[ExtVehicleType.Service] = LoadDllResource("service_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.Taxi] = LoadDllResource("taxi_infosign.png", 449, 411); VehicleInfoSignTextures[ExtVehicleType.Tram] = LoadDllResource("tram_infosign.png", 449, 411); RemoveButtonTexture2D = LoadDllResource("remove-btn.png", 150, 30); WindowBackgroundTexture2D = LoadDllResource("WindowBackground.png", 16, 60); }