public void OnClickBox(GameObject btn) { short reward_index = 0; switch (btn.name) { case "Box_1": reward_index = 0; break; case "Box_2": reward_index = 1; break; case "Box_3": reward_index = 2; break; } if (GetClearRewardAvailable(reward_index) == true) { m_SelectedBtn = btn; C2G.MapClearReward packet = new C2G.MapClearReward(); packet.map_id = m_SelectedMapInfo.ID; packet.index = reward_index; packet.difficulty = CurrentDifficulty; Network.GameServer.JsonAsync <C2G.MapClearReward, C2G.MapClearRewardAck>(packet, OnMapClearRewardHandler); } else { Popup.Instance.Show(ePopupMode.Reward, MapClearRewardInfoManager.Instance.GetInfoByIdn(m_SelectedMapInfo.IDN).conditions(CurrentDifficulty)[reward_index].rewards, Localization.Get("PopupRewardTitle"), Localization.Get("MapClearReward_Available")); } }
public void OnMapClearRewardHandler(C2G.MapClearReward packet, C2G.MapClearRewardAck ack) { m_temp_map_clear_reward_ack = ack.reward_ack; Network.Instance.ProcessReward3Ack(ack.reward_ack); MapClearRewardManager.Instance.SetReward(packet.map_id, packet.index, packet.difficulty); m_SelectedBtn.GetComponent <BoxCollider2D>().enabled = false; UIPlayTween tween = m_SelectedBtn.GetComponentInChildren <UIPlayTween>(); tween.Play(true); }