Example #1
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 ParameterFieldData CreateFieldData(string title, HeroActionField actionField, HeroObject heroObject)
        {
            ParameterFieldData data = new ParameterFieldData();

            data.Init(ref actionField);
            data.title   = title;
            data.startID = actionField.ints[1];
            data.endID   = actionField.ints[2];
            return(data);
        }
Example #2
0
        /// <summary>
        /// Get a return value from a method and assign the value to a hero object variable.
        /// </summary>
        /// <param name="title">Title for action field.</param>
        /// <param name="actionParams">Action field parameters.</param>
        /// <param name="actionField">Action field.</param>
        /// <param name="actionFieldB">Action field.</param>
        /// <param name="method">The method that contains the parameters.</param>
        public static void BuildFieldB(string title, HeroActionParams actionParams, HeroActionField actionField, HeroActionField actionFieldB, MethodInfo method)
        {
            // create the fields
            ParameterFieldData data = CreateFieldData(title, actionField, actionParams.heroObject);

            //-----------------------------------------
            // Get the list you want to work with.
            //-----------------------------------------
            ParameterInfo returnValue = method.ReturnParameter;

            if (returnValue != null)
            {
                if (data.title != "")
                {
                    SimpleLayout.Label(data.title);
                }

                SimpleLayout.Line();
                GetParameter(returnValue, actionParams, actionFieldB, true);
            }
        }
Example #3
0
        // --------------------------------------------------------------
        // Action Fields
        // --------------------------------------------------------------

        /// <summary>
        /// Set the parameters to be passed into a method in a script.
        /// </summary>
        /// <param name="title">Title for action field.</param>
        /// <param name="actionParams">Action field parameters.</param>
        /// <param name="actionField">Action field.</param>
        /// <param name="paramFieldStart">Action field ID (start of range).</param>
        /// <param name="paramFieldEnd">Action field ID (end of range).</param>
        /// <param name="method">The method that contains the parameters.</param>
        /// <param name="heroAction"></param>
        public static void BuildFieldA(string title, HeroActionParams actionParams, HeroActionField actionField, int paramFieldStart, int paramFieldEnd, MethodInfo method, HeroAction heroAction)
        {
            // create the fields
            ParameterFieldData data = CreateFieldData(title, actionField, actionParams.heroObject);

            //-----------------------------------------
            // Get the list you want to work with.
            //-----------------------------------------
            ParameterInfo[] parameters             = GetParameters(method);
            int             availablePropertySlots = paramFieldEnd - paramFieldStart;

            if (parameters != null && parameters.Length != 0)
            {
                if (data.title != "")
                {
                    SimpleLayout.Label(data.title);
                }

                SimpleLayout.Line();

                for (int i = 0; i < parameters.Length && i < availablePropertySlots; i++)
                {
                    ParameterInfo parameter = parameters[i];
                    GetParameter(parameter, actionParams, heroAction.actionFields[paramFieldStart + i], false);
                }
            }
            else
            {
                SimpleLayout.Label("There are not parameters for this method.");
            }

            //-----------------------------------------
            // assign values back to hero object fields
            //-----------------------------------------
            actionField.ints[1] = paramFieldStart;
            actionField.ints[2] = paramFieldEnd;
        }