static void AddElevenConfig() { if (PlayerSettings.productName != "Shallow Games") { ElevenConfig.GetEditorProjectConfig(PlayerSettings.productName); } }
public static ElevenConfig GetEditorProjectConfig(string name, string resourcesPath) { string pathName = ProjectConfigPath(name, resourcesPath); ElevenConfig toReturn = (ElevenConfig)AssetDatabase.LoadAssetAtPath(pathName, typeof(ElevenConfig)); if (toReturn == null) { if (!AssetDatabase.IsValidFolder(resourcesPath + "/Game Configs")) { if (!AssetDatabase.IsValidFolder(resourcesPath)) { int index = resourcesPath.LastIndexOf('/'); AssetDatabase.CreateFolder(resourcesPath.Substring(0, index), resourcesPath.Substring(index + 1)); } AssetDatabase.CreateFolder(resourcesPath, "Game Configs"); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } toReturn = ElevenConfig.CreateInstance <ElevenConfig>(); toReturn.FillFromCurrentProject(name); AssetDatabase.CreateAsset(toReturn, pathName); } AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); return(toReturn); }
void SceneLoaded(Scene scene, LoadSceneMode loadMode) { ElevenConfig activeGame = Config.Instance.activeGame; if (activeGame != null && activeGame != Config.Instance.elevenGame && activeGame.mainGameScene == scene.path) { Instantiate <GameObject>(gameCanvas); } }
void Start() { slider.wholeNumbers = true; slider.minValue = 0; slider.maxValue = Config.Instance.games.Count; slider.onValueChanged.AddListener(ValueChanged); currentGame = Config.Instance.games[0]; }
internal void Initialize(ElevenConfig gameConfig, GameSelectButton gameSelection, Color color) { this.gameConfig = gameConfig; this.gameSelection = gameSelection; rawImage.texture = gameConfig.previewImage; aspectRatio.aspectRatio = (float)gameConfig.previewImage.width / gameConfig.previewImage.height; foreach (var borderImage in borderImages) { borderImage.color = color.NewAlpha(borderImage.color.a); } }
protected override void OnDestroy() { base.OnDestroy(); #if UNITY_EDITOR ElevenConfig foundLocalGame = games.Find(delegate(ElevenConfig obj) { return(obj.gameName == Application.productName); }); if (foundLocalGame != null) { foundLocalGame.SetActive(); } #endif }
internal void Initialize(ElevenConfig gameConfig, GamePreviewItem preview, Color color) { this.gameConfig = gameConfig; this.previewItem = preview; titleText.text = gameConfig.gameName; foreach (var image in images) { HSBColor hsbColor = new HSBColor(color); hsbColor.brightness = image.brightness; hsbColor.alpha = image.alpha; image.image.color = hsbColor.ToColor(); } button.onClick.AddListener(PlayGame); }
public static ElevenConfig GetPlayerProjectConfig(string name) { ElevenConfig config = Resources.Load <ElevenConfig>("Game Configs/" + name); return(config); }
void ValueChanged(float value) { currentGame = Config.Instance.games[(int)value]; }