Example #1
0
        /**
         * Clears the current Expression so that the default portrait icon is used.
         */
        public void ClearExpression()
        {
            currentExpression = null;

            if (portraitIcon != null)
            {
                portraitIcon.Reset ();
            }

            foreach (Expression expression in expressions)
            {
                if (expression.portraitIcon != null)
                {
                    expression.portraitIcon.Reset ();
                }
            }
        }
Example #2
0
        private void ModifyAction(AC.Char _target, Expression _expression, string callback)
        {
            int i = -1;
            if (_expression != null && _target.expressions.IndexOf (_expression) > -1)
            {
                i = _target.expressions.IndexOf (_expression);
            }

            switch (callback)
            {
            case "Insert after":
                Undo.RecordObject (_target, "Create expression");
                _target.expressions.Insert (i+1, new Expression (GetExpressionIDArray (_target.expressions)));
                break;

            case "Delete":
                Undo.RecordObject (_target, "Delete expression");
                _target.expressions.Remove (_expression);
                break;

            case "Move up":
                Undo.RecordObject (_target, "Move expression up");
                _target.expressions.Remove (_expression);
                _target.expressions.Insert (i-1, _expression);
                break;

            case "Move down":
                Undo.RecordObject (_target, "Move expression down");
                _target.expressions.Remove (_expression);
                _target.expressions.Insert (i+1, _expression);
                break;
            }
        }
Example #3
0
 /**
  * <summary>Changes the active Expression.</summary>
  * <param name = "ID">The ID number of the Expression, in expressions, to make active.</param>
  */
 public void SetExpression(int ID)
 {
     currentExpression = null;
     foreach (Expression expression in expressions)
     {
         if (expression.ID == ID)
         {
             currentExpression = expression;
             return;
         }
     }
     ACDebug.LogWarning ("Cannot find expression with ID=" + ID.ToString () + " on character " + gameObject.name);
 }
Example #4
0
        private void ExpressionSideMenu(AC.Char _target, int i)
        {
            expressionToAffect = _target.expressions[i];
            GenericMenu menu = new GenericMenu ();

            menu.AddItem (new GUIContent ("Insert after"), false, Callback, "Insert after");
            if (_target.expressions.Count > 1)
            {
                menu.AddItem (new GUIContent ("Delete"), false, Callback, "Delete");
            }
            if (i > 0)
            {
                menu.AddItem (new GUIContent ("Re-arrange/Move up"), false, Callback, "Move up");
            }
            if (i < _target.expressions.Count-1)
            {
                menu.AddItem (new GUIContent ("Re-arrange/Move down"), false, Callback, "Move down");
            }

            menu.ShowAsContext ();
        }