예제 #1
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();
        }
예제 #2
0
        // --------------------------------------------------------------
        // Initialize Action Field
        // --------------------------------------------------------------

        /// <summary>
        /// Create the subfields that we need for this action field.
        /// </summary>
        /// <param name="title">The title of the action.</param>
        /// <param name="actionField">The action field.</param>
        /// <param name="heroObject">The hero object that contains this action field.</param>
        /// <returns>The data for this action field.</returns>
        private static HeroPropertyFieldData CreateFieldData(string title, HeroActionField actionField, HeroObject heroObject)
        {
            HeroPropertyFieldData data = new HeroPropertyFieldData();

            data.Init(ref actionField);
            data.title      = title;
            data.fieldValue = actionField.heroProperties[0];

            return(data);
        }