public ActionListEditorWindowData()
 {
     isLocked = false;
     targetID = 0;
     _target = null;
     targetAsset = null;
 }
示例#2
0
 public static void DeleteAction(AC.Action action, ActionListAsset _target)
 {
     _target.actions.Remove (action);
     Undo.DestroyObjectImmediate (action);
     //UnityEngine.Object.DestroyImmediate (_action, true);
     AssetDatabase.SaveAssets ();
 }
示例#3
0
        public static void AddAction(string className, int i, ActionListAsset _target)
        {
            List<int> idArray = new List<int>();

            foreach (AC.Action _action in _target.actions)
            {
                idArray.Add (_action.id);
            }

            idArray.Sort ();

            AC.Action newAction = (AC.Action) CreateInstance (className);
            newAction.hideFlags = HideFlags.HideInHierarchy;

            // Update id based on array
            foreach (int _id in idArray.ToArray())
            {
                if (newAction.id == _id)
                    newAction.id ++;
            }

            newAction.name = newAction.title;

            _target.actions.Insert (i, newAction);
            AssetDatabase.AddObjectToAsset (newAction, _target);
            AssetDatabase.ImportAsset (AssetDatabase.GetAssetPath (newAction));
            AssetDatabase.Refresh ();
        }
示例#4
0
		public override void Declare ()
		{
			label = "Button";
			hotspotLabel = "";
			hotspotLabelID = -1;
			isVisible = true;
			isClickable = true;
			textEffects = TextEffects.None;
			buttonClickType = AC_ButtonClickType.RunActionList;
			simulateInput = SimulateInputType.Button;
			simulateValue = 1f;
			numSlots = 1;
			anchor = TextAnchor.MiddleCenter;
			SetSize (new Vector2 (10f, 5f));
			doFade = false;
			switchMenuTitle = "";
			inventoryBoxTitle = "";
			shiftInventory = AC_ShiftInventory.ShiftLeft;
			loopJournal = false;
			actionList = null;
			inputAxis = "";
			clickTexture = null;
			clickAlpha = 0f;
			shiftAmount = 1;
			onlyShowWhenEffective = false;
			allowContinuousClick = false;

			base.Declare ();
		}
示例#5
0
        public void CopyButton(MenuButton _element)
        {
            uiButton = _element.uiButton;
            uiText = _element.uiText;
            label = _element.label;
            hotspotLabel = _element.hotspotLabel;
            hotspotLabelID = _element.hotspotLabelID;
            anchor = _element.anchor;
            textEffects = _element.textEffects;
            buttonClickType = _element.buttonClickType;
            simulateInput = _element.simulateInput;
            simulateValue = _element.simulateValue;
            doFade = _element.doFade;
            switchMenuTitle = _element.switchMenuTitle;
            inventoryBoxTitle = _element.inventoryBoxTitle;
            shiftInventory = _element.shiftInventory;
            loopJournal = _element.loopJournal;
            actionList = _element.actionList;
            inputAxis = _element.inputAxis;
            clickTexture = _element.clickTexture;
            clickAlpha = _element.clickAlpha;
            shiftAmount = _element.shiftAmount;
            onlyShowWhenEffective = _element.onlyShowWhenEffective;
            allowContinuousClick = _element.allowContinuousClick;
            parameterID = _element.parameterID;
            parameterValue = _element.parameterValue;

            base.Copy (_element);
        }
示例#6
0
 /**
  * <summary>A Constructor that copies the values of another ActionEnd.</summary>
  * <param name = "_actionEnd">The ActionEnd to copy from</param>
  */
 public ActionEnd(ActionEnd _actionEnd)
 {
     resultAction = _actionEnd.resultAction;
     skipAction = _actionEnd.skipAction;
     skipActionActual = _actionEnd.skipActionActual;
     linkedCutscene = _actionEnd.linkedCutscene;
     linkedAsset = _actionEnd.linkedAsset;
 }
示例#7
0
 /**
  * A Constructor that sets skipAction explicitly.
  */
 public ActionEnd(int _skipAction)
 {
     resultAction = ResultAction.Continue;
     skipAction = _skipAction;
     skipActionActual = null;
     linkedCutscene = null;
     linkedAsset = null;
 }
示例#8
0
		public static RuntimeActionList RunActionListAsset (ActionListAsset actionListAsset, Conversation endConversation, int i)
		{
			if (actionListAsset != null && actionListAsset.actions.Count > 0)
			{
				GameObject runtimeActionListObject = (GameObject) Instantiate (Resources.Load (Resource.runtimeActionList));
				RuntimeActionList runtimeActionList = runtimeActionListObject.GetComponent <RuntimeActionList>();
				runtimeActionList.DownloadActions (actionListAsset, endConversation, i);
				return runtimeActionList;
			}
			
			return null;
		}
示例#9
0
        public void CopyProfilesList(MenuProfilesList _element)
        {
            uiSlots = _element.uiSlots;

            textEffects = _element.textEffects;
            anchor = _element.anchor;
            maxSlots = _element.maxSlots;
            actionListOnClick = _element.actionListOnClick;
            showActive = _element.showActive;

            base.Copy (_element);
        }
        /**
         * <summary>Downloads and runs the settings and Actions stored within an ActionListAsset.</summary>
         * <param name = "actionListAsset">The ActionListAsset to copy Actions from and run</param>
         * <param name = "endConversation">If set, the supplied Conversation will be run when the AcionList ends</param>
         * <param name = "i">The index number of the first Action to run</param>
         * <param name = "doSkip">If True, then the Actions will be skipped, instead of run normally</param>
         * <param name = "addToSkipQueue">If True, the ActionList will be skippable when the user presses 'EndCutscene'</param>
         */
        public void DownloadActions(ActionListAsset actionListAsset, Conversation endConversation, int i, bool doSkip, bool addToSkipQueue)
        {
            this.name = actionListAsset.name;
            assetSource = actionListAsset;

            useParameters = actionListAsset.useParameters;
            parameters = actionListAsset.parameters;
            unfreezePauseMenus = actionListAsset.unfreezePauseMenus;

            actionListType = actionListAsset.actionListType;
            if (actionListAsset.actionListType == ActionListType.PauseGameplay)
            {
                isSkippable = actionListAsset.isSkippable;
            }
            else
            {
                isSkippable = false;
            }

            conversation = endConversation;
            actions.Clear ();

            foreach (AC.Action action in actionListAsset.actions)
            {
                ActionEnd _lastResult = action.lastResult;

                actions.Add (action);

                if (doSkip && action != null)
                {
                    actions[actions.Count-1].lastResult = _lastResult;
                }
            }

            if (!useParameters)
            {
                foreach (Action action in actions)
                {
                    action.AssignValues (null);
                }
            }

            if (doSkip)
            {
                Skip (i);
            }
            else
            {
                Interact (i, addToSkipQueue);
            }
        }
        public ActionListEditorWindowData(ActionListAsset actionListAsset)
        {
            targetID = 0;
            _target = null;
            targetAsset = actionListAsset;

            if (actionListAsset != null)
            {
                isLocked = true;
            }
            else
            {
                isLocked = false;
            }
        }
示例#12
0
		public void CopyButton (Button _button)
		{
			interaction = _button.interaction;
			assetFile = _button.assetFile;
			customScriptObject = _button.customScriptObject;
			customScriptFunction = _button.customScriptFunction;
			isDisabled = _button.isDisabled;
			invID = _button.invID;
			iconID = _button.iconID;
			playerAction = _button.playerAction;
			setProximity = _button.setProximity;
			proximity = _button.proximity;
			faceAfter = _button.faceAfter;
			isBlocking = _button.isBlocking;
		}
示例#13
0
		public void CopySavesList (MenuSavesList _element)
		{
			newSaveText = _element.newSaveText;
			textEffects = _element.textEffects;
			anchor = _element.anchor;
			saveListType = _element.saveListType;
			maxSaves = _element.maxSaves;
			actionListOnSave = _element.actionListOnSave;
			displayType = _element.displayType;
			blankSlotTexture = _element.blankSlotTexture;
			fixedOption = _element.fixedOption;
			optionToShow = _element.optionToShow;
			
			base.Copy (_element);
		}
示例#14
0
 public void DestroyAssetList(ActionListAsset asset)
 {
     RuntimeActionList[] runtimeActionLists = FindObjectsOfType (typeof (RuntimeActionList)) as RuntimeActionList[];
     foreach (RuntimeActionList runtimeActionList in runtimeActionLists)
     {
         if (runtimeActionList.assetSource == asset)
         {
             if (activeLists.Contains (runtimeActionList))
             {
                 activeLists.Remove (runtimeActionList);
             }
             Destroy (runtimeActionList.gameObject);
         }
     }
 }
示例#15
0
        /**
         * <summary>A Constructor that assigns the variables explicitly.</summary>
         * <param name = "_actionList">The ActionList this references. If it is a RuntimeActionList, its assetSource will be assigned to actionListAsset.</param>
         * <param name = "_startIndex">The index number of the Action to skip from</param>
         */
        public SkipList(ActionList _actionList, int _startIndex)
        {
            actionList = _actionList;
            startIndex = _startIndex;

            if (_actionList is RuntimeActionList)
            {
                RuntimeActionList runtimeActionList = (RuntimeActionList) _actionList;
                actionListAsset = runtimeActionList.assetSource;
            }
            else
            {
                actionListAsset = null;
            }
        }
        public ActionListEditorWindowData(ActionList actionList)
        {
            targetAsset = null;
            _target = actionList;

            if (actionList != null)
            {
                isLocked = true;
                targetID = actionList.GetInstanceID ();
            }
            else
            {
                isLocked = false;
                targetID = 0;
            }
        }
示例#17
0
        public static ActionListAsset AssetGUI(string label, ActionListAsset actionListAsset)
        {
            EditorGUILayout.BeginHorizontal ();
            actionListAsset = (ActionListAsset) EditorGUILayout.ObjectField (label, actionListAsset, typeof (ActionListAsset), false);

            if (actionListAsset == null)
            {
                if (GUILayout.Button ("Create", GUILayout.MaxWidth (60f)))
                {
                    actionListAsset = ActionListAssetMenu.CreateAsset ();
                }
            }

            EditorGUILayout.EndHorizontal ();
            return actionListAsset;
        }
示例#18
0
        public void CopyCycle(MenuCycle _element)
        {
            uiButton = _element.uiButton;
            uiText = null;
            label = _element.label;
            textEffects = _element.textEffects;
            anchor = _element.anchor;
            selected = _element.selected;
            optionsArray = _element.optionsArray;
            cycleType = _element.cycleType;
            varID = _element.varID;
            cycleText = "";
            actionListOnClick = _element.actionListOnClick;

            base.Copy (_element);
        }
示例#19
0
        public void CopyFromAsset(ActionListAsset actionListAsset)
        {
            isSkippable    = actionListAsset.isSkippable;
            actionListType = actionListAsset.actionListType;
            useParameters  = actionListAsset.useParameters;

            // Copy parameters
            parameters = new List <ActionParameter>();
            parameters.Clear();
            foreach (ActionParameter parameter in actionListAsset.parameters)
            {
                parameters.Add(new ActionParameter(parameter));
            }

            // Actions
            actions = new List <Action>();
            actions.Clear();

            Vector2 firstPosition = new Vector2(14f, 14f);

            foreach (Action originalAction in actionListAsset.actions)
            {
                if (originalAction == null)
                {
                    continue;
                }

                AC.Action duplicatedAction = Object.Instantiate(originalAction) as AC.Action;

                if (actionListAsset.actions.IndexOf(originalAction) == 0)
                {
                    duplicatedAction.nodeRect.x = firstPosition.x;
                    duplicatedAction.nodeRect.y = firstPosition.y;
                }
                else
                {
                    duplicatedAction.nodeRect.x = firstPosition.x + (originalAction.nodeRect.x - firstPosition.x);
                    duplicatedAction.nodeRect.y = firstPosition.y + (originalAction.nodeRect.y - firstPosition.y);
                }

                duplicatedAction.ClearIDs();
                duplicatedAction.isMarked    = false;
                duplicatedAction.isAssetFile = false;
                actions.Add(duplicatedAction);
            }
        }
        protected void ShowParametersGUI(ActionListAsset actionListAsset)
        {
            if (actionListAsset == null)
            {
                return;
            }

            if (actionListAsset.NumParameters > 0)
            {
                ShowActionListReference(actionListAsset);
                ShowParametersGUI(actionListAsset.DefaultParameters, true);
            }
            else
            {
                EditorGUILayout.HelpBox("No parameters defined for ActionList Assset '" + actionListAsset.name + "'.", MessageType.Warning);
            }
        }
示例#21
0
        public void ShowGUI()
        {
            runOnStart = EditorGUILayout.Toggle("Run on scene start?", runOnStart);
            runOnLoad  = EditorGUILayout.Toggle("Run on scene load?", runOnLoad);

            if (runOnLoad && KickStarter.settingsManager && KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow)
            {
                sceneLoadCondition = (SceneLoadCondition)EditorGUILayout.EnumPopup("Scene load condition:", sceneLoadCondition);
            }

            EditorGUILayout.Space();

            actionListSource = (ActionListSource)EditorGUILayout.EnumPopup("ActionList source:", actionListSource);
            switch (actionListSource)
            {
            case ActionListSource.InScene:
                actionList = (ActionList)EditorGUILayout.ObjectField("ActionList to run:", actionList, typeof(ActionList), true);

                if (actionList == null && GetComponent <ActionList>())
                {
                    actionList = GetComponent <ActionList>();
                }

                if (actionList && actionList.IsSkippable())
                {
                    runInstantly = EditorGUILayout.Toggle("Run instantly?", runInstantly);
                }
                EditorGUILayout.Space();
                ShowParametersGUI(actionList);
                break;

            case ActionListSource.AssetFile:
                actionListAsset = (ActionListAsset)EditorGUILayout.ObjectField("Asset to run:", actionListAsset, typeof(ActionListAsset), false);

                if (actionListAsset && actionListAsset.IsSkippable())
                {
                    runInstantly = EditorGUILayout.Toggle("Run instantly?", runInstantly);
                }
                EditorGUILayout.Space();
                ShowParametersGUI(actionListAsset);
                break;
            }

            EditorGUILayout.Space();
            EditorGUILayout.HelpBox("The linked ActionList can also be run by invoking this script's RunActionList() method.", MessageType.Info);
        }
示例#22
0
 /**
  * <summary>Stops an ActionListAsset from running.</summary>
  * <param name = "The ActionListAsset file to stop"></param>
  * <param name = "_action">An Action that, if present within 'asset', will prevent the ActionListAsset from ending prematurely</param>
  */
 public void EndAssetList(ActionListAsset asset, Action _action = null)
 {
     for (int i = 0; i < activeLists.Count; i++)
     {
         if (activeLists[i].IsFor(asset))
         {
             if (_action == null || !activeLists[i].actionList.actions.Contains(_action))
             {
                 KickStarter.actionListManager.EndList(activeLists[i]);
             }
             else if (_action != null)
             {
                 ACDebug.Log("Left " + activeLists[i].actionList.gameObject.name + " alone.");
             }
         }
     }
 }
示例#23
0
        private void ActionListGUI(string label)
        {
            actionListOnSave = ActionListAssetMenu.AssetGUI(label, actionListOnSave);

            if (actionListOnSave != null && actionListOnSave.useParameters && actionListOnSave.parameters.Count > 0)
            {
                EditorGUILayout.BeginVertical("Button");
                EditorGUILayout.BeginHorizontal();
                parameterID = Action.ChooseParameterGUI("", actionListOnSave.parameters, parameterID, ParameterType.Integer);
                if (parameterID >= 0)
                {
                    EditorGUILayout.LabelField("(= Slot index)");
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
            }
        }
        private void ShowParametersGUI(ActionListAsset actionListAsset)
        {
            if (actionListAsset == null)
            {
                return;
            }

            if (actionListAsset.useParameters && actionListAsset.parameters != null && actionListAsset.parameters.Count > 0)
            {
                ShowActionListReference(actionListAsset);
                ShowParametersGUI(actionListAsset.parameters, true);
            }
            else
            {
                EditorGUILayout.HelpBox("No parameters defined for ActionList Assset '" + actionListAsset.name + "'.", MessageType.Warning);
            }
        }
示例#25
0
        protected void AfterRunningOption()
        {
            EditorGUILayout.Space();
            endAction = (ResultAction)EditorGUILayout.EnumPopup("After running:", (ResultAction)endAction);

            if (endAction == ResultAction.RunCutscene)
            {
                if (isAssetFile)
                {
                    linkedAsset = ActionListAssetMenu.AssetGUI("ActionList to run:", linkedAsset);
                }
                else
                {
                    linkedCutscene = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", linkedCutscene);
                }
            }
        }
示例#26
0
        private void SearchAssetForType(ActionListAsset actionListAsset, ActionType actionType)
        {
            if (searchedAssets.Contains(actionListAsset))
            {
                return;
            }

            searchedAssets.Add(actionListAsset);
            if (actionListAsset != null)
            {
                int numFinds = SearchActionsForType(actionListAsset.actions, actionType);
                if (numFinds > 0)
                {
                    ACDebug.Log("(Asset: " + actionListAsset.name + ") Found " + numFinds + " instances of '" + actionType.GetFullTitle() + "'");
                }
            }
        }
示例#27
0
 /**
  * <summary>Copies the values of another Button onto itself.</summary>
  * <param name = "_button">The Button to copies values from</param>
  */
 public void CopyButton(Button _button)
 {
     interaction          = _button.interaction;
     assetFile            = _button.assetFile;
     customScriptObject   = _button.customScriptObject;
     customScriptFunction = _button.customScriptFunction;
     isDisabled           = _button.isDisabled;
     invID          = _button.invID;
     iconID         = _button.iconID;
     playerAction   = _button.playerAction;
     setProximity   = _button.setProximity;
     proximity      = _button.proximity;
     faceAfter      = _button.faceAfter;
     isBlocking     = _button.isBlocking;
     parameterID    = _button.parameterID;
     invParameterID = _button.invParameterID;
 }
示例#28
0
        public void CopyToggle(MenuToggle _element)
        {
            uiToggle = _element.uiToggle;
            uiText = null;
            label = _element.label;
            isOn = _element.isOn;
            textEffects = _element.textEffects;
            anchor = _element.anchor;
            toggleType = _element.toggleType;
            varID = _element.varID;
            appendState = _element.appendState;
            onTexture = _element.onTexture;
            offTexture = _element.offTexture;
            actionListOnClick = _element.actionListOnClick;

            base.Copy (_element);
        }
示例#29
0
        /**
         * <summary>Resumes a previously-paused ActionListAsset. If the ActionListAsset is already running, nothing will happen.</summary>
         * <param name = "actionListAsset">The ActionListAsset to pause</param>
         */
        public void Resume(ActionListAsset actionListAsset)
        {
            if (IsListRunning(actionListAsset) && !actionListAsset.canRunMultipleInstances)
            {
                return;
            }

            bool foundInstance = false;

            for (int i = 0; i < activeLists.Count; i++)
            {
                if (activeLists[i].IsFor(actionListAsset))
                {
                    int numInstances = 0;
                    foreach (ActiveList activeList in activeLists)
                    {
                        if (activeList.IsFor(actionListAsset) && activeList.IsRunning())
                        {
                            numInstances++;
                        }
                    }

                    GameObject runtimeActionListObject = (GameObject)Instantiate(Resources.Load(Resource.runtimeActionList));
                    runtimeActionListObject.name = actionListAsset.name;
                    if (numInstances > 0)
                    {
                        runtimeActionListObject.name += " " + numInstances.ToString();
                    }

                    RuntimeActionList runtimeActionList = runtimeActionListObject.GetComponent <RuntimeActionList>();
                    runtimeActionList.DownloadActions(actionListAsset, activeLists[i].GetConversationOnEnd(), activeLists[i].startIndex, false, activeLists[i].inSkipQueue, true);
                    activeLists[i].Resume(runtimeActionList);
                    foundInstance = true;
                    if (!actionListAsset.canRunMultipleInstances)
                    {
                        return;
                    }
                }
            }

            if (!foundInstance)
            {
                ACDebug.LogWarning("No resume data found for '" + actionListAsset + "' - running from start.", actionListAsset);
                AdvGame.RunActionListAsset(actionListAsset);
            }
        }
示例#30
0
 public override bool ReferencesAsset(ActionListAsset actionListAsset)
 {
     if (isAssetFile)
     {
         foreach (ActionEnd ending in endings)
         {
             if (ending.resultAction == ResultAction.RunCutscene)
             {
                 if (ending.linkedAsset == actionListAsset)
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
示例#31
0
        /**
         * <summary>A constructor for a scene-based Conversation's dialogue option.</summary>
         * <param name = "_ID">An ID number unique to this instance of ButtonDialog within a Conversation</param>
         * <param name = "_label">The option's display text</param>
         * <param name = "_startEnabled">If True, the option will be enabled by default</param>
         * <param name = "_dialogueOption">The DialogueOption to run when the option is chosen</param>
         * <param name = "_endsConversation">If True, the Conversation will end after the DialogueOption has finished running</param>
         */
        public ButtonDialog(int _ID, string _label, bool _startEnabled, DialogueOption _dialogueOption, bool _endsConversation)
        {
            label      = _label;
            icon       = null;
            cursorIcon = new CursorIconBase();
            isOn       = _startEnabled;
            isLocked   = false;

            conversationAction = (_endsConversation) ? ConversationAction.Stop : ConversationAction.ReturnToConversation;

            assetFile       = null;
            newConversation = null;
            dialogueOption  = _dialogueOption;
            lineID          = -1;
            ID        = _ID;
            isEditing = false;
        }
示例#32
0
        /**
         * <summary>A constructor for a runtime-generated Conversation's dialogue option.</summary>
         * <param name = "_ID">An ID number unique to this instance of ButtonDialog within a Conversation</param>
         * <param name = "_label">The option's display text</param>
         * <param name = "_isOn">If True, the option will be enabled</param>
         */
        public ButtonDialog(int _ID, string _label, bool _isOn)
        {
            label      = _label;
            icon       = null;
            cursorIcon = new CursorIconBase();
            isOn       = _isOn;
            isLocked   = false;

            conversationAction = ConversationAction.Stop;

            assetFile       = null;
            newConversation = null;
            dialogueOption  = null;
            lineID          = -1;
            ID        = _ID;
            isEditing = false;
        }
示例#33
0
        private void CopyCycle(MenuCycle _element)
        {
            uiButton              = _element.uiButton;
            uiText                = null;
            label                 = _element.label;
            textEffects           = _element.textEffects;
            outlineSize           = _element.outlineSize;
            anchor                = _element.anchor;
            selected              = _element.selected;
            optionsArray          = _element.optionsArray;
            cycleType             = _element.cycleType;
            varID                 = _element.varID;
            cycleText             = "";
            actionListOnClick     = _element.actionListOnClick;
            uiSelectableHideStyle = _element.uiSelectableHideStyle;

            base.Copy(_element);
        }
示例#34
0
 /**
  * Initialises the element when it is created within MenuManager.
  */
 public override void Declare()
 {
     uiSlots     = null;
     isVisible   = true;
     isClickable = true;
     numSlots    = 4;
     SetSize(new Vector2(6f, 10f));
     textEffects  = TextEffects.None;
     outlineSize  = 2f;
     craftingType = CraftingElementType.Ingredients;
     displayType  = ConversationDisplayType.IconOnly;
     uiHideStyle  = UIHideStyle.DisableObject;
     actionListOnWrongIngredients = null;
     linkUIGraphic             = LinkUIGraphic.ImageComponent;
     items                     = new List <InvItem>();
     autoCreate                = true;
     inventoryItemCountDisplay = InventoryItemCountDisplay.OnlyIfMultiple;
 }
示例#35
0
 /** A Constructor that copies its values from another Button */
 public Button(Button button)
 {
     interaction          = button.interaction;
     assetFile            = button.assetFile;
     customScriptObject   = button.customScriptObject;
     customScriptFunction = button.customScriptFunction;
     isDisabled           = button.isDisabled;
     invID          = button.invID;
     iconID         = button.iconID;
     selectItemMode = button.selectItemMode;
     playerAction   = button.playerAction;
     setProximity   = button.setProximity;
     proximity      = button.proximity;
     faceAfter      = button.faceAfter;
     isBlocking     = button.isBlocking;
     parameterID    = button.parameterID;
     invParameterID = button.invParameterID;
 }
示例#36
0
        protected void ShowParametersGUI(ActionListAsset actionListAsset)
        {
            if (actionListAsset == null)
            {
                EditorGUILayout.HelpBox("No " + interactionType.ToString() + " ActionList found!", MessageType.Warning);
                return;
            }

            if (actionListAsset.useParameters && actionListAsset.parameters != null && actionListAsset.parameters.Count > 0)
            {
                ShowActionListReference(actionListAsset);
                ShowParametersGUI(actionListAsset.parameters, true);
            }
            else
            {
                EditorGUILayout.HelpBox("No parameters defined for ActionList Assset '" + actionListAsset.name + "'.", MessageType.Warning);
            }
        }
示例#37
0
        public override void Declare()
        {
            uiSlots = null;

            isVisible   = true;
            isClickable = true;
            numSlots    = 1;
            maxSlots    = 5;
            showActive  = true;

            SetSize(new Vector2(20f, 5f));
            anchor = TextAnchor.MiddleCenter;

            actionListOnClick = null;
            textEffects       = TextEffects.None;

            base.Declare();
        }
示例#38
0
 /**
  * <summary>Stops an ActionListAsset from running.</summary>
  * <param name = "The ActionListAsset file to stop"></param>
  * <param name = "_action">An Action that, if present within 'asset', will prevent the ActionListAsset from ending prematurely</param>
  */
 public void EndAssetList(ActionListAsset asset, Action _action = null)
 {
     RuntimeActionList[] runtimeActionLists = FindObjectsOfType(typeof(RuntimeActionList)) as RuntimeActionList[];
     foreach (RuntimeActionList runtimeActionList in runtimeActionLists)
     {
         if (runtimeActionList.assetSource == asset)
         {
             if (_action == null || !runtimeActionList.actions.Contains(_action))
             {
                 EndList(runtimeActionList);
             }
             else if (_action != null)
             {
                 ACDebug.Log("Left " + runtimeActionList.gameObject.name + " alone.");
             }
         }
     }
 }
示例#39
0
        private void CopyToggle(MenuToggle _element)
        {
            uiToggle          = _element.uiToggle;
            uiText            = null;
            label             = _element.label;
            isOn              = _element.isOn;
            textEffects       = _element.textEffects;
            outlineSize       = _element.outlineSize;
            anchor            = _element.anchor;
            toggleType        = _element.toggleType;
            varID             = _element.varID;
            appendState       = _element.appendState;
            onTexture         = _element.onTexture;
            offTexture        = _element.offTexture;
            actionListOnClick = _element.actionListOnClick;

            base.Copy(_element);
        }
        public static void ResetList(ActionListAsset _targetAsset)
        {
            if (_targetAsset.actions.Count == 0 || (_targetAsset.actions.Count == 1 && _targetAsset.actions[0] == null))
            {
                if (_targetAsset.actions.Count == 1)
                {
                    ActionListAssetEditor.DeleteAction(_targetAsset.actions[0], _targetAsset);
                }
                Action newAction = ActionList.GetDefaultAction();
                _targetAsset.actions.Add(newAction);
                newAction.hideFlags = HideFlags.HideInHierarchy;

                AssetDatabase.AddObjectToAsset(newAction, _targetAsset);
                AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(newAction));
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
        }
示例#41
0
        private void CopyProfilesList(MenuProfilesList _element)
        {
            uiSlots = _element.uiSlots;

            textEffects       = _element.textEffects;
            outlineSize       = _element.outlineSize;
            anchor            = _element.anchor;
            maxSlots          = _element.maxSlots;
            actionListOnClick = _element.actionListOnClick;
            showActive        = _element.showActive;
            uiHideStyle       = _element.uiHideStyle;
            autoHandle        = _element.autoHandle;
            parameterID       = _element.parameterID;
            fixedOption       = _element.fixedOption;
            optionToShow      = _element.optionToShow;

            base.Copy(_element);
        }
示例#42
0
        public void CopyFromAsset(ActionListAsset actionListAsset)
        {
            isSkippable = actionListAsset.isSkippable;
            actionListType = actionListAsset.actionListType;
            useParameters = actionListAsset.useParameters;

            // Copy parameters
            parameters = new List<ActionParameter>();
            parameters.Clear ();
            foreach (ActionParameter parameter in actionListAsset.parameters)
            {
                parameters.Add (new ActionParameter (parameter));
            }

            // Actions
            actions = new List<Action>();
            actions.Clear ();

            Vector2 firstPosition = new Vector2 (14f, 14f);
            foreach (Action originalAction in actionListAsset.actions)
            {
                if (originalAction == null)
                {
                    continue;
                }

                AC.Action duplicatedAction = Object.Instantiate (originalAction) as AC.Action;

                if (actionListAsset.actions.IndexOf (originalAction) == 0)
                {
                    duplicatedAction.nodeRect.x = firstPosition.x;
                    duplicatedAction.nodeRect.y = firstPosition.y;
                }
                else
                {
                    duplicatedAction.nodeRect.x = firstPosition.x + (originalAction.nodeRect.x - firstPosition.x);
                    duplicatedAction.nodeRect.y = firstPosition.y + (originalAction.nodeRect.y - firstPosition.y);
                }

                duplicatedAction.isMarked = false;
                duplicatedAction.isAssetFile = false;
                actions.Add (duplicatedAction);
            }
        }
示例#43
0
        private void CopyJournal(MenuJournal _element, bool fromEditor, bool ignoreUnityUI)
        {
            if (ignoreUnityUI)
            {
                uiText = null;
            }
            else
            {
                uiText = _element.uiText;
            }

            pages = new List <JournalPage>();
            foreach (JournalPage page in _element.pages)
            {
                JournalPage newPage = new JournalPage(page);
                if (fromEditor)
                {
                    newPage.lineID = -1;
                }

                pages.Add(newPage);
            }

            numPages      = _element.numPages;
            startFromPage = _element.startFromPage;
            if (startFromPage)
            {
                showPage = _element.showPage;
            }
            else
            {
                showPage = 1;
            }
            anchor              = _element.anchor;
            textEffects         = _element.textEffects;
            outlineSize         = _element.outlineSize;
            fullText            = "";
            actionListOnAddPage = _element.actionListOnAddPage;
            journalType         = _element.journalType;
            pageOffset          = _element.pageOffset;
            otherJournalTitle   = _element.otherJournalTitle;;

            base.Copy(_element);
        }
示例#44
0
 public bool ReferencesAsset(ActionListAsset actionListAsset)
 {
     if (actionListSource == ActionListSource.AssetFile)
     {
         if (actionListAssetOnStart == actionListAsset)
         {
             return(true);
         }
         if (actionListAssetOnLoad == actionListAsset)
         {
             return(true);
         }
         if (actionListAssetOnVarChange == actionListAsset)
         {
             return(true);
         }
     }
     return(false);
 }
		private int pulseDirection = 0; // 0 = none, 1 = in, -1 = out
		
		
		public void Awake ()
		{
			selectedItem = null;
			GetReferences ();
			
			craftingItems.Clear ();
			localItems.Clear ();
			GetItemsOnStart ();
			
			if (inventoryManager)
			{
				unhandledCombine = inventoryManager.unhandledCombine;
				unhandledHotspot = inventoryManager.unhandledHotspot;
			}
			else
			{
				Debug.LogError ("An Inventory Manager is required - please use the Adventure Creator window to create one.");
			}
		}
        override public void SkipActionGUI(List <Action> actions, bool showGUI)
        {
            if (showGUI)
            {
                EditorGUILayout.Space();
                resultActionTrue = (ResultAction)EditorGUILayout.EnumPopup("If condition is met:", (ResultAction)resultActionTrue);
            }
            if (resultActionTrue == ResultAction.RunCutscene && showGUI)
            {
                if (isAssetFile)
                {
                    linkedAssetTrue = ActionListAssetMenu.AssetGUI("ActionList to run:", linkedAssetTrue);
                }
                else
                {
                    linkedCutsceneTrue = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", linkedCutsceneTrue);
                }
            }
            else if (resultActionTrue == ResultAction.Skip)
            {
                SkipActionTrueGUI(actions, showGUI);
            }

            if (showGUI)
            {
                resultActionFail = (ResultAction)EditorGUILayout.EnumPopup("If condition is not met:", (ResultAction)resultActionFail);
            }
            if (resultActionFail == ResultAction.RunCutscene && showGUI)
            {
                if (isAssetFile)
                {
                    linkedAssetFail = ActionListAssetMenu.AssetGUI("ActionList to run:", linkedAssetFail);
                }
                else
                {
                    linkedCutsceneFail = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", linkedCutsceneFail);
                }
            }
            else if (resultActionFail == ResultAction.Skip)
            {
                SkipActionFailGUI(actions, showGUI);
            }
        }
示例#47
0
        public void ShowGUI()
        {
            string defaultName = "ActiveInput_" + Label;

            label     = CustomGUILayout.TextField("Label:", label, string.Empty, "An Editor-friendly name");
            inputName = CustomGUILayout.TextField("Input button:", inputName, string.Empty, "The name of the Input button, as defined in the Input Manager");
            inputType = (SimulateInputType)CustomGUILayout.EnumPopup("Input type:", inputType, string.Empty, "What type of input is expected");
            if (inputType == SimulateInputType.Axis)
            {
                axisThreshold = CustomGUILayout.Slider("Axis threshold:", axisThreshold, -1f, 1f, string.Empty, "The threshold value for the axis to trigger the ActionListAsset");
            }
            else if (inputType == SimulateInputType.Button)
            {
                buttonType = (ActiveInputButtonType)CustomGUILayout.EnumPopup("Responds to:", buttonType, string.Empty, "What type of button press this responds to");
            }
            enabledOnStart  = CustomGUILayout.Toggle("Enabled by default?", enabledOnStart, string.Empty, "If True, the active input is enabled when the game begins");
            gameState       = (GameState)CustomGUILayout.EnumPopup("Available when game is:", gameState, string.Empty, "What state the game must be in for the actionListAsset to run");
            actionListAsset = ActionListAssetMenu.AssetGUI("ActionList when triggered:", actionListAsset, defaultName, string.Empty, "The ActionListAsset to run when the input button is pressed");
        }
示例#48
0
		public Recipe (int[] idArray)
		{
			isEditing = false;
			ingredients = new List<Ingredient>();
			resultID = 0;
			useSpecificSlots = false;
			invActionList = null;
			autoCreate = true;
			onCreateRecipe = OnCreateRecipe.JustMoveToInventory;

			// Update id based on array
			foreach (int _id in idArray)
			{
				if (id == _id)
					id ++;
			}
			
			label = "Recipe " + (id + 1).ToString ();
		}
        /**
         * <summary>Checks if a particular ActionListAsset file is running.</summary>
         * <param name = "actionListAsset">The ActionListAsset to search for</param>
         * <returns>True if the ActionListAsset file is currently running</returns>
         */
        public bool IsListRunning(ActionListAsset actionListAsset)
        {
            if (actionListAsset == null)
            {
                return(false);
            }

            foreach (ActiveList activeList in activeLists)
            {
                if (activeList.IsFor(actionListAsset))
                {
                    if (activeList.IsRunning())
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
示例#50
0
        public override void ShowGUI(MenuSource source)
        {
            EditorGUILayout.BeginVertical("Button");

            showActive = EditorGUILayout.Toggle("Include active?", showActive);
            maxSlots   = EditorGUILayout.IntField("Max no. of slots:", maxSlots);
            if (source == MenuSource.AdventureCreator)
            {
                numSlots    = EditorGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots);
                slotSpacing = EditorGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f);
                orientation = (ElementOrientation)EditorGUILayout.EnumPopup("Slot orientation:", orientation);
                if (orientation == ElementOrientation.Grid)
                {
                    gridWidth = EditorGUILayout.IntSlider("Grid size:", gridWidth, 1, 10);
                }
            }

            if (source == MenuSource.AdventureCreator)
            {
                anchor      = (TextAnchor)EditorGUILayout.EnumPopup("Text alignment:", anchor);
                textEffects = (TextEffects)EditorGUILayout.EnumPopup("Text effect:", textEffects);
            }

            actionListOnClick = ActionListAssetMenu.AssetGUI("ActionList after selecting:", actionListOnClick);

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                uiHideStyle = (UIHideStyle)EditorGUILayout.EnumPopup("When invisible:", uiHideStyle);
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                uiSlots = ResizeUISlots(uiSlots, maxSlots);
                for (int i = 0; i < uiSlots.Length; i++)
                {
                    uiSlots[i].LinkedUiGUI(i, source);
                }
            }

            EditorGUILayout.EndVertical();

            base.ShowGUI(source);
        }
示例#51
0
        /**
         * <summary>Runs or skips an ActionList asset file.</summary>
         * <param name = "actionListAsset">The ActionList asset to run</param>
         * <param name = "endConversation">The Conversation to enable when the ActionList is complete</param>
         * <param name = "i">The index of the Action to start from</param>
         * <param name = "doSkip">If True, all Actions within the ActionList will be run and completed instantly.</param>
         * <param name = "addToSkipQueue">True if the ActionList should be added to the skip queue</param>
         * <returns>The temporary RuntimeActionList object in the scene that performs the Actions within the asset</returns>
         */
        public static RuntimeActionList RunActionListAsset(ActionListAsset actionListAsset, Conversation endConversation, int i, bool doSkip, bool addToSkipQueue)
        {
            if (actionListAsset != null && actionListAsset.actions.Count > 0)
            {
                GameObject        runtimeActionListObject = (GameObject)Instantiate(Resources.Load(Resource.runtimeActionList));
                RuntimeActionList runtimeActionList       = runtimeActionListObject.GetComponent <RuntimeActionList>();
                runtimeActionList.DownloadActions(actionListAsset, endConversation, i, doSkip, addToSkipQueue);

                GameObject cutsceneFolder = GameObject.Find("_Cutscenes");
                if (cutsceneFolder != null && cutsceneFolder.transform.position == Vector3.zero)
                {
                    runtimeActionList.transform.parent = cutsceneFolder.transform;
                }

                return(runtimeActionList);
            }

            return(null);
        }
示例#52
0
        /**
         * The default Constructor.
         */
        public ActiveInput(int[] idArray)
        {
            inputName       = "";
            gameState       = GameState.Normal;
            actionListAsset = null;
            enabledOnStart  = true;
            ID            = 1;
            inputType     = SimulateInputType.Button;
            axisThreshold = 0.2f;

            // Update id based on array
            foreach (int _id in idArray)
            {
                if (ID == _id)
                {
                    ID++;
                }
            }
        }
示例#53
0
        public override void Declare()
        {
            uiButton = null;
            uiText = null;
            label = "Cycle";
            selected = 0;
            isVisible = true;
            isClickable = true;
            numSlots = 1;
            textEffects = TextEffects.None;
            SetSize (new Vector2 (15f, 5f));
            anchor = TextAnchor.MiddleLeft;
            cycleType = AC_CycleType.CustomScript;
            varID = 0;
            optionsArray = new List<string>();
            cycleText = "";
            actionListOnClick = null;

            base.Declare ();
        }
        /**
         * <summary>The default Constructor.</summary>
         * <param name = "idArray">An array of existing ID numbers, so that a unique ID number can be assigned</param>
         */
        public ButtonDialog(int[] idArray)
        {
            label = "";
            icon = null;
            isOn = true;
            isLocked = false;
            conversationAction = ConversationAction.ReturnToConversation;
            assetFile = null;
            newConversation = null;
            dialogueOption = null;
            lineID = -1;
            ID = 1;
            isEditing = false;

            // Update id based on array
            foreach (int _id in idArray)
            {
                if (ID == _id)
                {
                    ID ++;
                }
            }
        }
示例#55
0
		public override void Declare ()
		{
			newSaveText = "New save";
			isVisible = true;
			isClickable = true;
			numSlots = 1;
			maxSaves = 5;

			SetSize (new Vector2 (20f, 5f));
			anchor = TextAnchor.MiddleCenter;
			saveListType = AC_SaveListType.Save;

			actionListOnSave = null;
			newSaveSlot = false;
			textEffects = TextEffects.None;
			displayType = SaveDisplayType.LabelOnly;
			blankSlotTexture = null;

			fixedOption = false;
			optionToShow = 1;

			base.Declare ();
		}
		public void DownloadActions (ActionListAsset actionListAsset, Conversation endConversation, int i)
		{
			this.name = actionListAsset.name;
			assetSource = actionListAsset;

			useParameters = actionListAsset.useParameters;
			parameters = actionListAsset.parameters;
			unfreezePauseMenus = actionListAsset.unfreezePauseMenus;

			actionListType = actionListAsset.actionListType;
			if (actionListAsset.actionListType == ActionListType.PauseGameplay)
			{
				isSkippable = actionListAsset.isSkippable;
			}
			else
			{
				isSkippable = false;
			}

			conversation = endConversation;
			actions.Clear ();
			
			foreach (AC.Action action in actionListAsset.actions)
			{
				actions.Add (action);
			}

			if (!useParameters)
			{
				foreach (Action action in actions)
				{
					action.AssignValues (null);
				}
			}
			
			Interact (i);
		}
示例#57
0
 /**
  * The default Constructor.
  */
 public NodeCommand()
 {
     cutscene = null;
     actionListAsset = null;
     parameterID = -1;
 }
示例#58
0
        public override void SkipActionGUI(List<Action> actions, bool showGUI)
        {
            if (showGUI)
            {
                EditorGUILayout.Space ();
                resultActionTrue = (ResultAction) EditorGUILayout.EnumPopup("If condition is met:", (ResultAction) resultActionTrue);
            }
            if (resultActionTrue == ResultAction.RunCutscene && showGUI)
            {
                if (isAssetFile)
                {
                    linkedAssetTrue = ActionListAssetMenu.AssetGUI ("ActionList to run:", linkedAssetTrue);
                }
                else
                {
                    linkedCutsceneTrue = ActionListAssetMenu.CutsceneGUI ("Cutscene to run:", linkedCutsceneTrue);
                }
            }
            else if (resultActionTrue == ResultAction.Skip)
            {
                SkipActionTrueGUI (actions, showGUI);
            }

            if (showGUI)
            {
                resultActionFail = (ResultAction) EditorGUILayout.EnumPopup("If condition is not met:", (ResultAction) resultActionFail);
            }
            if (resultActionFail == ResultAction.RunCutscene && showGUI)
            {
                if (isAssetFile)
                {
                    linkedAssetFail = ActionListAssetMenu.AssetGUI ("ActionList to run:", linkedAssetFail);
                }
                else
                {
                    linkedCutsceneFail = ActionListAssetMenu.CutsceneGUI ("Cutscene to run:", linkedCutsceneFail);
                }
            }
            else if (resultActionFail == ResultAction.Skip)
            {
                SkipActionFailGUI (actions, showGUI);
            }
        }
示例#59
0
 /**
  * <summary>Skips an ActionList asset file.</summary>
  * <param name = "actionListAsset">The ActionList asset to skip</param>
  * <param name = "i">The index of the Action to skip from</param>
  * <returns>The temporary RuntimeActionList object in the scene that performs the Actions within the asset</returns>
  */
 public static RuntimeActionList SkipActionListAsset(ActionListAsset actionListAsset, int i)
 {
     return RunActionListAsset (actionListAsset, null, i, true, false);
 }
示例#60
0
        /**
         * <summary>Runs or skips an ActionList asset file.</summary>
         * <param name = "actionListAsset">The ActionList asset to run</param>
         * <param name = "endConversation">The Conversation to enable when the ActionList is complete</param>
         * <param name = "i">The index of the Action to start from</param>
         * <param name = "doSkip">If True, all Actions within the ActionList will be run and completed instantly.</param>
         * <param name = "addToSkipQueue">True if the ActionList should be added to the skip queue</param>
         * <returns>The temporary RuntimeActionList object in the scene that performs the Actions within the asset</returns>
         */
        public static RuntimeActionList RunActionListAsset(ActionListAsset actionListAsset, Conversation endConversation, int i, bool doSkip, bool addToSkipQueue)
        {
            if (actionListAsset != null && actionListAsset.actions.Count > 0)
            {
                GameObject runtimeActionListObject = (GameObject) Instantiate (Resources.Load (Resource.runtimeActionList));
                RuntimeActionList runtimeActionList = runtimeActionListObject.GetComponent <RuntimeActionList>();
                runtimeActionList.DownloadActions (actionListAsset, endConversation, i, doSkip, addToSkipQueue);

                GameObject cutsceneFolder = GameObject.Find ("_Cutscenes");
                if (cutsceneFolder != null && cutsceneFolder.transform.position == Vector3.zero)
                {
                    runtimeActionList.transform.parent = cutsceneFolder.transform;
                }

                return runtimeActionList;
            }

            return null;
        }