Esempio n. 1
0
 public static bool CopyAuctionDBItem(List <GoldAuctionDBItem> sData, ref List <GoldAuctionDBItem> rData)
 {
     try
     {
         foreach (GoldAuctionDBItem item in sData)
         {
             GoldAuctionDBItem tempItem = new GoldAuctionDBItem();
             CopyData.Copy <GoldAuctionDBItem>(item, ref tempItem);
             tempItem.BuyerData = new AuctionRoleData();
             CopyData.Copy <AuctionRoleData>(item.BuyerData, ref tempItem.BuyerData);
             if (tempItem != null)
             {
                 tempItem.RoleList = new List <AuctionRoleData>();
                 foreach (AuctionRoleData RoleData in item.RoleList)
                 {
                     AuctionRoleData tempRole = new AuctionRoleData();
                     CopyData.Copy <AuctionRoleData>(RoleData, ref tempRole);
                     tempItem.RoleList.Add(tempRole);
                 }
                 tempItem.OldAuctionType = tempItem.AuctionType;
                 rData.Add(tempItem);
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         LjlLog.WriteLog(LogTypes.Error, ex.ToString(), "");
     }
     return(false);
 }
Esempio n. 2
0
        private void GetGlodAuction(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            GetAuctionDBData msgData = new GetAuctionDBData();

            try
            {
                string cmdData = new UTF8Encoding().GetString(cmdParams, 0, count);
                int    type    = Convert.ToInt32(cmdData);
                List <GoldAuctionDBItem> tempList;
                if (3 <= type || 0 >= type)
                {
                    msgData.Flag = false;
                    LjlLog.WriteLog(LogTypes.Error, string.Format("GetGlodAuction 金团类型错误{0} type=", type), "");
                }
                else if (this.AuctionDict.TryGetValue(type, out tempList))
                {
                    msgData.Flag = CopyData.CopyAuctionDBItem(tempList, ref msgData.ItemList);
                }
                else
                {
                    msgData.Flag = GoldAuctionDB.Select(out msgData.ItemList, type);
                    if (msgData.Flag)
                    {
                        tempList = new List <GoldAuctionDBItem>();
                        if (CopyData.CopyAuctionDBItem(msgData.ItemList, ref tempList))
                        {
                            this.AuctionDict.Add(type, tempList);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LjlLog.WriteLog(LogTypes.Exception, ex.ToString(), "");
            }
            client.sendCmd <GetAuctionDBData>(nID, msgData);
        }