예제 #1
0
        /// <summary>
        /// 初始化魔法阵
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="userLv"></param>
        private static void InitMagicEmbattle(string userId, short userLv)
        {
            List <UserMagic> userMagicList = new PersonalCacheStruct <UserMagic>().FindAll(userId, m => m.MagicType == MagicType.MoFaZhen && m.MagicID != new GameUser().UserMagicID);

            if (userMagicList.Count == 0)
            {
                List <MagicInfo> magicInfoList = new ShareCacheStruct <MagicInfo>().FindAll(m => m.MagicType == MagicType.MoFaZhen && m.DemandLv <= userLv);
                foreach (var magicInfo in magicInfoList)
                {
                    var userMagic = new PersonalCacheStruct <UserMagic>().FindKey(userId, magicInfo.MagicID);
                    if (userMagic != null)
                    {
                        continue;
                    }

                    userMagic = new UserMagic
                    {
                        UserID    = userId,
                        MagicID   = magicInfo.MagicID,
                        MagicLv   = magicInfo.MagicLv,
                        MagicType = magicInfo.MagicType,
                        IsEnabled = false
                    };
                    new PersonalCacheStruct <UserMagic>().Add(userMagic);
                    MagicLvInfo magicLvInfo  = new ShareCacheStruct <MagicLvInfo>().FindKey(magicInfo.MagicID, magicInfo.MagicLv);
                    short       position     = magicLvInfo.GetFirstGrid();
                    var         userEmbattle = new UserEmbattle
                    {
                        UserID    = userId,
                        GeneralID = 0, // LanguageManager.GetLang().GameUserGeneralID,
                        MagicID   = magicInfo.MagicID,
                        Position  = position
                    };
                    new PersonalCacheStruct <UserEmbattle>().Add(userEmbattle);
                }
            }
            //UserEmbattle
        }
예제 #2
0
        /// <summary>
        /// 初始化魔法阵
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="userLv"></param>
        private static void InitMagicEmbattle(string userId, short userLv)
        {
            List<UserMagic> userMagicList = new PersonalCacheStruct<UserMagic>().FindAll(userId, m => m.MagicType == MagicType.MoFaZhen && m.MagicID != new GameUser().UserMagicID);
            if (userMagicList.Count == 0)
            {
                List<MagicInfo> magicInfoList = new ShareCacheStruct<MagicInfo>().FindAll(m => m.MagicType == MagicType.MoFaZhen && m.DemandLv <= userLv);
                foreach (var magicInfo in magicInfoList)
                {
                    var userMagic = new PersonalCacheStruct<UserMagic>().FindKey(userId, magicInfo.MagicID);
                    if (userMagic != null) continue;

                    userMagic = new UserMagic
                    {
                        UserID = userId,
                        MagicID = magicInfo.MagicID,
                        MagicLv = magicInfo.MagicLv,
                        MagicType = magicInfo.MagicType,
                        IsEnabled = false
                    };
                    new PersonalCacheStruct<UserMagic>().Add(userMagic);
                    MagicLvInfo magicLvInfo = new ShareCacheStruct<MagicLvInfo>().FindKey(magicInfo.MagicID, magicInfo.MagicLv);
                    short position = magicLvInfo.GetFirstGrid();
                    var userEmbattle = new UserEmbattle
                    {
                        UserID = userId,
                        GeneralID = 0, // LanguageManager.GetLang().GameUserGeneralID,
                        MagicID = magicInfo.MagicID,
                        Position = position
                    };
                    new PersonalCacheStruct<UserEmbattle>().Add(userEmbattle);
                }
            }
            //UserEmbattle
        }