public static SCarryShopUnLock_SC ParsePackage(byte[] dataBuffer) { SCarryShopUnLock_SC sCarryShopUnLock_SC = new SCarryShopUnLock_SC(); int offset = 0; offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out sCarryShopUnLock_SC.byIndex); offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out sCarryShopUnLock_SC.bySucess); sCarryShopUnLock_SC.dCarryShopUint = DCarryShopUint.ParsePackage(dataBuffer, ref offset); return(sCarryShopUnLock_SC); }
public byte byIsSale; //是否卖完 0-未售完,1-售完 public static DCarryShopUint ParsePackage(byte[] dataBuffer, ref int offset) { DCarryShopUint dCarryShopUint = new DCarryShopUint(); offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out dCarryShopUint.byIndex); offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out dCarryShopUint.dwShopID); offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out dCarryShopUint.dwShopNum); offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out dCarryShopUint.byIsSale); return(dCarryShopUint); }
public void ReceiveBuyResult(SCarryShopBuy_SC sCarryShopBuy_SC) { if (sCarryShopBuy_SC.bySucess == 1) { int index = GetCarryShopData(sCarryShopBuy_SC.byIndex); DCarryShopUint shopUint = sCarryShopOpenUI_SC.shopUintMap[index]; shopUint.byIsSale = 1; sCarryShopOpenUI_SC.shopUintMap.RemoveAt(index); sCarryShopOpenUI_SC.shopUintMap.Insert(index, shopUint); } UIEventManager.Instance.TriggerUIEvent(UIEventType.RcvCarryShopBuyEvent, sCarryShopBuy_SC.bySucess); }
public static SCarryShopOpenUI_SC ParsePackage(byte[] dataBuffer) { SCarryShopOpenUI_SC sCarryShopOpenUI_SC = new SCarryShopOpenUI_SC(); int offset = 0; offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out sCarryShopOpenUI_SC.TimeInterval); offset += PackageHelper.ReadData(dataBuffer.Skip(offset).ToArray(), out sCarryShopOpenUI_SC.byUintNum); sCarryShopOpenUI_SC.shopUintMap = new List <DCarryShopUint> (); for (int i = 0; i < sCarryShopOpenUI_SC.byUintNum; i++) { DCarryShopUint dCarryShopUint = DCarryShopUint.ParsePackage(dataBuffer, ref offset); sCarryShopOpenUI_SC.shopUintMap.Add(dCarryShopUint); } return(sCarryShopOpenUI_SC); }
void UpdateList() { int startIndex = CarryShopModel.Instance.curShowIndexView * 6; int count = 0; bool isOver = false; for (int i = startIndex; i <= CarryShopModel.Instance.sCarryShopOpenUI_SC.shopUintMap.Count && count < 6; i++) { isOver = false; if (i == CarryShopModel.Instance.sCarryShopOpenUI_SC.shopUintMap.Count) { if (i >= CommonDefineManager.Instance.CommonDefine.ShopSlotMaxNum) { //已经最大,无再开锁数据 break; } DCarryShopUint item = new DCarryShopUint(); item.byIndex = (byte)(i + 1); gridList[count].gameObject.SetActive(true); gridList[count].Show(this, item, count, true, false); count++; break; } else { if (CarryShopModel.Instance.sCarryShopOpenUI_SC.shopUintMap[i].byIsSale == 1) { isOver = true; } gridList[count].gameObject.SetActive(true); gridList[count].Show(this, CarryShopModel.Instance.sCarryShopOpenUI_SC.shopUintMap[i], count, false, isOver); } count++; } if (count < 6) { for (; count < 6; count++) { gridList[count].gameObject.SetActive(false); } } }
public void Show(UI.MainUI.CarryShopPanel parentObj, DCarryShopUint shop, int index, bool isLock, bool isOver) { uiParent = parentObj; shopUint = shop; curIndex = index; isItemLock = isLock; isItemOver = isOver; shopData = ShopDataManager.Instance.GetShopData((int)shopUint.dwShopID); effObj.SetActive(false); if (iconObj != null) { DestroyImmediate(iconObj); } if (isLock) { SetLockInfo(); } else { SetContent(isOver); } }