/// <summary> /// 请求获取物品 /// </summary> public void OnReceiveClick() { if (GameManager.gameManager.PlayerDataPool.m_ActivityRewardIndex <= 0) { // GUIData.AddNotifyData("#{5137}"); return; } int curIndex = GameManager.gameManager.PlayerDataPool.m_ActivityRewardIndex; if (!GameManager.gameManager.PlayerDataPool.OnActivityRewardTable.ContainsKey(curIndex)) { return; } ActivityRewardData rewardData = GameManager.gameManager.PlayerDataPool.OnActivityRewardTable[curIndex]; //获取当前物品状态 if (rewardData.State == AcitivityRewardState.EXPIRED) //已过期状态 { string fortip = StrDictionary.GetClientDictionaryString("#{4703}", rewardData.BindYuanbao); MessageBoxLogic.OpenOKCancelBox(fortip, "", SendRewardClick, null); } else if (rewardData.State == AcitivityRewardState.RECEIVE) { CG_RECEIVE_ACTIVITYREWARD msg = (CG_RECEIVE_ACTIVITYREWARD)PacketDistributed.CreatePacket(MessageID.PACKET_CG_RECEIVE_ACTIVITYREWARD); msg.SetRewardIndex(curIndex); msg.SetIsreplacement(0); msg.SendPacket(); } }
/// <summary> /// 发送元宝领取 /// </summary> public void SendRewardClick() { int curIndex = GameManager.gameManager.PlayerDataPool.m_ActivityRewardIndex; if (!GameManager.gameManager.PlayerDataPool.OnActivityRewardTable.ContainsKey(curIndex)) { return; } ActivityRewardData rewardData = GameManager.gameManager.PlayerDataPool.OnActivityRewardTable[curIndex]; // 弹出提示元宝足或不足 int nYuanBaoCount = GameManager.gameManager.PlayerDataPool.Money.GetMoney_YuanBao() + GameManager.gameManager.PlayerDataPool.Money.GetMoney_YuanBaoBind(); if (nYuanBaoCount < rewardData.BindYuanbao) { // 钱不够,弹,充值 MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{1848}"), "", DoPay, null); } else { //发送消息给服务器要求不领 CG_RECEIVE_ACTIVITYREWARD msg = (CG_RECEIVE_ACTIVITYREWARD)PacketDistributed.CreatePacket(MessageID.PACKET_CG_RECEIVE_ACTIVITYREWARD); msg.SetRewardIndex(rewardData.Index); msg.SetIsreplacement(1); msg.SendPacket(); } }
public uint Execute(PacketDistributed ipacket) { CG_RECEIVE_ACTIVITYREWARD packet = (CG_RECEIVE_ACTIVITYREWARD )ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }