示例#1
0
        public void _AddAbility(int abID, int replaceID = -1)
        {
            Ability newAbility = Ability_DB.CloneItem(abID);

            if (newAbility == null)
            {
                return;
            }

            int slotID = -1;

            if (replaceID >= 0)
            {
                for (int i = 0; i < abilityList.Count; i++)
                {
                    if (abilityList[i].ID == replaceID)
                    {
                        slotID = i;     break;
                    }
                }
            }

            if (slotID < 0)
            {
                slotID = abilityList.Count;
                abilityList.Add(null);
            }

            abilityList[slotID] = newAbility;
            abilityList[slotID].Init();

            if (replaceID < 0 || slotID < 0)
            {
                TDS.NewAbility(abilityList[slotID]);
            }
            else
            {
                TDS.NewAbility(newAbility, slotID);
            }

            Select(slotID);
        }