public uint Execute(PacketDistributed ipacket) { GC_UPDATE_COST_REBATE_INFO packet = (GC_UPDATE_COST_REBATE_INFO)ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic if (GameManager.gameManager.PlayerDataPool != null) { GameManager.gameManager.PlayerDataPool.HandlePacket(packet); } return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
public void HandlePacket(GC_UPDATE_COST_REBATE_INFO packet) { m_bCostRebateOpen = (packet.Isopen == 1)?true:false; m_nStartTime = packet.Start; m_nEndTime = packet.End; m_nCostType = packet.Costtype; if (m_CostRebateDataList == null) { m_CostRebateDataList = new List <Tab_LevelAwardSimulate>(); } int count = packet.costlimitCount; for (int index = 0; index < count; ++index) { if (m_CostRebateDataList.Count > index) { if (m_CostRebateDataList[index] != null) { m_CostRebateDataList[index].SetInfo( index, (int)ActivityRewardType.Cost, 0, 0, packet.GetCostlimit(index), new int[] { packet.GetId1(index), packet.GetId2(index), packet.GetId3(index) }, new int[] { packet.GetNum1(index), packet.GetNum2(index), packet.GetNum3(index), } ); } else { Tab_LevelAwardSimulate lap = new Tab_LevelAwardSimulate( index, (int)ActivityRewardType.Cost, 0, 0, packet.GetCostlimit(index), new int[] { packet.GetId1(index), packet.GetId2(index), packet.GetId3(index) }, new int[] { packet.GetNum1(index), packet.GetNum2(index), packet.GetNum3(index), } ); m_CostRebateDataList[index] = lap; } } else { Tab_LevelAwardSimulate lap = new Tab_LevelAwardSimulate( index, (int)ActivityRewardType.Cost, 0, 0, packet.GetCostlimit(index), new int[] { packet.GetId1(index), packet.GetId2(index), packet.GetId3(index) }, new int[] { packet.GetNum1(index), packet.GetNum2(index), packet.GetNum3(index), } ); m_CostRebateDataList.Add(lap); } } if (m_CostRebateDataList.Count > count) { m_CostRebateDataList.RemoveRange(count, m_CostRebateDataList.Count - count); } /*天龙的返利存储服务器推送数据,先注释掉,为适合Cabal的界面 * for (int index = 0; index < packet.costlimitCount; index++) * { * m_nRebateLimit[index] = packet.GetCostlimit(index); * } * for (int index = 0; index < packet.id1Count; index++) * { * m_nRebateId1[index] = packet.GetId1(index); * } * for (int index = 0; index < packet.id2Count; index++) * { * m_nRebateId2[index] = packet.GetId2(index); * } * for (int index = 0; index < packet.id3Count; index++) * { * m_nRebateId3[index] = packet.GetId3(index); * } * for (int index = 0; index < packet.num1Count; index++) * { * m_nRebateNum1[index] = packet.GetNum1(index); * } * for (int index = 0; index < packet.num2Count; index++) * { * m_nRebateNum2[index] = packet.GetNum2(index); * } * for (int index = 0; index < packet.num3Count; index++) * { * m_nRebateNum3[index] = packet.GetNum3(index); * } */ // for (int index = 0; index < packet.flagsCount; index++) { // m_bRebateFlag[index] = (packet.GetFlags(index) == 1) ? true : false; // } List <int> alreadyget; if (GameManager.gameManager.ActivityRewardGetDic.TryGetValue(ActivityRewardType.Cost, out alreadyget)) { alreadyget.Clear(); alreadyget.AddRange(packet.flagsList); } else { GameManager.gameManager.ActivityRewardGetDic.Add(ActivityRewardType.Cost, new List <int>(packet.flagsList)); } // if (ChargeActivityLogic.Instance()) // { // ChargeActivityLogic.Instance().UpdateCurTab(); // } if (ActivityRewardsController.Instance() != null) { ActivityRewardsController.Instance().RefreshCostRebate(); } }