//获取当前是谁出的价 public string GetBuyerName(DAuctionUint auction) { if (auction.dwAcotorID == 0) { return("[b1dbff]" + LanguageTextManager.GetString("IDS_I27_15") + "[-]"); } return("[b1dbff]" + Encoding.UTF8.GetString(auction.szName) + "[-]"); }
//更新现场 DAuctionUint public static SAuctionGoods_SC ParsePackage(byte[] dataBuffer) { SAuctionGoods_SC sAuctionGoods_SC = new SAuctionGoods_SC(); int offset = 0; offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out sAuctionGoods_SC.byIndex); sAuctionGoods_SC.auction = DAuctionUint.ParsePackage(dataBuffer, ref offset); return(sAuctionGoods_SC); }
void ShowInfo() { DAuctionUint auctionData = AuctionModel.Instance.GetGoodsInfo(curByIndex); ItemData item = ItemDataManager.Instance.GetItemData((int)auctionData.dwGoodsID); //物品 iconInfo.Init(item, "x" + auctionData.dwGoodsNum); iconName.text = UI.NGUIColor.SetTxtColor(LanguageTextManager.GetString(item._szGoodsName), (UI.TextColor)item._ColorLevel); //职业 if (item._AllowProfession.Equals("1")) { professionSprite.ChangeSprite(1); } else if (item._AllowProfession.Equals("4")) { professionSprite.ChangeSprite(2); } else { professionSprite.ChangeSprite(3); } //类型 typeLabel.text = LanguageTextManager.GetString(string.Format("IDS_A5_{0}{1}", item._GoodsClass, item._GoodsSubClass)); //当前价格 priceLabel.text = auctionData.dwCurPrice.ToString(); //竞拍:当不是我, if (auctionData.dwAcotorID == 0) { //无人竞拍 buyerLabel.text = LanguageTextManager.GetString("IDS_I27_15"); //Encoding.UTF8.GetString(auctionData.szName); btnBuyObj.gameObject.SetActive(true); buyMark.gameObject.SetActive(false); } else if (auctionData.dwAcotorID == PlayerManager.Instance.FindHeroDataModel().ActorID) { buyerLabel.text = Encoding.UTF8.GetString(auctionData.szName); btnBuyObj.gameObject.SetActive(false); buyMark.gameObject.SetActive(true); buyMark.ChangeSprite(1); } else { buyerLabel.text = Encoding.UTF8.GetString(auctionData.szName); if (auctionData.dwCurPrice >= CommonDefineManager.Instance.CommonDefine.AuctionTopBid) { btnBuyObj.gameObject.SetActive(false); buyMark.gameObject.SetActive(true); buyMark.ChangeSprite(2); } else { btnBuyObj.gameObject.SetActive(true); buyMark.gameObject.SetActive(false); } } }
public byte[] szName; //出价者姓名 public static DAuctionUint ParsePackage(byte[] dataBuffer, ref int offset) { DAuctionUint dAuctionUint = new DAuctionUint(); offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out dAuctionUint.byIndex); offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out dAuctionUint.dwGoodsID); offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out dAuctionUint.dwGoodsNum); offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out dAuctionUint.dwCurPrice); offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out dAuctionUint.dwAcotorID); offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out dAuctionUint.szName, 19); return(dAuctionUint); }
public static SAuctionOpenUI_SC ParsePackage(byte[] dataBuffer) { SAuctionOpenUI_SC sAuctionOpenUI_SC = new SAuctionOpenUI_SC(); int offset = 0; offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out sAuctionOpenUI_SC.TimeInterval); offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out sAuctionOpenUI_SC.byUintNum); sAuctionOpenUI_SC.auctionMap = new Dictionary <byte, DAuctionUint>(); for (int i = 0; i < sAuctionOpenUI_SC.byUintNum; i++) { DAuctionUint dAuctionUint = DAuctionUint.ParsePackage(dataBuffer, ref offset); sAuctionOpenUI_SC.auctionMap.Add(dAuctionUint.byIndex, dAuctionUint); } return(sAuctionOpenUI_SC); }
//测试使用 public void Test() { isHaveRequestAuctionData = true; sAuctionOpenUI_SC = new SAuctionOpenUI_SC(); sAuctionOpenUI_SC.TimeInterval = 122; sAuctionOpenUI_SC.byUintNum = 20; sAuctionOpenUI_SC.auctionMap = new Dictionary <byte, DAuctionUint> (); for (int i = 0; i < (int)sAuctionOpenUI_SC.byUintNum; i++) { DAuctionUint test = new DAuctionUint(); test.byIndex = (byte)i; test.dwGoodsID = (uint)1000000; test.dwGoodsNum = (uint)(i + 5); test.dwCurPrice = (uint)4000; test.dwAcotorID = (uint)i; test.szName = new byte[] { 1, 2, 3 }; sAuctionOpenUI_SC.auctionMap.Add(test.byIndex, test); } }