コード例 #1
0
        public Character(SocketUser user, string charName, CharacterStats.SPECIAL special, CharacterStats.Skills charSkills,
                         SkillEnum skillTag1, SkillEnum skillTag2, SkillEnum skillTag3, List <CharacterStats.Trait> traits)
        {
            if (skillTag1.Equals(skillTag2) || skillTag1.Equals(skillTag3) || skillTag2.Equals(skillTag3))
            {
                throw new ArgumentException("All tagged skills must be unique.");
            }

            // Adds 15 to each tagged skill
            foreach (var skill in charSkills.skillDict.ToList())
            {
                string skillName = skill.Key.ToLower();
                if (skillName == skillTag1.ToString() || skillName == skillTag2.ToString() || skillName == skillTag3.ToString())
                {
                    charSkills.skillDict[skill.Key] += 15;
                }
            }

            DiscordId   = user.Id;
            Name        = charName;
            CharSpecial = special;
            CharSkills  = charSkills;
            if (traits != null)
            {
                CharTraits = traits;
            }
            else
            {
                CharTraits = new List <CharacterStats.Trait>();
            }
            CharPerks            = new List <CharacterStats.Perk>();
            RemainingSkillPoints = 0;
            ExpPoints            = 0;
        }
コード例 #2
0
 public bool ApplySkill(SkillEnum skill, float data)
 {
     if (mSkillAbilities.ContainsKey(skill))
     {
         mSkillAbilities[skill].OnCallback(data);
         return(true);
     }
     {
         Debug.LogWarning("No this skill: " + skill.ToString());
         return(false);
     }
 }
コード例 #3
0
        public override string ToString()
        {
            string res = ID.ToString();

            res += " = ";
            res += value;
            res += " --> callback : ";
            if (callback != null)
            {
                res += callback.Method.Name;
            }
            return(res);
        }
コード例 #4
0
        /// <summary>
        /// 仅用于可随意设定内容的新手教程状态
        /// </summary>
        public void Refresh(SkillEnum skillCode, int skillLevel, string skillName, int useEnergy)
        {
            if (skillCode == 0)
            {
                gameObject.SetActive(false);

                SprSkillIcon.enabled = false;
                LblDisplayName.text  = null;
                LblCost.text         = null;
            }
            else
            {
                gameObject.SetActive(true);

                //图标
                var spriteName = string.Format("skillicon-{0}", skillCode);
                if (SprSkillIcon.atlas.GetSprite(spriteName) != null)
                {
                    SprSkillIcon.spriteName = spriteName;
                    SprSkillIcon.MakePixelPerfect();
                    SprSkillIcon.enabled = true;
                }
                else
                {
                    SprSkillIcon.enabled   = false;
                    LblDisplayName.text    = skillCode.ToString();
                    LblDisplayName.enabled = true;
                }

                //技能名称
                LblDisplayName.text = skillName;
                LblSkillLevel.text  = string.Format("{0}级", skillLevel);

                //价格
                LblCost.text = useEnergy.ToString(CultureInfo.InvariantCulture);
            }
        }
コード例 #5
0
ファイル: Skill.cs プロジェクト: kvpz/Ideally-Connected
 protected Skill(SkillEnum @enum, byte expertise)
 {
     Type      = @enum.ToString();
     Expertise = expertise;
 }
コード例 #6
0
 public PAPISkill(string _name, SkillEnum _skillEnum, SkillTypeEnum _skillTypeEnum, Value _value, CharacteristicEnum _characteristicEnum,
                  List <GenreEnum> _availableGenres, bool _isCareer)
 {
     this._skillEnum          = _skillEnum;
     this._name               = (_name == null || _name == "" || _skillEnum != SkillEnum.CUSTOM) ? ("Skill_" + _skillEnum.ToString()) : _name;
     this._skillTypeEnum      = _skillTypeEnum;
     this._value              = (_value._value <MIN_VALUE || _value._value> MAX_VALUE)? this._value = new Value(0, null) : this._value = _value;
     this._characteristicEnum = this._characteristicEnum;
     this._availableGenres    = (_availableGenres == null || _availableGenres.Count == 0) ?
                                new List <GenreEnum>(PAPIApplication.GetAllGenres()) : _availableGenres;
     this._isCareer = _isCareer;
     WfLogger.Log(this, LogLevel.DETAILED, "Skill '" + this._name + "' was created");
 }
コード例 #7
0
        /// <summary>
        /// 如果没有该档次的技能(skillCode == 0),则显示锁住
        /// </summary>
        public void Refresh(SkillEnum skillCode)
        {
            if (skillCode == 0)
            {
                gameObject.SetActive(false);

                SprSkillIcon.enabled = false;
                LblDisplayName.text  = null;
                LblCost.text         = null;
            }
            else
            {
                gameObject.SetActive(true);

                //图标
                var spriteName = string.Format("skillicon-{0}", skillCode);
                if (SprSkillIcon.atlas.GetSprite(spriteName) != null)
                {
                    SprSkillIcon.spriteName = spriteName;
                    SprSkillIcon.MakePixelPerfect();
                    SprSkillIcon.enabled = true;
                }
                else
                {
                    SprSkillIcon.enabled = false;

                    LblDisplayName.text    = skillCode.ToString();
                    LblDisplayName.enabled = true;
                }

                //技能等级
                var userSkill = CommonData.MySkillList.Find(x => x.Code == (int)skillCode);
                int level;
                if (userSkill == null)
                {
                    Debug.LogError("这里怎么可能找不到userSkill:Code==" + skillCode);
                    level = 0;
                }
                else
                {
                    level = userSkill.Level;
                }
                //技能名称
                var skillIntroTextConfig =
                    ConfigManager.GetConfig(ConfigManager.ConfigType.SkillIntroTextConfig) as SkillIntroTextConfig;
                if (skillIntroTextConfig != null)
                {
                    var index = skillIntroTextConfig.SkillCodeList.FindIndex(x => x == (int)skillCode);
                    if (index >= 0 && index < skillIntroTextConfig.DisplayNameList.Count)
                    {
                        LblDisplayName.text = string.Format("{0}",
                                                            skillIntroTextConfig.DisplayNameList[index]);
                        LblDisplayName.enabled = true;

                        LblSkillLevel.text = string.Format("{0}级", level);
                    }
                    else
                    {
                        LblDisplayName.enabled = false;
                    }
                }
                else
                {
                    LblDisplayName.enabled = false;
                }


                //价格
                var useEnergy = SkillUtil.GetSkillUseEnergy(skillCode);
                if (LblCost != null) //免费技能可以固定显示FREE
                {
                    LblCost.text = useEnergy.ToString(CultureInfo.InvariantCulture);
                }
            }
        }