示例#1
0
 static void AddElevenConfig()
 {
     if (PlayerSettings.productName != "Shallow Games")
     {
         ElevenConfig.GetEditorProjectConfig(PlayerSettings.productName);
     }
 }
示例#2
0
        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);
        }
示例#3
0
        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);
            }
        }
示例#4
0
        void Start()
        {
            slider.wholeNumbers = true;
            slider.minValue     = 0;
            slider.maxValue     = Config.Instance.games.Count;

            slider.onValueChanged.AddListener(ValueChanged);
            currentGame = Config.Instance.games[0];
        }
示例#5
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);
            }
        }
示例#6
0
        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
        }
示例#7
0
        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);
        }
示例#8
0
        public static ElevenConfig GetPlayerProjectConfig(string name)
        {
            ElevenConfig config = Resources.Load <ElevenConfig>("Game Configs/" + name);

            return(config);
        }
示例#9
0
 void ValueChanged(float value)
 {
     currentGame = Config.Instance.games[(int)value];
 }