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; } }
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); }
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; }