Ejemplo n.º 1
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();
            }
        }
Ejemplo 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();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Draw the button in the block.
        /// </summary>
        private static void DrawButton()
        {
            GUILayout.BeginVertical();
            SimpleLayout.Space(10);

            GUILayout.BeginHorizontal();
            SimpleLayout.Button(Content.MenuIcon, clickOptionsButton, Button.StyleA, 25);
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
        }
Ejemplo 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)
            {
                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);
            }
        }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
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();
        }
Ejemplo n.º 7
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 (HeroObjectMenuBlock.globalFocus && HeroObjectMenuBlock.globalID == menuID)
            {
                style       = Box.StyleMenuSelected;
                buttonStyle = Button.StyleFoldoutTextB;
            }

            // show foldout
            SimpleLayout.BeginHorizontal(style);
            SimpleLayout.Space(indentMenu);
            SimpleLayout.Button(HeroObjectMenuBlock.textIcon + " " + itemName, showBlockContent, menuID, buttonStyle);
            SimpleLayout.EndHorizontal();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Draw the heading for this block.
        /// </summary>
        private static void DrawHeading()
        {
            // get the box to draw around the foldout
            GUIStyle style       = Box.StyleDefault;
            GUIStyle buttonStyle = Button.StyleFoldoutHeading;

            if (HeroObjectMenuBlock.variableFocus && HeroObjectMenuBlock.variableID == -1)
            {
                style       = Box.StyleMenuSelected;
                buttonStyle = Button.StyleFoldoutHeadingB;
            }

            // show foldout
            SimpleLayout.BeginHorizontal(style);
            GUIStyle foldoutStyle = (heroObject.lists.visible) ? Button.StyleFoldoutOpen : Button.StyleFoldoutClosed;

            SimpleLayout.Button("", toggleBlock, foldoutStyle, 10);
            SimpleLayout.Button(blockName, showBlockTitle, buttonStyle);
            SimpleLayout.EndHorizontal();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Draw the body of the block.
        /// </summary>
        private static void DrawBody()
        {
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Refresh Hero Objects", RefreshHeroObjects, Button.StyleA);
            SimpleLayout.Label("Use this to make sure that your hero objects structure is up-to-date. \n" +
                               "For example, if you change a Hero Property that is assigned to several \n" +
                               "Hero Objects, press this button to make sure all of the hero objects have \n" +
                               "the new, updated properties.");

            SimpleLayout.Line();
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Delete Save Files", DeleteSaveFiles, Button.StyleA);
            SimpleLayout.Label("Quickly delete save files.");

            SimpleLayout.Line();
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Migrate HeroKit data to Beta 1.02", UpdateHeroKit1_2, Button.StyleA);
            SimpleLayout.Label("This move your properties on hero objects into the new Property \n" +
                               "structure on hero objects. Once you've done this, you need to update your \n" +
                               "actions to point to the updated properties.");

            SimpleLayout.Line();
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Show/Hide Menu Templates", ShowMenuSkins, Button.StyleA);
            SimpleLayout.Label("You can use the default templates we provide for your menus \n" +
                               "or you can use your own. The default templates are stored here: \n" +
                               "HeroKit/Hero Engine/Assets/Resources/Hero Templates/Menus");
            MenuSkins();

            SimpleLayout.Line();
            SimpleLayout.EndVertical();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Draw the body of the block.
        /// </summary>
        private static void DrawItems()
        {
            if (!heroObject.states.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.stateFocus && HeroObjectMenuBlock.stateID == i && HeroObjectMenuBlock.eventID == -1 && HeroObjectMenuBlock.actionID == -1)
                {
                    style       = Box.StyleMenuSelected;
                    buttonStyle = Button.StyleFoldoutTextB;
                }

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

                // show events for state
                DrawEventForState(i);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Hero Object = A hero object attached to a game object in a scene.
        /// </summary>
        /// <typeparam name="T">The type of data for the action field.</typeparam>
        /// <param name="data">The data for the action field.</param>
        /// <returns>The data for the action field.</returns>
        public static T GetHeroObjectInScene <T>(T data) where T : ITargetHeroObject
        {
            GameObject    go       = null;
            HeroKitObject hkoField = null;

            // if there is no game object attached to action, do this here...
            if (data.heroGUID == 0)
            {
                hkoField = SimpleLayout.ObjectField <HeroKitObject>(hkoField, 300, true);
                if (hkoField != null)
                {
                    go = hkoField.gameObject;
                }
            }

            // if a game object was attached to action, update fields here...
            if (data.heroGUID != 0)
            {
                HeroKitObject hko = HeroKitDatabase.GetHeroKitObject(data.heroGUID);
                if (hko != null)
                {
                    go = hko.gameObject;
                }

                oldGUID = data.heroGUID;
                newGUID = data.heroGUID;

                SimpleLayout.Space(5);
                SimpleLayout.Button(" [X] " + data.objectName, new UnityAction <T>(DeleteGameObject), data, Button.StyleB, 205);

                if (oldGUID != newGUID)
                {
                    data.heroGUID         = newGUID;
                    data.objectName       = "";
                    data.targetHeroObject = null;
                    go = null;
                }
            }

            // if there is a game object attached to the action field, populate it here
            if (go != null)
            {
                HeroKitObject hko = go.GetComponent <HeroKitObject>();
                if (hko == null)
                {
                    Debug.LogError("Game Object can't be added because it doesn't have a Hero Kit Object component. Add this component and re-add the game object.");
                    return(data);
                }

                data.heroGUID   = hko.heroGUID;
                data.objectName = go.name;

                // get the hero kit objects in the open scene(s)
                HeroKitObject[] heroKitObjects = Resources.FindObjectsOfTypeAll <HeroKitObject>();

                // get the gameobject that has the GUID we need
                for (int i = 0; i < heroKitObjects.Count(); i++)
                {
                    if (heroKitObjects[i].heroGUID == data.heroGUID)
                    {
                        data.targetHeroObject = heroKitObjects[i].heroObject;
                        break;
                    }
                }
            }
            else
            {
                data.targetHeroObject = null;
            }

            return(data);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Draw the body of the block.
        /// </summary>
        private static void DrawBody()
        {
            int bsize = 150;

            SimpleLayout.Space(22);
            SimpleLayout.BeginHorizontal();
            SimpleLayout.Space(22);
            SimpleLayout.BeginVertical();


            // -----------------------------------


            SimpleLayout.BeginHorizontal();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Item Types", OpenItemTypeDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Items", OpenItemsDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Affix Types", OpenAffixTypeDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Affixes", OpenAffixDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Stats", OpenStatsDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Meter Stats", OpenMeterDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Character Types", OpenCharacterTypeDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Characters", OpenCharacterDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();
            SimpleLayout.Space(10);

            // -----------------------------------


            SimpleLayout.BeginHorizontal();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Element Types", OpenElementTypeDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Elements", OpenElementsDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Condition Types", OpenConditionTypeDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Conditions", OpenConditionDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Weapon Types", OpenWeaponTypeDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Weapons", OpenWeaponDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Armor Types", OpenArmorTypeDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Armor", OpenArmorDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();
            SimpleLayout.Space(10);

            // -----------------------------------


            SimpleLayout.BeginHorizontal();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Ammunition Types", OpenAmmunitionTypeDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Ammunition", OpenAmmunitionDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Ability Types", OpenAbilityTypeDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Abilities", OpenAbilityDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Classes", OpenClassDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Subclasses", OpenSubclassDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Race", OpenRaceDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Subrace", OpenSubraceDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();
            SimpleLayout.Space(10);

            // -----------------------------------

            // -----------------------------------


            SimpleLayout.BeginHorizontal();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Alignments", OpenAlignmentDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            //SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            //SimpleLayout.Button("Alignments", OpenAmmunitionDB, Button.StyleBig, bsize);
            //SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Currency Types", OpenMoneyDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            //SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            //SimpleLayout.Button("Formulas", OpenFormulaDB, Button.StyleBig, bsize);
            //SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(Box.StyleA);
            SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            SimpleLayout.Button("Formulas", OpenFormulaDB, Button.StyleBig, bsize);
            SimpleLayout.EndVertical();
            //SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            //SimpleLayout.Button("Formulas", OpenFormulaDB, Button.StyleBig, bsize);
            //SimpleLayout.EndVertical();
            SimpleLayout.EndVertical();

            //SimpleLayout.BeginVertical(Box.StyleA);
            //SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            //SimpleLayout.Button("Race", OpenRaceDB, Button.StyleBig, bsize);
            //SimpleLayout.EndVertical();
            //SimpleLayout.BeginVertical(Box.StyleCanvasBox);
            //SimpleLayout.Button("Subrace", OpenSubraceDB, Button.StyleBig, bsize);
            //SimpleLayout.EndVertical();
            //SimpleLayout.EndVertical();

            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();
            SimpleLayout.Space(10);

            // -----------------------------------



            SimpleLayout.EndHorizontal();
            SimpleLayout.Space();
            SimpleLayout.EndVertical();
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Bool conditions that must be satisfied for the event to run.
        /// </summary>
        private static void DrawBoolConditionFields()
        {
            SimpleLayout.BeginVertical(Box.StyleB);

            // ROW: START -----------------------------------------
            SimpleLayout.BeginHorizontal();
            // COLUMN 1: START ------------------------------------
            SimpleLayout.BeginVertical();
            SimpleLayout.Label("BOOLS (these conditions must be met before this event can run):");
            SimpleLayout.EndVertical();
            // COLUMN 1: END --------------------------------------
            SimpleLayout.Space();
            // COLUMN 2: START ------------------------------------
            SimpleLayout.BeginVertical();
            SimpleLayout.Button(Content.AddIcon, addBoolCondition, Button.StyleA, 25);
            SimpleLayout.EndVertical();
            // COLUMN 2: END --------------------------------------
            SimpleLayout.EndHorizontal();
            // ROW: END -------------------------------------------

            if (eventBlock.boolConditions.Count > 0)
            {
                SimpleLayout.Line();
            }

            // List of entries
            for (int i = 0; i < eventBlock.boolConditions.Count; i++)
            {
                // ROW 1: START ---------------------------------------
                SimpleLayout.BeginHorizontal();

                // COLUMN 1: START ------------------------------------
                SimpleLayout.BeginVertical();

                // VALUE 1
                SimpleLayout.BeginHorizontal();
                GetBoolField.BuildEventField("Value 1:", eventBlock.boolConditions[i].itemA, heroObject);
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();

                // OPERATOR
                SimpleLayout.BeginHorizontal();
                SimpleLayout.Space(60);
                eventBlock.boolConditions[i].operatorID = new TrueFalseField().SetValues(eventBlock.boolConditions[i].operatorID, 0);
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();
                //SimpleLayout.Space(4);

                // VALUE 2
                SimpleLayout.BeginHorizontal();
                GetBoolField.BuildEventField("Value 2:", eventBlock.boolConditions[i].itemB, heroObject);
                SimpleLayout.Space();
                SimpleLayout.EndHorizontal();
                SimpleLayout.EndVertical();
                // COLUMN 1: END --------------------------------------

                // COLUMN 2: START ------------------------------------
                SimpleLayout.BeginVertical();
                SimpleLayout.Button(Content.DeleteIcon, deleteBoolCondition, i, Button.StyleA, 25);
                SimpleLayout.EndVertical();
                // COLUMN 2: END --------------------------------------

                SimpleLayout.EndHorizontal();
                // ROW 1: END -----------------------------------------

                // ROW 2: START ---------------------------------------
                if (i < eventBlock.boolConditions.Count - 1)
                {
                    SimpleLayout.Line();
                }
                // ROW 2: END -----------------------------------------
            }

            SimpleLayout.EndVertical();
        }
Ejemplo n.º 14
0
        /// <summary>
        /// When the event should run.
        /// </summary>
        private static void DrawEventTypeField()
        {
            SimpleLayout.BeginVertical(Box.StyleB);

            SimpleLayout.BeginHorizontal();
            eventBlock.eventType = EventTypeField.SetValues(heroObject, stateIndex, eventIndex, 80);
            if (eventBlock.eventType == 5)
            {
                SimpleLayout.Button(Content.AddIcon, addConditionInputList, Button.StyleA, 25);
            }
            SimpleLayout.EndHorizontal();

            // input event
            if (eventBlock.eventType == 5)
            {
                for (int listID = 0; listID < eventBlock.inputConditions.Count; listID++)
                {
                    // exit early if there are no items in this condition
                    if (eventBlock.inputConditions[listID].items == null)
                    {
                        break;
                    }

                    SimpleLayout.BeginVertical(Box.StyleA);

                    // draw content for condition
                    for (int condID = 0;
                         listID < eventBlock.inputConditions.Count &&
                         condID < eventBlock.inputConditions[listID].items.Count;
                         condID++)
                    {
                        SimpleLayout.BeginHorizontal();
                        if (condID == 0)
                        {
                            SimpleLayout.Button(Content.AddIcon, addEventCondition, listID, Button.StyleA, 25);
                        }
                        eventBlock.inputConditions[listID].items[condID].inputType = EventInputTypeField.SetValues(heroObject, stateIndex, eventIndex, listID, condID, (condID == 0) ? 42 : 70);
                        int inputType = eventBlock.inputConditions[listID].items[condID].inputType;

                        // mouse
                        if (inputType == 1)
                        {
                            eventBlock.inputConditions[listID].items[condID].key = EventMouseField.SetValues(heroObject, stateIndex, eventIndex, listID, condID, 0);
                        }
                        // keyboard
                        else if (inputType == 2)
                        {
                            eventBlock.inputConditions[listID].items[condID].key = EventKeyField.SetValues(heroObject, stateIndex, eventIndex, listID, condID, 0);
                        }
                        // joystick
                        else if (inputType == 3)
                        {
                            eventBlock.inputConditions[listID].items[condID].key = EventJoystickField.SetValues(heroObject, stateIndex, eventIndex, listID, condID, 0);
                        }
                        // touch
                        if (inputType == 4)
                        {
                            eventBlock.inputConditions[listID].items[condID].key = EventTouchField.SetValues(heroObject, stateIndex, eventIndex, listID, condID, 0);
                        }

                        eventBlock.inputConditions[listID].items[condID].pressType = EventPressTypeField.SetValues(heroObject, stateIndex, eventIndex, listID, condID, 0);
                        SimpleLayout.Button(Content.DeleteIcon, deleteEventCondition, listID, condID, Button.StyleA, 25);
                        SimpleLayout.EndHorizontal();
                    }

                    SimpleLayout.EndVertical();
                }
            }

            // message event
            else if (eventBlock.eventType == 6)
            {
                // what kind of tags are acceptable?
                eventBlock.messageSettings[0] = EventMessageTagField.SetValues(heroObject, stateIndex, eventIndex, 80);

                // if a specific tag is needed, get it
                if (eventBlock.messageSettings[0] == 4)
                {
                    eventBlock.messageSettings[1] = TagListField.SetEventValues(heroObject, stateIndex, eventIndex, 80);
                    eventBlock.messageTag         = "";
                    if (eventBlock.messageSettings[1] > 0)
                    {
                        eventBlock.messageTag = UnityEditorInternal.InternalEditorUtility.tags[eventBlock.messageSettings[1] - 1];
                    }
                }

                // what kind of interaction is possible (on touch, interact, on leave?)
                eventBlock.messageSettings[2] = EventMessageInteractField.SetValues(heroObject, stateIndex, eventIndex, 80);

                // if message type = Touch Object
                if (eventBlock.messageSettings[2] == 3 || eventBlock.messageSettings[2] == 4)
                {
                    eventBlock.messageSettings[3] = EventMessageRunField.SetValues(heroObject, stateIndex, eventIndex, 80);
                }
            }

            else
            {
                // clear the input list if we're using another type of condition
                eventBlock.inputConditions = new List <ConditionInputList>();
            }

            SimpleLayout.EndVertical();
        }
Ejemplo n.º 15
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 == eventIndex && HeroObjectMenuBlock.actionID == i)
                {
                    style       = Box.StyleMenuSelected;
                    buttonStyle = Button.StyleFoldoutTextB;
                }

                //---------------------------------------------
                // get the prefix to show before the name of the item
                //---------------------------------------------
                string prefix = (items[i].actionTemplate != null) ? items[i].actionTemplate.title : "";

                //---------------------------------------------
                // get the name to show for the action
                //---------------------------------------------
                string itemName = items[i].name;
                if (items[i].actionTemplate != null)
                {
                    itemName = (items[i].name != "") ? items[i].name : items[i].actionTemplate.name;
                }

                // dont show item name if prefix found and if item has no name
                itemName = (prefix != "" && items[i].name == "") ? "" : itemName;

                //---------------------------------------------
                // set indent level of this action
                //---------------------------------------------
                if (items[i].actionTemplate != null)
                {
                    // get new indent
                    indent = indent + items[i].actionTemplate.indentThis;

                    // if indent is negative, change it to zero (happens if too many end statements added)
                    if (indent < 0)
                    {
                        indent = 0;
                    }
                }
                items[i].indent = indent;
                string space = "".PadRight(indent * 5);

                //---------------------------------------------
                // set the color of the action title text
                //---------------------------------------------
                string hexColor = (SimpleGUICommon.isProSkin) ? "FFFFFF" : "000000";
                if (items[i].actionTemplate != null)
                {
                    hexColor = SimpleGUICommon.GetHexFromColor(items[i].actionTemplate.titleColor);

                    // lighten colors for dark skin
                    if (SimpleGUICommon.isProSkin)
                    {
                        hexColor = SimpleGUICommon.AlterHexBrightness(hexColor, 150);
                    }
                }

                //---------------------------------------------
                // if button is disabled, change the color of the text
                //---------------------------------------------
                if (!items[i].active)
                {
                    buttonStyle = Button.StyleFoldoutDisabledText;
                    hexColor    = SimpleGUICommon.GetHexFromColor(Button.StyleFoldoutDisabledText.normal.textColor);
                }

                //---------------------------------------------
                // show foldout
                //---------------------------------------------
                SimpleLayout.BeginHorizontal();
                SimpleLayout.Space(indentMenu);
                SimpleLayout.BeginHorizontal(style);
                string name = HeroObjectMenuBlock.textIcon + " " + blockName + " " + i + ": " + space + "<color=#" + hexColor + ">" + prefix + itemName + "</color>";
                SimpleLayout.Button(name, showBlockContent, showContextMenu, stateIndex, eventIndex, i, buttonStyle);
                SimpleLayout.EndHorizontal();
                SimpleLayout.EndHorizontal();

                //---------------------------------------------
                // set indent level of next action
                //---------------------------------------------

                // note if delete called, the last item in list won't exist. check to make sure it is still there.
                if (items.Count > i && items[i].actionTemplate != null)
                {
                    // get new indent
                    indent = indent + items[i].actionTemplate.indentNext;

                    // if indent is negative, change it to zero (happens if too many end statements added)
                    if (indent < 0)
                    {
                        indent = 0;
                    }
                }

                // if we are at the end of the action list, reset indent
                if (i == (items.Count - 1))
                {
                    indent = 0;
                }
            }
        }