Пример #1
0
        /// <summary>
        /// Get a value from a hero object field.
        /// 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="titleToLeft">Show the title on the left?</param>
        public static HeroObject BuildFieldB(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);
            }

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

            //-----------------------------------------
            // 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)
            //-----------------------------------------
            if (data.fieldType == 1 || data.fieldType == 2)
            {
                data = ActionCommon.GetTargetHeroObject(data);
            }

            //-----------------------------------------
            // Get the hero list you want to work with.
            // The list is in hero object editor > Variables
            //-----------------------------------------

            // if this is a field, draw field (1=value)
            data = SetPropertyID(data);
            List <HeroObjectField> items = GetItemsFromList(data);

            data = BuildItemFieldList(data, items);

            //-----------------------------------------
            // 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(GetTargetHeroObject(data.targetHeroObject, data.fieldType + 1, data.fieldID, data.propertyID));
        }
Пример #2
0
        // --------------------------------------------------------------
        // Action Fields
        // --------------------------------------------------------------

        /// <summary>
        /// Get a value from a hero object field.
        /// This is for a field that contains Value, 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="titleToLeft">Show the title on the left?</param>
        public static HeroObject BuildFieldA(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);
            }

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

            //-----------------------------------------
            // Get the type of object we are working with. (if it isn't a global)
            //-----------------------------------------
            data = ActionCommon.GetTargetHeroObject(data);

            //-----------------------------------------
            // Get the list you want to work with.
            //-----------------------------------------
            // if this is a list, draw ints (2=variables, 3=properties)
            if (data.fieldType != 1)
            {
                data = SetPropertyID(data, -1);
                List <HeroObjectField> items = GetItemsFromList(data, -1);
                data = BuildItemFieldList(data, items);
            }

            //-----------------------------------------
            // 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 value
            //-----------------------------------------
            return(GetTargetHeroObject(data.targetHeroObject, data.fieldType, data.fieldID, data.propertyID));
        }
Пример #3
0
        /// <summary>
        /// Get a value from an integer field on an event.
        /// This is for a field that contains Value, Variable, Property, Global.
        /// </summary>
        /// <param name="title">Title for action field.</param>
        /// <param name="boolData">Current data for this action field.</param>
        /// <param name="heroObject">Hero object that is the target of this action.</param>
        public static void BuildEventField(string title, ConditionIntField eventData, HeroObject heroObject) // string title, ref int fieldType, ref int objectType, ref int objectID, ref int fieldID, ref int heroGUID)
        {
            IntegerFieldData data = new IntegerFieldData();

            data.heroObject       = heroObject;
            data.targetHeroObject = eventData.targetHeroObject;
            data.objectType       = eventData.objectType;
            data.objectID         = eventData.objectID;
            data.fieldID          = eventData.fieldID;
            data.fieldType        = eventData.fieldType;
            data.heroGUID         = eventData.heroGUID;
            data.propertyID       = eventData.propertyID;
            data.objectName       = eventData.objectName;
            data.fieldValue       = eventData.fieldValue;

            SimpleLayout.Label(title);

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

            //-----------------------------------------
            // Get the type of game object we are working with
            // Option 1: This game object (game object that this hero object is attached to)
            // Option 2: Another game object (another game object in the scene that has a hero object attached to it)
            // 2 = Local Variable, 3 = Property
            //-----------------------------------------
            if (data.fieldType == 2 || data.fieldType == 3)
            {
                data = ActionCommon.GetTargetHeroObject(data);
            }

            //-----------------------------------------
            // Get the integer list you want to work with.
            // The integer list is in hero object editor > Variables
            //-----------------------------------------

            // if this is a field, draw field (1=number)
            if (data.fieldType == 1)
            {
                data.fieldValue = SimpleLayout.IntField(data.fieldValue, 149);
            }

            // if this is a list, draw ints (2=integers, 3=properties)
            if (data.fieldType != 1)
            {
                data = SetPropertyID(data, -1);
                List <IntField> items = GetItemsFromList(data, -1);
                data = BuildItemFieldList(data, items);
            }


            //-----------------------------------------
            // assign values back to hero object fields
            //-----------------------------------------
            eventData.objectType       = data.objectType;
            eventData.objectID         = data.objectID;
            eventData.fieldID          = data.fieldID;
            eventData.fieldType        = data.fieldType;
            eventData.heroGUID         = data.heroGUID;
            eventData.propertyID       = data.propertyID;
            eventData.targetHeroObject = data.targetHeroObject;
            eventData.objectName       = data.objectName;
            eventData.fieldValue       = data.fieldValue;
        }
Пример #4
0
        /// <summary>
        /// Get a value from an integer field.
        /// This is for a field that contains Value, 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="titleToLeft">Show the title on the left?</param>
        public static void BuildFieldA(string title, HeroActionParams actionParams, HeroActionField actionField, bool titleToLeft = false, SliderData sliderData = new SliderData())
        {
            // create the fields
            IntegerFieldData 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.ValueTypeField().SetValues(data.fieldType, 0);

            //-----------------------------------------
            // Get the type of game object we are working with
            // Option 1: This game object (game object that this hero object is attached to)
            // Option 2: Another game object (another game object in the scene that has a hero object attached to it)
            // 2 = Local Variable, 3 = Property
            //-----------------------------------------
            if (data.fieldType == 2 || data.fieldType == 3)
            {
                data = ActionCommon.GetTargetHeroObject(data);
            }

            //-----------------------------------------
            // Get the integer list you want to work with.
            // The integer list is in hero object editor > Variables
            //-----------------------------------------

            // if this is a field, draw field (1=number)
            if (data.fieldType == 1)
            {
                if (!sliderData.useSlider)
                {
                    data.fieldValue = SimpleLayout.IntField(data.fieldValue, 149);
                }
                else
                {
                    data.fieldValue = (int)SimpleLayout.SliderField(data.fieldValue, 250, sliderData.min, sliderData.max);
                    if (data.fieldValue > sliderData.max)
                    {
                        data.fieldValue = (int)sliderData.max;
                    }
                    else if (data.fieldValue < sliderData.min)
                    {
                        data.fieldValue = (int)sliderData.min;
                    }
                }
            }

            // if this is a list, draw ints (2=integers, 3=properties)
            if (data.fieldType != 1)
            {
                data = SetPropertyID(data, -1);
                List <IntField> items = GetItemsFromList(data, -1);
                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.heroObjects[0] = data.targetHeroObject;
            actionField.strings[0]     = data.objectName;
            actionField.ints[5]        = data.fieldValue;
            actionField.ints[6]        = data.propertyID;

            //-----------------------------------------
            // Visual stuff
            //-----------------------------------------
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();
        }
Пример #5
0
        /// <summary>
        /// Get a value from an integer field.
        /// 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="titleToLeft">Show the title on the left?</param>
        public static void BuildFieldB(string title, HeroActionParams actionParams, HeroActionField actionField, bool titleToLeft = false)
        {
            IntegerFieldData 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
            // 1 = Local Variable, 2 = Property
            //-----------------------------------------
            if (data.fieldType == 1 || data.fieldType == 2)
            {
                data = ActionCommon.GetTargetHeroObject(data);
            }

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

            data = BuildItemFieldList(data, items);

            //-----------------------------------------
            // 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.strings[0]     = data.objectName;
            actionField.ints[5]        = data.fieldValue;
            actionField.ints[6]        = data.propertyID;

            //-----------------------------------------
            // Visual stuff
            //-----------------------------------------
            SimpleLayout.Space();
            SimpleLayout.EndHorizontal();
        }
Пример #6
0
        // --------------------------------------------------------------
        // Action Fields
        // --------------------------------------------------------------

        /// <summary>
        /// Get a value from a unity object field.
        /// This is for a field that contains Value, Variable, Property, Global.
        /// </summary>
        /// <typeparam name="T">The type of unity object.</typeparam>
        /// <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>
        /// <returns></returns>
        public static T BuildFieldA <T>(string title, HeroActionParams actionParams, HeroActionField actionField, bool titleToLeft = false) where T : Object
        {
            // create the fields
            UnityObjectFieldData 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.ValueTypeField().SetValues(data.fieldType, 0);

            //-----------------------------------------
            // Get the type of game object we are working with
            // Option 1: This game object (game object that this hero object is attached to)
            // Option 2: Another game object (another game object in the scene that has a hero object attached to it)
            //-----------------------------------------
            if (data.fieldType == 2 || data.fieldType == 3)
            {
                data = ActionCommon.GetTargetHeroObject(data);
            }

            //-----------------------------------------
            // Get the integer list you want to work with.
            // The integer list is in hero object editor > Variables
            //-----------------------------------------
            // if this is a field, draw field (1=value)
            if (data.fieldType == 1)
            {
                data.fieldValue = SimpleLayout.ObjectField(data.fieldValue as T, HeroKitCommon.GetWidthForField(135));
                SetScene(ref data);
            }

            // if this is a list, draw ints (2=variables, 3=properties)
            if (data.fieldType != 1)
            {
                data = SetPropertyID(data, -1);
                List <UnityObjectField> items = GetItemsFromList(data, -1);
                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[6]         = data.propertyID;
            actionField.heroObjects[0]  = data.targetHeroObject;
            actionField.strings[0]      = data.objectName;
            actionField.unityObjects[0] = data.fieldValue;
            actionField.ints[5]         = data.sceneID;
            actionField.strings[1]      = data.sceneName;

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

            return(data.fieldValue as T);
        }