Пример #1
0
        public void ShowStartDataGUI(string apiPrefix)
        {
            GUILayout.Label("Starting point data for Player " + ID.ToString() + ": " + ((playerOb) ? playerOb.name : "(EMPTY)"), EditorStyles.boldLabel);

            chooseSceneBy = (ChooseSceneBy)CustomGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);
            switch (chooseSceneBy)
            {
            case ChooseSceneBy.Name:
                startingSceneName = CustomGUILayout.TextField("Scene name:", startingSceneName);
                break;

            case ChooseSceneBy.Number:
                startingSceneIndex = CustomGUILayout.IntField("Scene index:", startingSceneIndex);
                break;
            }

            useSceneDefaultPlayerStart = EditorGUILayout.Toggle("Use default PlayerStart?", useSceneDefaultPlayerStart);
            if (!useSceneDefaultPlayerStart)
            {
                PlayerStart playerStart = ConstantID.GetComponent <PlayerStart> (startingPlayerStartID);
                playerStart           = (PlayerStart)CustomGUILayout.ObjectField <PlayerStart> ("PlayerStart:", playerStart, true, apiPrefix + ".startingPlayerStartID", "The PlayerStart that this character starts from.");
                startingPlayerStartID = FieldToID <PlayerStart> (playerStart, startingPlayerStartID);

                if (startingPlayerStartID != 0)
                {
                    CustomGUILayout.BeginVertical();
                    EditorGUILayout.LabelField("Recorded ConstantID: " + startingPlayerStartID.ToString(), EditorStyles.miniLabel);
                    CustomGUILayout.EndVertical();
                }
            }
        }
Пример #2
0
        public override void ShowGUI(List <ActionParameter> parameters)
        {
            sceneAddRemove = (SceneAddRemove)EditorGUILayout.EnumPopup("Method:", sceneAddRemove);

            chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);
            if (chooseSceneBy == ChooseSceneBy.Name)
            {
                sceneNameParameterID = Action.ChooseParameterGUI("Scene name:", parameters, sceneNameParameterID, ParameterType.String);
                if (sceneNameParameterID < 0)
                {
                    sceneName = EditorGUILayout.TextField("Scene name:", sceneName);
                }
            }
            else
            {
                sceneNumberParameterID = Action.ChooseParameterGUI("Scene number:", parameters, sceneNumberParameterID, ParameterType.Integer);
                if (sceneNumberParameterID < 0)
                {
                    sceneNumber = EditorGUILayout.IntField("Scene number:", sceneNumber);
                }
            }

            if (sceneAddRemove == SceneAddRemove.Add)
            {
                runCutsceneOnStart = EditorGUILayout.Toggle("Run 'Cutscene on start'?", runCutsceneOnStart);
                if (runCutsceneOnStart)
                {
                    runCutsceneIfAlreadyOpen = EditorGUILayout.Toggle("Run if already open?", runCutsceneIfAlreadyOpen);
                }
            }

            AfterRunningOption();
        }
Пример #3
0
        /**
         * The default Constructor.
         * An array of ID numbers is required, to ensure its own ID is unique.
         */
        public PlayerPrefab(int[] idArray)
        {
            ID       = 0;
            playerOb = null;

            if (idArray.Length > 0)
            {
                isDefault = false;

                foreach (int _id in idArray)
                {
                    if (ID == _id)
                    {
                        ID++;
                    }
                }
            }
            else
            {
                isDefault = true;
            }

            startingSceneIndex    = 0;
            startingSceneName     = string.Empty;
            chooseSceneBy         = ChooseSceneBy.Number;
            startingPlayerStartID = 0;
        }
        override public void ShowGUI(List <ActionParameter> parameters)
        {
                        #if UNITY_5_3 || UNITY_5_4 || UNITY_5_3_OR_NEWER
            sceneAddRemove = (SceneAddRemove)EditorGUILayout.EnumPopup("Method:", sceneAddRemove);

            chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);
            if (chooseSceneBy == ChooseSceneBy.Name)
            {
                sceneNameParameterID = Action.ChooseParameterGUI("Scene name:", parameters, sceneNameParameterID, ParameterType.String);
                if (sceneNameParameterID < 0)
                {
                    sceneName = EditorGUILayout.TextField("Scene name:", sceneName);
                }
            }
            else
            {
                sceneNumberParameterID = Action.ChooseParameterGUI("Scene number:", parameters, sceneNumberParameterID, ParameterType.Integer);
                if (sceneNumberParameterID < 0)
                {
                    sceneNumber = EditorGUILayout.IntField("Scene number:", sceneNumber);
                }
            }

            if (sceneAddRemove == SceneAddRemove.Add)
            {
                runCutsceneOnStart = EditorGUILayout.Toggle("Run 'Cutscene on start'?", runCutsceneOnStart);
            }
                        #else
            EditorGUILayout.HelpBox("This Action is only available for Unity 5.3 or greater.", MessageType.Info);
                        #endif

            AfterRunningOption();
        }
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            sceneToCheck  = (SceneToCheck)EditorGUILayout.EnumPopup("Check previous or current:", sceneToCheck);
            chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);

            EditorGUILayout.BeginHorizontal();
            if (chooseSceneBy == ChooseSceneBy.Name)
            {
                EditorGUILayout.LabelField("Scene name is:", GUILayout.Width(100f));
                intCondition = (IntCondition)EditorGUILayout.EnumPopup(intCondition);

                sceneNameParameterID = Action.ChooseParameterGUI("", parameters, sceneNameParameterID, ParameterType.String);
                if (sceneNameParameterID < 0)
                {
                    sceneName = EditorGUILayout.TextField(sceneName);
                }
            }
            else
            {
                EditorGUILayout.LabelField("Scene number is:", GUILayout.Width(100f));
                intCondition = (IntCondition)EditorGUILayout.EnumPopup(intCondition);

                sceneNumberParameterID = Action.ChooseParameterGUI("", parameters, sceneNumberParameterID, ParameterType.Integer);
                if (sceneNumberParameterID < 0)
                {
                    sceneNumber = EditorGUILayout.IntField(sceneNumber);
                }
            }
            EditorGUILayout.EndHorizontal();
        }
Пример #6
0
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);
            if (chooseSceneBy == ChooseSceneBy.Name)
            {
                sceneNameParameterID = Action.ChooseParameterGUI("Scene name:", parameters, sceneNameParameterID, ParameterType.String);
                if (sceneNameParameterID < 0)
                {
                    sceneName = EditorGUILayout.TextField("Scene name:", sceneName);
                }
            }
            else
            {
                sceneNumberParameterID = Action.ChooseParameterGUI("Scene number:", parameters, sceneNumberParameterID, ParameterType.Integer);
                if (sceneNumberParameterID < 0)
                {
                    sceneNumber = EditorGUILayout.IntField("Scene number:", sceneNumber);
                }
            }

            relativePosition = EditorGUILayout.ToggleLeft("Position Player relative to Marker?", relativePosition);
            if (relativePosition)
            {
                relativeMarkerParameterID = Action.ChooseParameterGUI("Relative Marker:", parameters, relativeMarkerParameterID, ParameterType.GameObject);
                if (relativeMarkerParameterID >= 0)
                {
                    relativeMarkerID = 0;
                    relativeMarker   = null;
                }
                else
                {
                    relativeMarker = (Marker)EditorGUILayout.ObjectField("Relative Marker:", relativeMarker, typeof(Marker), true);

                    relativeMarkerID = FieldToID(relativeMarker, relativeMarkerID);
                    relativeMarker   = IDToField(relativeMarker, relativeMarkerID, false);
                }
            }
            else
            {
                onlyPreload = EditorGUILayout.ToggleLeft("Don't change scene, just preload data?", onlyPreload);
            }

            if (onlyPreload && !relativePosition)
            {
                if (AdvGame.GetReferences() != null && AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.useAsyncLoading)
                {
                }
                else
                {
                    EditorGUILayout.HelpBox("To pre-load scenes, 'Load scenes asynchronously?' must be enabled in the Settings Manager.", MessageType.Warning);
                }

                AfterRunningOption();
            }
            else
            {
                assignScreenOverlay = EditorGUILayout.ToggleLeft("Overlay current screen during switch?", assignScreenOverlay);
            }
        }
Пример #7
0
		public static string GetSceneName (ChooseSceneBy chooseSceneBy, string sceneName)
		{
			if (chooseSceneBy == ChooseSceneBy.Number)
			{
				return "";
			}
			return sceneName;
		}
Пример #8
0
 public static string GetSceneName(ChooseSceneBy chooseSceneBy, string sceneName)
 {
     if (chooseSceneBy == ChooseSceneBy.Number)
     {
         return("");
     }
     return(sceneName);
 }
        /**
         * <summary>A Constructor.</summary>
         * <param name = "chooseSeneBy">The method by which the scene is referenced (Name, Number)</param>
         * <param name = "_name">The scene's name</param>
         * <param name = "_number">The scene's number. If name is left empty, this number will be used to reference the scene instead</param>
         */
        public SceneInfo(ChooseSceneBy chooseSceneBy, string _name, int _number)
        {
            number = _number;

            if (chooseSceneBy == ChooseSceneBy.Number)
            {
                name = "";
            }
            else
            {
                name = _name;
            }
        }
Пример #10
0
 /**
  * <summary>A Constructor.</summary>
  * <param name = "chooseSeneBy">The method by which the scene is referenced (Name, Number)</param>
  * <param name = "_name">The scene's name</param>
  * <param name = "_number">The scene's number. If name is left empty, this number will be used to reference the scene instead</param>
  */
 public SceneInfo(ChooseSceneBy chooseSceneBy, string _name, int _number)
 {
     if (chooseSceneBy == ChooseSceneBy.Number || string.IsNullOrEmpty(_name))
     {
         number = _number;
         name   = string.Empty;
     }
     else
     {
         name   = _name;
         number = -1;
     }
 }
Пример #11
0
 override public void ShowGUI()
 {
     chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);
     if (chooseSceneBy == ChooseSceneBy.Name)
     {
         sceneName = EditorGUILayout.TextField("Scene name:", sceneName);
     }
     else
     {
         sceneNumber = EditorGUILayout.IntField("Scene number:", sceneNumber);
     }
     assignScreenOverlay = EditorGUILayout.Toggle("Overlay current screen?", assignScreenOverlay);
 }
Пример #12
0
		override public void ShowGUI ()
		{
			chooseSceneBy = (ChooseSceneBy) EditorGUILayout.EnumPopup ("Choose scene by:", chooseSceneBy);
			if (chooseSceneBy == ChooseSceneBy.Name)
			{
				sceneName = EditorGUILayout.TextField ("Scene name:", sceneName);
			}
			else
			{
				sceneNumber = EditorGUILayout.IntField ("Scene number:", sceneNumber);
			}
			assignScreenOverlay = EditorGUILayout.Toggle ("Overlay current screen?", assignScreenOverlay);
		}
Пример #13
0
 /**
  * <summary>A Constructor.</summary>
  * <param name = "chooseSeneBy">The method by which the scene is referenced (Name, Number)</param>
  * <param name = "_name">The scene's name</param>
  * <param name = "_number">The scene's number. If name is left empty, this number will be used to reference the scene instead</param>
  */
 public SceneInfo(ChooseSceneBy chooseSceneBy, string _name, int _number)
 {
     if (chooseSceneBy == ChooseSceneBy.Number || _name == "")
     {
         number = _number;
         name   = "";
     }
     else
     {
         name   = _name;
         number = -1;
     }
 }
Пример #14
0
        override public void ShowGUI()
        {
            endGameType = (AC_EndGameType)EditorGUILayout.EnumPopup("Command:", endGameType);

            if (endGameType == AC_EndGameType.RestartGame)
            {
                chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);
                if (chooseSceneBy == ChooseSceneBy.Name)
                {
                    sceneName = EditorGUILayout.TextField("Scene to restart to:", sceneName);
                }
                else
                {
                    sceneNumber = EditorGUILayout.IntField("Scene to restart to:", sceneNumber);
                }
            }
        }
Пример #15
0
        public override void ShowGUI(List <ActionParameter> parameters)
        {
            sceneAddRemove = (SceneAddRemove)EditorGUILayout.EnumPopup("Method:", sceneAddRemove);

            chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);
            if (chooseSceneBy == ChooseSceneBy.Name)
            {
                sceneNameParameterID = Action.ChooseParameterGUI("Scene name:", parameters, sceneNameParameterID, ParameterType.String);
                if (sceneNameParameterID < 0)
                {
                    sceneName = EditorGUILayout.TextField("Scene name:", sceneName);
                }
            }
            else
            {
                sceneNumberParameterID = Action.ChooseParameterGUI("Scene number:", parameters, sceneNumberParameterID, ParameterType.Integer);
                if (sceneNumberParameterID < 0)
                {
                    sceneNumber = EditorGUILayout.IntField("Scene number:", sceneNumber);
                }
            }

            if (sceneAddRemove == SceneAddRemove.Add)
            {
                runCutsceneOnStart = EditorGUILayout.Toggle("Run 'Cutscene on start'?", runCutsceneOnStart);
                if (runCutsceneOnStart)
                {
                    runCutsceneIfAlreadyOpen = EditorGUILayout.Toggle("Run if already open?", runCutsceneIfAlreadyOpen);
                }
            }
            else if (sceneAddRemove == SceneAddRemove.Remove && endAction != ResultAction.Stop)
            {
                if (isAssetFile)
                {
                    EditorGUILayout.HelpBox("If the active scene is removed, further Actions can only be run if the ActionList asset's 'Survive scene changes?' property is checked.", MessageType.Info);
                }
                else
                {
                    EditorGUILayout.HelpBox("If the active scene is removed, further Actions cannot be run - consider using an ActionList asset instead.", MessageType.Warning);
                }
            }

            AfterRunningOption();
        }
Пример #16
0
        override public void ShowGUI()
        {
            chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);

            EditorGUILayout.BeginHorizontal();
            sceneToCheck = (SceneToCheck)EditorGUILayout.EnumPopup(sceneToCheck);
            if (chooseSceneBy == ChooseSceneBy.Name)
            {
                EditorGUILayout.LabelField("scene name is:", GUILayout.Width(100f));
                intCondition = (IntCondition)EditorGUILayout.EnumPopup(intCondition);
                sceneName    = EditorGUILayout.TextField(sceneName);
            }
            else
            {
                EditorGUILayout.LabelField("scene number is:", GUILayout.Width(100f));
                intCondition = (IntCondition)EditorGUILayout.EnumPopup(intCondition);
                sceneNumber  = EditorGUILayout.IntField(sceneNumber);
            }
            EditorGUILayout.EndHorizontal();
        }
Пример #17
0
        public override void ShowGUI(List <ActionParameter> parameters)
        {
            if (KickStarter.settingsManager != null && KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow)
            {
                playerParameterID = ChooseParameterGUI("Player:", parameters, playerParameterID, ParameterType.Integer);
                if (playerParameterID < 0)
                {
                    playerID = ChoosePlayerGUI(playerID, true);
                }
            }

            sceneToCheck  = (SceneToCheck)EditorGUILayout.EnumPopup("Check type:", sceneToCheck);
            chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);

            EditorGUILayout.BeginHorizontal();
            if (chooseSceneBy == ChooseSceneBy.Name)
            {
                EditorGUILayout.LabelField("Scene name is:", GUILayout.Width(100f));
                intCondition = (IntCondition)EditorGUILayout.EnumPopup(intCondition);

                sceneNameParameterID = ChooseParameterGUI(string.Empty, parameters, sceneNameParameterID, ParameterType.String);
                if (sceneNameParameterID < 0)
                {
                    sceneName = EditorGUILayout.TextField(sceneName);
                }
            }
            else
            {
                EditorGUILayout.LabelField("Scene number is:", GUILayout.Width(100f));
                intCondition = (IntCondition)EditorGUILayout.EnumPopup(intCondition);

                sceneNumberParameterID = ChooseParameterGUI(string.Empty, parameters, sceneNumberParameterID, ParameterType.Integer);
                if (sceneNumberParameterID < 0)
                {
                    sceneNumber = EditorGUILayout.IntField(sceneNumber);
                }
            }
            EditorGUILayout.EndHorizontal();
        }
Пример #18
0
        public override void ShowGUI(List<ActionParameter> parameters)
        {
            chooseSceneBy = (ChooseSceneBy) EditorGUILayout.EnumPopup ("Choose scene by:", chooseSceneBy);
            if (chooseSceneBy == ChooseSceneBy.Name)
            {
                sceneNameParameterID = Action.ChooseParameterGUI ("Scene name:", parameters, sceneNameParameterID, ParameterType.String);
                if (sceneNameParameterID < 0)
                {
                    sceneName = EditorGUILayout.TextField ("Scene name:", sceneName);
                }
            }
            else
            {
                sceneNumberParameterID = Action.ChooseParameterGUI ("Scene number:", parameters, sceneNumberParameterID, ParameterType.Integer);
                if (sceneNumberParameterID < 0)
                {
                    sceneNumber = EditorGUILayout.IntField ("Scene number:", sceneNumber);
                }
            }

            relativePosition = EditorGUILayout.ToggleLeft ("Position Player relative to Marker?", relativePosition);
            if (relativePosition)
            {
                relativeMarkerParameterID = Action.ChooseParameterGUI ("Relative Marker:", parameters, relativeMarkerParameterID, ParameterType.GameObject);
                if (relativeMarkerParameterID >= 0)
                {
                    relativeMarkerID = 0;
                    relativeMarker = null;
                }
                else
                {
                    relativeMarker = (Marker) EditorGUILayout.ObjectField ("Relative Marker:", relativeMarker, typeof(Marker), true);

                    relativeMarkerID = FieldToID (relativeMarker, relativeMarkerID);
                    relativeMarker = IDToField (relativeMarker, relativeMarkerID, false);
                }
            }
            else
            {
                onlyPreload = EditorGUILayout.ToggleLeft ("Don't change scene, just preload data?", onlyPreload);
            }

            if (onlyPreload && !relativePosition)
            {
                if (AdvGame.GetReferences () != null && AdvGame.GetReferences ().settingsManager != null && AdvGame.GetReferences ().settingsManager.useAsyncLoading)
                {}
                else
                {
                    EditorGUILayout.HelpBox ("To pre-load scenes, 'Load scenes asynchronously?' must be enabled in the Settings Manager.", MessageType.Warning);
                }

                AfterRunningOption ();
            }
            else
            {
                assignScreenOverlay = EditorGUILayout.ToggleLeft ("Overlay current screen during switch?", assignScreenOverlay);
            }
        }
Пример #19
0
        public void ShowGUI()
        {
            EditorGUILayout.LabelField ("Save game settings", EditorStyles.boldLabel);

            if (saveFileName == "")
            {
                saveFileName = SaveSystem.SetProjectName ();
            }
            maxSaves = EditorGUILayout.IntField ("Max. number of saves:", maxSaves);
            saveFileName = EditorGUILayout.TextField ("Save filename:", saveFileName);
            useProfiles = EditorGUILayout.ToggleLeft ("Enable save game profiles?", useProfiles);
            #if !UNITY_WEBPLAYER && !UNITY_ANDROID && !UNITY_WINRT && !UNITY_WII
            saveTimeDisplay = (SaveTimeDisplay) EditorGUILayout.EnumPopup ("Time display:", saveTimeDisplay);
            takeSaveScreenshots = EditorGUILayout.ToggleLeft ("Take screenshot when saving?", takeSaveScreenshots);
            orderSavesByUpdateTime = EditorGUILayout.ToggleLeft ("Order save lists by update time?", orderSavesByUpdateTime);
            #else
            EditorGUILayout.HelpBox ("Save-game screenshots are disabled for WebPlayer, Windows Store and Android platforms.", MessageType.Info);
            takeSaveScreenshots = false;
            #endif

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Cutscene settings:", EditorStyles.boldLabel);

            actionListOnStart = ActionListAssetMenu.AssetGUI ("ActionList on start game:", actionListOnStart);
            blackOutWhenSkipping = EditorGUILayout.Toggle ("Black out when skipping?", blackOutWhenSkipping);

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Character settings:", EditorStyles.boldLabel);

            CreatePlayersGUI ();

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Interface settings", EditorStyles.boldLabel);

            movementMethod = (MovementMethod) EditorGUILayout.EnumPopup ("Movement method:", movementMethod);
            if (movementMethod == MovementMethod.UltimateFPS && !UltimateFPSIntegration.IsDefinePresent ())
            {
                EditorGUILayout.HelpBox ("The 'UltimateFPSIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
            }

            inputMethod = (InputMethod) EditorGUILayout.EnumPopup ("Input method:", inputMethod);
            interactionMethod = (AC_InteractionMethod) EditorGUILayout.EnumPopup ("Interaction method:", interactionMethod);

            if (inputMethod != InputMethod.TouchScreen)
            {
                useOuya = EditorGUILayout.ToggleLeft ("Playing on OUYA platform?", useOuya);
                if (useOuya && !OuyaIntegration.IsDefinePresent ())
                {
                    EditorGUILayout.HelpBox ("The 'OUYAIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
                }
                if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    selectInteractions = (SelectInteractions) EditorGUILayout.EnumPopup ("Select Interactions by:", selectInteractions);
                    if (selectInteractions != SelectInteractions.CyclingCursorAndClickingHotspot)
                    {
                        seeInteractions = (SeeInteractions) EditorGUILayout.EnumPopup ("See Interactions with:", seeInteractions);
                        if (seeInteractions == SeeInteractions.ClickOnHotspot)
                        {
                            stopPlayerOnClickHotspot = EditorGUILayout.ToggleLeft ("Stop player moving when click Hotspot?", stopPlayerOnClickHotspot);
                        }
                    }

                    if (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot)
                    {
                        autoCycleWhenInteract = EditorGUILayout.ToggleLeft ("Auto-cycle after an Interaction?", autoCycleWhenInteract);
                    }

                    if (SelectInteractionMethod () == SelectInteractions.ClickingMenu)
                    {
                        clickUpInteractions = EditorGUILayout.ToggleLeft ("Trigger interaction by releasing click?", clickUpInteractions);
                        cancelInteractions = (CancelInteractions) EditorGUILayout.EnumPopup ("Close interactions with:", cancelInteractions);
                    }
                    else
                    {
                        cancelInteractions = CancelInteractions.CursorLeavesMenu;
                    }
                }
            }
            if (interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
            {
                autoCycleWhenInteract = EditorGUILayout.ToggleLeft ("Reset cursor after an Interaction?", autoCycleWhenInteract);
            }

            if (movementMethod == MovementMethod.FirstPerson && inputMethod == InputMethod.TouchScreen)
            {
                // First person dragging only works if cursor is unlocked
                lockCursorOnStart = false;
            }
            else
            {
                lockCursorOnStart = EditorGUILayout.ToggleLeft ("Lock cursor in screen's centre when game begins?", lockCursorOnStart);
                hideLockedCursor = EditorGUILayout.ToggleLeft ("Hide cursor when locked in screen's centre?", hideLockedCursor);
                onlyInteractWhenCursorUnlocked = EditorGUILayout.ToggleLeft ("Disallow Interactions if cursor is locked?", onlyInteractWhenCursorUnlocked);
            }
            if (IsInFirstPerson ())
            {
                disableFreeAimWhenDragging = EditorGUILayout.ToggleLeft ("Disable free-aim when dragging?", disableFreeAimWhenDragging);

                if (movementMethod == MovementMethod.FirstPerson)
                {
                    useFPCamDuringConversations = EditorGUILayout.ToggleLeft ("Run Conversations in first-person?", useFPCamDuringConversations);
                }
            }
            if (inputMethod != InputMethod.TouchScreen)
            {
                runConversationsWithKeys = EditorGUILayout.ToggleLeft ("Dialogue options can be selected with number keys?", runConversationsWithKeys);
            }

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Inventory settings", EditorStyles.boldLabel);

            if (interactionMethod != AC_InteractionMethod.ContextSensitive)
            {
                inventoryInteractions = (InventoryInteractions) EditorGUILayout.EnumPopup ("Inventory interactions:", inventoryInteractions);

                if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    if (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot)
                    {
                        cycleInventoryCursors = EditorGUILayout.ToggleLeft ("Include Inventory items in Interaction cycles?", cycleInventoryCursors);
                    }
                    else
                    {
                        cycleInventoryCursors = EditorGUILayout.ToggleLeft ("Include Inventory items in Interaction menus?", cycleInventoryCursors);
                    }
                }

                if (inventoryInteractions == InventoryInteractions.Multiple && CanSelectItems (false))
                {
                    selectInvWithUnhandled = EditorGUILayout.ToggleLeft ("Select item if Interaction is unhandled?", selectInvWithUnhandled);
                    if (selectInvWithUnhandled)
                    {
                        CursorManager cursorManager = AdvGame.GetReferences ().cursorManager;
                        if (cursorManager != null && cursorManager.cursorIcons != null && cursorManager.cursorIcons.Count > 0)
                        {
                            selectInvWithIconID = GetIconID ("Select with unhandled:", selectInvWithIconID, cursorManager);
                        }
                        else
                        {
                            EditorGUILayout.HelpBox ("No Interaction cursors defined - please do so in the Cursor Manager.", MessageType.Info);
                        }
                    }

                    giveInvWithUnhandled = EditorGUILayout.ToggleLeft ("Give item if Interaction is unhandled?", giveInvWithUnhandled);
                    if (giveInvWithUnhandled)
                    {
                        CursorManager cursorManager = AdvGame.GetReferences ().cursorManager;
                        if (cursorManager != null && cursorManager.cursorIcons != null && cursorManager.cursorIcons.Count > 0)
                        {
                            giveInvWithIconID = GetIconID ("Give with unhandled:", giveInvWithIconID, cursorManager);
                        }
                        else
                        {
                            EditorGUILayout.HelpBox ("No Interaction cursors defined - please do so in the Cursor Manager.", MessageType.Info);
                        }
                    }
                }
            }

            if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction && selectInteractions != SelectInteractions.ClickingMenu && inventoryInteractions == InventoryInteractions.Multiple)
            {}
            else
            {
                reverseInventoryCombinations = EditorGUILayout.ToggleLeft ("Combine interactions work in reverse?", reverseInventoryCombinations);
            }

            //if (interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction || inventoryInteractions == InventoryInteractions.Single)
            if (CanSelectItems (false))
            {
                inventoryDragDrop = EditorGUILayout.ToggleLeft ("Drag and drop Inventory interface?", inventoryDragDrop);
                if (!inventoryDragDrop)
                {
                    if (interactionMethod == AC_InteractionMethod.ContextSensitive || inventoryInteractions == InventoryInteractions.Single)
                    {
                        rightClickInventory = (RightClickInventory) EditorGUILayout.EnumPopup ("Right-click active item:", rightClickInventory);
                    }
                }
                else if (inventoryInteractions == AC.InventoryInteractions.Single)
                {
                    inventoryDropLook = EditorGUILayout.ToggleLeft ("Can drop an Item onto itself to Examine it?", inventoryDropLook);
                }
            }

            if (CanSelectItems (false) && !inventoryDragDrop)
            {
                inventoryDisableLeft = EditorGUILayout.ToggleLeft ("Left-click deselects active item?", inventoryDisableLeft);

                if (movementMethod == MovementMethod.PointAndClick && !inventoryDisableLeft)
                {
                    canMoveWhenActive = EditorGUILayout.ToggleLeft ("Can move player if an Item is active?", canMoveWhenActive);
                }
            }

            inventoryActiveEffect = (InventoryActiveEffect) EditorGUILayout.EnumPopup ("Active cursor FX:", inventoryActiveEffect);
            if (inventoryActiveEffect == InventoryActiveEffect.Pulse)
            {
                inventoryPulseSpeed = EditorGUILayout.Slider ("Active FX pulse speed:", inventoryPulseSpeed, 0.5f, 2f);
            }

            activeWhenUnhandled = EditorGUILayout.ToggleLeft ("Show Active FX when an Interaction is unhandled?", activeWhenUnhandled);
            canReorderItems = EditorGUILayout.ToggleLeft ("Items can be re-ordered in Menu?", canReorderItems);
            hideSelectedFromMenu = EditorGUILayout.ToggleLeft ("Hide currently active Item in Menu?", hideSelectedFromMenu);
            activeWhenHover = EditorGUILayout.ToggleLeft ("Show Active FX when Cursor hovers over Item in Menu?", activeWhenHover);

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Required inputs:", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox ("The following inputs are available for the chosen interface settings:" + GetInputList (), MessageType.Info);

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Movement settings", EditorStyles.boldLabel);

            if ((inputMethod == InputMethod.TouchScreen && movementMethod != MovementMethod.PointAndClick) || movementMethod == MovementMethod.Drag)
            {
                dragWalkThreshold = EditorGUILayout.FloatField ("Walk threshold:", dragWalkThreshold);
                dragRunThreshold = EditorGUILayout.FloatField ("Run threshold:", dragRunThreshold);

                if (inputMethod == InputMethod.TouchScreen && movementMethod == MovementMethod.FirstPerson)
                {
                    freeAimTouchSpeed = EditorGUILayout.FloatField ("Freelook speed:", freeAimTouchSpeed);
                }

                drawDragLine = EditorGUILayout.Toggle ("Draw drag line?", drawDragLine);
                if (drawDragLine)
                {
                    dragLineWidth = EditorGUILayout.FloatField ("Drag line width:", dragLineWidth);
                    dragLineColor = EditorGUILayout.ColorField ("Drag line colour:", dragLineColor);
                }
            }
            else if (movementMethod == MovementMethod.Direct)
            {
                magnitudeAffectsDirect = EditorGUILayout.ToggleLeft ("Input magnitude affects speed?", magnitudeAffectsDirect);
                directMovementType = (DirectMovementType) EditorGUILayout.EnumPopup ("Direct-movement type:", directMovementType);
                if (directMovementType == DirectMovementType.RelativeToCamera)
                {
                    limitDirectMovement = (LimitDirectMovement) EditorGUILayout.EnumPopup ("Movement limitation:", limitDirectMovement);
                    if (cameraPerspective == CameraPerspective.ThreeD)
                    {
                        directMovementPerspective = EditorGUILayout.ToggleLeft ("Account for player's position on screen?", directMovementPerspective);
                    }
                }
            }
            else if (movementMethod == MovementMethod.PointAndClick)
            {
                clickPrefab = (Transform) EditorGUILayout.ObjectField ("Click marker:", clickPrefab, typeof (Transform), false);
                walkableClickRange = EditorGUILayout.Slider ("NavMesh search %:", walkableClickRange, 0f, 1f);
                doubleClickMovement = EditorGUILayout.Toggle ("Double-click to move?", doubleClickMovement);
            }
            if (movementMethod == MovementMethod.StraightToCursor)
            {
                dragRunThreshold = EditorGUILayout.FloatField ("Run threshold:", dragRunThreshold);
                singleTapStraight = EditorGUILayout.ToggleLeft ("Single-clicking also moves player?", singleTapStraight);
                if (singleTapStraight)
                {
                    singleTapStraightPathfind = EditorGUILayout.ToggleLeft ("Pathfind when single-clicking?", singleTapStraightPathfind);
                }
            }
            if (movementMethod == MovementMethod.FirstPerson && inputMethod == InputMethod.TouchScreen)
            {
                dragAffects = (DragAffects) EditorGUILayout.EnumPopup ("Touch-drag affects:", dragAffects);
            }
            if ((movementMethod == MovementMethod.Direct || movementMethod == MovementMethod.FirstPerson) && inputMethod != InputMethod.TouchScreen)
            {
                jumpSpeed = EditorGUILayout.Slider ("Jump speed:", jumpSpeed, 1f, 10f);
            }

            destinationAccuracy = EditorGUILayout.Slider ("Destination accuracy:", destinationAccuracy, 0f, 1f);
            if (destinationAccuracy == 1f && movementMethod != MovementMethod.StraightToCursor)
            {
                experimentalAccuracy = EditorGUILayout.ToggleLeft ("Attempt to be super-accurate? (Experimental)", experimentalAccuracy);
            }

            if (inputMethod == InputMethod.TouchScreen)
            {
                EditorGUILayout.Space ();
                EditorGUILayout.LabelField ("Touch Screen settings", EditorStyles.boldLabel);

                if (movementMethod != MovementMethod.FirstPerson)
                {
                    offsetTouchCursor = EditorGUILayout.Toggle ("Drag cursor with touch?", offsetTouchCursor);
                }
                doubleTapHotspots = EditorGUILayout.Toggle ("Double-tap Hotspots?", doubleTapHotspots);
            }

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Camera settings", EditorStyles.boldLabel);

            cameraPerspective_int = (int) cameraPerspective;
            cameraPerspective_int = EditorGUILayout.Popup ("Camera perspective:", cameraPerspective_int, cameraPerspective_list);
            cameraPerspective = (CameraPerspective) cameraPerspective_int;
            if (movementMethod == MovementMethod.FirstPerson)
            {
                cameraPerspective = CameraPerspective.ThreeD;
            }
            if (cameraPerspective == CameraPerspective.TwoD)
            {
                movingTurning = (MovingTurning) EditorGUILayout.EnumPopup ("Moving and turning:", movingTurning);
                if (movingTurning == MovingTurning.TopDown || movingTurning == MovingTurning.Unity2D)
                {
                    verticalReductionFactor = EditorGUILayout.Slider ("Vertical movement factor:", verticalReductionFactor, 0.1f, 1f);
                }
            }

            forceAspectRatio = EditorGUILayout.Toggle ("Force aspect ratio?", forceAspectRatio);
            if (forceAspectRatio)
            {
                wantedAspectRatio = EditorGUILayout.FloatField ("Aspect ratio:", wantedAspectRatio);
                #if UNITY_IPHONE
                landscapeModeOnly = EditorGUILayout.Toggle ("Landscape-mode only?", landscapeModeOnly);
                #endif
            }

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Hotpot settings", EditorStyles.boldLabel);

            hotspotDetection = (HotspotDetection) EditorGUILayout.EnumPopup ("Hotspot detection method:", hotspotDetection);
            if (hotspotDetection == HotspotDetection.PlayerVicinity && (movementMethod == MovementMethod.Direct || IsInFirstPerson ()))
            {
                hotspotsInVicinity = (HotspotsInVicinity) EditorGUILayout.EnumPopup ("Hotspots in vicinity:", hotspotsInVicinity);
            }
            else if (hotspotDetection == HotspotDetection.MouseOver)
            {
                scaleHighlightWithMouseProximity = EditorGUILayout.ToggleLeft ("Highlight Hotspots based on cursor proximity?", scaleHighlightWithMouseProximity);
                if (scaleHighlightWithMouseProximity)
                {
                    highlightProximityFactor = EditorGUILayout.FloatField ("Cursor proximity factor:", highlightProximityFactor);
                }
            }

            if (cameraPerspective != CameraPerspective.TwoD)
            {
                playerFacesHotspots = EditorGUILayout.ToggleLeft ("Player turns head to active Hotspot?", playerFacesHotspots);
            }

            hotspotIconDisplay = (HotspotIconDisplay) EditorGUILayout.EnumPopup ("Display Hotspot icon:", hotspotIconDisplay);
            if (hotspotIconDisplay != HotspotIconDisplay.Never)
            {
                if (cameraPerspective != CameraPerspective.TwoD)
                {
                    occludeIcons = EditorGUILayout.ToggleLeft ("Don't show behind Colliders?", occludeIcons);
                }
                hotspotIcon = (HotspotIcon) EditorGUILayout.EnumPopup ("Hotspot icon type:", hotspotIcon);
                if (hotspotIcon == HotspotIcon.Texture)
                {
                    hotspotIconTexture = (Texture2D) EditorGUILayout.ObjectField ("Hotspot icon texture:", hotspotIconTexture, typeof (Texture2D), false);
                }
                hotspotIconSize = EditorGUILayout.FloatField ("Hotspot icon size:", hotspotIconSize);
                if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction &&
                    selectInteractions != SelectInteractions.CyclingCursorAndClickingHotspot &&
                    hotspotIconDisplay != HotspotIconDisplay.OnlyWhenFlashing)
                {
                    hideIconUnderInteractionMenu = EditorGUILayout.ToggleLeft ("Hide when Interaction Menus are visible?", hideIconUnderInteractionMenu);
                }
            }

            #if UNITY_5
            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Audio settings", EditorStyles.boldLabel);
            volumeControl = (VolumeControl) EditorGUILayout.EnumPopup ("Volume controlled by:", volumeControl);
            if (volumeControl == VolumeControl.AudioMixerGroups)
            {
                musicMixerGroup = (AudioMixerGroup) EditorGUILayout.ObjectField ("Music mixer:", musicMixerGroup, typeof (AudioMixerGroup), false);
                sfxMixerGroup = (AudioMixerGroup) EditorGUILayout.ObjectField ("SFX mixer:", sfxMixerGroup, typeof (AudioMixerGroup), false);
                speechMixerGroup = (AudioMixerGroup) EditorGUILayout.ObjectField ("Speech mixer:", speechMixerGroup, typeof (AudioMixerGroup), false);
                musicAttentuationParameter = EditorGUILayout.TextField ("Music atten. parameter:", musicAttentuationParameter);
                sfxAttentuationParameter = EditorGUILayout.TextField ("SFX atten. parameter:", sfxAttentuationParameter);
                speechAttentuationParameter = EditorGUILayout.TextField ("Speech atten. parameter:", speechAttentuationParameter);
            }
            #endif

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Raycast settings", EditorStyles.boldLabel);
            navMeshRaycastLength = EditorGUILayout.FloatField ("NavMesh ray length:", navMeshRaycastLength);
            hotspotRaycastLength = EditorGUILayout.FloatField ("Hotspot ray length:", hotspotRaycastLength);
            moveableRaycastLength = EditorGUILayout.FloatField ("Moveable ray length:", moveableRaycastLength);

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Layer names", EditorStyles.boldLabel);

            hotspotLayer = EditorGUILayout.TextField ("Hotspot:", hotspotLayer);
            navMeshLayer = EditorGUILayout.TextField ("Nav mesh:", navMeshLayer);
            if (cameraPerspective == CameraPerspective.TwoPointFiveD)
            {
                backgroundImageLayer = EditorGUILayout.TextField ("Background image:", backgroundImageLayer);
            }
            deactivatedLayer = EditorGUILayout.TextField ("Deactivated:", deactivatedLayer);

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Loading scene", EditorStyles.boldLabel);
            useLoadingScreen = EditorGUILayout.Toggle ("Use loading screen?", useLoadingScreen);
            if (useLoadingScreen)
            {
                loadingSceneIs = (ChooseSceneBy) EditorGUILayout.EnumPopup ("Choose loading scene by:", loadingSceneIs);
                if (loadingSceneIs == ChooseSceneBy.Name)
                {
                    loadingSceneName = EditorGUILayout.TextField ("Loading scene name:", loadingSceneName);
                }
                else
                {
                    loadingScene = EditorGUILayout.IntField ("Loading screen scene:", loadingScene);
                }
            }

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Options data", EditorStyles.boldLabel);

            optionsData = Options.LoadPrefsFromID (0, false, true);
            if (optionsData == null)
            {
                Debug.Log ("Saved new prefs");
                Options.SaveDefaultPrefs (optionsData);
            }

            defaultSpeechVolume = optionsData.speechVolume = EditorGUILayout.Slider ("Speech volume:", optionsData.speechVolume, 0f, 1f);
            defaultMusicVolume = optionsData.musicVolume = EditorGUILayout.Slider ("Music volume:", optionsData.musicVolume, 0f, 1f);
            defaultSfxVolume = optionsData.sfxVolume = EditorGUILayout.Slider ("SFX volume:", optionsData.sfxVolume, 0f, 1f);
            defaultShowSubtitles = optionsData.showSubtitles = EditorGUILayout.Toggle ("Show subtitles?", optionsData.showSubtitles);
            defaultLanguage = optionsData.language = EditorGUILayout.IntField ("Language:", optionsData.language);

            Options.SaveDefaultPrefs (optionsData);

            if (GUILayout.Button ("Reset options data"))
            {
                optionsData = new OptionsData ();

                optionsData.language = 0;
                optionsData.speechVolume = 1f;
                optionsData.musicVolume = 0.6f;
                optionsData.sfxVolume = 0.9f;
                optionsData.showSubtitles = false;

                Options.SavePrefsToID (0, optionsData, true);
            }

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Debug settings", EditorStyles.boldLabel);
            showActiveActionLists = EditorGUILayout.ToggleLeft ("List active ActionLists in Game window?", showActiveActionLists);
            showHierarchyIcons = EditorGUILayout.ToggleLeft ("Show icons in Hierarchy window?", showHierarchyIcons);

            if (GUI.changed)
            {
                EditorUtility.SetDirty (this);
            }
        }
Пример #20
0
        public override void ShowGUI(List <ActionParameter> parameters)
        {
            bool showPlayerOptions = false;

            if (KickStarter.settingsManager != null && KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow)
            {
                playerParameterID = ChooseParameterGUI("Player:", parameters, playerParameterID, ParameterType.Integer);
                if (playerParameterID < 0)
                {
                    playerID          = ChoosePlayerGUI(playerID, true);
                    showPlayerOptions = (playerID >= 0);
                }
                else
                {
                    showPlayerOptions = true;
                }
            }

            if (showPlayerOptions)
            {
                sceneToCheck = (SceneToCheck)EditorGUILayout.EnumPopup("Check type:", sceneToCheck);
                if (chooseSceneByPlayerSwitching == -1)
                {
                    chooseSceneByPlayerSwitching = (int)chooseSceneBy;
                }
                ChooseSceneByPlayerSwitching csbps = (ChooseSceneByPlayerSwitching)chooseSceneByPlayerSwitching;
                csbps = (ChooseSceneByPlayerSwitching)EditorGUILayout.EnumPopup("Choose scene by:", csbps);
                chooseSceneByPlayerSwitching = (int)csbps;
                chooseSceneBy = (ChooseSceneBy)chooseSceneByPlayerSwitching;

                EditorGUILayout.BeginHorizontal();
                switch (csbps)
                {
                case ChooseSceneByPlayerSwitching.Name:
                    EditorGUILayout.LabelField("Scene name is:", GUILayout.Width(100f));
                    intCondition = (IntCondition)EditorGUILayout.EnumPopup(intCondition);

                    sceneNameParameterID = ChooseParameterGUI(string.Empty, parameters, sceneNameParameterID, ParameterType.String);
                    if (sceneNameParameterID < 0)
                    {
                        sceneName = EditorGUILayout.TextField(sceneName);
                    }
                    break;

                case ChooseSceneByPlayerSwitching.Number:
                    EditorGUILayout.LabelField("Scene number is:", GUILayout.Width(100f));
                    intCondition = (IntCondition)EditorGUILayout.EnumPopup(intCondition);

                    sceneNumberParameterID = ChooseParameterGUI(string.Empty, parameters, sceneNumberParameterID, ParameterType.Integer);
                    if (sceneNumberParameterID < 0)
                    {
                        sceneNumber = EditorGUILayout.IntField(sceneNumber);
                    }
                    break;

                default:
                    break;
                }
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                sceneToCheck  = (SceneToCheck)EditorGUILayout.EnumPopup("Check type:", sceneToCheck);
                chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);

                EditorGUILayout.BeginHorizontal();
                switch (chooseSceneBy)
                {
                case ChooseSceneBy.Name:
                    EditorGUILayout.LabelField("Scene name is:", GUILayout.Width(100f));
                    intCondition = (IntCondition)EditorGUILayout.EnumPopup(intCondition);

                    sceneNameParameterID = ChooseParameterGUI(string.Empty, parameters, sceneNameParameterID, ParameterType.String);
                    if (sceneNameParameterID < 0)
                    {
                        sceneName = EditorGUILayout.TextField(sceneName);
                    }
                    break;

                case ChooseSceneBy.Number:
                    EditorGUILayout.LabelField("Scene number is:", GUILayout.Width(100f));
                    intCondition = (IntCondition)EditorGUILayout.EnumPopup(intCondition);

                    sceneNumberParameterID = ChooseParameterGUI(string.Empty, parameters, sceneNumberParameterID, ParameterType.Integer);
                    if (sceneNumberParameterID < 0)
                    {
                        sceneNumber = EditorGUILayout.IntField(sceneNumber);
                    }
                    break;

                default:
                    break;
                }
                EditorGUILayout.EndHorizontal();
            }
        }
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            if (settingsManager == null)
            {
                settingsManager = AdvGame.GetReferences().settingsManager;
            }

            if (settingsManager == null)
            {
                return;
            }

            if (settingsManager.playerSwitching == PlayerSwitching.DoNotAllow)
            {
                EditorGUILayout.HelpBox("This Action requires Player Switching to be allowed, as set in the Settings Manager.", MessageType.Info);
                return;
            }

            if (settingsManager.players.Count > 0)
            {
                playerIDParameterID = Action.ChooseParameterGUI("New Player ID:", parameters, playerIDParameterID, ParameterType.Integer);
                if (playerIDParameterID == -1)
                {
                    // Create a string List of the field's names (for the PopUp box)
                    List <string> labelList = new List <string>();

                    int i            = 0;
                    int playerNumber = -1;

                    foreach (PlayerPrefab playerPrefab in settingsManager.players)
                    {
                        if (playerPrefab.playerOb != null)
                        {
                            labelList.Add(playerPrefab.playerOb.name);
                        }
                        else
                        {
                            labelList.Add("(Undefined prefab)");
                        }

                        // If a player has been removed, make sure selected player is still valid
                        if (playerPrefab.ID == playerID)
                        {
                            playerNumber = i;
                        }

                        i++;
                    }

                    if (playerNumber == -1)
                    {
                        // Wasn't found (item was possibly deleted), so revert to zero
                        ACDebug.LogWarning("Previously chosen Player no longer exists!");

                        playerNumber = 0;
                        playerID     = 0;
                    }

                    playerNumber = EditorGUILayout.Popup("New Player:", playerNumber, labelList.ToArray());
                    playerID     = settingsManager.players[playerNumber].ID;
                }

                if (AdvGame.GetReferences().settingsManager == null || !AdvGame.GetReferences().settingsManager.shareInventory)
                {
                    keepInventory = EditorGUILayout.Toggle("Transfer inventory?", keepInventory);
                }
                restorePreviousData = EditorGUILayout.Toggle("Restore position?", restorePreviousData);
                if (restorePreviousData)
                {
                    EditorGUILayout.BeginVertical(CustomStyles.thinBox);
                    EditorGUILayout.LabelField("If first time in game:", EditorStyles.boldLabel);
                }

                newPlayerPosition = (NewPlayerPosition)EditorGUILayout.EnumPopup("New Player position:", newPlayerPosition);

                if (newPlayerPosition == NewPlayerPosition.ReplaceNPC)
                {
                    newPlayerNPC = (NPC)EditorGUILayout.ObjectField("NPC to be replaced:", newPlayerNPC, typeof(NPC), true);

                    newPlayerNPC_ID = FieldToID <NPC> (newPlayerNPC, newPlayerNPC_ID);
                    newPlayerNPC    = IDToField <NPC> (newPlayerNPC, newPlayerNPC_ID, false);
                }
                else if (newPlayerPosition == NewPlayerPosition.AppearAtMarker)
                {
                    newPlayerMarker = (Marker)EditorGUILayout.ObjectField("Marker to appear at:", newPlayerMarker, typeof(Marker), true);

                    newPlayerMarker_ID = FieldToID <Marker> (newPlayerMarker, newPlayerMarker_ID);
                    newPlayerMarker    = IDToField <Marker> (newPlayerMarker, newPlayerMarker_ID, false);
                }
                else if (newPlayerPosition == NewPlayerPosition.AppearInOtherScene)
                {
                    chooseNewSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", chooseNewSceneBy);
                    if (chooseNewSceneBy == ChooseSceneBy.Name)
                    {
                        newPlayerSceneName = EditorGUILayout.TextField("Scene to appear in:", newPlayerSceneName);
                    }
                    else
                    {
                        newPlayerScene = EditorGUILayout.IntField("Scene to appear in:", newPlayerScene);
                    }

                    newPlayerNPC = (NPC)EditorGUILayout.ObjectField("NPC to be replaced:", newPlayerNPC, typeof(NPC), true);

                    newPlayerNPC_ID = FieldToID <NPC> (newPlayerNPC, newPlayerNPC_ID);
                    newPlayerNPC    = IDToField <NPC> (newPlayerNPC, newPlayerNPC_ID, false);

                    EditorGUILayout.HelpBox("If the Player has an Associated NPC defined, it will be used if none is defined here.", MessageType.Info);
                }
                else if (newPlayerPosition == NewPlayerPosition.ReplaceAssociatedNPC)
                {
                    EditorGUILayout.HelpBox("A Player's 'Associated NPC' is defined in the Player Inspector.", MessageType.Info);
                }

                if (restorePreviousData)
                {
                    EditorGUILayout.EndVertical();
                }

                if (newPlayerPosition == NewPlayerPosition.ReplaceNPC ||
                    newPlayerPosition == NewPlayerPosition.AppearAtMarker ||
                    newPlayerPosition == NewPlayerPosition.AppearInOtherScene ||
                    newPlayerPosition == NewPlayerPosition.ReplaceAssociatedNPC)
                {
                    EditorGUILayout.Space();
                    oldPlayer = (OldPlayer)EditorGUILayout.EnumPopup("Old Player:", oldPlayer);

                    if (oldPlayer == OldPlayer.ReplaceWithNPC)
                    {
                        oldPlayerNPC = (NPC)EditorGUILayout.ObjectField("NPC to replace old Player:", oldPlayerNPC, typeof(NPC), true);

                        oldPlayerNPC_ID = FieldToID <NPC> (oldPlayerNPC, oldPlayerNPC_ID);
                        oldPlayerNPC    = IDToField <NPC> (oldPlayerNPC, oldPlayerNPC_ID, false);

                        EditorGUILayout.HelpBox("This NPC must be already be present in the scene - either within the scene file itself, or spawned at runtime with the 'Object: Add or remove' Action.", MessageType.Info);
                    }
                    else if (oldPlayer == OldPlayer.ReplaceWithAssociatedNPC)
                    {
                        EditorGUILayout.HelpBox("A Player's 'Associated NPC' is defined in the Player Inspector.", MessageType.Info);
                    }
                }
            }
            else
            {
                EditorGUILayout.LabelField("No players exist!");
                playerID = -1;
            }

            alwaysSnapCamera = EditorGUILayout.Toggle("Snap camera if shared?", alwaysSnapCamera);

            EditorGUILayout.Space();

            AfterRunningOption();
        }
Пример #22
0
        override public void ShowGUI()
        {
            if (!settingsManager)
            {
                settingsManager = AdvGame.GetReferences().settingsManager;
            }

            if (!settingsManager)
            {
                return;
            }

            if (settingsManager.playerSwitching == PlayerSwitching.DoNotAllow)
            {
                EditorGUILayout.HelpBox("This Action requires Player Switching to be allowed, as set in the Settings Manager.", MessageType.Info);
                return;
            }

            // Create a string List of the field's names (for the PopUp box)
            List <string> labelList = new List <string>();

            int i = 0;

            playerNumber = -1;

            if (settingsManager.players.Count > 0)
            {
                foreach (PlayerPrefab playerPrefab in settingsManager.players)
                {
                    if (playerPrefab.playerOb != null)
                    {
                        labelList.Add(playerPrefab.playerOb.name);
                    }
                    else
                    {
                        labelList.Add("(Undefined prefab)");
                    }

                    // If a player has been removed, make sure selected player is still valid
                    if (playerPrefab.ID == playerID)
                    {
                        playerNumber = i;
                    }

                    i++;
                }

                if (playerNumber == -1)
                {
                    // Wasn't found (item was possibly deleted), so revert to zero
                    Debug.LogWarning("Previously chosen Player no longer exists!");

                    playerNumber = 0;
                    playerID     = 0;
                }

                playerNumber = EditorGUILayout.Popup("New Player:", playerNumber, labelList.ToArray());
                playerID     = settingsManager.players[playerNumber].ID;

                restorePreviousData = EditorGUILayout.Toggle("Restore position?", restorePreviousData);
                if (restorePreviousData)
                {
                    EditorGUILayout.LabelField("If first time in game:", EditorStyles.boldLabel);
                }

                newPlayerPosition = (NewPlayerPosition)EditorGUILayout.EnumPopup("New Player position:", newPlayerPosition);

                if (newPlayerPosition == NewPlayerPosition.ReplaceNPC)
                {
                    newPlayerNPC = (NPC)EditorGUILayout.ObjectField("NPC to be replaced:", newPlayerNPC, typeof(NPC), true);

                    newPlayerNPC_ID = FieldToID <NPC> (newPlayerNPC, newPlayerNPC_ID);
                    newPlayerNPC    = IDToField <NPC> (newPlayerNPC, newPlayerNPC_ID, false);
                }
                else if (newPlayerPosition == NewPlayerPosition.AppearAtMarker)
                {
                    newPlayerMarker = (Marker)EditorGUILayout.ObjectField("Marker to appear at:", newPlayerMarker, typeof(Marker), true);

                    newPlayerMarker_ID = FieldToID <Marker> (newPlayerMarker, newPlayerMarker_ID);
                    newPlayerMarker    = IDToField <Marker> (newPlayerMarker, newPlayerMarker_ID, false);
                }
                else if (newPlayerPosition == NewPlayerPosition.AppearInOtherScene)
                {
                    chooseNewSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", chooseNewSceneBy);
                    if (chooseNewSceneBy == ChooseSceneBy.Name)
                    {
                        newPlayerSceneName = EditorGUILayout.TextField("Scene to appear in:", newPlayerSceneName);
                    }
                    else
                    {
                        newPlayerScene = EditorGUILayout.IntField("Scene to appear in:", newPlayerScene);
                    }
                }

                if (newPlayerPosition == NewPlayerPosition.ReplaceNPC || newPlayerPosition == NewPlayerPosition.AppearAtMarker)
                {
                    EditorGUILayout.Space();
                    oldPlayer = (OldPlayer)EditorGUILayout.EnumPopup("Old Player", oldPlayer);

                    if (oldPlayer == OldPlayer.ReplaceWithNPC)
                    {
                        oldPlayerNPC = (NPC)EditorGUILayout.ObjectField("NPC to replace old Player:", oldPlayerNPC, typeof(NPC), true);

                        oldPlayerNPC_ID = FieldToID <NPC> (oldPlayerNPC, oldPlayerNPC_ID);
                        oldPlayerNPC    = IDToField <NPC> (oldPlayerNPC, oldPlayerNPC_ID, false);
                    }
                }
            }

            else
            {
                EditorGUILayout.LabelField("No players exist!");
                playerID     = -1;
                playerNumber = -1;
            }

            EditorGUILayout.Space();

            AfterRunningOption();
        }
Пример #23
0
        public override bool CheckCondition()
        {
            int actualSceneNumber = 0;

            if (KickStarter.settingsManager == null || KickStarter.settingsManager.playerSwitching == PlayerSwitching.DoNotAllow)
            {
                runtimePlayerID = -1;
            }

            if (runtimePlayerID >= 0)
            {
                PlayerData playerData = KickStarter.saveSystem.GetPlayerData(runtimePlayerID);
                if (playerData != null)
                {
                    if (sceneToCheck == SceneToCheck.Previous)
                    {
                        actualSceneNumber = playerData.previousScene;
                    }
                    else
                    {
                        actualSceneNumber = playerData.currentScene;
                    }

                    ChooseSceneByPlayerSwitching csbps = (ChooseSceneByPlayerSwitching)chooseSceneByPlayerSwitching;
                    if (csbps == ChooseSceneByPlayerSwitching.CurrentMain)
                    {
                        return(actualSceneNumber == SceneChanger.CurrentSceneIndex);
                    }
                    chooseSceneBy = (ChooseSceneBy)chooseSceneByPlayerSwitching;
                }
                else
                {
                    LogWarning("Could not find scene data for Player ID = " + playerID);
                }
            }
            else
            {
                if (sceneToCheck == SceneToCheck.Previous)
                {
                    actualSceneNumber = KickStarter.sceneChanger.PreviousSceneIndex;
                }
                else
                {
                    actualSceneNumber = SceneChanger.CurrentSceneIndex;
                }
            }

            if (actualSceneNumber == -1 && sceneToCheck == SceneToCheck.Previous)
            {
                LogWarning("The " + sceneToCheck + " scene's Build Index is currently " + actualSceneNumber + " - is this the game's first scene?");
                return(false);
            }

            string actualSceneName = KickStarter.sceneChanger.IndexToName(actualSceneNumber);

            if (intCondition == IntCondition.EqualTo)
            {
                if (chooseSceneBy == ChooseSceneBy.Name && actualSceneName == AdvGame.ConvertTokens(sceneName))
                {
                    return(true);
                }

                if (chooseSceneBy == ChooseSceneBy.Number && actualSceneNumber == sceneNumber)
                {
                    return(true);
                }
            }
            else if (intCondition == IntCondition.NotEqualTo)
            {
                if (chooseSceneBy == ChooseSceneBy.Name && actualSceneName != AdvGame.ConvertTokens(sceneName))
                {
                    return(true);
                }

                if (chooseSceneBy == ChooseSceneBy.Number && actualSceneNumber != sceneNumber)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #24
0
        public override void ShowGUI()
        {
            endGameType = (AC_EndGameType) EditorGUILayout.EnumPopup ("Command:", endGameType);

            if (endGameType == AC_EndGameType.RestartGame)
            {
                chooseSceneBy = (ChooseSceneBy) EditorGUILayout.EnumPopup ("Choose scene by:", chooseSceneBy);
                if (chooseSceneBy == ChooseSceneBy.Name)
                {
                    sceneName = EditorGUILayout.TextField ("Scene to restart to:", sceneName);
                }
                else
                {
                    sceneNumber = EditorGUILayout.IntField ("Scene to restart to:", sceneNumber);
                }
            }
        }
Пример #25
0
		public void ShowGUI ()
		{
			EditorGUILayout.LabelField ("Save game settings", EditorStyles.boldLabel);
			
			if (saveFileName == "")
			{
				saveFileName = SaveSystem.SetProjectName ();
			}
			saveFileName = EditorGUILayout.TextField ("Save filename:", saveFileName);
			#if !UNITY_WEBPLAYER && !UNITY_ANDROID
			saveTimeDisplay = (SaveTimeDisplay) EditorGUILayout.EnumPopup ("Time display:", saveTimeDisplay);
			takeSaveScreenshots = EditorGUILayout.ToggleLeft ("Take screenshot when saving?", takeSaveScreenshots);
			#else
			EditorGUILayout.HelpBox ("Save-game screenshots are disabled for WebPlayer and Android platforms.", MessageType.Info);
			takeSaveScreenshots = false;
			#endif
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Cutscene settings:", EditorStyles.boldLabel);
			
			actionListOnStart = (ActionListAsset) EditorGUILayout.ObjectField ("ActionList on start game:", actionListOnStart, typeof (ActionListAsset), false);
			blackOutWhenSkipping = EditorGUILayout.Toggle ("Black out when skipping?", blackOutWhenSkipping);
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Character settings:", EditorStyles.boldLabel);
			
			CreatePlayersGUI ();
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Interface settings", EditorStyles.boldLabel);
			
			movementMethod = (MovementMethod) EditorGUILayout.EnumPopup ("Movement method:", movementMethod);
			if (movementMethod == MovementMethod.UltimateFPS && !UltimateFPSIntegration.IsDefinePresent ())
			{
				EditorGUILayout.HelpBox ("The 'UltimateFPSIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
			}

			inputMethod = (InputMethod) EditorGUILayout.EnumPopup ("Input method:", inputMethod);
			interactionMethod = (AC_InteractionMethod) EditorGUILayout.EnumPopup ("Interaction method:", interactionMethod);
			
			if (inputMethod != InputMethod.TouchScreen)
			{
				useOuya = EditorGUILayout.ToggleLeft ("Playing on OUYA platform?", useOuya);
				if (useOuya && !OuyaIntegration.IsDefinePresent ())
				{
					EditorGUILayout.HelpBox ("The 'OUYAIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
				}
				if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
				{
					selectInteractions = (SelectInteractions) EditorGUILayout.EnumPopup ("Select Interactions by:", selectInteractions);
					if (selectInteractions != SelectInteractions.CyclingCursorAndClickingHotspot)
					{
						seeInteractions = (SeeInteractions) EditorGUILayout.EnumPopup ("See Interactions with:", seeInteractions);
					}
					if (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot)
					{
						cycleInventoryCursors = EditorGUILayout.ToggleLeft ("Cycle through Inventory items too?", cycleInventoryCursors);
						autoCycleWhenInteract = EditorGUILayout.ToggleLeft ("Auto-cycle after an Interaction?", autoCycleWhenInteract);
					}
				
					if (SelectInteractionMethod () == SelectInteractions.ClickingMenu)
					{
						cancelInteractions = (CancelInteractions) EditorGUILayout.EnumPopup ("Close interactions with:", cancelInteractions);
					}
					else
					{
						cancelInteractions = CancelInteractions.CursorLeavesMenus;
					}
				}
			}
			if (interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
			{
				autoCycleWhenInteract = EditorGUILayout.ToggleLeft ("Reset cursor after an Interaction?", autoCycleWhenInteract);
			}
			lockCursorOnStart = EditorGUILayout.ToggleLeft ("Lock cursor in screen's centre when game begins?", lockCursorOnStart);
			hideLockedCursor = EditorGUILayout.ToggleLeft ("Hide cursor when locked in screen's centre?", hideLockedCursor);
			if (IsInFirstPerson ())
			{
				disableFreeAimWhenDragging = EditorGUILayout.ToggleLeft ("Disable free-aim when dragging?", disableFreeAimWhenDragging);
			}
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Inventory settings", EditorStyles.boldLabel);
			
			reverseInventoryCombinations = EditorGUILayout.ToggleLeft ("Combine interactions work in reverse?", reverseInventoryCombinations);
			if (interactionMethod != AC_InteractionMethod.ContextSensitive)
			{
				inventoryInteractions = (InventoryInteractions) EditorGUILayout.EnumPopup ("Inventory interactions:", inventoryInteractions);
			}
			if (interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction || inventoryInteractions == InventoryInteractions.Single)
			{
				inventoryDragDrop = EditorGUILayout.ToggleLeft ("Drag and drop Inventory interface?", inventoryDragDrop);
				if (!inventoryDragDrop)
				{
					inventoryDisableLeft = EditorGUILayout.ToggleLeft ("Left-click deselects active item?", inventoryDisableLeft);
					if (interactionMethod == AC_InteractionMethod.ContextSensitive || inventoryInteractions == InventoryInteractions.Single)
					{
						rightClickInventory = (RightClickInventory) EditorGUILayout.EnumPopup ("Right-click active item:", rightClickInventory);
					}
					
					if (movementMethod == MovementMethod.PointAndClick)
					{
						canMoveWhenActive = EditorGUILayout.ToggleLeft ("Can move player if an Item is active?", canMoveWhenActive);
					}
				}
				else
				{
					inventoryDropLook = EditorGUILayout.ToggleLeft ("Can drop an Item onto itself to Examine it?", inventoryDropLook);
				}
				inventoryActiveEffect = (InventoryActiveEffect) EditorGUILayout.EnumPopup ("Active cursor FX:", inventoryActiveEffect);
				if (inventoryActiveEffect == InventoryActiveEffect.Pulse)
				{
					inventoryPulseSpeed = EditorGUILayout.Slider ("Active FX pulse speed:", inventoryPulseSpeed, 0.5f, 2f);
				}
				activeWhenUnhandled = EditorGUILayout.ToggleLeft ("Show Active FX when an Interaction is unhandled?", activeWhenUnhandled);
				canReorderItems = EditorGUILayout.ToggleLeft ("Items can be re-ordered in Menu?", canReorderItems);
				hideSelectedFromMenu = EditorGUILayout.ToggleLeft ("Hide currently active Item in Menu?", hideSelectedFromMenu);
			}
			activeWhenHover = EditorGUILayout.ToggleLeft ("Show Active FX when Cursor hovers over Item in Menu?", activeWhenHover);
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Required inputs:", EditorStyles.boldLabel);
			EditorGUILayout.HelpBox ("The following inputs are available for the chosen interface settings:" + GetInputList (), MessageType.Info);
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Movement settings", EditorStyles.boldLabel);
			
			if ((inputMethod == InputMethod.TouchScreen && movementMethod != MovementMethod.PointAndClick) || movementMethod == MovementMethod.Drag)
			{
				dragWalkThreshold = EditorGUILayout.FloatField ("Walk threshold:", dragWalkThreshold);
				dragRunThreshold = EditorGUILayout.FloatField ("Run threshold:", dragRunThreshold);
				
				if (inputMethod == InputMethod.TouchScreen && movementMethod == MovementMethod.FirstPerson)
				{
					freeAimTouchSpeed = EditorGUILayout.FloatField ("Freelook speed:", freeAimTouchSpeed);
				}
				
				drawDragLine = EditorGUILayout.Toggle ("Draw drag line?", drawDragLine);
				if (drawDragLine)
				{
					dragLineWidth = EditorGUILayout.FloatField ("Drag line width:", dragLineWidth);
					dragLineColor = EditorGUILayout.ColorField ("Drag line colour:", dragLineColor);
				}
			}
			else if (movementMethod == MovementMethod.Direct)
			{
				directMovementType = (DirectMovementType) EditorGUILayout.EnumPopup ("Direct-movement type:", directMovementType);
				if (directMovementType == DirectMovementType.RelativeToCamera)
				{
					limitDirectMovement = (LimitDirectMovement) EditorGUILayout.EnumPopup ("Movement limitation:", limitDirectMovement);
				}
			}
			else if (movementMethod == MovementMethod.PointAndClick)
			{
				clickPrefab = (Transform) EditorGUILayout.ObjectField ("Click marker:", clickPrefab, typeof (Transform), false);
				walkableClickRange = EditorGUILayout.Slider ("NavMesh search %:", walkableClickRange, 0f, 1f);
				doubleClickMovement = EditorGUILayout.Toggle ("Double-click to move?", doubleClickMovement);
			}
			if (movementMethod == MovementMethod.StraightToCursor)
			{
				dragRunThreshold = EditorGUILayout.FloatField ("Run threshold:", dragRunThreshold);
				singleTapStraight = EditorGUILayout.Toggle ("Single-click works too?", singleTapStraight);
			}
			if (movementMethod == MovementMethod.FirstPerson && inputMethod == InputMethod.TouchScreen)
			{
				dragAffects = (DragAffects) EditorGUILayout.EnumPopup ("Touch-drag affects:", dragAffects);
			}
			if ((movementMethod == MovementMethod.Direct || movementMethod == MovementMethod.FirstPerson) && inputMethod != InputMethod.TouchScreen)
			{
				jumpSpeed = EditorGUILayout.Slider ("Jump speed:", jumpSpeed, 1f, 10f);
			}
			
			destinationAccuracy = EditorGUILayout.Slider ("Destination accuracy:", destinationAccuracy, 0f, 1f);
			
			if (inputMethod == InputMethod.TouchScreen)
			{
				EditorGUILayout.Space ();
				EditorGUILayout.LabelField ("Touch Screen settings", EditorStyles.boldLabel);
				
				offsetTouchCursor = EditorGUILayout.Toggle ("Drag cursor with touch?", offsetTouchCursor);
				doubleTapHotspots = EditorGUILayout.Toggle ("Double-tap Hotspots?", doubleTapHotspots);
			}
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Camera settings", EditorStyles.boldLabel);
			
			cameraPerspective_int = (int) cameraPerspective;
			cameraPerspective_int = EditorGUILayout.Popup ("Camera perspective:", cameraPerspective_int, cameraPerspective_list);
			cameraPerspective = (CameraPerspective) cameraPerspective_int;
			if (movementMethod == MovementMethod.FirstPerson)
			{
				cameraPerspective = CameraPerspective.ThreeD;
			}
			if (cameraPerspective == CameraPerspective.TwoD)
			{
				movingTurning = (MovingTurning) EditorGUILayout.EnumPopup ("Moving and turning:", movingTurning);
				if (movingTurning == MovingTurning.TopDown || movingTurning == MovingTurning.Unity2D)
				{
					verticalReductionFactor = EditorGUILayout.Slider ("Vertical movement factor:", verticalReductionFactor, 0.1f, 1f);
				}
			}
			
			forceAspectRatio = EditorGUILayout.Toggle ("Force aspect ratio?", forceAspectRatio);
			if (forceAspectRatio)
			{
				wantedAspectRatio = EditorGUILayout.FloatField ("Aspect ratio:", wantedAspectRatio);
				#if UNITY_IPHONE
				landscapeModeOnly = EditorGUILayout.Toggle ("Landscape-mode only?", landscapeModeOnly);
				#endif
			}
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Hotpot settings", EditorStyles.boldLabel);
			
			hotspotDetection = (HotspotDetection) EditorGUILayout.EnumPopup ("Hotspot detection method:", hotspotDetection);
			
			if (hotspotDetection == HotspotDetection.PlayerVicinity && (movementMethod == MovementMethod.Direct || IsInFirstPerson ()))
			{
				hotspotsInVicinity = (HotspotsInVicinity) EditorGUILayout.EnumPopup ("Hotspots in vicinity:", hotspotsInVicinity);
			}
			
			if (cameraPerspective != CameraPerspective.TwoD)
			{
				playerFacesHotspots = EditorGUILayout.Toggle ("Player turns head to active?", playerFacesHotspots);
			}
			
			hotspotIconDisplay = (HotspotIconDisplay) EditorGUILayout.EnumPopup ("Display Hotspot icon:", hotspotIconDisplay);
			if (hotspotIconDisplay != HotspotIconDisplay.Never)
			{
				hotspotIcon = (HotspotIcon) EditorGUILayout.EnumPopup ("Hotspot icon type:", hotspotIcon);
				if (hotspotIcon == HotspotIcon.Texture)
				{
					hotspotIconTexture = (Texture2D) EditorGUILayout.ObjectField ("Hotspot icon texture:", hotspotIconTexture, typeof (Texture2D), false);
				}
				hotspotIconSize = EditorGUILayout.FloatField ("Hotspot icon size:", hotspotIconSize);
			}
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Raycast settings", EditorStyles.boldLabel);
			navMeshRaycastLength = EditorGUILayout.FloatField ("NavMesh ray length:", navMeshRaycastLength);
			hotspotRaycastLength = EditorGUILayout.FloatField ("Hotspot ray length:", hotspotRaycastLength);
			moveableRaycastLength = EditorGUILayout.FloatField ("Moveable ray length:", moveableRaycastLength);
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Layer names", EditorStyles.boldLabel);
			
			hotspotLayer = EditorGUILayout.TextField ("Hotspot:", hotspotLayer);
			navMeshLayer = EditorGUILayout.TextField ("Nav mesh:", navMeshLayer);
			if (cameraPerspective == CameraPerspective.TwoPointFiveD)
			{
				backgroundImageLayer = EditorGUILayout.TextField ("Background image:", backgroundImageLayer);
			}
			deactivatedLayer = EditorGUILayout.TextField ("Deactivated:", deactivatedLayer);
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Loading scene", EditorStyles.boldLabel);
			useLoadingScreen = EditorGUILayout.Toggle ("Use loading screen?", useLoadingScreen);
			if (useLoadingScreen)
			{
				loadingSceneIs = (ChooseSceneBy) EditorGUILayout.EnumPopup ("Choose loading scene by:", loadingSceneIs);
				if (loadingSceneIs == ChooseSceneBy.Name)
				{
					loadingSceneName = EditorGUILayout.TextField ("Loading scene name:", loadingSceneName);
				}
				else
				{
					loadingScene = EditorGUILayout.IntField ("Loading screen scene:", loadingScene);
				}
			}
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Options data", EditorStyles.boldLabel);
			
			if (!PlayerPrefs.HasKey (ppKey))
			{
				optionsData = new OptionsData ();
				optionsBinary = Serializer.SerializeObjectBinary (optionsData);
				PlayerPrefs.SetString (ppKey, optionsBinary);
			}
			
			optionsBinary = PlayerPrefs.GetString (ppKey);
			optionsData = Serializer.DeserializeObjectBinary <OptionsData> (optionsBinary);
			
			optionsData.speechVolume = EditorGUILayout.Slider ("Speech volume:", optionsData.speechVolume, 0f, 1f);
			optionsData.musicVolume = EditorGUILayout.Slider ("Music volume:", optionsData.musicVolume, 0f, 1f);
			optionsData.sfxVolume = EditorGUILayout.Slider ("SFX volume:", optionsData.sfxVolume, 0f, 1f);
			optionsData.showSubtitles = EditorGUILayout.Toggle ("Show subtitles?", optionsData.showSubtitles);
			optionsData.language = EditorGUILayout.IntField ("Language:", optionsData.language);
			
			optionsBinary = Serializer.SerializeObjectBinary (optionsData);
			PlayerPrefs.SetString (ppKey, optionsBinary);
			
			if (GUILayout.Button ("Reset options data"))
			{
				PlayerPrefs.DeleteKey ("Options");
				optionsData = new OptionsData ();
				Debug.Log ("PlayerPrefs cleared");
			}
			
			if (GUI.changed)
			{
				EditorUtility.SetDirty (this);
			}
		}
        public override void ShowGUI(List <ActionParameter> parameters)
        {
            if (KickStarter.settingsManager != null)
            {
                if (KickStarter.settingsManager.playerSwitching == PlayerSwitching.DoNotAllow)
                {
                    EditorGUILayout.HelpBox("This Action requires Player Switching to be allowed, as set in the Settings Manager.", MessageType.Info);
                    return;
                }

                if (KickStarter.settingsManager.players.Count == 0)
                {
                    EditorGUILayout.HelpBox("No players are defined in the Settings Manager.", MessageType.Warning);
                    return;
                }

                playerIDParameterID = Action.ChooseParameterGUI("New Player ID:", parameters, playerIDParameterID, ParameterType.Integer);
                if (playerIDParameterID == -1)
                {
                    // Create a string List of the field's names (for the PopUp box)
                    List <string> labelList = new List <string>();

                    int i            = 0;
                    int playerNumber = -1;

                    foreach (PlayerPrefab playerPrefab in KickStarter.settingsManager.players)
                    {
                        if (playerPrefab.playerOb != null)
                        {
                            labelList.Add(playerPrefab.playerOb.name);
                        }
                        else
                        {
                            labelList.Add("(Undefined prefab)");
                        }

                        // If a player has been removed, make sure selected player is still valid
                        if (playerPrefab.ID == playerID)
                        {
                            playerNumber = i;
                        }

                        i++;
                    }

                    if (playerNumber == -1)
                    {
                        // Wasn't found (item was possibly deleted), so revert to zero
                        if (playerID > 0)
                        {
                            LogWarning("Previously chosen Player no longer exists!");
                        }

                        playerNumber = 0;
                        playerID     = 0;
                    }

                    playerNumber = EditorGUILayout.Popup("Player:", playerNumber, labelList.ToArray());
                    playerID     = KickStarter.settingsManager.players[playerNumber].ID;
                }

                moveToCurrentScene = EditorGUILayout.Toggle("Move to current scene?", moveToCurrentScene);
                if (moveToCurrentScene)
                {
                    teleportPlayerStartMethod = (TeleportPlayerStartMethod)EditorGUILayout.EnumPopup("PlayerStart:", teleportPlayerStartMethod);

                    if (teleportPlayerStartMethod == TeleportPlayerStartMethod.EnteredHere)
                    {
                        newTransformParameterID = Action.ChooseParameterGUI("New PlayerStart:", parameters, newTransformParameterID, ParameterType.GameObject);
                        if (newTransformParameterID >= 0)
                        {
                            newTransformConstantID = 0;
                            newTransform           = null;
                        }
                        else
                        {
                            newTransform = (PlayerStart)EditorGUILayout.ObjectField("New PlayerStart:", newTransform, typeof(PlayerStart), true);

                            newTransformConstantID = FieldToID(newTransform, newTransformConstantID);
                            newTransform           = IDToField(newTransform, newTransformConstantID, true);
                        }
                    }
                }
                else
                {
                    chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);
                    switch (chooseSceneBy)
                    {
                    case ChooseSceneBy.Number:
                        newSceneIndex = EditorGUILayout.IntField("New scene index:", newSceneIndex);
                        break;

                    case ChooseSceneBy.Name:
                        newSceneName = EditorGUILayout.TextField("New scene name:", newSceneName);
                        break;

                    default:
                        break;
                    }

                    teleportPlayerStartMethod = (TeleportPlayerStartMethod)EditorGUILayout.EnumPopup("PlayerStart:", teleportPlayerStartMethod);

                    if (teleportPlayerStartMethod == TeleportPlayerStartMethod.EnteredHere)
                    {
                        newTransformParameterID = -1;
                        newTransform            = (PlayerStart)EditorGUILayout.ObjectField("New PlayerStart:", newTransform, typeof(PlayerStart), true);

                        newTransformConstantID = FieldToID(newTransform, newTransformConstantID, true);
                        newTransform           = IDToField(newTransform, newTransformConstantID, true);
                    }
                }
            }
            else
            {
                EditorGUILayout.HelpBox("No Settings Manager assigned!", MessageType.Warning);
            }

            AfterRunningOption();
        }
Пример #27
0
        public override void ShowGUI()
        {
            if (!settingsManager)
            {
                settingsManager = AdvGame.GetReferences ().settingsManager;
            }

            if (!settingsManager)
            {
                return;
            }

            if (settingsManager.playerSwitching == PlayerSwitching.DoNotAllow)
            {
                EditorGUILayout.HelpBox ("This Action requires Player Switching to be allowed, as set in the Settings Manager.", MessageType.Info);
                return;
            }

            // Create a string List of the field's names (for the PopUp box)
            List<string> labelList = new List<string>();

            int i = 0;
            playerNumber = -1;

            if (settingsManager.players.Count > 0)
            {
                foreach (PlayerPrefab playerPrefab in settingsManager.players)
                {
                    if (playerPrefab.playerOb != null)
                    {
                        labelList.Add (playerPrefab.playerOb.name);
                    }
                    else
                    {
                        labelList.Add ("(Undefined prefab)");
                    }

                    // If a player has been removed, make sure selected player is still valid
                    if (playerPrefab.ID == playerID)
                    {
                        playerNumber = i;
                    }

                    i++;
                }

                if (playerNumber == -1)
                {
                    // Wasn't found (item was possibly deleted), so revert to zero
                    ACDebug.LogWarning ("Previously chosen Player no longer exists!");

                    playerNumber = 0;
                    playerID = 0;
                }

                playerNumber = EditorGUILayout.Popup ("New Player:", playerNumber, labelList.ToArray());
                playerID = settingsManager.players[playerNumber].ID;

                if (AdvGame.GetReferences ().settingsManager == null || !AdvGame.GetReferences ().settingsManager.shareInventory)
                {
                    keepInventory = EditorGUILayout.Toggle ("Transfer inventory?", keepInventory);
                }
                restorePreviousData = EditorGUILayout.Toggle ("Restore position?", restorePreviousData);
                if (restorePreviousData)
                {
                    EditorGUILayout.LabelField ("If first time in game:", EditorStyles.boldLabel);
                }

                newPlayerPosition = (NewPlayerPosition) EditorGUILayout.EnumPopup ("New Player position:", newPlayerPosition);

                if (newPlayerPosition == NewPlayerPosition.ReplaceNPC)
                {
                    newPlayerNPC = (NPC) EditorGUILayout.ObjectField ("NPC to be replaced:", newPlayerNPC, typeof (NPC), true);

                    newPlayerNPC_ID = FieldToID <NPC> (newPlayerNPC, newPlayerNPC_ID);
                    newPlayerNPC = IDToField <NPC> (newPlayerNPC, newPlayerNPC_ID, false);
                }
                else if (newPlayerPosition == NewPlayerPosition.AppearAtMarker)
                {
                    newPlayerMarker = (Marker) EditorGUILayout.ObjectField ("Marker to appear at:", newPlayerMarker, typeof (Marker), true);

                    newPlayerMarker_ID = FieldToID <Marker> (newPlayerMarker, newPlayerMarker_ID);
                    newPlayerMarker = IDToField <Marker> (newPlayerMarker, newPlayerMarker_ID, false);
                }
                else if (newPlayerPosition == NewPlayerPosition.AppearInOtherScene)
                {
                    chooseNewSceneBy = (ChooseSceneBy) EditorGUILayout.EnumPopup ("Choose scene by:", chooseNewSceneBy);
                    if (chooseNewSceneBy == ChooseSceneBy.Name)
                    {
                        newPlayerSceneName = EditorGUILayout.TextField ("Scene to appear in:", newPlayerSceneName);
                    }
                    else
                    {
                        newPlayerScene = EditorGUILayout.IntField ("Scene to appear in:", newPlayerScene);
                    }
                }

                if (newPlayerPosition == NewPlayerPosition.ReplaceNPC || newPlayerPosition == NewPlayerPosition.AppearAtMarker)
                {
                    EditorGUILayout.Space ();
                    oldPlayer = (OldPlayer) EditorGUILayout.EnumPopup ("Old Player", oldPlayer);

                    if (oldPlayer == OldPlayer.ReplaceWithNPC)
                    {
                        oldPlayerNPC = (NPC) EditorGUILayout.ObjectField ("NPC to replace old Player:", oldPlayerNPC, typeof (NPC), true);

                        oldPlayerNPC_ID = FieldToID <NPC> (oldPlayerNPC, oldPlayerNPC_ID);
                        oldPlayerNPC = IDToField <NPC> (oldPlayerNPC, oldPlayerNPC_ID, false);
                    }
                }
            }

            else
            {
                EditorGUILayout.LabelField ("No players exist!");
                playerID = -1;
                playerNumber = -1;
            }

            EditorGUILayout.Space ();

            AfterRunningOption ();
        }
Пример #28
0
        public override void ShowGUI(List <ActionParameter> parameters)
        {
            chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);
            if (chooseSceneBy == ChooseSceneBy.Name)
            {
                sceneNameParameterID = Action.ChooseParameterGUI("Scene name:", parameters, sceneNameParameterID, ParameterType.String);
                if (sceneNameParameterID < 0)
                {
                    sceneName = EditorGUILayout.TextField("Scene name:", sceneName);
                }
            }
            else
            {
                sceneNumberParameterID = Action.ChooseParameterGUI("Scene number:", parameters, sceneNumberParameterID, ParameterType.Integer);
                if (sceneNumberParameterID < 0)
                {
                    sceneNumber = EditorGUILayout.IntField("Scene number:", sceneNumber);
                }
            }

            onlyPreload = EditorGUILayout.ToggleLeft("Don't change scene, just preload data?", onlyPreload);

            if (onlyPreload)
            {
                if (AdvGame.GetReferences() != null && AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.useAsyncLoading)
                {
                }
                else if (AdvGame.GetReferences() != null && AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.useLoadingScreen)
                {
                    EditorGUILayout.HelpBox("Preloaded scene data can not be used if loading screens are used.", MessageType.Warning);
                }
                else
                {
                    EditorGUILayout.HelpBox("To pre-load scenes, 'Load scenes asynchronously?' must be enabled in the Settings Manager.", MessageType.Warning);
                }

                numSockets = 1;
                AfterRunningOption();
            }
            else
            {
                forceReload      = EditorGUILayout.ToggleLeft("Reload even if scene is already open?", forceReload);
                relativePosition = EditorGUILayout.ToggleLeft("Position Player relative to Marker?", relativePosition);
                if (relativePosition)
                {
                    relativeMarkerParameterID = Action.ChooseParameterGUI("Relative Marker:", parameters, relativeMarkerParameterID, ParameterType.GameObject);
                    if (relativeMarkerParameterID >= 0)
                    {
                        relativeMarkerID = 0;
                        relativeMarker   = null;
                    }
                    else
                    {
                        relativeMarker = (Marker)EditorGUILayout.ObjectField("Relative Marker:", relativeMarker, typeof(Marker), true);

                        relativeMarkerID = FieldToID(relativeMarker, relativeMarkerID);
                        relativeMarker   = IDToField(relativeMarker, relativeMarkerID, false);
                    }
                }

                assignScreenOverlay = EditorGUILayout.ToggleLeft("Overlay current screen during switch?", assignScreenOverlay);
                if (isAssetFile)
                {
                    EditorGUILayout.HelpBox("To perform any Actions afterwards, 'Survive scene changes?' must be checked in the ActionList asset's properties.", MessageType.Info);
                    numSockets = 1;
                    AfterRunningOption();
                }
                else
                {
                    numSockets = 0;
                }
            }
        }
Пример #29
0
        public void ShowGUI()
        {
            EditorGUILayout.LabelField("Save game settings", EditorStyles.boldLabel);

            if (saveFileName == "")
            {
                saveFileName = SaveSystem.SetProjectName();
            }
            saveFileName = EditorGUILayout.TextField("Save filename:", saveFileName);
                        #if !UNITY_WEBPLAYER && !UNITY_ANDROID
            saveTimeDisplay     = (SaveTimeDisplay)EditorGUILayout.EnumPopup("Time display:", saveTimeDisplay);
            takeSaveScreenshots = EditorGUILayout.ToggleLeft("Take screenshot when saving?", takeSaveScreenshots);
                        #else
            EditorGUILayout.HelpBox("Save-game screenshots are disabled for WebPlayer and Android platforms.", MessageType.Info);
            takeSaveScreenshots = false;
                        #endif

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Cutscene settings:", EditorStyles.boldLabel);

            actionListOnStart    = ActionListAssetMenu.AssetGUI("ActionList on start game:", actionListOnStart);
            blackOutWhenSkipping = EditorGUILayout.Toggle("Black out when skipping?", blackOutWhenSkipping);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Character settings:", EditorStyles.boldLabel);

            CreatePlayersGUI();

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Interface settings", EditorStyles.boldLabel);

            movementMethod = (MovementMethod)EditorGUILayout.EnumPopup("Movement method:", movementMethod);
            if (movementMethod == MovementMethod.UltimateFPS && !UltimateFPSIntegration.IsDefinePresent())
            {
                EditorGUILayout.HelpBox("The 'UltimateFPSIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
            }

            inputMethod       = (InputMethod)EditorGUILayout.EnumPopup("Input method:", inputMethod);
            interactionMethod = (AC_InteractionMethod)EditorGUILayout.EnumPopup("Interaction method:", interactionMethod);

            if (inputMethod != InputMethod.TouchScreen)
            {
                useOuya = EditorGUILayout.ToggleLeft("Playing on OUYA platform?", useOuya);
                if (useOuya && !OuyaIntegration.IsDefinePresent())
                {
                    EditorGUILayout.HelpBox("The 'OUYAIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
                }
                if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    selectInteractions = (SelectInteractions)EditorGUILayout.EnumPopup("Select Interactions by:", selectInteractions);
                    if (selectInteractions != SelectInteractions.CyclingCursorAndClickingHotspot)
                    {
                        seeInteractions = (SeeInteractions)EditorGUILayout.EnumPopup("See Interactions with:", seeInteractions);
                        if (seeInteractions == SeeInteractions.ClickOnHotspot)
                        {
                            stopPlayerOnClickHotspot = EditorGUILayout.ToggleLeft("Stop player moving when click Hotspot?", stopPlayerOnClickHotspot);
                        }
                    }

                    if (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot)
                    {
                        autoCycleWhenInteract = EditorGUILayout.ToggleLeft("Auto-cycle after an Interaction?", autoCycleWhenInteract);
                    }

                    if (SelectInteractionMethod() == SelectInteractions.ClickingMenu)
                    {
                        cancelInteractions = (CancelInteractions)EditorGUILayout.EnumPopup("Close interactions with:", cancelInteractions);
                    }
                    else
                    {
                        cancelInteractions = CancelInteractions.CursorLeavesMenu;
                    }
                }
            }
            if (interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
            {
                autoCycleWhenInteract = EditorGUILayout.ToggleLeft("Reset cursor after an Interaction?", autoCycleWhenInteract);
            }
            lockCursorOnStart = EditorGUILayout.ToggleLeft("Lock cursor in screen's centre when game begins?", lockCursorOnStart);
            hideLockedCursor  = EditorGUILayout.ToggleLeft("Hide cursor when locked in screen's centre?", hideLockedCursor);
            onlyInteractWhenCursorUnlocked = EditorGUILayout.ToggleLeft("Disallow Interactions if cursor is unlocked?", onlyInteractWhenCursorUnlocked);
            if (IsInFirstPerson())
            {
                disableFreeAimWhenDragging = EditorGUILayout.ToggleLeft("Disable free-aim when dragging?", disableFreeAimWhenDragging);
            }
            if (inputMethod != InputMethod.TouchScreen)
            {
                runConversationsWithKeys = EditorGUILayout.ToggleLeft("Dialogue options can be selected with number keys?", runConversationsWithKeys);
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Inventory settings", EditorStyles.boldLabel);

            if (interactionMethod != AC_InteractionMethod.ContextSensitive)
            {
                inventoryInteractions = (InventoryInteractions)EditorGUILayout.EnumPopup("Inventory interactions:", inventoryInteractions);

                if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    if (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot)
                    {
                        cycleInventoryCursors = EditorGUILayout.ToggleLeft("Include Inventory items in Interaction cycles?", cycleInventoryCursors);
                    }
                    else
                    {
                        cycleInventoryCursors = EditorGUILayout.ToggleLeft("Include Inventory items in Interaction menus?", cycleInventoryCursors);
                    }
                }

                if (inventoryInteractions == InventoryInteractions.Multiple && CanSelectItems(false))
                {
                    selectInvWithUnhandled = EditorGUILayout.ToggleLeft("Select item if Interaction is unhandled?", selectInvWithUnhandled);
                    if (selectInvWithUnhandled)
                    {
                        CursorManager cursorManager = AdvGame.GetReferences().cursorManager;
                        if (cursorManager != null && cursorManager.cursorIcons != null && cursorManager.cursorIcons.Count > 0)
                        {
                            selectInvWithIconID = GetIconID("Select with unhandled:", selectInvWithIconID, cursorManager);
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("No Interaction cursors defined - please do so in the Cursor Manager.", MessageType.Info);
                        }
                    }

                    giveInvWithUnhandled = EditorGUILayout.ToggleLeft("Give item if Interaction is unhandled?", giveInvWithUnhandled);
                    if (giveInvWithUnhandled)
                    {
                        CursorManager cursorManager = AdvGame.GetReferences().cursorManager;
                        if (cursorManager != null && cursorManager.cursorIcons != null && cursorManager.cursorIcons.Count > 0)
                        {
                            giveInvWithIconID = GetIconID("Give with unhandled:", giveInvWithIconID, cursorManager);
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("No Interaction cursors defined - please do so in the Cursor Manager.", MessageType.Info);
                        }
                    }
                }
            }

            if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction && selectInteractions != SelectInteractions.ClickingMenu && inventoryInteractions == InventoryInteractions.Multiple)
            {
            }
            else
            {
                reverseInventoryCombinations = EditorGUILayout.ToggleLeft("Combine interactions work in reverse?", reverseInventoryCombinations);
            }

            //if (interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction || inventoryInteractions == InventoryInteractions.Single)
            if (CanSelectItems(false))
            {
                inventoryDragDrop = EditorGUILayout.ToggleLeft("Drag and drop Inventory interface?", inventoryDragDrop);
                if (!inventoryDragDrop)
                {
                    if (interactionMethod == AC_InteractionMethod.ContextSensitive || inventoryInteractions == InventoryInteractions.Single)
                    {
                        rightClickInventory = (RightClickInventory)EditorGUILayout.EnumPopup("Right-click active item:", rightClickInventory);
                    }
                }
                else if (inventoryInteractions == AC.InventoryInteractions.Single)
                {
                    inventoryDropLook = EditorGUILayout.ToggleLeft("Can drop an Item onto itself to Examine it?", inventoryDropLook);
                }
            }

            if (CanSelectItems(false) && !inventoryDragDrop)
            {
                inventoryDisableLeft = EditorGUILayout.ToggleLeft("Left-click deselects active item?", inventoryDisableLeft);

                if (movementMethod == MovementMethod.PointAndClick && !inventoryDisableLeft)
                {
                    canMoveWhenActive = EditorGUILayout.ToggleLeft("Can move player if an Item is active?", canMoveWhenActive);
                }
            }

            inventoryActiveEffect = (InventoryActiveEffect)EditorGUILayout.EnumPopup("Active cursor FX:", inventoryActiveEffect);
            if (inventoryActiveEffect == InventoryActiveEffect.Pulse)
            {
                inventoryPulseSpeed = EditorGUILayout.Slider("Active FX pulse speed:", inventoryPulseSpeed, 0.5f, 2f);
            }

            activeWhenUnhandled  = EditorGUILayout.ToggleLeft("Show Active FX when an Interaction is unhandled?", activeWhenUnhandled);
            canReorderItems      = EditorGUILayout.ToggleLeft("Items can be re-ordered in Menu?", canReorderItems);
            hideSelectedFromMenu = EditorGUILayout.ToggleLeft("Hide currently active Item in Menu?", hideSelectedFromMenu);
            activeWhenHover      = EditorGUILayout.ToggleLeft("Show Active FX when Cursor hovers over Item in Menu?", activeWhenHover);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Required inputs:", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("The following inputs are available for the chosen interface settings:" + GetInputList(), MessageType.Info);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Movement settings", EditorStyles.boldLabel);

            if ((inputMethod == InputMethod.TouchScreen && movementMethod != MovementMethod.PointAndClick) || movementMethod == MovementMethod.Drag)
            {
                dragWalkThreshold = EditorGUILayout.FloatField("Walk threshold:", dragWalkThreshold);
                dragRunThreshold  = EditorGUILayout.FloatField("Run threshold:", dragRunThreshold);

                if (inputMethod == InputMethod.TouchScreen && movementMethod == MovementMethod.FirstPerson)
                {
                    freeAimTouchSpeed = EditorGUILayout.FloatField("Freelook speed:", freeAimTouchSpeed);
                }

                drawDragLine = EditorGUILayout.Toggle("Draw drag line?", drawDragLine);
                if (drawDragLine)
                {
                    dragLineWidth = EditorGUILayout.FloatField("Drag line width:", dragLineWidth);
                    dragLineColor = EditorGUILayout.ColorField("Drag line colour:", dragLineColor);
                }
            }
            else if (movementMethod == MovementMethod.Direct)
            {
                magnitudeAffectsDirect = EditorGUILayout.ToggleLeft("Input magnitude affects speed?", magnitudeAffectsDirect);
                directMovementType     = (DirectMovementType)EditorGUILayout.EnumPopup("Direct-movement type:", directMovementType);
                if (directMovementType == DirectMovementType.RelativeToCamera)
                {
                    limitDirectMovement = (LimitDirectMovement)EditorGUILayout.EnumPopup("Movement limitation:", limitDirectMovement);
                    if (cameraPerspective == CameraPerspective.ThreeD)
                    {
                        directMovementPerspective = EditorGUILayout.ToggleLeft("Account for player's position on screen?", directMovementPerspective);
                    }
                }
            }
            else if (movementMethod == MovementMethod.PointAndClick)
            {
                clickPrefab         = (Transform)EditorGUILayout.ObjectField("Click marker:", clickPrefab, typeof(Transform), false);
                walkableClickRange  = EditorGUILayout.Slider("NavMesh search %:", walkableClickRange, 0f, 1f);
                doubleClickMovement = EditorGUILayout.Toggle("Double-click to move?", doubleClickMovement);
            }
            if (movementMethod == MovementMethod.StraightToCursor)
            {
                dragRunThreshold  = EditorGUILayout.FloatField("Run threshold:", dragRunThreshold);
                singleTapStraight = EditorGUILayout.ToggleLeft("Single-clicking also moves player?", singleTapStraight);
                if (singleTapStraight)
                {
                    singleTapStraightPathfind = EditorGUILayout.ToggleLeft("Pathfind when single-clicking?", singleTapStraightPathfind);
                }
            }
            if (movementMethod == MovementMethod.FirstPerson && inputMethod == InputMethod.TouchScreen)
            {
                dragAffects = (DragAffects)EditorGUILayout.EnumPopup("Touch-drag affects:", dragAffects);
            }
            if ((movementMethod == MovementMethod.Direct || movementMethod == MovementMethod.FirstPerson) && inputMethod != InputMethod.TouchScreen)
            {
                jumpSpeed = EditorGUILayout.Slider("Jump speed:", jumpSpeed, 1f, 10f);
            }

            destinationAccuracy = EditorGUILayout.Slider("Destination accuracy:", destinationAccuracy, 0f, 1f);

            if (inputMethod == InputMethod.TouchScreen)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Touch Screen settings", EditorStyles.boldLabel);

                offsetTouchCursor = EditorGUILayout.Toggle("Drag cursor with touch?", offsetTouchCursor);
                doubleTapHotspots = EditorGUILayout.Toggle("Double-tap Hotspots?", doubleTapHotspots);
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Camera settings", EditorStyles.boldLabel);

            cameraPerspective_int = (int)cameraPerspective;
            cameraPerspective_int = EditorGUILayout.Popup("Camera perspective:", cameraPerspective_int, cameraPerspective_list);
            cameraPerspective     = (CameraPerspective)cameraPerspective_int;
            if (movementMethod == MovementMethod.FirstPerson)
            {
                cameraPerspective = CameraPerspective.ThreeD;
            }
            if (cameraPerspective == CameraPerspective.TwoD)
            {
                movingTurning = (MovingTurning)EditorGUILayout.EnumPopup("Moving and turning:", movingTurning);
                if (movingTurning == MovingTurning.TopDown || movingTurning == MovingTurning.Unity2D)
                {
                    verticalReductionFactor = EditorGUILayout.Slider("Vertical movement factor:", verticalReductionFactor, 0.1f, 1f);
                }
            }

            forceAspectRatio = EditorGUILayout.Toggle("Force aspect ratio?", forceAspectRatio);
            if (forceAspectRatio)
            {
                wantedAspectRatio = EditorGUILayout.FloatField("Aspect ratio:", wantedAspectRatio);
                                #if UNITY_IPHONE
                landscapeModeOnly = EditorGUILayout.Toggle("Landscape-mode only?", landscapeModeOnly);
                                #endif
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Hotpot settings", EditorStyles.boldLabel);

            hotspotDetection = (HotspotDetection)EditorGUILayout.EnumPopup("Hotspot detection method:", hotspotDetection);
            if (hotspotDetection == HotspotDetection.PlayerVicinity && (movementMethod == MovementMethod.Direct || IsInFirstPerson()))
            {
                hotspotsInVicinity = (HotspotsInVicinity)EditorGUILayout.EnumPopup("Hotspots in vicinity:", hotspotsInVicinity);
            }
            else if (hotspotDetection == HotspotDetection.MouseOver)
            {
                scaleHighlightWithMouseProximity = EditorGUILayout.ToggleLeft("Highlight Hotspots based on cursor proximity?", scaleHighlightWithMouseProximity);
                if (scaleHighlightWithMouseProximity)
                {
                    highlightProximityFactor = EditorGUILayout.FloatField("Cursor proximity factor:", highlightProximityFactor);
                }
            }

            if (cameraPerspective != CameraPerspective.TwoD)
            {
                playerFacesHotspots = EditorGUILayout.Toggle("Player turns head to active?", playerFacesHotspots);
            }

            hotspotIconDisplay = (HotspotIconDisplay)EditorGUILayout.EnumPopup("Display Hotspot icon:", hotspotIconDisplay);
            if (hotspotIconDisplay != HotspotIconDisplay.Never)
            {
                if (cameraPerspective != CameraPerspective.TwoD)
                {
                    occludeIcons = EditorGUILayout.Toggle("Don't show behind Colliders?", occludeIcons);
                }
                hotspotIcon = (HotspotIcon)EditorGUILayout.EnumPopup("Hotspot icon type:", hotspotIcon);
                if (hotspotIcon == HotspotIcon.Texture)
                {
                    hotspotIconTexture = (Texture2D)EditorGUILayout.ObjectField("Hotspot icon texture:", hotspotIconTexture, typeof(Texture2D), false);
                }
                hotspotIconSize = EditorGUILayout.FloatField("Hotspot icon size:", hotspotIconSize);
            }

                        #if UNITY_5
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Audio settings", EditorStyles.boldLabel);
            volumeControl = (VolumeControl)EditorGUILayout.EnumPopup("Volume controlled by:", volumeControl);
            if (volumeControl == VolumeControl.AudioMixerGroups)
            {
                musicMixerGroup             = (AudioMixerGroup)EditorGUILayout.ObjectField("Music mixer:", musicMixerGroup, typeof(AudioMixerGroup), false);
                sfxMixerGroup               = (AudioMixerGroup)EditorGUILayout.ObjectField("SFX mixer:", sfxMixerGroup, typeof(AudioMixerGroup), false);
                speechMixerGroup            = (AudioMixerGroup)EditorGUILayout.ObjectField("Speech mixer:", speechMixerGroup, typeof(AudioMixerGroup), false);
                musicAttentuationParameter  = EditorGUILayout.TextField("Music atten. parameter:", musicAttentuationParameter);
                sfxAttentuationParameter    = EditorGUILayout.TextField("SFX atten. parameter:", sfxAttentuationParameter);
                speechAttentuationParameter = EditorGUILayout.TextField("Speech atten. parameter:", speechAttentuationParameter);
            }
                        #endif

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Raycast settings", EditorStyles.boldLabel);
            navMeshRaycastLength  = EditorGUILayout.FloatField("NavMesh ray length:", navMeshRaycastLength);
            hotspotRaycastLength  = EditorGUILayout.FloatField("Hotspot ray length:", hotspotRaycastLength);
            moveableRaycastLength = EditorGUILayout.FloatField("Moveable ray length:", moveableRaycastLength);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Layer names", EditorStyles.boldLabel);

            hotspotLayer = EditorGUILayout.TextField("Hotspot:", hotspotLayer);
            navMeshLayer = EditorGUILayout.TextField("Nav mesh:", navMeshLayer);
            if (cameraPerspective == CameraPerspective.TwoPointFiveD)
            {
                backgroundImageLayer = EditorGUILayout.TextField("Background image:", backgroundImageLayer);
            }
            deactivatedLayer = EditorGUILayout.TextField("Deactivated:", deactivatedLayer);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Loading scene", EditorStyles.boldLabel);
            useLoadingScreen = EditorGUILayout.Toggle("Use loading screen?", useLoadingScreen);
            if (useLoadingScreen)
            {
                loadingSceneIs = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose loading scene by:", loadingSceneIs);
                if (loadingSceneIs == ChooseSceneBy.Name)
                {
                    loadingSceneName = EditorGUILayout.TextField("Loading scene name:", loadingSceneName);
                }
                else
                {
                    loadingScene = EditorGUILayout.IntField("Loading screen scene:", loadingScene);
                }
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Options data", EditorStyles.boldLabel);

            if (!PlayerPrefs.HasKey(ppKey))
            {
                optionsData   = new OptionsData();
                optionsBinary = Serializer.SerializeObjectBinary(optionsData);
                PlayerPrefs.SetString(ppKey, optionsBinary);
            }

            optionsBinary = PlayerPrefs.GetString(ppKey);
            if (optionsBinary.Length > 0)
            {
                optionsData = Serializer.DeserializeObjectBinary <OptionsData> (optionsBinary);
            }
            else
            {
                optionsData = new OptionsData();
            }

            defaultSpeechVolume  = optionsData.speechVolume = EditorGUILayout.Slider("Speech volume:", optionsData.speechVolume, 0f, 1f);
            defaultMusicVolume   = optionsData.musicVolume = EditorGUILayout.Slider("Music volume:", optionsData.musicVolume, 0f, 1f);
            defaultSfxVolume     = optionsData.sfxVolume = EditorGUILayout.Slider("SFX volume:", optionsData.sfxVolume, 0f, 1f);
            defaultShowSubtitles = optionsData.showSubtitles = EditorGUILayout.Toggle("Show subtitles?", optionsData.showSubtitles);
            defaultLanguage      = optionsData.language = EditorGUILayout.IntField("Language:", optionsData.language);

            optionsBinary = Serializer.SerializeObjectBinary(optionsData);
            PlayerPrefs.SetString(ppKey, optionsBinary);

            if (GUILayout.Button("Reset options data"))
            {
                PlayerPrefs.DeleteKey("Options");
                optionsData = new OptionsData();
                Debug.Log("PlayerPrefs cleared");
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Debug settings", EditorStyles.boldLabel);
            showActiveActionLists = EditorGUILayout.ToggleLeft("List active ActionLists in Game window?", showActiveActionLists);
            showHierarchyIcons    = EditorGUILayout.ToggleLeft("Show icons in Hierarchy window?", showHierarchyIcons);


            if (GUI.changed)
            {
                EditorUtility.SetDirty(this);
            }
        }
Пример #30
0
        public override void ShowGUI()
        {
            sceneToCheck = (SceneToCheck) EditorGUILayout.EnumPopup ("Check previous or current:", sceneToCheck);
            chooseSceneBy = (ChooseSceneBy) EditorGUILayout.EnumPopup ("Choose scene by:", chooseSceneBy);

            EditorGUILayout.BeginHorizontal();
                if (chooseSceneBy == ChooseSceneBy.Name)
                {
                    EditorGUILayout.LabelField ("Scene name is:", GUILayout.Width (100f));
                    intCondition = (IntCondition) EditorGUILayout.EnumPopup (intCondition);
                    sceneName = EditorGUILayout.TextField (sceneName);
                }
                else
                {
                    EditorGUILayout.LabelField ("Scene number is:", GUILayout.Width (100f));
                    intCondition = (IntCondition) EditorGUILayout.EnumPopup (intCondition);
                    sceneNumber = EditorGUILayout.IntField (sceneNumber);
                }
            EditorGUILayout.EndHorizontal();
        }