コード例 #1
0
        public static void Show(AIActionCollection collection, string path = "")
        {
            var menu = new GenericMenu();

            AddAction(menu, path, collection.Add);
            menu.ShowAsContext();
        }
コード例 #2
0
 void Header(GUIContent label, AIAction action, AIActionCollection collection)
 {
     GUILayout.BeginHorizontal();
     EditorGUILayout.LabelField(label, EditorStyles.boldLabel);
     if (GUILayout.Button(Texts.menu, GUIStyle.none, GUILayout.ExpandWidth(false)))
     {
         Menu.Show(action, collection);
     }
     GUILayout.EndHorizontal();
 }
コード例 #3
0
 void Draw(AIAction action, AIActionCollection collection)
 {
     Header(action is AIConditional ? Texts.conditional : Actions[action.GetType()].withColon, action, collection);
     if (action is AIConditional c)
     {
         Draw(c);
     }
     else
     {
         Draw(action);
     }
 }
コード例 #4
0
        public static void Show(AIAction action, AIActionCollection collection)
        {
            var menu = new GenericMenu();

            menu.AddItem(new GUIContent("Remove"), false, () => collection.Remove(action));

            menu.AddSeparator(string.Empty);

            AddAction(menu, "Create new above", (a) => collection.AddAbove(action, a));
            AddAction(menu, "Create new below", (a) => collection.AddBelow(action, a));

            menu.ShowAsContext();
        }
コード例 #5
0
    void Draw(AIActionCollection actions)
    {
        if (actions == null)
        {
            actions = new AIActionCollection(target);
        }
        actions.Parent = target;

        GUILayout.BeginVertical(Styles.collection);

        if (actions?.Count > 0)
        {
            foreach (var action in actions)
            {
                Draw(action, actions);
            }
        }
        else
        {
            EditorGUILayout.LabelField("-- No actions --");
        }
        GUILayout.EndVertical();
    }