예제 #1
0
            public void UpdateSkillAtPlayerInfo(PlayerInfoSkill skill)
            {
                var ctx = adaptor.Update(dataId);

                ctx
                .WriteField("Skill", skill)
                ;
                updateQueue.Add(ctx);
            }
예제 #2
0
            public void UpdateSkillAtPlayerInfo(PlayerInfoSkill skill)
            {
                const string dataId = "UPDATE `mem_player` SET `Skill`=?2 WHERE `Pid`=?1";
                var          ctx    = adaptor.Update(dataId);

                ctx
                .WriteField("Pid", (UInt64)key)
                .WriteField("Skill", skill)
                ;
                updateQueue.Add(ctx);
            }
예제 #3
0
            public async Task <PlayerInfoSkill> LoadSkillAtPlayerInfoAsync()
            {
                var val    = new PlayerInfoSkill();
                var reader = await adaptor.Query(dataId, "Skill");

                if (reader == null)
                {
                    return(null);
                }
                val = reader.ReadField <PlayerInfoSkill>("Skill");
                return(val);
            }
예제 #4
0
            public async Task <PlayerInfoSkill> LoadSkillAtPlayerInfoAsync()
            {
                const string sql    = "SELECT `Skill` FROM `mem_player` WHERE `Pid` = ?1";
                var          val    = new PlayerInfoSkill();
                var          reader = await adaptor.Query(sql, (UInt64)key);

                if (reader == null)
                {
                    return(null);
                }
                val = reader.ReadField <PlayerInfoSkill>("Skill");
                reader.Dispose();
                return(val);
            }
예제 #5
0
        public async Task <bool> AskLearnSkill(ulong pid, uint skillId)
        {
            if (!await CheckValid(pid))
            {
                return(false);
            }

            using (var accesser = await Program.CacheService.GetPlayerInfoAccesser(pid))
            {
                var infoSkill = await accesser.LoadSkillAtPlayerInfoAsync();

                Console.WriteLine("LogicServiceImpl.AskLearnSkill load InfoSkill complete pid={0}", pid);

                if (infoSkill == null)
                {
                    Console.WriteLine("LogicServiceImpl.AskLearnSkill InfoSkill is null pid={0}", pid);
                    infoSkill = new PlayerInfoSkill()
                    {
                        SkillList = new List <uint>()
                    };
                }
                if (infoSkill.SkillList == null)
                {
                    infoSkill.SkillList = new List <uint>();
                }

                infoSkill.SkillList.Add(skillId);

                accesser.UpdateSkillAtPlayerInfo(infoSkill);

                await accesser.SubmitChanges();

                Program.Logic2CliService.Forward(sessionId).ServerMessageOk();

                return(true);
            }
        }