public static bool CanUse(this Skill skill, ICharacterData character, short level)
        {
            if (skill == null || character == null)
            {
                return(false);
            }

            bool available = true;

            switch (skill.skillType)
            {
            case SkillType.Active:
                WeaponType[] availableWeapons = skill.availableWeapons;
                available = availableWeapons == null || availableWeapons.Length == 0;
                if (!available)
                {
                    Item rightWeaponItem = character.EquipWeapons.rightHand.GetWeaponItem();
                    Item leftWeaponItem  = character.EquipWeapons.leftHand.GetWeaponItem();
                    foreach (WeaponType availableWeapon in availableWeapons)
                    {
                        if (rightWeaponItem != null && rightWeaponItem.WeaponType == availableWeapon)
                        {
                            available = true;
                            break;
                        }
                        else if (leftWeaponItem != null && leftWeaponItem.WeaponType == availableWeapon)
                        {
                            available = true;
                            break;
                        }
                        else if (rightWeaponItem == null && leftWeaponItem == null && GameInstance.Singleton.DefaultWeaponItem.WeaponType == availableWeapon)
                        {
                            available = true;
                            break;
                        }
                    }
                }
                break;

            case SkillType.CraftItem:
                if (!(character is BasePlayerCharacterEntity) || !skill.itemCraft.CanCraft(character as BasePlayerCharacterEntity))
                {
                    return(false);
                }
                break;

            default:
                return(false);
            }
            if (level <= 0)
            {
                return(false);
            }
            if (!available)
            {
                return(false);
            }
            if (character.CurrentMp < skill.GetConsumeMp(level))
            {
                return(false);
            }
            int skillUsageIndex = character.IndexOfSkillUsage(skill.DataId, SkillUsageType.Skill);

            if (skillUsageIndex >= 0 && character.SkillUsages[skillUsageIndex].coolDownRemainsDuration > 0f)
            {
                return(false);
            }
            return(true);
        }
        protected override void UpdateData()
        {
            if (Level <= 0)
            {
                onSetLevelZeroData.Invoke();
            }
            else
            {
                onSetNonLevelZeroData.Invoke();
            }

            if (uiTextTitle != null)
            {
                uiTextTitle.text = string.Format(titleFormat, Skill == null ? "Unknow" : Skill.title);
            }

            if (uiTextDescription != null)
            {
                uiTextDescription.text = string.Format(descriptionFormat, Skill == null ? "N/A" : Skill.description);
            }

            if (uiTextLevel != null)
            {
                uiTextLevel.text = string.Format(levelFormat, Level.ToString("N0"));
            }

            if (imageIcon != null)
            {
                var iconSprite = Skill == null ? null : Skill.icon;
                imageIcon.gameObject.SetActive(iconSprite != null);
                imageIcon.sprite = iconSprite;
            }

            if (uiTextSkillType != null)
            {
                switch (Skill.skillType)
                {
                case SkillType.Active:
                    uiTextSkillType.text = string.Format(skillTypeFormat, activeSkillType);
                    break;

                case SkillType.Passive:
                    uiTextSkillType.text = string.Format(skillTypeFormat, passiveSkillType);
                    break;

                case SkillType.CraftItem:
                    uiTextSkillType.text = string.Format(skillTypeFormat, craftItemSkillType);
                    break;
                }
            }

            if (uiTextAvailableWeapons != null)
            {
                if (Skill.availableWeapons == null || Skill.availableWeapons.Length == 0)
                {
                    uiTextAvailableWeapons.gameObject.SetActive(false);
                }
                else
                {
                    var str = string.Empty;
                    foreach (var availableWeapon in Skill.availableWeapons)
                    {
                        if (!string.IsNullOrEmpty(str))
                        {
                            str += "/";
                        }
                        str += availableWeapon.title;
                    }
                    uiTextAvailableWeapons.text = string.Format(availableWeaponsFormat, str);
                    uiTextAvailableWeapons.gameObject.SetActive(true);
                }
            }

            if (uiTextConsumeMp != null)
            {
                uiTextConsumeMp.text = string.Format(consumeMpFormat, Skill == null || Level <= 0 ? "N/A" : Skill.GetConsumeMp(Level).ToString("N0"));
            }

            if (uiRequirement != null)
            {
                if (Skill == null || (Skill.GetRequireCharacterLevel(Level) == 0 && Skill.CacheRequireSkillLevels.Count == 0))
                {
                    uiRequirement.Hide();
                }
                else
                {
                    uiRequirement.Show();
                    uiRequirement.Data = new SkillTuple(Skill, Level);
                }
            }

            if (uiCraftItem != null)
            {
                if (Skill == null || Skill.skillType != SkillType.CraftItem)
                {
                    uiCraftItem.Hide();
                }
                else
                {
                    uiCraftItem.Show();
                    uiCraftItem.Data = Skill.itemCraft;
                }
            }

            var isAttack = Skill != null && Skill.IsAttack();
            var isOverrideWeaponDamage = isAttack && Skill.skillAttackType == SkillAttackType.Normal;

            if (uiDamageAmount != null)
            {
                if (!isOverrideWeaponDamage)
                {
                    uiDamageAmount.Hide();
                }
                else
                {
                    uiDamageAmount.Show();
                    var keyValuePair = Skill.GetDamageAmount(Level, null);
                    uiDamageAmount.Data = new DamageElementAmountTuple(keyValuePair.Key, keyValuePair.Value);
                }
            }

            if (uiDamageInflictions != null)
            {
                var damageInflictionRates = Skill.GetWeaponDamageInflictions(Level);
                if (!isAttack || damageInflictionRates == null || damageInflictionRates.Count == 0)
                {
                    uiDamageInflictions.Hide();
                }
                else
                {
                    uiDamageInflictions.Show();
                    uiDamageInflictions.Data = damageInflictionRates;
                }
            }

            if (uiAdditionalDamageAmounts != null)
            {
                var additionalDamageAmounts = Skill.GetAdditionalDamageAmounts(Level);
                if (!isAttack || additionalDamageAmounts == null || additionalDamageAmounts.Count == 0)
                {
                    uiAdditionalDamageAmounts.Hide();
                }
                else
                {
                    uiAdditionalDamageAmounts.Show();
                    uiAdditionalDamageAmounts.Data = additionalDamageAmounts;
                }
            }

            if (uiSkillBuff != null)
            {
                if (!Skill.IsBuff())
                {
                    uiSkillBuff.Hide();
                }
                else
                {
                    uiSkillBuff.Show();
                    uiSkillBuff.Data = new BuffTuple(Skill.buff, Level);
                }
            }

            if (uiSkillDebuff != null)
            {
                if (!Skill.IsDebuff())
                {
                    uiSkillDebuff.Hide();
                }
                else
                {
                    uiSkillDebuff.Show();
                    uiSkillDebuff.Data = new BuffTuple(Skill.debuff, Level);
                }
            }

            if (uiNextLevelSkill != null)
            {
                if (Level + 1 > Skill.maxLevel)
                {
                    uiNextLevelSkill.Hide();
                }
                else
                {
                    uiNextLevelSkill.Setup(new SkillTuple(Skill, (short)(Level + 1)), character, indexOfData);
                    uiNextLevelSkill.Show();
                }
            }
        }