示例#1
0
    // Use this for initialization
    void Start()
    {
        HeroObject heroObj = RoleObjectController.Instance.CreateHeroObject();

        heroObj.InitLogic(new Vector3(100, 100, 100), new Vector3(0, 45, 0), Vector3.one);
        heroObj.Init(new ViewHeroObject());
    }
示例#2
0
 public void SetLeaderHeroType(short typeID)
 {
     temp_leaderHeroType = typeID;
     temp_Leader         = gc.GenerateHeroByRandom(0, typeID, temp_leaderHeroSex, 1, 0);
     StartChoosePanel.Instance.UpdateLeaderInfo(typeID);
     HeroPanel.Instance.OnShow(temp_Leader, false, 374, -32);
 }
示例#3
0
        // --------------------------------------------------------------
        // Methods (General)
        // --------------------------------------------------------------

        /// <summary>
        /// Block to display on the canvas.
        /// </summary>
        /// <param name="heroKitAction">Hero kit action to display in the block.</param>
        /// <param name="indexState">ID of the state for this event.</param>
        /// <param name="indexEvent">ID of this event.</param>
        public static void Block(HeroObject heroKitObject, int indexState, int indexEvent)
        {
            // exit early if object is null
            if (heroKitObject == null)
            {
                return;
            }

            // exit early if state no longer exists
            if (heroKitObject.states.states == null || heroKitObject.states.states.Count - 1 < indexState)
            {
                return;
            }

            // exit early if event no longer exists
            if (heroKitObject.states.states[indexState].heroEvent == null || heroKitObject.states.states[indexState].heroEvent.Count - 1 < indexEvent)
            {
                return;
            }

            // save the id of the state that this event belongs in
            stateIndex = indexState;
            eventIndex = indexEvent;

            // assign hero object to this class
            heroObject = heroKitObject;
            eventBlock = heroObject.states.states[stateIndex].heroEvent[eventIndex];

            // draw components
            DrawBlock();
        }
示例#4
0
        // pass field into a drop down list [change first value in DropDownList]
        public static int SetValues(HeroObject heroObject, int stateIndex, int eventIndex, int titleWidth)
        {
            int result = SimpleLayout.DropDownList(heroObject.states.states[stateIndex].heroEvent[eventIndex].messageSettings[3], field, titleWidth);

            result = (result == 0) ? 1 : result;
            return(result);
        }
示例#5
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // add menu to scene if it doesn't exist
            HeroKitObject targetObject = HeroKitCommonRuntime.GetPrefabFromAssets(HeroKitCommonRuntime.settingsInfo.inventoryMenu, true);
            HeroObject    item         = null;
            int           count        = 0;
            bool          runThis      = (targetObject != null);

            if (runThis)
            {
                targetObject.gameObject.name = HeroKitCommonRuntime.settingsInfo.inventoryMenu.name;
                targetObject.gameObject.SetActive(true);

                // get the container for the inventory slots
                GameObject parent = HeroKitCommonRuntime.GetChildGameObject(targetObject.gameObject, "Inventory Menu Content");
                if (parent != null)
                {
                    // get the item we want to remove
                    item = HeroObjectFieldValue.GetValueC(heroKitObject, 0);
                    if (item != null)
                    {
                        // get the number of items to remove
                        bool addMultiple = BoolValue.GetValue(heroKitObject, 1);
                        count = (addMultiple) ? IntegerFieldValue.GetValueA(heroKitObject, 2) : 1;

                        // check to see if the inventory slot already exists in the menu
                        GameObject    gameObject = HeroKitCommonRuntime.GetChildGameObject(parent, item.name, false);
                        HeroKitObject heroObject = null;

                        // if the item exists, remove it
                        if (gameObject != null)
                        {
                            // get hero kit object
                            if (heroObject == null)
                            {
                                heroObject = heroKitObject.GetGameObjectComponent <HeroKitObject>("HeroKitObject", false, gameObject);
                            }

                            // add the # of items to add to integer variable list, slot 1
                            heroObject.heroList.ints.items[1].value = count;

                            // play event 2 in the hero kit object attached to this prefab
                            heroObject.PlayEvent(2);
                        }
                    }
                }
            }

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Item: " + item + "\n" +
                                      "Count: " + count;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
示例#6
0
        // --------------------------------------------------------------
        // Methods (General)
        // --------------------------------------------------------------

        /// <summary>
        /// Block to display on the canvas.
        /// </summary>
        /// <param name="heroKitAction">Hero kit action to display in the block.</param>
        /// <param name="indexState">ID of the state.</param>
        public static void Block(HeroObject heroKitObject, int indexState)
        {
            // exit early if object is null
            if (heroKitObject == null)
            {
                return;
            }

            // exit early if state no longer exists
            if (heroKitObject.states.states == null || heroKitObject.states.states.Count - 1 < indexState)
            {
                return;
            }

            // save the id of the state that this event belongs in
            stateIndex = indexState;

            // assign hero object to this class
            heroObject = heroKitObject;
            stateBlock = heroObject.states.states[stateIndex];

            // draw components
            DrawBlock();

            // refresh hero kit objects in scene if state info has changed
            if (GUI.changed)
            {
                Scene.HeroKitCommonRuntime.RefreshAllVisuals(heroObject);
            }
        }
示例#7
0
 /// <summary>
 /// Click Edit button in hero kit object inspector.
 /// </summary>
 /// <param name="selectedAsset"></param>
 public static void ButtonClickHeroObjectAsset(HeroObject selectedAsset)
 {
     heroType   = 0;
     heroObject = selectedAsset;
     ShowWindow();
     HeroKitCommon.SaveHeroSession(heroObject);
 }
示例#8
0
        public static void BuildField(HeroActionParams actionParams)
        {
            HeroAction heroAction = actionParams.heroAction;

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

            //-----------------------------------------
            // create the fields for this action
            //-----------------------------------------
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            HeroObject targetObject = GetHeroObjectField.BuildFieldE("Update a different object?", actionParams, heroAction.actionFields[0], heroAction.actionFields[1]);

            SimpleLayout.EndVertical();

            if (targetObject != null)
            {
                ActionCommon.GetAnimation("", actionParams, heroAction.actionFields[2], heroAction.actionFields[3], heroAction.actionFields[4], AnimatorControllerParameterType.Int, targetObject);

                SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
                GetIntegerField.BuildFieldA("New value for the integer:", actionParams, heroAction.actionFields[5]);
                SimpleLayout.EndVertical();
            }
        }
示例#9
0
        /// <summary>
        /// Get a hero kit object from a conditional int field on an event.
        /// </summary>
        /// <param name="heroKitObject">The hero kit object that contains the data for this action.</param>
        /// <param name="actionFieldID">ID assigned to action field A.</param>
        /// <returns>A hero kit object from a conditional int field on an event.</returns>
        public static HeroKitObject GetValueEvent(HeroKitObject heroKitObject, ConditionIntField itemField)
        {
            // Get the game object
            HeroObjectFieldData goData = new HeroObjectFieldData();

            goData.heroKitObject = heroKitObject;
            goData.heroList      = goData.heroKitObject.heroList;
            goData.objectType    = itemField.objectType;
            goData.objectID      = itemField.objectID;
            goData.heroGUID      = itemField.heroGUID;
            goData.propertyID    = itemField.propertyID;

            // Get the hero kit object
            HeroKitObject targetHKO = HeroObjectTargetField.GetValue(goData)[0];

            if (targetHKO == null)
            {
                Debug.LogError("No hero kit object was found for this event." + HeroKitCommonRuntime.GetHeroDebugInfo(goData.heroKitObject));
                return(null);
            }

            // If we are working with a hero object in the scene or a property or variable field, make sure it matches the object we want to work with.
            if (heroKitObject.debugHeroObject && goData.objectType != 1)
            {
                // make sure we're working with the right kind of hero object inside the hero kit object
                HeroObject expectedHeroObject = itemField.heroObject;
                HeroObject thisHeroObject     = targetHKO.heroObject;
                if (expectedHeroObject != null && (expectedHeroObject != thisHeroObject))
                {
                    Debug.LogWarning("Wrong hero object for this event. Expected " + expectedHeroObject.name + " but got " + thisHeroObject.name + ". " + HeroKitCommonRuntime.GetHeroDebugInfo(goData.heroKitObject));
                }
            }

            return(targetHKO);
        }
示例#10
0
        public static void BuildField(HeroActionParams actionParams)
        {
            HeroAction heroAction = actionParams.heroAction;

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

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

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            HeroObject targetObject = GetHeroObjectField.BuildFieldE("Work with an event on a different object?", actionParams, heroAction.actionFields[0], heroAction.actionFields[1]);

            SimpleLayout.EndVertical();

            // Field: Event
            if (targetObject != null)
            {
                SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
                GetEventField.BuildField("", actionParams, heroAction.actionFields[2], targetObject);
                SimpleLayout.EndVertical();
            }
        }
示例#11
0
        /// <summary>
        /// Get a value from a hero object. Use this hero object by default, but let developer select another hero object.
        /// If another hero object is selected, you can get with a Value, Variable, Property, or Global.
        /// </summary>
        /// <param name="title">Title for the action field.</param>
        /// <param name="actionParams">Action field parameters.</param>
        /// <param name="actionFieldA">Action field.</param>
        /// <param name="actionFieldB">Action field.</param>
        /// <returns>A hero object.</returns>
        public static HeroObject BuildFieldE(string title, HeroActionParams actionParams, HeroActionField actionFieldA, HeroActionField actionFieldB)
        {
            bool       useAnotherObject = GetBoolValue.BuildField(title, actionParams, actionFieldA, true);
            HeroObject targetHeroObject = useAnotherObject ? BuildFieldA("", actionParams, actionFieldB) : actionParams.heroObject;

            return(targetHeroObject);
        }
示例#12
0
        public static void BuildField(HeroActionParams actionParams)
        {
            HeroAction heroAction = actionParams.heroAction;

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

            //-----------------------------------------
            // create the fields for this action
            //-----------------------------------------
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            HeroObject targetHO = GetHeroObjectField.BuildFieldC("Get string from this hero object template:", actionParams, heroAction.actionFields[0]);

            if (targetHO != null)
            {
                GetStringField.BuildFieldC("The string:", actionParams, heroAction.actionFields[1], targetHO);
            }
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            GetStringField.BuildFieldB("Save the string here:", actionParams, heroAction.actionFields[2]);
            SimpleLayout.EndVertical();
        }
示例#13
0
        /// <summary>
        /// Get the template assigned to a hero object field.
        /// This is for a field that contains Variable, Property, Global.
        /// </summary>
        /// <param name="heroKitObject">The hero kit object that contains the data for this action.</param>
        /// <param name="actionFieldID">ID assigned to action field A.</param>
        /// <returns>The template assigned to a hero object field.</returns>
        public static HeroObject GetValueC(HeroKitObject heroKitObject, int actionFieldID)
        {
            // Get the action
            HeroAction action = heroKitObject.heroState.heroEvent[heroKitObject.heroStateData.eventBlock].actions[heroKitObject.heroStateData.action];

            // set up the target hero object type
            HeroObject targetHeroObject = null;

            // Get the game object data
            HeroObjectFieldData goData = new HeroObjectFieldData();

            goData.heroKitObject = heroKitObject;
            goData.heroList      = goData.heroKitObject.heroList;
            goData.objectType    = action.actionFields[actionFieldID].ints[0];
            goData.objectID      = action.actionFields[actionFieldID].ints[1];
            goData.heroGUID      = action.actionFields[actionFieldID].ints[4];
            goData.propertyID    = action.actionFields[actionFieldID].ints[5];

            // get hero object from a file
            if (goData.objectType == 1)
            {
                targetHeroObject = action.actionFields[actionFieldID].heroObjects[0];
            }
            // get hero object from elsewhere
            else
            {
                targetHeroObject = HeroObjectTargetField.GetTemplate(goData);
            }

            return(targetHeroObject);
        }
示例#14
0
        public static void BuildField(HeroActionParams actionParams)
        {
            HeroAction heroAction = actionParams.heroAction;

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

            //-----------------------------------------
            // create the fields for this action
            //-----------------------------------------
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            HeroObject targetHeroObject = GetHeroObjectField.BuildFieldE("Animate a different object?", actionParams, heroAction.actionFields[0], heroAction.actionFields[1]);

            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            bool changeBegin = GetBoolValue.BuildField("Change jump begin animation?", actionParams, heroAction.actionFields[2], true);

            if (changeBegin)
            {
                ActionCommon.GetAnimation("The animation to show when jump begins:", actionParams, heroAction.actionFields[3], heroAction.actionFields[4], heroAction.actionFields[5], AnimatorControllerParameterType.Trigger, targetHeroObject);
            }
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            bool changeEnd = GetBoolValue.BuildField("Change jump end animation?", actionParams, heroAction.actionFields[6], true);

            if (changeEnd)
            {
                ActionCommon.GetAnimation("The animation to show when jump ends:", actionParams, heroAction.actionFields[7], heroAction.actionFields[8], heroAction.actionFields[9], AnimatorControllerParameterType.Trigger, targetHeroObject);
            }
            SimpleLayout.EndVertical();
        }
示例#15
0
        /*          CHECK if Objects already exist within the MySQL Database        */

        #region Check Hero Info exists
        public bool CheckExist(HeroObject hInfo)
        {
            if (hInfo == null)
            {
                return(false);
            }
            if (hInfo.Master == null)
            {
                return(false);
            }
            PlayerObject tmp = null;

            if (hInfo.Master is PlayerObject)
            {
                tmp = (PlayerObject)hInfo.Master;
            }

            if (tmp == null)
            {
                return(false);
            }
            bool found = false;

            try
            {
                if (!Connected)
                {
                    Connect();
                }
                else
                {
                    Disconnect();
                    Connect();
                }
                string temp = string.Format("SELECT * FROM mir_db.t_hero WHERE a_hero_name = {0} AND a_owner = {1};", hInfo.HeroName, tmp.Name);
                using (MySqlCommand cmd = new MySqlCommand(temp, con))
                {
                    MySqlDataReader reader = cmd.ExecuteReader();
                    found = reader.HasRows;
                    reader.Close();
                }
            }
            catch (MySqlException ex)
            {
                SQLError(ex);
                return(false);
            }
            finally
            {
                con.Close();
            }
            if (found)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#16
0
        // Gets objects in a scene that match a certerin criteria
        public int Execute(HeroKitObject hko)
        {
            // Get variables
            heroKitObject = hko;

            //-----------------------------------------
            // Get the game objects in the scene that match specific parameters
            //-----------------------------------------
            int        actionType     = DropDownListValue.GetValue(heroKitObject, 0);
            int        getHeroFieldID = 1;
            int        objectCount    = IntegerFieldValue.GetValueA(heroKitObject, 2);
            HeroObject heroType       = HeroTypeValue.GetValue(heroKitObject, 3);

            // filter the hero kit objects in the scene
            List <HeroKitObject> filteredObjects = HeroActionCommonRuntime.GetHeroObjectsByType(HeroActionCommonRuntime.GetHeroObjectsInScene(), objectCount, heroType);

            // assign the hero kit objects to the list
            HeroActionCommonRuntime.AssignObjectsToList(heroKitObject, getHeroFieldID, filteredObjects, actionType);

            //-----------------------------------------
            // debugging stuff
            //-----------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string heroTypeStr  = (heroType != null) ? heroType.name : "";
                string countStr     = (filteredObjects != null) ? filteredObjects.Count.ToString() : 0.ToString();
                string debugMessage = "Get objects assigned to this hero type: " + heroTypeStr + "\n" +
                                      "Maximum number of objects to get: " + objectCount + "\n" +
                                      "Objects found: " + countStr;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
示例#17
0
        // --------------------------------------------------------------
        // Methods (General)
        // --------------------------------------------------------------

        /// <summary>
        /// Block to display on the canvas.
        /// </summary>
        /// <param name="heroKitAction">Hero kit action to display in the block.</param>
        /// <param name="indexProperty">ID of the property.</param>
        public static void Block(HeroObject heroKitObject, int indexProperty)
        {
            // exit early if object is null
            if (heroKitObject == null)
            {
                return;
            }

            // exit early if property no longer exists
            if (heroKitObject.propertiesList.properties == null || heroKitObject.propertiesList.properties.Count - 1 < indexProperty)
            {
                return;
            }

            // assign hero object to this class
            heroObject = heroKitObject;

            // save the id of the property that this event belongs in
            itemIndex     = indexProperty;
            propertyBlock = heroObject.propertiesList.properties[itemIndex];

            // save the fields
            stringFields = propertyBlock.itemProperties.strings.items;
            intFields    = propertyBlock.itemProperties.ints.items;
            floatFields  = propertyBlock.itemProperties.floats.items;
            boolFields   = propertyBlock.itemProperties.bools.items;
            uoFields     = propertyBlock.itemProperties.unityObjects.items;

            // draw components
            DrawBlock();
        }
示例#18
0
    public HeroObject CreateHeroObject()
    {
        uint       objectKey  = Tools.GetUniqueObjectKey();
        HeroObject heroObject = new HeroObject(objectKey);

        return(heroObject);
    }
示例#19
0
        // pass field into a drop down list [change first value in DropDownList]
        public static int SetValues(HeroObject heroObject, int stateIndex, int eventIndex, int listIndex, int conditionIndex, int titleWidth)
        {
            int result = SimpleLayout.DropDownList(heroObject.states.states[stateIndex].heroEvent[eventIndex].inputConditions[listIndex].items[conditionIndex].pressType, field, titleWidth);

            result = (result == 0) ? 1 : result;
            return(result);
        }
示例#20
0
        /// <summary>
        /// Get the target hero object.
        /// </summary>
        /// <param name="targetObject"></param>
        /// <param name="fieldType"></param>
        /// <param name="fieldID"></param>
        /// <returns></returns>
        private static HeroObject GetTargetHeroObject(HeroObject targetObject, int fieldType, int fieldID, int propertyID)
        {
            HeroObject heroObject = null;

            // value
            if (fieldType == 1)
            {
                heroObject = targetObject;
            }

            if (targetObject != null && fieldID > 0)
            {
                // variable
                if (fieldType == 2 && targetObject.lists.heroObjects.items.Count >= fieldID)
                {
                    heroObject = targetObject.lists.heroObjects.items[fieldID - 1].value;
                }
                // property
                else if (fieldType == 3 && targetObject.propertiesList.properties[propertyID].itemProperties.heroObjects.items.Count >= fieldID)
                {
                    heroObject = targetObject.propertiesList.properties[propertyID].itemProperties.heroObjects.items[fieldID - 1].value;
                }
                // global
                else if (fieldType == 4 && HeroKitCommon.GetGlobals().globals.heroObjects.items.Count >= fieldID)
                {
                    heroObject = HeroKitCommon.GetGlobals().globals.heroObjects.items[fieldID - 1].value;
                }
            }

            return(heroObject);
        }
示例#21
0
        /// <summary>
        /// This builds the action fields in the editor.
        /// </summary>
        /// <param name="heroObject">The hero object.</param>
        public static void BuildActionFields(HeroObject heroObject)
        {
            // referesh states
            if (heroObject.states.states != null && heroObject.states.states.Count != 0)
            {
                for (int stateID = 0; stateID < heroObject.states.states.Count; stateID++)
                {
                    StateBlock.Block(heroObject, stateID);

                    if (heroObject.states.states[stateID].heroEvent == null)
                    {
                        return;
                    }
                    for (int eventID = 0; eventID < heroObject.states.states[stateID].heroEvent.Count; eventID++)
                    {
                        EventBlock.Block(heroObject, stateID, eventID);

                        if (heroObject.states.states[stateID].heroEvent[eventID].actions == null)
                        {
                            return;
                        }
                        for (int actionID = 0; actionID < heroObject.states.states[stateID].heroEvent[eventID].actions.Count; actionID++)
                        {
                            ActionBlock.Block(heroObject, stateID, eventID, actionID);
                        }
                    }
                }
            }
        }
 void OnTriggerExit2D(Collider2D coll)
 {
     if (HeroObject != null && !HeroObject._cannCarry)
     {
         HeroInn = false;
         HeroObject.SendMessage("TriggerEscada", this);
     }
 }
示例#23
0
        private void WriteHero(BinaryWriter w, HeroObject o)
        {
            w.Write(o.Identifier);
            w.Write((byte)o.Owner);
            if (o.Identity != null)
            {
                w.Write(o.Identity.Value);
            }

            if (o.Name != null)
            {
                w.Write(o.Name);
            }

            if (o.Experience.HasValue)
            {
                w.Write(o.Experience.Value);
            }

            if (o.PortraitId.HasValue)
            {
                w.Write(o.PortraitId.Value);
            }

            if (o.SecondarySkills != null)
            {
                WriteSkills(w, o.SecondarySkills);
            }

            if (o.Army != null)
            {
                WriteCreatures(w, o.Army);
            }

            w.Write((byte)o.ArmyFormationType);
            if (o.Inventory != null)
            {
                WriteInventory(w, o.Inventory);
            }

            w.Write((byte)o.PatrolRadius);
            if (o.Bio != null)
            {
                w.Write(o.Bio);
            }

            w.Write((byte)o.Sex);
            w.Write(o.StartsWithCustomSpell);
            if (o.Spells != null)
            {
                WriteSpells(w, o.Spells);
            }

            if (o.PrimarySkills != null)
            {
                WriteSkills(w, o.PrimarySkills);
            }
        }
示例#24
0
        /*          End Of MySQL UPDATES                                            */
        #endregion
        #region Insert Data
        /*          INSERT MySQL Tables                                             */

        #region Insert Hero Info
        public void InsetData(HeroObject hInfo, bool IsOnline = false)
        {
            if (hInfo == null)
            {
                return;
            }
            if (hInfo.Master == null)
            {
                return;
            }
            PlayerObject tmp = null;

            if (hInfo.Master is PlayerObject)
            {
                tmp = (PlayerObject)hInfo.Master;
            }

            if (tmp == null)
            {
                return;
            }

            if (!Connected)
            {
                Connect();
            }
            else
            {
                Disconnect();
                Connect();
            }
            if (hInfo != null)
            {
                try
                {
                    MySqlCommand cmd = new MySqlCommand
                    {
                        Connection  = con,
                        CommandText = "INSERT INTO mir_db.t_hero (a_level, a_exp, a_hero_name, a_class, a_owner) VALUES (@a_level, @a_exp, @a_hero_name, @a_class, @a_owner);"
                    };
                    cmd.Prepare();
                    cmd.Parameters.AddWithValue("@a_level", hInfo.HeroLevel);
                    cmd.Parameters.AddWithValue("@a_exp", hInfo.HeroExperience);
                    cmd.Parameters.AddWithValue("@a_hero_name", hInfo.HeroName);
                    cmd.Parameters.AddWithValue("@a_class", hInfo.HeroClass.ToString());
                    cmd.Parameters.AddWithValue("@a_owner", tmp.Name);
                    cmd.ExecuteNonQuery();
                }
                catch (MySqlException ex)
                {
                    SQLError(ex);
                }
                finally
                {
                    con.Close();
                }
            }
        }
示例#25
0
 void OnCollisionExit2D(Collision2D coll)
 {
     if (coll.gameObject.CompareTag("Player") && !HeroObject._cannCarry)
     {
         HeroObject = coll.gameObject.GetComponentInParent <HeroTemp>();
         HeroInn    = false;
         HeroObject.SendMessage("TriggerEscada", this);
     }
 }
示例#26
0
        public void UpdateData(HeroObject aInfo, bool IsOnline = false)
        {
            if (aInfo == null)
            {
                return;
            }

            if (aInfo.Master == null)
            {
                return;
            }
            PlayerObject tmp = null;

            if (aInfo.Master is PlayerObject)
            {
                tmp = (PlayerObject)aInfo.Master;
            }

            if (tmp == null)
            {
                return;
            }

            if (!Connected)
            {
                Connect();
            }
            else
            {
                Disconnect();
                Connect();
            }
            try
            {
                MySqlCommand cmd = new MySqlCommand
                {
                    Connection  = con,
                    CommandText = "UPDATE mir_db.t_hero SET a_hero_name = @a_hero_name , a_level = @a_level , a_exp = @a_exp , a_class = @a_class WHERE a_owner = @a_owner AND a_hero_name = @a_hero_name"
                };
                cmd.Prepare();
                cmd.Parameters.AddWithValue("@a_hero_name", aInfo.HeroName);
                cmd.Parameters.AddWithValue("@a_level", aInfo.HeroLevel);
                cmd.Parameters.AddWithValue("@a_exp", aInfo.HeroExperience);
                cmd.Parameters.AddWithValue("@a_class", aInfo.HeroClass.ToString());
                cmd.Parameters.AddWithValue("@a_owner", tmp.Name);
                cmd.ExecuteNonQuery();
            }
            catch (MySqlException ex)
            {
                SQLError(ex);
            }
            finally
            {
                con.Close();
            }
        }
示例#27
0
        /// <summary>
        /// Get a hero object.
        /// </summary>
        /// <param name="heroKitObject">The hero kit object that contains the data for this action.</param>
        /// <param name="actionFieldID">ID assigned to action field A.</param>
        /// <returns>The hero object.</returns>
        public static HeroObject GetValue(HeroKitObject heroKitObject, int actionFieldID)
        {
            // Get the action
            HeroAction action = heroKitObject.heroState.heroEvent[heroKitObject.heroStateData.eventBlock].actions[heroKitObject.heroStateData.action];

            // Get the value
            HeroObject value = action.actionFields[actionFieldID].heroObjects[0];

            // Return the value
            return(value);
        }
示例#28
0
        // --------------------------------------------------------------
        // Methods (General)
        // --------------------------------------------------------------

        /// <summary>
        /// Block to display in the menu. 
        /// </summary>
        /// <param name="heroKitObject">Hero object info to display in the menu.</param>
        public static void Block(HeroObject heroKitObject)
        {
            // exit early if object is null
            if (heroKitObject == null)
            {
                return;
            }

            // draw components
            DrawBlock();
        }
示例#29
0
        /// <summary>
        /// A field that can contain a hero object from a Hero Object List object. A GameObjectField exists inside a Hero Object List object.
        /// </summary>
        /// <param name="heroObjectField">The HeroObjectField object that contains the hero object that appears in the field.</param>
        /// <param name="index">The slot assigned to the HeroObjectField in its HeroObjectList object.</param>
        /// <param name="fieldWidth">The width of the field.</param>
        /// <returns>The HeroObjectField assigned to the field.</returns>
        public static HeroObject HeroObjectListField(HeroObjectField heroObjectField, int index, int fieldWidth)
        {
            HeroObject value = heroObjectField.value;

            BeginHorizontal();
            HeroObject result = EditorGUILayout.ObjectField(value, typeof(HeroObject), false, GUILayout.Width(fieldWidth)) as HeroObject;

            EndHorizontal();

            return(result);
        }
示例#30
0
        /// <summary>
        /// Block to display in the menu.
        /// </summary>
        /// <param name="heroKitObject">Hero object info to display in the menu.</param>
        public static void Block(HeroObject heroKitObject)
        {
            // exit early if object is null
            if (heroKitObject == null)
            {
                return;
            }

            // assign hero object to this class
            heroObject = heroKitObject;

            // draw components
            DrawBlock();
        }