コード例 #1
0
ファイル: ButtonActions.cs プロジェクト: HeffJoker/GGJ2016
 public void SetNextLevelToLoad(LevelInfo level)
 {
     Messenger.Publish(new Message_LevelLoad(level, true));
 }
コード例 #2
0
        private void DrawConfigOptions()
        {
            manager.GameObjectIdentifier = EditorGUILayout.TextField(new GUIContent("Game Object ID", "The name of the game object to delete when the scene is reloaded.  This holds all of the levels game objects and managers."),
                                                                     manager.GameObjectIdentifier);

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.BeginVertical();

            newLevelName = EditorGUILayout.TextField("Name", newLevelName);
            isLevelEnabled = EditorGUILayout.Toggle("Is Enabled?", isLevelEnabled);

            EditorGUILayout.EndVertical();

            if (GUILayout.Button("Add", GUILayout.ExpandHeight(true), GUILayout.MaxHeight(30)) 
                && !string.IsNullOrEmpty(newLevelName) && !DoesLevelExist(newLevelName))
            {
                LevelInfo newLevel = (LevelInfo)GameUtil.CreateAsset<LevelInfo>(newLevelName, false, "Assets/Resources/Prefabs/Assets/GameLevels/");
                newLevel.LevelName = newLevelName;
                newLevel.Enabled = isLevelEnabled;

                string name = string.Format("{0} - {1}", newLevel.LevelName, (newLevel.Enabled ? "Enabled" : "Disabled"));
                levels.Add(new EditorData<LevelInfo>(newLevel, name));

                newLevelName = string.Empty;
                isLevelEnabled = false;
            }

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.LabelField("Levels", EditorStyles.boldLabel);
            ++EditorGUI.indentLevel;

            EditorUtilities.EditableList(levels, DrawLevel, true, false, false, false);

            --EditorGUI.indentLevel;

            if(GUILayout.Button("Reload Levels"))
            {
                levels.Clear();

                LevelInfo[] existingLevels = Resources.LoadAll<LevelInfo>("Prefabs/Assets/GameLevels");

                for(int i = 0; i < existingLevels.Length; ++i)
                {
                    string name = string.Format("{0} - {1}", existingLevels[i].LevelName, (existingLevels[i].Enabled ? "Enabled" : "Disabled"));
                    levels.Add(new EditorData<LevelInfo>(existingLevels[i], name));
                }
            }
            
            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginVertical();

            currButton = EditorGUILayout.ObjectField("Button:", currButton, typeof(GameObject), true) as GameObject;
            buttonLevel = EditorGUILayout.ObjectField("Level:", buttonLevel, typeof(LevelInfo), false) as LevelInfo;

            EditorGUILayout.EndVertical();

            if(GUILayout.Button("Add") && currButton != null && buttonLevel != null)
            {
                LevelButtonLink newLevelButton = new LevelButtonLink();
                newLevelButton.ButtonObj = currButton;
                newLevelButton.Level = buttonLevel;
                levelButtons.Add(new EditorData<LevelButtonLink>(newLevelButton, string.Format("{0} button", buttonLevel.LevelName)));

                currButton = null;
                buttonLevel = null;
                Repaint();
            }

            EditorGUILayout.EndHorizontal();

            EditorUtilities.EditableList(levelButtons, DrawLevelButton);
        }
コード例 #3
0
ファイル: Messages.cs プロジェクト: HeffJoker/GGJ2016
 public Message_LevelLoad(LevelInfo levelInfo, bool isOverride)
 {
     Level = levelInfo;
     IsOverride = isOverride;
 }
コード例 #4
0
        private void DrawLevel(LevelInfo levelData)
        {
            EditorGUILayout.BeginVertical();

            levelData.LevelName = EditorGUILayout.TextField("Name", levelData.LevelName);
            levelData.Enabled = EditorGUILayout.Toggle("Is Enabled?", levelData.Enabled);

            EditorGUILayout.EndVertical();
        }