private static void OnAllSlidersChanged(float newVal) { colorR = (byte)newVal; colorG = (byte)newVal; colorB = (byte)newVal; RoadSkins.roadColor.r = colorR / 255f; RoadSkins.roadColor.g = colorG / 255f; RoadSkins.roadColor.b = colorB / 255f; ColorRSlider.tooltip = colorR.ToString(); ColorRSlider.parent.Find <UILabel>("Label").text = "R" + "(" + colorR.ToString() + ")"; ColorGSlider.tooltip = colorG.ToString(); ColorGSlider.parent.Find <UILabel>("Label").text = "G" + "(" + colorG.ToString() + ")"; ColorBSlider.tooltip = colorB.ToString(); ColorBSlider.parent.Find <UILabel>("Label").text = "B" + "(" + colorB.ToString() + ")"; ColorRSlider.value = newVal; ColorGSlider.value = newVal; ColorBSlider.value = newVal; if (levelLoaded) { RoadSkins.ChangeAllColor(); } Debug.Log($"colors changed to" + colorB.ToString()); SaveSetting(); }
// called when level is loaded public void OnLevelLoaded(LoadMode mode) { // loads texture container if (!Utils.LoadTextures()) { ExceptionPanel panel = UIView.library.ShowModal <ExceptionPanel>("ExceptionPanel", true); panel.SetMessage("CSUR Loader", "Road texture not found. This indicates that " + $"the asset containing textures for CSUR roads are not loaded into the game. " + $"Please check if the file CSURTextureContainer.crp is present in the workshop" + $"folder for CSUR Loader.", true); return; } OptionUI.LoadSetting(); for (uint i = 0; i < PrefabCollection <NetInfo> .LoadedCount(); i++) { NetInfo asset = PrefabCollection <NetInfo> .GetLoaded(i); if (Utils.IsCSUR(asset)) { Utils.ApplyTexture(asset); Utils.SetOutsideConnection(asset); Utils.ApplyGeneralSkins(asset); if (Utils.IsTwoWayCSUR(asset)) { Utils.ApplyIntersectionSkins(asset); } Utils.SetColor(asset, RoadSkins.roadColor); if (Utils.IsCSURDerivative(asset)) { Utils.LinkDerivative(asset); } else { Utils.LinkBridgeMode(asset); } } else if (asset != null && OptionUI.changeAllRoadColor) { if (asset.m_netAI is RoadAI) { //Debug.Log("Process color change for " + asset.name.ToString()); Utils.SetColor(asset, RoadSkins.roadColor); } } } RoadSkins.SetSidewalkPillars(); //Change All color RoadSkins.ChangeBuiltRoadColor(); //Refresh networks to apply skin change RoadSkins.RefreshNetworks(); if (Utils.LOAD_LOD) { NetManager.instance.RebuildLods(); } OptionUI.levelLoaded = true; }
public static void ApplyGeneralSkins(NetInfo asset) { if (asset.name.Contains("express")) { RoadSkins.ToggleStructure(asset); } RoadSkins.InvertUndergroundPolicyToggle(asset); RoadSkins.ReplaceArrows(asset); }
private static void OnBlueSliderChanged(float newVal) { if (grayscale) { OnAllSlidersChanged(newVal); } else { colorB = (byte)newVal; RoadSkins.roadColor.b = colorB / 255f; ColorBSlider.tooltip = colorB.ToString(); ColorBSlider.parent.Find <UILabel>("Label").text = "B" + "(" + colorB.ToString() + ")"; if (levelLoaded) { RoadSkins.ChangeAllColor(); } Debug.Log($"colorB changed to" + colorB.ToString()); SaveSetting(); } }
public static void ApplyIntersectionSkins(NetInfo asset) { RoadSkins.ReplaceTrafficLights(asset); RoadSkins.ReplaceMedianSigns(asset); RoadSkins.ToggleCameras(asset); }