Esempio n. 1
0
        public override void PrepareToCopy(int originalIndex, List<Action> actionList)
        {
            if (resultActionFail == ResultAction.Continue)
            {
                if (originalIndex == actionList.Count - 1)
                {
                    resultActionFail = ResultAction.Stop;
                }
                else if (actionList [originalIndex + 1].isMarked)
                {
                    resultActionFail = ResultAction.Skip;
                    skipActionFailActual = actionList [originalIndex + 1];
                }
                else
                {
                    resultActionFail = ResultAction.Stop;
                }
            }
            if (resultActionFail == ResultAction.Skip)
            {
                if (skipActionFailActual.isMarked)
                {
                    int place = 0;
                    foreach (Action _action in actionList)
                    {
                        if (_action.isMarked)
                        {
                            if (_action == skipActionFailActual)
                            {
                                skipActionFailActual = null;
                                skipActionFail = place;
                                break;
                            }
                            place ++;
                        }
                    }
                }
                else
                {
                    resultActionFail = ResultAction.Stop;
                }
            }

            if (resultActionTrue == ResultAction.Continue)
            {
                if (originalIndex == actionList.Count - 1)
                {
                    resultActionTrue = ResultAction.Stop;
                }
                else if (actionList [originalIndex + 1].isMarked)
                {
                    resultActionTrue = ResultAction.Skip;
                    skipActionTrueActual = actionList [originalIndex + 1];
                }
                else
                {
                    resultActionTrue = ResultAction.Stop;
                }
            }
            if (resultActionTrue == ResultAction.Skip)
            {
                if (skipActionTrueActual.isMarked)
                {
                    int place = 0;
                    foreach (Action _action in actionList)
                    {
                        if (_action.isMarked)
                        {
                            if (_action == skipActionTrueActual)
                            {
                                skipActionTrueActual = null;
                                skipActionTrue = place;
                                break;
                            }
                            place ++;
                        }
                    }
                }
                else
                {
                    resultActionTrue = ResultAction.Stop;
                }
            }
        }
Esempio n. 2
0
        private void SkipActionTrueGUI(List<Action> actions, bool showGUI)
        {
            if (skipActionTrue == -1)
            {
                // Set default
                int i = actions.IndexOf (this);
                if (actions.Count > i+1)
                {
                    skipActionTrue = i+1;
                }
                else
                {
                    skipActionTrue = i;
                }
            }

            int tempSkipAction = skipActionTrue;
            List<string> labelList = new List<string>();

            if (skipActionTrueActual)
            {
                bool found = false;

                for (int i = 0; i < actions.Count; i++)
                {
                    labelList.Add (i.ToString () + ": " + actions [i].title);

                    if (skipActionTrueActual == actions [i])
                    {
                        skipActionTrue = i;
                        found = true;
                    }
                }

                if (!found)
                {
                    skipActionTrue = tempSkipAction;
                }
            }

            if (skipActionTrue >= actions.Count)
            {
                skipActionTrue = actions.Count - 1;
            }

            if (showGUI)
            {
                if (actions.Count > 1)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField ("  Action to skip to:");
                    tempSkipAction = EditorGUILayout.Popup (skipActionTrue, labelList.ToArray());
                    skipActionTrue = tempSkipAction;
                    EditorGUILayout.EndHorizontal();
                }
                else
                {
                    EditorGUILayout.HelpBox ("Cannot skip action - no further Actions available", MessageType.Warning);
                    return;
                }
            }

            skipActionTrueActual = actions [skipActionTrue];
        }
Esempio n. 3
0
 public override void FixLinkAfterDeleting(Action actionToDelete, Action targetAction, List<Action> actionList)
 {
     if ((resultActionFail == ResultAction.Skip && skipActionFailActual == actionToDelete) || (resultActionFail == ResultAction.Continue && actionList.IndexOf (actionToDelete) == (actionList.IndexOf (this) + 1)))
     {
         if (targetAction == null)
         {
             resultActionFail = ResultAction.Stop;
         }
         else
         {
             resultActionFail = ResultAction.Skip;
             skipActionFailActual = targetAction;
         }
     }
     if ((resultActionTrue == ResultAction.Skip && skipActionTrueActual == actionToDelete) || (resultActionTrue == ResultAction.Continue && actionList.IndexOf (actionToDelete) == (actionList.IndexOf (this) + 1)))
     {
         if (targetAction == null)
         {
             resultActionTrue = ResultAction.Stop;
         }
         else
         {
             resultActionTrue = ResultAction.Skip;
             skipActionTrueActual = targetAction;
         }
     }
 }
Esempio n. 4
0
		public override void AfterCopy (List<Action> copyList)
		{
			if (resultActionFail == ResultAction.Skip && skipActionFailActual == null && copyList.Count > skipActionFail)
			{
				skipActionFailActual = copyList[skipActionFail];
			}
			if (resultActionTrue == ResultAction.Skip && skipActionTrueActual == null && copyList.Count > skipActionTrue)
			{
				skipActionTrueActual = copyList[skipActionTrue];
			}
		}
Esempio n. 5
0
        private void ActionSideMenu(int i)
        {
            ActionList _target = (ActionList) target;
            actionToAffect = _target.actions[i];
            GenericMenu menu = new GenericMenu ();

            if (_target.actions[i].isEnabled)
            {
                menu.AddItem (new GUIContent ("Disable"), false, Callback, "Disable");
            }
            else
            {
                menu.AddItem (new GUIContent ("Enable"), false, Callback, "Enable");
            }
            menu.AddSeparator ("");
            if (!Application.isPlaying)
            {
                if (_target.actions.Count > 1)
                {
                    menu.AddItem (new GUIContent ("Cut"), false, Callback, "Cut");
                }
                menu.AddItem (new GUIContent ("Copy"), false, Callback, "Copy");
            }
            if (AdvGame.copiedActions.Count > 0)
            {
                menu.AddItem (new GUIContent ("Paste after"), false, Callback, "Paste after");
            }
            menu.AddSeparator ("");
            menu.AddItem (new GUIContent ("Insert after"), false, Callback, "Insert after");
            if (_target.actions.Count > 1)
            {
                menu.AddItem (new GUIContent ("Delete"), false, Callback, "Delete");
            }
            if (i > 0 || i < _target.actions.Count-1)
            {
                menu.AddSeparator ("");
            }
            if (i > 0)
            {
                menu.AddItem (new GUIContent ("Re-arrange/Move to top"), false, Callback, "Move to top");
                menu.AddItem (new GUIContent ("Re-arrange/Move up"), false, Callback, "Move up");
            }
            if (i < _target.actions.Count-1)
            {
                menu.AddItem (new GUIContent ("Re-arrange/Move down"), false, Callback, "Move down");
                menu.AddItem (new GUIContent ("Re-arrange/Move to bottom"), false, Callback, "Move to bottom");
            }

            menu.AddSeparator ("");
            menu.AddItem (new GUIContent ("Toggle breakpoint"), false, Callback, "Toggle breakpoint");

            menu.ShowAsContext ();
        }
        private void JumpToActionGUI(List<Action> actions)
        {
            int tempSkipAction = jumpToAction;
            List<string> labelList = new List<string>();

            if (jumpToActionActual)
            {
                bool found = false;

                for (int i = 0; i < actions.Count; i++)
                {
                    labelList.Add (i.ToString () + ": " + actions [i].title);

                    if (jumpToActionActual == actions [i])
                    {
                        jumpToAction = i;
                        found = true;
                    }
                }

                if (!found)
                {
                    jumpToAction = tempSkipAction;
                }
            }

            if (jumpToAction < 0)
            {
                jumpToAction = 0;
            }

            if (jumpToAction >= actions.Count)
            {
                jumpToAction = actions.Count - 1;
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField ("  Action to skip to:");
            tempSkipAction = EditorGUILayout.Popup (jumpToAction, labelList.ToArray());
            jumpToAction = tempSkipAction;
            EditorGUILayout.EndHorizontal();
            jumpToActionActual = actions [jumpToAction];
        }
Esempio n. 7
0
        private void ActionSideMenu(AC.Action action)
        {
            ActionListAsset _target = (ActionListAsset) target;

            int i = _target.actions.IndexOf (action);
            actionToAffect = action;
            GenericMenu menu = new GenericMenu ();

            if (action.isEnabled)
            {
                menu.AddItem (new GUIContent ("Disable"), false, Callback, "Disable");
            }
            else
            {
                menu.AddItem (new GUIContent ("Enable"), false, Callback, "Enable");
            }
            menu.AddSeparator ("");
            if (_target.actions.Count > 1)
            {
                menu.AddItem (new GUIContent ("Cut"), false, Callback, "Cut");
            }
            menu.AddItem (new GUIContent ("Copy"), false, Callback, "Copy");
            if (AdvGame.copiedActions.Count > 0)
            {
                menu.AddItem (new GUIContent ("Paste after"), false, Callback, "Paste after");
            }
            menu.AddSeparator ("");
            menu.AddItem (new GUIContent ("Insert after"), false, Callback, "Insert after");
            menu.AddItem (new GUIContent ("Delete"), false, Callback, "Delete");
            if (i > 0 || i < _target.actions.Count-1)
            {
                menu.AddSeparator ("");
            }
            if (i > 0)
            {
                menu.AddItem (new GUIContent ("Re-arrange/Move to top"), false, Callback, "Move to top");
                menu.AddItem (new GUIContent ("Re-arrange/Move up"), false, Callback, "Move up");
            }
            if (i < _target.actions.Count-1)
            {
                menu.AddItem (new GUIContent ("Re-arrange/Move down"), false, Callback, "Move down");
                menu.AddItem (new GUIContent ("Re-arrange/Move to bottom"), false, Callback, "Move to bottom");
            }

            menu.ShowAsContext ();
        }