コード例 #1
0
 public static RawSkillCache Instance()
 {
     if (null == s_instnce || !s_instnce.InitFlag)
     {
         lock (s_lockObj)
         {
             if (null == s_instnce || !s_instnce.InitFlag)
             {
                 s_instnce = new RawSkillCache();
             }
         }
     }
     return(s_instnce);
 }
コード例 #2
0
        public static void LoadHideSkills(ISkillContext context, ISkillManager owner)
        {
            var hideSkills = RawSkillCache.Instance().GetHideSkills();

            if (hideSkills.Count == 0)
            {
                return;
            }
            ISkill skill = null;

            foreach (var rawSkill in hideSkills)
            {
                skill = new Skill(context, owner, "");
                skill.Load(rawSkill);
                skill.Invoke();
            }
        }
コード例 #3
0
        public void LoadSkill(ISkillOwner owner, List <string> skills)
        {
            if (null == skills || skills.Count == 0)
            {
                return;
            }
            if (RawSkillCache.Instance().TRACEPlayerSkillFlag&& owner is ISkillPlayer)
            {
                LogUtil.Info("Loading...Player[{0}] Skills[{1}] ", ((ISkillPlayer)owner).SkillPlayerId, string.Join(",", skills));
            }
            if (owner is ISkillManager)
            {
                LogUtil.Info("Loading...Manager[{0}] Skills[{1}] ", ((ISkillManager)owner).InnerId, string.Join(",", skills));
            }
            var dic = this._context.DicBuffer(1);

            dic.Clear();
            for (int i = 0; i < this._skillList.Count; i++)
            {
                dic[_skillList[i].RawSkill.RawSkillId] = i;
            }
            string    skillCode = string.Empty;
            string    args      = string.Empty;
            int       argsIdx   = 0;
            IRawSkill rawSkill  = null;
            ISkill    skill     = null;
            int       idx       = 0;

            foreach (var str in skills)
            {
                skillCode = str;
                argsIdx   = str.IndexOf('.');
                if (argsIdx >= 0)
                {
                    args      = str.Substring(argsIdx + 1);
                    skillCode = str.Substring(0, argsIdx);
                }
                if (!RawSkillCache.Instance().TryGetRawSkill(skillCode, out rawSkill))
                {
                    LogUtil.Info("No RawSkill for SkillCode:" + skillCode);
                    continue;
                }
                if (dic.TryGetValue(rawSkill.RawSkillId, out idx))
                {
                    dic[rawSkill.RawSkillId]    = -1;
                    _skillList[idx].InvalidFlag = false;
                    _skillList[idx].FitCasters();
                    continue;
                }
                skill = new Skill(this._context, owner, args);
                skill.Load(rawSkill);
                this._skillList.Add(skill);
                switch (rawSkill.TimeType)
                {
                case EnumSkillTimeType.Session:
                    _skillDic[EnumSkillTimeType.Session].Add(skill);
                    break;

                case EnumSkillTimeType.Section:
                    _skillDic[EnumSkillTimeType.Session].Add(skill);
                    _skillDic[EnumSkillTimeType.Section].Add(skill);
                    break;

                case EnumSkillTimeType.Minute:
                    _skillDic[EnumSkillTimeType.Section].Add(skill);
                    _skillDic[EnumSkillTimeType.Minute].Add(skill);
                    break;

                case EnumSkillTimeType.Round:
                    _skillDic[EnumSkillTimeType.Minute].Add(skill);
                    _skillDic[EnumSkillTimeType.Round].Add(skill);
                    break;

                case EnumSkillTimeType.PreDecide:
                    _skillDic[EnumSkillTimeType.PreDecide].Add(skill);
                    break;
                }
                this.AddOpenClip(skill);
            }
            foreach (var kvp in dic)
            {
                if (kvp.Value < 0)
                {
                    continue;
                }
                this._skillList[kvp.Value].Revoke();
            }
        }
コード例 #4
0
 public static void Boot()
 {
     RawSkillCache.Instance().Init();
 }