private void onSaveBtnClicked() { if (loaded()) { RouteShieldConfig.SaveRouteShieldInfo(); RenderingManager.instance.ForceUpdate(); } }
/// <summary> /// Loads all custom sprites /// </summary> private void LoadSprites() { bool spriteSuccess = true; //TODO: Replace with a loader function( JSON mapping available ) //We probably need this before we load any displays DynamicSignConfig.LoadVmsMsgList(); RouteShieldConfig.LoadRouteShieldInfo(); String[] files = Directory.GetFiles(FileUtils.GetModPath() + Path.DirectorySeparatorChar + "Icons"); foreach (string file in files) { string[] splitValues = file[0] == Path.DirectorySeparatorChar ? file.Substring(1).Split(Path.DirectorySeparatorChar) : file.Split(Path.DirectorySeparatorChar); string fileName = splitValues[splitValues.Length - 1]; string fileKey = fileName.Split('.')[0]; spriteSuccess = SpriteUtils.AddTexture(file, fileKey) && spriteSuccess; if (!RouteShieldConfig.Instance().routeShieldDictionary.ContainsKey(fileKey)) { RouteShieldConfig.Instance().routeShieldDictionary[fileKey] = new RouteShieldInfo(fileKey); } } //TODO: When we need it, load a json descriptor file for relevant shaders here ShaderUtils.AddShader("Shaders/font", "font"); //TODO: When we need it, load a json descriptor file for relevant fonts here FontUtils.AddFonts(); if (!spriteSuccess) { LoggerUtils.LogError("Failed to load some sprites!"); } else { RouteShieldConfig.SaveRouteShieldInfo(); } }