Ejemplo n.º 1
0
        public async Task<bool> AskAddMoney(ulong pid, uint money)
        {
            if (!await CheckValid(pid))
            {
                return false;
            }

            using (var accesser = await Program.CacheService.GetPlayerInfoAccesser(pid))
            {
                var infoItem = await accesser.LoadItemAtPlayerInfoAsync();

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

                if (infoItem == null)
                {
                    Console.WriteLine("LogicServiceImpl.AskAddMoney InfoItem is null pid={0}", pid);
                    infoItem = new PlayerInfoItem() { ItemList = new List<uint>() };
                }

                infoItem.Money += money;

                accesser.UpdateItemAtPlayerInfo(infoItem);

                await accesser.SubmitChanges();

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

                return true;
            }
        }
Ejemplo n.º 2
0
 public PlayerInfo Read(BinaryReader br)
 {
     Pid = br.ReadUInt64();
     Uid = br.ReadUInt32();
     if (br.ReadByte() == (byte)SerializeObjectMark.Common)
     {
         Name = br.ReadString();
     }
     Level = br.ReadUInt32();
     if (br.ReadByte() == (byte)SerializeObjectMark.Common)
     {
         Skill = (new PlayerInfoSkill()).Read(br);
     }
     if (br.ReadByte() == (byte)SerializeObjectMark.Common)
     {
         Item = (new PlayerInfoItem()).Read(br);
     }
     return(this);
 }
Ejemplo n.º 3
0
 public PlayerInfo Read(BinaryReader br)
 {
     Pid = br.ReadUInt64();
     Uid = br.ReadUInt32();
     if (br.ReadByte() == (byte)SerializeObjectMark.Common)
     {
         Name = br.ReadString();
     }
     Level = br.ReadUInt32();
     if (br.ReadByte() == (byte)SerializeObjectMark.Common)
     {
         Skill = (new PlayerInfoSkill()).Read(br);
     }
     if (br.ReadByte() == (byte)SerializeObjectMark.Common)
     {
         Item = (new PlayerInfoItem()).Read(br);
     }
     return this;
 }