public uint Execute(PacketDistributed ipacket) { GC_ADD_SHOPPINGLIST_WAITPAY packet = (GC_ADD_SHOPPINGLIST_WAITPAY)ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic ShoppingList shoppinglist = new ShoppingList(); shoppinglist.Guid = packet.Guid; shoppinglist.SenderName = packet.SenderName; shoppinglist.CreateTime = packet.CreateTime; // 每个购物单 商品ID和数量永远传5个 不足5个的用invalid_id填充 for (int i = 0; i < GlobeVar.SHOPPINGLIST_GOODSMAX; i++) { shoppinglist.GoodsID[i] = packet.GoodsIDList[i]; shoppinglist.GoodsCount[i] = packet.GoodsCountList[i]; } GameManager.gameManager.PlayerDataPool.WaitPayRecord.AddShoppingList(shoppinglist); if (PresentRootLogic.Instance() != null) { PresentRootLogic.Instance().UpdateTabShow(); } return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
public void DelGoods(int goodsindex) { if (goodsindex < 0 || goodsindex >= m_GoodsInfo.Count) { return; } if (m_GoodsInfo.Count <= 0) { return; } m_GoodsInfo.RemoveAt(goodsindex); if (m_GoodsInfo.Count == 0) { m_CreateTime = GlobeVar.INVALID_ID; } WriteShoppingCartInfo(); if (PresentRootLogic.Instance() != null) { PresentRootLogic.Instance().UpdateTabShow(); } }
void DelOK() { if (PresentRootLogic.Instance() != null) { PresentRootLogic.Instance().OnDelFromShoppingCart(m_GoodsIndex); } }
public void Submit(UInt64 receiver, string name, SUBMIT_TYPE type) { if (receiver == GlobeVar.INVALID_GUID) { return; } if (type == SUBMIT_TYPE.TYPE_PRESENT) { CG_ADD_SHOPPINGLIST_PRESENT packet = (CG_ADD_SHOPPINGLIST_PRESENT)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ADD_SHOPPINGLIST_PRESENT); packet.ReceiverGUID = receiver; packet.ReceiverName = name; for (int i = 0; i < m_GoodsInfo.Count; i++) { if (m_GoodsInfo[i].GoodsId == GlobeVar.INVALID_ID || m_GoodsInfo[i].GoodsCount == GlobeVar.INVALID_ID) { break; } packet.AddGoodsID(m_GoodsInfo[i].GoodsId); packet.AddGoodsCount(m_GoodsInfo[i].GoodsCount); } packet.SendPacket(); } else if (type == SUBMIT_TYPE.TYPE_WAITPAY) { CG_ADD_SHOPPINGLIST_WAITPAY packet = (CG_ADD_SHOPPINGLIST_WAITPAY)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ADD_SHOPPINGLIST_WAITPAY); packet.ReceiverGUID = receiver; packet.ReceiverName = name; for (int i = 0; i < m_GoodsInfo.Count; i++) { if (m_GoodsInfo[i].GoodsId == GlobeVar.INVALID_ID || m_GoodsInfo[i].GoodsCount == GlobeVar.INVALID_ID) { break; } packet.AddGoodsID(m_GoodsInfo[i].GoodsId); packet.AddGoodsCount(m_GoodsInfo[i].GoodsCount); } packet.SendPacket(); } CleanUp(); WriteShoppingCartInfo(); if (PresentRootLogic.Instance() != null) { PresentRootLogic.Instance().UpdateTabShow(); } }
void ChooseFriend() { if (PresentRootLogic.Instance() == null) { return; } if (m_Type == PresentRootLogic.TAB_INDEX.TAB_SHOPPINGCART) { PresentRootLogic.Instance().OnChooseFriend(m_FriendGuid, m_FriendName); } else { PresentRootLogic.Instance().OnChooseShoppingList(m_ShoppingListGuid); } }
public uint Execute(PacketDistributed ipacket) { GC_SYNC_SHOPPINGLIST_WAITPAY packet = (GC_SYNC_SHOPPINGLIST_WAITPAY)ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic for (int i = 0; i < packet.GuidCount; i++) { if (i >= packet.GuidList.Count || i >= packet.SenderNameList.Count || i >= packet.CreateTimeList.Count) { LogModule.ErrorLog("guid index out of range than packet define"); continue; } ShoppingList shoppinglist = new ShoppingList(); shoppinglist.Guid = packet.GuidList[i]; shoppinglist.SenderName = packet.SenderNameList[i]; shoppinglist.CreateTime = packet.CreateTimeList[i]; // 每个购物单 商品ID和数量永远传5个 不足5个的用invalid_id填充 for (int j = 0; j < GlobeVar.SHOPPINGLIST_GOODSMAX; j++) { int goodIndex = i * GlobeVar.SHOPPINGLIST_GOODSMAX + j; if (j >= shoppinglist.GoodsID.Length || j >= shoppinglist.GoodsCount.Length || goodIndex >= packet.GoodsIDList.Count || goodIndex >= packet.GoodsCountList.Count) { LogModule.ErrorLog("good index out of range than packet define"); } else { shoppinglist.GoodsID[j] = packet.GoodsIDList[goodIndex]; shoppinglist.GoodsCount[j] = packet.GoodsCountList[goodIndex]; } } GameManager.gameManager.PlayerDataPool.WaitPayRecord.AddShoppingList(shoppinglist); } if (PresentRootLogic.Instance() != null) { PresentRootLogic.Instance().UpdateTabShow(); } return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
public uint Execute(PacketDistributed ipacket) { GC_DEL_SHOPPINGLIST_PRESENTOVERDUE packet = (GC_DEL_SHOPPINGLIST_PRESENTOVERDUE)ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic GameManager.gameManager.PlayerDataPool.PresentRecord.DelShoppingList(packet.Guid); if (PresentRootLogic.Instance() != null) { PresentRootLogic.Instance().UpdateTabShow(); } return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
void ConfirmOK() { if (m_Type == SHOW_TYPE.TYPE_INVALID) { return; } if (m_Type == SHOW_TYPE.TYPE_PRESENT || m_Type == SHOW_TYPE.TYPE_PAY) { int nPlayerYuanBao = GameManager.gameManager.PlayerDataPool.Money.GetMoney_YuanBao(); if (nPlayerYuanBao < m_CostYuanBao) { MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{1848}"), "", BuyChargeOK); return; } } if (m_Type == SHOW_TYPE.TYPE_PRESENT) { GameManager.gameManager.PlayerDataPool.ShoppingCart.Submit(m_ChooseFriendGuid, m_ChooseFriendName, ShoppingCart.SUBMIT_TYPE.TYPE_PRESENT); } else if (m_Type == SHOW_TYPE.TYPE_WAITPAY) { GameManager.gameManager.PlayerDataPool.ShoppingCart.Submit(m_ChooseFriendGuid, m_ChooseFriendName, ShoppingCart.SUBMIT_TYPE.TYPE_WAITPAY); } else if (m_Type == SHOW_TYPE.TYPE_PAY) { CG_PAY_SHOPPINGLIST_WAITPAY packet = (CG_PAY_SHOPPINGLIST_WAITPAY)PacketDistributed.CreatePacket(MessageID.PACKET_CG_PAY_SHOPPINGLIST_WAITPAY); packet.Guid = m_ChooseShoppingListGuid; packet.SendPacket(); } CleanUp(); if (PresentRootLogic.Instance() != null) { PresentRootLogic.Instance().CleanUp(); } gameObject.SetActive(false); }