Esempio n. 1
0
        // --------------------------------------------------------------
        // Action Fields
        // --------------------------------------------------------------

        /// <summary>
        /// Get a layer mask.
        /// </summary>
        /// <param name="title">Title for action field.</param>
        /// <param name="actionParams">Action field parameters.</param>
        /// <param name="actionField">Action field.</param>
        /// <param name="titleToLeft">Show the title on the left?</param>
        public static void BuildField(string title, HeroActionParams actionParams, HeroActionField actionField, bool titleToLeft = false)
        {
            // create the fields
            LayerMaskValueData data = CreateFieldData(title, actionField, actionParams.heroObject);

            //-----------------------------------------
            // Display this title above the field
            //-----------------------------------------
            if (data.title != "" && !titleToLeft)
            {
                SimpleLayout.Label(data.title);
            }
            SimpleLayout.BeginHorizontal();
            if (data.title != "" && titleToLeft)
            {
                SimpleLayout.Label(data.title);
            }

            //-----------------------------------------
            // Get the bool list you want to work with.
            // The bool list is in hero object editor > Variables
            //-----------------------------------------
            data.fieldValue = SimpleLayout.LayerMaskField(data.fieldValue, 200);

            //-----------------------------------------
            // assign values back to hero object fields
            //-----------------------------------------
            actionField.ints[0] = data.fieldValue;

            //-----------------------------------------
            // Visual stuff
            //-----------------------------------------
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();
        }
Esempio n. 2
0
        /// <summary>
        /// Draw the body of the block.
        /// </summary>
        private static void DrawItems()
        {
            // exit early if there are no items
            if (items == null || items.Count == 0)
            {
                return;
            }

            // display items
            for (int i = 0; i < items.Count; i++)
            {
                // get the box to draw around the foldout
                GUIStyle style       = Box.StyleDefault;
                GUIStyle buttonStyle = Button.StyleFoldoutText;
                if (HeroKitMenuBlock.itemFocus && HeroKitMenuBlock.itemID == i)
                {
                    style       = Box.StyleMenuSelected;
                    buttonStyle = Button.StyleFoldoutTextB;
                }

                string itemName = (items[i].itemProperties.strings.items[0].value != "") ? items[i].itemProperties.strings.items[0].value : "[none]";

                // show foldout
                SimpleLayout.BeginHorizontal(style);
                SimpleLayout.Button(i + ": " + itemName, showBlockContent, showContextMenu, i, buttonStyle);
                SimpleLayout.EndHorizontal();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Draw the body of the block.
        /// </summary>
        private static void DrawItems()
        {
            if (!heroObject.propertiesList.visible)
            {
                return;
            }

            // exit early if there are no items
            if (items == null || items.Count == 0)
            {
                return;
            }

            // display items
            for (int i = 0; i < items.Count; i++)
            {
                // get the box to draw around the foldout
                GUIStyle style       = Box.StyleDefault;
                GUIStyle buttonStyle = Button.StyleFoldoutText;
                if (HeroObjectMenuBlock.propertyFocus && HeroObjectMenuBlock.propertyID == i)
                {
                    style       = Box.StyleMenuSelected;
                    buttonStyle = Button.StyleFoldoutTextB;
                }

                string templateName = (items[i].propertyTemplate != null) ? items[i].propertyTemplate.name : "[none]";

                // show foldout
                SimpleLayout.BeginHorizontal(style);
                SimpleLayout.Space(indentMenu);
                SimpleLayout.Button(blockName + " " + i + ": " + templateName, showBlockContent, showContextMenu, i, buttonStyle);
                SimpleLayout.EndHorizontal();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Draw the body of the block.
        /// </summary>
        private static void DrawItems()
        {
            // exit early if there are no items
            if (items == null || items.Count == 0)
            {
                HeroKitCommon.DrawNoItemsInList(blockName);
                return;
            }

            SimpleLayout.BeginVertical(Box.StyleCanvasBox);

            // display items (move up, move down, int field,
            for (int i = 0; i < items.Count; i++)
            {
                SimpleLayout.BeginHorizontal();
                HeroKitCommon.DrawListArrows(moveItemUp, moveItemDown, i);

                items[i].value = SimpleLayout.BoolListField(items[i], i);
                items[i].name  = SimpleLayout.StringListField(items[i].name, HeroKitCommon.GetWidthForField(289));

                HeroKitCommon.DrawListButtons(addItem, copyItem, pasteItem, deleteItem, i);
                SimpleLayout.EndHorizontal();

                if (i != items.Count - 1)
                {
                    SimpleLayout.Line();
                }
            }

            SimpleLayout.EndVertical();

            SimpleLayout.Space(20);
        }
Esempio n. 5
0
        // --------------------------------------------------------------
        // Action Fields
        // --------------------------------------------------------------

        /// <summary>
        /// Get values from a drop-down field.
        /// </summary>
        /// <typeparam name="T">The HeroList type.</typeparam>
        /// <typeparam name="U">The items for the HeroList type.</typeparam>
        /// <param name="title">Title for action field.</param>
        /// <param name="actionParams">Action field parameters.</param>
        /// <param name="actionField">Action field.</param>
        /// <param name="dropDownField">A hero list.</param>
        /// <param name="items">The items for the hero list.</param>
        /// <returns>The selected item in the drop-down list field</returns>
        public static int BuildField <T, U>(string title, HeroActionParams actionParams, HeroActionField actionField, T dropDownField, List <U> items) where T : IDropDownListB <U>
        {
            DropDownBFieldData data = CreateFieldData(title, actionField);

            //-----------------------------------------
            // Display this title above the field
            //-----------------------------------------
            if (data.title != "")
            {
                SimpleLayout.Label(data.title);
            }
            SimpleLayout.BeginHorizontal();

            //-----------------------------------------
            // Display the drop down field
            //-----------------------------------------
            actionField.ints[0] = dropDownField.SetValues(data.fieldID, items, 0);

            //-----------------------------------------
            // Visual stuff
            //-----------------------------------------
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();

            //-----------------------------------------
            // Return ID of item selected in the drop down field
            //-----------------------------------------
            return(actionField.ints[0]);
        }
Esempio n. 6
0
        //--------------------------------------
        // Methods (Draw Hero Action Windows)
        //--------------------------------------

        /// <summary>
        /// Draw the title window inside the hero kit editor (hero action).
        /// </summary>
        /// <param name="id">ID assigned to the GUI Window</param>
        private void DrawTitleWindowHeroAction(int id)
        {
            SimpleLayout.BeginHorizontal(Box.StyleTitleWindow);
            TitleBlock.Block(heroKitAction.name, 1);
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();
        }
Esempio n. 7
0
        public static void BuildField(HeroActionParams actionParams)
        {
            HeroAction heroAction = actionParams.heroAction;

            //-----------------------------------------
            // create the action fields if they don't exist
            //-----------------------------------------
            ActionCommon.CreateActionFieldsOnHeroObject(heroAction, 11);

            //-----------------------------------------
            // create the fields for this action
            //-----------------------------------------

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            SimpleLayout.Label("Get the hero objects here:");
            GetHeroObjectField.BuildFieldB("", actionParams, heroAction.actionFields[10]);

            SimpleLayout.Label("Hero object to reference:");
            GetHeroObjectField.BuildFieldA("", actionParams, heroAction.actionFields[3]);

            SimpleLayout.Label("Longest distance objects can be from this hero object:");
            SimpleLayout.BeginHorizontal();
            bool useX = GetBoolValue.BuildField("X", actionParams, heroAction.actionFields[4]);
            bool useY = GetBoolValue.BuildField("Y", actionParams, heroAction.actionFields[5]);
            bool useZ = GetBoolValue.BuildField("Z", actionParams, heroAction.actionFields[6]);

            SimpleLayout.EndHorizontal();

            if (useX || useY || useZ)
            {
                SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
                if (showContent(heroAction, 4))
                {
                    GetFloatField.BuildFieldA("X:", actionParams, heroAction.actionFields[7], true);
                }
                if (showContent(heroAction, 5))
                {
                    GetFloatField.BuildFieldA("Y:", actionParams, heroAction.actionFields[8], true);
                }
                if (showContent(heroAction, 6))
                {
                    GetFloatField.BuildFieldA("Z:", actionParams, heroAction.actionFields[9], true);
                }
                SimpleLayout.EndVertical();
            }
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            SimpleLayout.Label("Operation:");
            GetDropDownField.BuildField("", actionParams, heroAction.actionFields[0], new HeroObjectOperatorField());
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            SimpleLayout.Label("Save the hero objects here:");
            GetHeroObjectField.BuildFieldB("", actionParams, heroAction.actionFields[1]);

            SimpleLayout.Label("Maximum number of hero objects to save:");
            GetIntegerField.BuildFieldA("", actionParams, heroAction.actionFields[2]);
            SimpleLayout.EndVertical();
        }
Esempio n. 8
0
        private static void DrawTimerEndCond()
        {
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);

            SimpleLayout.BeginHorizontal();
            boolFields[0].value = SimpleLayout.BoolField(boolFields[0].value);
            SimpleLayout.Label("Turn off condition with timer");
            SimpleLayout.EndHorizontal();

            if (boolFields[0].value)
            {
                SimpleLayout.Line();

                // list of stat change types
                DropDownValues changeTypeValues = new DropDownValues();
                string[]       changeType       = { "Seconds", "Minutes", "Hours" };
                changeTypeValues.setValues("", changeType);

                SimpleLayout.BeginHorizontal();
                intFields[0].value = SimpleLayout.DropDownList(intFields[0].value, changeTypeValues, 0, 150);
                intFields[1].value = SimpleLayout.IntField(intFields[1].value, 150);
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();
            }


            SimpleLayout.EndVertical();
        }
Esempio n. 9
0
        /// <summary>
        /// Draw item type
        /// </summary>
        private static void DrawTarget2()
        {
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            SimpleLayout.BeginHorizontal();
            SimpleLayout.Label("Uses Ammunition" + ":");
            boolFields[3].value = SimpleLayout.BoolField(boolFields[3].value);
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();

            if (boolFields[3].value)
            {
                SimpleLayout.Space(5);
                SimpleLayout.Line();

                // item type field
                string[]       items    = { "Another Character", "Caster" };
                DropDownValues itemList = new DropDownValues();
                itemList.setValues("", items);

                SimpleLayout.BeginHorizontal();
                intFields[1].value = SimpleLayout.DropDownList(intFields[1].value, itemList, 0, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 200));
                SimpleLayout.Label("Target");
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();

                SimpleLayout.BeginHorizontal();
                intFields[17].value = SimpleLayout.IntField(intFields[17].value);
                SimpleLayout.Label("Range (in meters)");
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();
            }

            SimpleLayout.EndVertical();
        }
Esempio n. 10
0
        // --------------------------------------------------------------
        // Action Fields
        // --------------------------------------------------------------

        /// <summary>
        /// Get a hero property.
        /// </summary>
        /// <param name="title">Title for action field.</param>
        /// <param name="actionParams">Action field parameters.</param>
        /// <param name="actionField">Action field.</param>
        public static void BuildField(string title, HeroActionParams actionParams, HeroActionField actionField)
        {
            // create the fields
            HeroPropertyFieldData data = CreateFieldData(title, actionField, actionParams.heroObject);

            //-----------------------------------------
            // Display this title above the field
            //-----------------------------------------
            if (data.title != "")
            {
                SimpleLayout.Label(data.title);
            }
            SimpleLayout.BeginHorizontal();

            //-----------------------------------------
            // Get the integer list you want to work with.
            // The integer list is in hero object editor > Variables
            //-----------------------------------------
            data.fieldValue = SimpleLayout.ObjectField(data.fieldValue, 200);

            //-----------------------------------------
            // assign values back to hero object fields
            //-----------------------------------------
            actionField.heroProperties[0] = data.fieldValue;

            //-----------------------------------------
            // Visual stuff
            //-----------------------------------------
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();
        }
Esempio n. 11
0
        /// <summary>
        /// Draw exp meter
        /// </summary>
        private static void DrawExpMeter()
        {
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);

            SimpleLayout.BeginHorizontal();
            boolFields[6].value = SimpleLayout.BoolField(boolFields[6].value);
            SimpleLayout.Label("Ability has Experience Meter");
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();

            if (boolFields[6].value)
            {
                SimpleLayout.BeginHorizontal();
                intFields[11].value = SimpleLayout.IntField(intFields[11].value);
                SimpleLayout.Label("Experience gained per use of this ability");
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();

                SimpleLayout.BeginHorizontal();
                intFields[10].value = SimpleLayout.IntField(intFields[10].value);
                SimpleLayout.Label("Experience needed to morph ability");
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();

                DropDownValues itemList = HeroKitCommon.databaseList(HeroKitCommon.abilityDatabase);
                SimpleLayout.BeginHorizontal();
                intFields[12].value = SimpleLayout.DropDownList(intFields[12].value, itemList, 0, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 250));
                SimpleLayout.Label("Morph into...");
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();
            }

            SimpleLayout.EndVertical();
        }
Esempio n. 12
0
        // --------------------------------------------------------------
        // Action Fields
        // --------------------------------------------------------------

        /// <summary>
        /// Get values from a drop-down field.
        /// </summary>
        /// <typeparam name="T">The HeroList type.</typeparam>
        /// <param name="title">Title for action field.</param>
        /// <param name="actionParams">Action field parameters.</param>
        /// <param name="actionField">Action field.</param>
        /// <param name="dropDownField">A hero list.</param>
        /// <param name="titleToLeft">Show the title on the left?</param>
        /// <returns>The selected item in the drop-down list field</returns>
        public static int BuildField <T>(string title, HeroActionParams actionParams, HeroActionField actionField, T dropDownField, bool titleToLeft = false) where T : IDropDownList
        {
            DropDownFieldData data = CreateFieldData(title, actionField);

            //-----------------------------------------
            // Display this title above the field
            //-----------------------------------------
            if (data.title != "" && !titleToLeft)
            {
                SimpleLayout.Label(data.title);
            }
            SimpleLayout.BeginHorizontal();
            if (data.title != "" && titleToLeft)
            {
                SimpleLayout.Label(data.title);
            }

            //-----------------------------------------
            // Display the operator field
            //-----------------------------------------
            actionField.ints[0] = dropDownField.SetValues(data.fieldID, 0);

            //-----------------------------------------
            // Visual stuff
            //-----------------------------------------
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();

            return(actionField.ints[0]);
        }
Esempio n. 13
0
        /// <summary>
        /// Draw item type
        /// </summary>
        private static void DrawUsesAmmo()
        {
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            SimpleLayout.BeginHorizontal();
            SimpleLayout.Label("Uses Ammunition" + ":");
            boolFields[3].value = SimpleLayout.BoolField(boolFields[3].value);
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();

            if (boolFields[3].value)
            {
                SimpleLayout.Space(5);
                SimpleLayout.Line();

                // item type field
                DropDownValues itemList = HeroKitCommon.databaseList(HeroKitCommon.ammunitionTypeDatabase);

                SimpleLayout.BeginHorizontal();
                intFields[2].value = SimpleLayout.DropDownList(intFields[2].value, itemList, 0, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 200));
                SimpleLayout.Label("Ammunition type");
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();

                SimpleLayout.BeginHorizontal();
                intFields[3].value = SimpleLayout.IntField(intFields[3].value);
                SimpleLayout.Label("Range (in meters)");
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();
            }

            SimpleLayout.EndVertical();
        }
Esempio n. 14
0
        /// <summary>
        /// Draw item type
        /// </summary>
        private static void DrawRange()
        {
            // item type field
            string[]       items    = { "Projectile launched at target", "Everything within radius around Caster", "Directly on Target" };
            DropDownValues itemList = new DropDownValues();

            itemList.setValues("", items);

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            SimpleLayout.BeginHorizontal();
            intFields[2].value = SimpleLayout.DropDownList(intFields[2].value, itemList, 0, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 200));
            SimpleLayout.Label("How ability is used");
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();

            // projectile or radius
            if (intFields[2].value == 1 || intFields[2].value == 2)
            {
                SimpleLayout.BeginHorizontal();
                intFields[3].value = SimpleLayout.IntField(intFields[3].value);
                SimpleLayout.Label("Range (in meters)");
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();
            }

            // projectile
            if (intFields[2].value == 1)
            {
                SimpleLayout.BeginHorizontal();
                intFields[4].value = SimpleLayout.IntField(intFields[4].value);
                SimpleLayout.Label("Speed of projectile");
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();

                // particle effect on target
                SimpleLayout.BeginHorizontal();
                uoFields[3].value = SimpleLayout.ObjectField(uoFields[3].value as ParticleSystem, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 200));
                SimpleLayout.Label("Particle effect for projectile");
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();
            }

            // particle effect on target
            SimpleLayout.BeginHorizontal();
            uoFields[2].value = SimpleLayout.ObjectField(uoFields[2].value as ParticleSystem, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 200));
            SimpleLayout.Label("Particle effect on target");
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();

            // particle effect on caster
            SimpleLayout.BeginHorizontal();
            uoFields[1].value = SimpleLayout.ObjectField(uoFields[1].value as ParticleSystem, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 200));
            SimpleLayout.Label("Particle effect on caster");
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();


            SimpleLayout.EndVertical();
        }
Esempio n. 15
0
        /// <summary>
        /// Get a value from a bool field in a hero object template.
        /// This is for a field that contains Variable, Property, Global.
        /// </summary>
        /// <param name="title">Title for action field.</param>
        /// <param name="actionParams">Action field parameters.</param>
        /// <param name="actionField">Action field.</param>
        /// <param name="heroObject">Hero object that is the target of this action.</param>
        /// <param name="titleToLeft">Show the title on the left?</param>
        public static void BuildFieldC(string title, HeroActionParams actionParams, HeroActionField actionField, HeroObject heroObject, bool titleToLeft = false)
        {
            // create the fields
            BoolFieldData data = CreateFieldData(title, actionField, actionParams.heroObject);

            //-----------------------------------------
            // Display this title above the field
            //-----------------------------------------
            if (data.title != "" && !titleToLeft)
            {
                SimpleLayout.Label(data.title);
            }
            SimpleLayout.BeginHorizontal();
            if (data.title != "" && titleToLeft)
            {
                SimpleLayout.Label(data.title);
            }

            //-----------------------------------------
            // Get the type of field you want to work with.
            //-----------------------------------------
            data.fieldType = new HeroField.ValueTypeFieldB().SetValues(data.fieldType, 0);

            //-----------------------------------------
            // Get the type of game object we are working with
            // Option 1: This game object
            // Option 2: Another game object in the Game Object list attached to this game object
            // Option 3: Another game object in the scene
            //-----------------------------------------
            data.targetHeroObject = heroObject;

            //-----------------------------------------
            // Get the bool list you want to work with.
            // The bool list is in hero object editor > Variables
            //-----------------------------------------
            data = SetPropertyID(data);
            List <BoolField> items = GetItemsFromList(data);

            data = BuildItemFieldList(data, items);

            //-----------------------------------------
            // assign values back to hero object fields
            //-----------------------------------------
            actionField.ints[0]        = data.objectType;
            actionField.ints[1]        = data.objectID;
            actionField.ints[2]        = data.fieldID;
            actionField.ints[3]        = data.fieldType;
            actionField.ints[4]        = data.heroGUID;
            actionField.ints[5]        = data.propertyID;
            actionField.heroObjects[0] = data.targetHeroObject;
            actionField.strings[0]     = data.objectName;
            actionField.bools[0]       = data.fieldValue;

            //-----------------------------------------
            // Visual stuff
            //-----------------------------------------
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();
        }
Esempio n. 16
0
        //--------------------------------------
        // Methods (Draw Hero Property Windows)
        //--------------------------------------

        /// <summary>
        /// Draw the title window inside the hero kit editor (hero property).
        /// </summary>
        /// <param name="id">ID assigned to the GUI Window</param>
        private void DrawTitleWindowHeroProperty(int id)
        {
            SimpleLayout.BeginHorizontal(Box.StyleTitleWindow);
            TitleBlock.Block(heroKitProperty.name, 2);
            SimpleLayout.Space();
            TitleButtonBlock.Block(true);
            SimpleLayout.EndHorizontal();
        }
Esempio n. 17
0
 /// <summary>
 /// Button to add a new item to list.
 /// </summary>
 public static void AddItemButton()
 {
     SimpleLayout.BeginHorizontal();
     SimpleLayout.Space(indentMenu - 3);
     HeroKitCommon.DrawAddNewItem("Action", addItem, Button.StyleAddMenuItem, -2);
     SimpleLayout.EndHorizontal();
     SimpleLayout.Space(3);
 }
Esempio n. 18
0
        // --------------------------------------------------------------
        // Methods (Draw Hero Object Windows)
        // --------------------------------------------------------------

        /// <summary>
        /// Draw the title window inside the hero kit editor (hero object).
        /// </summary>
        /// <param name="id">ID assigned to the GUI Window</param>
        private void DrawTitleWindowHeroObject(int id)
        {
            SimpleLayout.BeginHorizontal(Box.StyleTitleWindow);
            TitleBlock.Block(heroObject.name, 0);
            SimpleLayout.Space();
            TitleButtonBlock.Block();
            SimpleLayout.EndHorizontal();
        }
Esempio n. 19
0
        /// <summary>
        /// Draw the block.
        /// </summary>
        private static void DrawBlock()
        {
            DrawItems();

            SimpleLayout.BeginHorizontal();
            SimpleLayout.Space(indentMenu - 12);
            addItemButton();
            SimpleLayout.EndHorizontal();
        }
        /// <summary>
        /// Get an animation from a legacy animation component.
        /// </summary>
        /// <param name="title">Title for action field.</param>
        /// <param name="actionParams">Action field parameters.</param>
        /// <param name="actionField">Action field.</param>
        /// <param name="heroObject">Hero object that is the target of this action.</param>
        /// <param name="stateID">ID of the state that contains the animation controller.</param>
        /// <param name="titleToLeft">Show the title on the left?</param>
        /// <returns>The animation controller.</returns>
        public static Animation BuildFieldA_Legacy(string title, HeroActionParams actionParams, HeroActionField actionField, HeroObject heroObject, int stateID, bool titleToLeft = false)
        {
            // create the fields
            AnimationParameterFieldData data = CreateFieldData(title, actionField);

            //-----------------------------------------
            // Display this title above the field
            //-----------------------------------------
            if (data.title != "" && !titleToLeft)
            {
                SimpleLayout.Label(data.title);
            }
            SimpleLayout.BeginHorizontal();
            if (data.title != "" && titleToLeft)
            {
                SimpleLayout.Label(data.title);
            }

            //-----------------------------------------
            // Get the animation controller we are working with
            //-----------------------------------------
            Animation animation = null;

            if (heroObject.states.states[stateID].heroVisuals.prefab != null)
            {
                animation = heroObject.states.states[stateID].heroVisuals.prefab.GetComponent <Animation>();
            }

            if (animation == null)
            {
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();
                return(null);
            }

            //-----------------------------------------
            // Get the triggers we want to work with
            //-----------------------------------------
            List <string> items = GetItemsFromList_Legacy(animation);

            data = BuildItemFieldList(data, items);

            //-----------------------------------------
            // assign values back to hero object fields
            //-----------------------------------------
            actionField.ints[0]    = data.fieldID;
            actionField.strings[0] = data.fieldName;

            //-----------------------------------------
            // Visual stuff
            //-----------------------------------------
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();

            return(animation);
        }
Esempio n. 21
0
 /// <summary>
 /// Draw item type
 /// </summary>
 private static void DrawAttackSpeed()
 {
     SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
     SimpleLayout.BeginHorizontal();
     intFields[1].value = SimpleLayout.IntField(intFields[1].value);
     SimpleLayout.Label("Pause time between attacks");
     SimpleLayout.Space();
     SimpleLayout.EndHorizontal();
     SimpleLayout.EndVertical();
 }
Esempio n. 22
0
 /// <summary>
 /// Draw item type
 /// </summary>
 private static void DrawIsTwoHanded()
 {
     SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
     SimpleLayout.BeginHorizontal();
     SimpleLayout.Label("Two-Handed Weapon" + ":");
     boolFields[2].value = SimpleLayout.BoolField(boolFields[2].value);
     SimpleLayout.Space();
     SimpleLayout.EndHorizontal();
     SimpleLayout.EndVertical();
 }
Esempio n. 23
0
        public static void BuildField(HeroActionParams actionParams)
        {
            HeroAction heroAction = actionParams.heroAction;

            //-----------------------------------------
            // create the action fields if they don't exist
            //-----------------------------------------
            ActionCommon.CreateActionFieldsOnHeroObject(heroAction, 11);

            //-----------------------------------------
            // create the fields for this action
            //-----------------------------------------
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            SimpleLayout.Label("Get the hero objects here:");
            GetHeroObjectField.BuildFieldB("", actionParams, heroAction.actionFields[10]);

            SimpleLayout.Label("Get hero objects in the scene at a specific position:");
            SimpleLayout.BeginHorizontal();
            GetBoolValue.BuildField("X", actionParams, heroAction.actionFields[3]);
            GetBoolValue.BuildField("Y", actionParams, heroAction.actionFields[4]);
            GetBoolValue.BuildField("Z", actionParams, heroAction.actionFields[5]);
            SimpleLayout.EndHorizontal();

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            if (showContent(heroAction, 3))
            {
                GetFloatField.BuildFieldA("X:", actionParams, heroAction.actionFields[6], true);
            }
            if (showContent(heroAction, 4))
            {
                GetFloatField.BuildFieldA("Y:", actionParams, heroAction.actionFields[7], true);
            }
            if (showContent(heroAction, 5))
            {
                GetFloatField.BuildFieldA("Z:", actionParams, heroAction.actionFields[8], true);
            }
            SimpleLayout.EndVertical();

            SimpleLayout.Label("Radius to include around each coordinate:");
            GetFloatField.BuildFieldA("", actionParams, heroAction.actionFields[9]);
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            SimpleLayout.Label("Operation:");
            GetDropDownField.BuildField("", actionParams, heroAction.actionFields[0], new HeroObjectOperatorField());
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            SimpleLayout.Label("Save the hero objects here:");
            GetHeroObjectField.BuildFieldB("", actionParams, heroAction.actionFields[1]);

            SimpleLayout.Label("Maximum number of hero objects to save:");
            GetIntegerField.BuildFieldA("", actionParams, heroAction.actionFields[2]);
            SimpleLayout.EndVertical();
        }
Esempio n. 24
0
        private static void DrawCantBeAttacked()
        {
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);

            SimpleLayout.BeginHorizontal();
            boolFields[4].value = SimpleLayout.BoolField(boolFields[4].value);
            SimpleLayout.Label("Character can't be attacked");
            SimpleLayout.EndHorizontal();

            SimpleLayout.EndVertical();
        }
        // --------------------------------------------------------------
        // Action Fields
        // --------------------------------------------------------------

        /// <summary>
        /// Get an animation controller.
        /// </summary>
        /// <param name="title">Title for action field.</param>
        /// <param name="actionParams">Action field parameters.</param>
        /// <param name="actionField">Action field.</param>
        /// <param name="heroObject">Hero object that is the target of this action.</param>
        /// <param name="stateID">ID of the state that contains the animation controller.</param>
        /// <param name="paramType">Animation controller parameter type.</param>
        /// <param name="titleToLeft">Show the title on the left?</param>
        /// <returns>The animation controller.</returns>
        public static RuntimeAnimatorController BuildFieldA(string title, HeroActionParams actionParams, HeroActionField actionField, HeroObject heroObject, int stateID, AnimatorControllerParameterType paramType, bool titleToLeft = false)
        {
            // create the fields
            AnimationParameterFieldData data = CreateFieldData(title, actionField);

            //-----------------------------------------
            // Display this title above the field
            //-----------------------------------------
            if (data.title != "" && !titleToLeft)
            {
                SimpleLayout.Label(data.title);
            }
            SimpleLayout.BeginHorizontal();
            if (data.title != "" && titleToLeft)
            {
                SimpleLayout.Label(data.title);
            }

            //-----------------------------------------
            // Get the animation controller we are working with
            //-----------------------------------------
            RuntimeAnimatorController animatorController = heroObject.states.states[stateID].heroVisuals.animatorController;

            if (animatorController == null)
            {
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();
                return(null);
            }

            //-----------------------------------------
            // Get the triggers we want to work with
            //-----------------------------------------
            List <string> items = GetItemsFromList(animatorController, paramType);

            data = BuildItemFieldList(data, items);

            //-----------------------------------------
            // assign values back to hero object fields
            //-----------------------------------------
            actionField.ints[0]    = data.fieldID;
            actionField.strings[0] = data.fieldName;

            //-----------------------------------------
            // Visual stuff
            //-----------------------------------------
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();

            return(animatorController);
        }
Esempio n. 26
0
        /// <summary>
        /// Get a value from a hero object field in a hero object template.
        /// This is for a field that contains Variable, Property, Global.
        /// </summary>
        /// <param name="title">Title for action field.</param>
        /// <param name="actionParams">Action field parameters.</param>
        /// <param name="actionField">Action field.</param>
        /// <param name="heroObject">Hero object that is the target of this action.</param>
        /// <param name="titleToLeft">Show the title on the left?</param>
        public static HeroObject BuildFieldC(string title, HeroActionParams actionParams, HeroActionField actionField, bool titleToLeft = false)
        {
            HeroObjectFieldData data = CreateFieldData(title, actionField, actionParams.heroObject);

            //-----------------------------------------
            // Display this title above the field
            //-----------------------------------------
            if (data.title != "" && !titleToLeft)
            {
                SimpleLayout.Label(data.title);
            }
            SimpleLayout.BeginHorizontal();
            if (data.title != "" && titleToLeft)
            {
                SimpleLayout.Label(data.title);
            }
            else
            {
                SimpleLayout.Space(8);
            }

            //-----------------------------------------
            // Get the type of object we are working with
            // Option 1: This object (object that this hero object is attached to)
            // Option 2: Another object (another object in the scene that has a hero object attached to it)
            //-----------------------------------------
            SimpleLayout.Space(-8);
            data = ActionCommon.GetTargetHeroTemplate(data);

            //-----------------------------------------
            // assign values back to hero object fields
            //-----------------------------------------
            actionField.heroObjects[0] = data.targetHeroObject;
            actionField.ints[0]        = data.objectType;
            actionField.ints[1]        = data.objectID;
            actionField.ints[2]        = data.fieldID;
            actionField.ints[3]        = data.fieldType;
            actionField.ints[4]        = data.heroGUID;
            actionField.ints[5]        = data.propertyID;
            actionField.strings[0]     = data.objectName;

            //-----------------------------------------
            // Visual stuff
            //-----------------------------------------
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();

            return(data.targetHeroObject);
        }
Esempio n. 27
0
        /// <summary>
        /// Draw the body of the block.
        /// </summary>
        private static void DrawItems()
        {
            // exit early if there are no items
            if (items == null || items.Count == 0)
            {
                return;
            }

            // display items (move up, move down, int field,
            for (int i = 0; i < items.Count; i++)
            {
                // get the box to draw around the foldout
                GUIStyle style       = Box.StyleDefault;
                GUIStyle buttonStyle = Button.StyleFoldoutText;
                if (HeroObjectMenuBlock.stateFocus && HeroObjectMenuBlock.stateID == stateIndex && HeroObjectMenuBlock.eventID == i && HeroObjectMenuBlock.actionID == -1)
                {
                    style       = Box.StyleMenuSelected;
                    buttonStyle = Button.StyleFoldoutTextB;
                }

                // use default name for event if name not provided
                string eventName = "";
                if (items[i].name == "")
                {
                    if (items[i].eventType > 0)
                    {
                        eventName = HeroField.EventTypeField.field.items[items[i].eventType - 1];
                    }
                }
                else
                {
                    eventName = items[i].name;
                }

                // show foldout
                SimpleLayout.BeginHorizontal();
                SimpleLayout.Space(indentMenu);
                SimpleLayout.BeginHorizontal(style);
                GUIStyle foldoutStyle = (items[i].visible) ? Button.StyleFoldoutOpen : Button.StyleFoldoutClosed;
                SimpleLayout.Button("", toggleBlock, showContextMenu, stateIndex, i, foldoutStyle, 10);
                SimpleLayout.Button(blockName + " " + i + ": " + eventName, showBlockContent, showContextMenu, stateIndex, i, buttonStyle);
                SimpleLayout.EndHorizontal();
                SimpleLayout.EndHorizontal();

                // show actions for open foldout
                DrawActionForEvent(i);
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Draw the block.
        /// </summary>
        private static void DrawBlock()
        {
            // get the box to draw around the foldout
            GUIStyle style = Box.StyleDefault;
            GUIStyle buttonStyle = Button.StyleFoldoutHeading;
            if (HeroObjectMenuBlock.propertyFocus)
            {
                style = Box.StyleMenuSelected;
                buttonStyle = Button.StyleFoldoutHeadingB;
            }

            // draw the properties
            SimpleLayout.BeginHorizontal(style);
            SimpleLayout.Button(" " + HeroObjectMenuBlock.textIcon + "  " + blockName, showBlockContent, buttonStyle);
            SimpleLayout.EndHorizontal();
        }
Esempio n. 29
0
        /// <summary>
        /// Draw an item in the list.
        /// </summary>
        /// <param name="itemName">Name of the item.</param>
        /// <param name="menuID">ID assigned to the list type.</param>
        private static void DrawListItem(string itemName, int menuID)
        {
            // get the box to draw around the foldout
            GUIStyle style       = Box.StyleDefault;
            GUIStyle buttonStyle = Button.StyleFoldoutText;

            if (variableID == menuID)
            {
                style       = Box.StyleMenuSelected;
                buttonStyle = Button.StyleFoldoutTextB;
            }

            // show options
            SimpleLayout.BeginHorizontal(style);
            SimpleLayout.Button(textIcon + " " + itemName, showBlockContent, menuID, buttonStyle);
            SimpleLayout.EndHorizontal();
        }
Esempio n. 30
0
        /// <summary>
        /// Draw item type
        /// </summary>
        private static void DrawSuccess()
        {
            // item type field
            string[]       items = { "100%", "95%", "90%", "85%", "80%", "75%", "70%", "65%", "60%", "55%", "50%",
                                     "45%",        "40%", "35%", "30%", "25%", "20%", "15%", "15%", "5%" };
            DropDownValues itemList = new DropDownValues();

            itemList.setValues("", items);

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            SimpleLayout.BeginHorizontal();
            intFields[5].value = SimpleLayout.DropDownList(intFields[5].value, itemList, 0, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 200));
            SimpleLayout.Label("Chance of success");
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();
            SimpleLayout.EndVertical();
        }