public void CopyBuyList(out List <BoCaiBuyItem> itemList, int roleID) { itemList = new List <BoCaiBuyItem>(); try { lock (this.mutex) { PlayerBuyBoCaiData playerBoCai = this.BoCaiBaseList.Find((PlayerBuyBoCaiData x) => x.RoleID == roleID); if (null != playerBoCai) { foreach (BoCaiBuyItem item in playerBoCai.BuyItemList) { BoCaiBuyItem temp = new BoCaiBuyItem { BuyNum = item.BuyNum, strBuyValue = item.strBuyValue, DataPeriods = item.DataPeriods }; itemList.Add(temp); } } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_caidaxiao_猜数字]{0}", ex.ToString()), null, true); } }
public BuyBoCai2SDB BuyBocai(GameClient client, int buyNum, string BuyVal, ref int allNum) { BuyBoCai2SDB DbData = null; try { lock (this.mutex) { PlayerBuyBoCaiData playerBoCai = this.BoCaiBaseList.Find((PlayerBuyBoCaiData x) => x.RoleID == client.ClientData.RoleID); if (null == playerBoCai) { playerBoCai = new PlayerBuyBoCaiData(); playerBoCai.RoleID = client.ClientData.RoleID; playerBoCai.RoleName = client.ClientData.RoleName; playerBoCai.ZoneID = client.ClientData.ZoneID; playerBoCai.strUserID = client.strUserID; playerBoCai.ServerId = client.ServerId; playerBoCai.BuyItemList = new List <BoCaiBuyItem>(); BoCaiBuyItem item = new BoCaiBuyItem { BuyNum = buyNum, strBuyValue = BuyVal, DataPeriods = this.ServerOpenData.DataPeriods }; playerBoCai.BuyItemList.Add(item); this.BoCaiBaseList.Add(playerBoCai); } else { BoCaiBuyItem item = playerBoCai.BuyItemList.Find((BoCaiBuyItem x) => x.strBuyValue.Equals(BuyVal)); if (null == item) { item = new BoCaiBuyItem { BuyNum = buyNum, strBuyValue = BuyVal, DataPeriods = this.ServerOpenData.DataPeriods }; playerBoCai.BuyItemList.Add(item); } else { item.BuyNum += buyNum; allNum = item.BuyNum; } } DbData = new BuyBoCai2SDB(); DbData.m_RoleID = playerBoCai.RoleID; DbData.m_RoleName = playerBoCai.RoleName; DbData.ZoneID = playerBoCai.ZoneID; DbData.strUserID = playerBoCai.strUserID; DbData.ServerId = playerBoCai.ServerId; DbData.BuyNum = buyNum; DbData.strBuyValue = BuyVal; DbData.BocaiType = this.BoCaiType; DbData.DataPeriods = this.ServerOpenData.DataPeriods; DbData.IsSend = false; DbData.IsWin = false; } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_caidaxiao_猜数字]{0}", ex.ToString()), null, true); } return(DbData); }