public void OnClickGet() { C2G.FriendsGiftGet packet = new C2G.FriendsGiftGet(); packet.account_idx = m_Info.account_idx; packet.is_all = false; Network.GameServer.JsonAsync <C2G.FriendsGiftGet, C2G.FriendsGiftGetAck>(packet, OnFriendsGiftGetHandler); }
public void OnClickGetAll() { if (m_Friends.Exists(e => e.state_info.available_gift == true) == false) { Tooltip.Instance.ShowMessageKey("NotExistsFriendsGift"); return; } C2G.FriendsGiftGet _packet = new C2G.FriendsGiftGet(); _packet.account_idx = 0; _packet.is_all = true; Network.GameServer.JsonAsync <C2G.FriendsGiftGet, C2G.FriendsGiftGetAck>(_packet, OnFriendsGiftGetHandler); }
void OnFriendsGiftGetHandler(C2G.FriendsGiftGet packet, C2G.FriendsGiftGetAck ack) { m_Friends.ForEach(e => e.state_info.available_gift = false); switch (ack.result) { case pe_FriendsResult.Success: Network.PlayerInfo.SetGoodsValue(pe_GoodsType.token_friends, ack.token_friends); Tooltip.Instance.ShowMessageKeyFormat("FriendsGiftGetAllCompleted", ack.token_friends); break; default: ShowFriendsErrorTooltip(ack.result); break; } InitItem(); UpdateSendGetButton(); }
void OnFriendsGiftGetHandler(C2G.FriendsGiftGet packet, C2G.FriendsGiftGetAck ack) { //pd_FriendsInfo friends_info = m_Info as pd_FriendsInfo; switch (ack.result) { case pe_FriendsResult.Success: Tooltip.Instance.ShowMessageKey("FriendsSendGiftSuccess"); StateInfo.available_gift = false; Network.PlayerInfo.SetGoodsValue(pe_GoodsType.token_friends, ack.token_friends); UpdateButton(); if (OnCallback != null) { OnCallback(m_Info); } break; default: Friends.ShowFriendsErrorTooltip(ack.result); break; } }