public void reset(protocol.game.map_show ms, int page) { m_page = page; m_ms = ms; m_title.GetComponent <UILabel>().text = ms.name; m_tg.GetComponent <UILabel>().text = ms.pas.ToString("N0"); m_cs.GetComponent <UILabel>().text = ms.amount.ToString("N0"); float tgl = 0; if (ms.amount > 0) { tgl = (float)ms.pas / ms.amount * 100; } m_tgl.GetComponent <UILabel>().text = tgl.ToString("f2") + "%"; m_icon.GetComponent <UITexture> ().mainTexture = game_data._instance.mission_to_texture(ms.url); if (ms.difficulty > 0) { m_nd.GetComponent <UISprite> ().spriteName = "jbjb_" + ms.difficulty.ToString(); } else { m_nd.GetComponent <UISprite> ().spriteName = "jbjb_" + utils.get_map_nd(ms.pas, ms.amount).ToString(); } if (ms.finish == 1) { m_win.SetActive(true); } else { m_win.SetActive(false); } }
void click(GameObject obj) { if (mario._instance.m_self.guide == 200) { if (obj.name != "big_sub") { mario._instance.show_tip(game_data._instance.get_language_string("play_select_gui_jxbs")); return; } int id = obj.GetComponent <play_select_big>().m_type; if (id != 200) { mario._instance.show_tip(game_data._instance.get_language_string("play_select_gui_jxbs")); return; } } if (mario._instance.m_self.guide == 201 && obj.name != "play") { mario._instance.show_tip(game_data._instance.get_language_string("play_select_gui_jxpl")); return; } if (obj.name == "close") { mario._instance.change_state(e_game_state.egs_login, 1, delegate() { Object.Destroy(this.gameObject); }); } if (obj.name == "big_sub") { if (m_lan == 0) { int id = obj.GetComponent <play_select_big>().m_type; if (id >= 200) { int clevel = obj.GetComponent <play_select_big>().m_clevel; if (clevel > mario._instance.m_self.level) { s_t_view_title t_vt = game_data._instance.get_t_view_title(id); string s = string.Format(game_data._instance.get_language_string("play_select_gui_ddjv"), clevel, t_vt.name); mario._instance.show_tip(s); return; } if (mario._instance.m_self.guide == 200) { obj.GetComponent <play_select_big>().hide_shou(); mario._instance.m_self.guide = 201; } protocol.game.cmsg_view_comment msg = new protocol.game.cmsg_view_comment(); msg.id = mario._instance.m_self.mapid; net_http._instance.send_msg <protocol.game.cmsg_view_comment>(opclient_t.OPCODE_VIEW_COMMENT, msg); } else if (id == 1) { change_first(true); } else if (id == 2) { protocol.game.cmsg_mission_view msg = new protocol.game.cmsg_mission_view(); net_http._instance.send_msg <protocol.game.cmsg_mission_view>(opclient_t.OPCODE_MISSION_VIEW, msg); } } } if (obj.name == "first_sub") { if (m_lan == 1) { m_page_type = obj.GetComponent <play_select_sub>().m_type; m_page_up = 0; m_page_down = 0; m_page_fx = 0; protocol.game.cmsg_view_map msg = new protocol.game.cmsg_view_map(); msg.index = 0; msg.type = m_page_type; msg.ver = game_data.m_self_map_ver; net_http._instance.send_msg <protocol.game.cmsg_view_map>(opclient_t.OPCODE_VIEW_MAP, msg); } } if (obj.name == "return") { if (m_lan == 2) { m_page_type = -1; change_first(false); } else if (m_lan == 1) { m_page_type = -1; change_big(); } else { mario._instance.change_state(e_game_state.egs_login, 1, delegate() { Object.Destroy(this.gameObject); }); } } if (obj.name == "small_sub") { protocol.game.map_show ms = obj.GetComponent <play_select_sub1>().m_ms; protocol.game.cmsg_view_comment msg = new protocol.game.cmsg_view_comment(); msg.id = ms.id; net_http._instance.send_msg <protocol.game.cmsg_view_comment>(opclient_t.OPCODE_VIEW_COMMENT, msg); } if (obj.name == "play") { m_id = m_mi.id; protocol.game.cmsg_play_map msg = new protocol.game.cmsg_play_map(); msg.id = m_id; net_http._instance.send_msg <protocol.game.cmsg_play_map>(opclient_t.OPCODE_PLAY_MAP, msg); } if (obj.name == "search") { if (m_lan == 0) { mario._instance.show_tip(game_data._instance.get_language_string("play_select_gui_zxsc")); return; } m_search.SetActive(true); m_search_text.GetComponent <UIInput>().value = ""; } if (obj.name == "search_ok") { string name = m_search_text.GetComponent <UIInput>().value; if (name == "") { mario._instance.show_tip(game_data._instance.get_language_string("play_select_gui_gjzk")); return; } m_page_type = -1; protocol.game.cmsg_search_map msg = new protocol.game.cmsg_search_map(); msg.name = name; net_http._instance.send_msg <protocol.game.cmsg_search_map>(opclient_t.OPCODE_SEARCH_MAP, msg); } if (obj.name == "search_close") { m_search.GetComponent <ui_show_anim>().hide_ui(); } if (obj.name == "shc") { protocol.game.cmsg_favorite_map msg = new protocol.game.cmsg_favorite_map(); msg.id = m_mi.id; net_http._instance.send_msg <protocol.game.cmsg_favorite_map>(opclient_t.OPCODE_FAVORITE_MAP, msg); } if (obj.name == "pl") { m_pinglun.SetActive(true); m_pinglun_text.GetComponent <UIInput>().value = ""; } if (obj.name == "pinglun_ok") { string text = m_pinglun_text.GetComponent <UIInput>().value; if (text == "") { mario._instance.show_tip(game_data._instance.get_language_string("play_select_gui_plwk")); return; } protocol.game.cmsg_comment msg = new protocol.game.cmsg_comment(); msg.id = m_mi.id; msg.text = text; net_http._instance.send_msg <protocol.game.cmsg_comment>(opclient_t.OPCODE_COMMENT, msg); } if (obj.name == "pinglun_close") { m_pinglun.GetComponent <ui_show_anim>().hide_ui(); } if (obj.name == "ph") { protocol.game.cmsg_view_map_point_rank msg = new protocol.game.cmsg_view_map_point_rank(); msg.map_id = m_mi.id; net_http._instance.send_msg <protocol.game.cmsg_view_map_point_rank>(opclient_t.OPCODE_VIEW_MAP_POINT_RANK, msg); } if (obj.name == "touxiang") { look_player(m_mi.owner_id); } if (obj.name == "br_start") { protocol.game.cmsg_mission_start msg = new protocol.game.cmsg_mission_start(); msg.hard = m_bhard; net_http._instance.send_msg <protocol.game.cmsg_mission_start>(opclient_t.OPCODE_MISSION_START, msg); } if (obj.name == "br_continue") { protocol.game.cmsg_mission_continue msg = new protocol.game.cmsg_mission_continue(); net_http._instance.send_msg <protocol.game.cmsg_mission_continue>(opclient_t.OPCODE_MISSION_CONTINUE, msg); } if (obj.name == "download") { s_message mes = new s_message(); mes.m_type = "player_select_gui_download"; mario._instance.show_double_dialog_box(game_data._instance.get_language_string("play_select_gui_dself"), mes); } if (obj.name == "br_drop") { s_message mes = new s_message(); mes.m_type = "player_select_gui_br_drop"; mario._instance.show_double_dialog_box(game_data._instance.get_language_string("play_select_gui_br_drop"), mes); } }
void add_second(protocol.game.smsg_view_map msg, int fx) { int cur_page = 0; if (fx == -1) { if (m_tp_up_tuo != null) { Object.Destroy(m_tp_up_tuo); } cur_page = m_page_up; if (m_page_down - m_page_up >= 3) { for (int i = m_second.Count - 1; i >= 0; --i) { if (m_second[i].GetComponent <play_select_sub1>().m_page == m_page_down) { Object.Destroy(m_second[i]); m_second.RemoveAt(i); } } m_page_down--; if (m_tp_down_tuo != null) { m_tp_down_tuo.transform.localPosition = new Vector3(0, 182 - 850 * m_page_down - 850, 0); } else { m_tp_down_tuo = (GameObject)Instantiate(m_down_tuo); m_tp_down_tuo.transform.parent = m_left_view1.transform; m_tp_down_tuo.transform.localPosition = new Vector3(0, 182 - 850 * m_page_down - 850, 0); m_tp_down_tuo.transform.localScale = new Vector3(1, 1, 1); m_tp_down_tuo.SetActive(true); } } } else if (fx == 1) { if (m_tp_down_tuo != null) { Object.Destroy(m_tp_down_tuo); } cur_page = m_page_down; if (m_page_down - m_page_up >= 3) { for (int i = m_second.Count - 1; i >= 0; --i) { if (m_second[i].GetComponent <play_select_sub1>().m_page == m_page_up) { Object.Destroy(m_second[i]); m_second.RemoveAt(i); } } m_page_up++; if (m_tp_up_tuo != null) { m_tp_up_tuo.transform.localPosition = new Vector3(0, 182 - 850 * m_page_up + 85, 0); } else { m_tp_up_tuo = (GameObject)Instantiate(m_up_tuo); m_tp_up_tuo.transform.parent = m_left_view1.transform; m_tp_up_tuo.transform.localPosition = new Vector3(0, 182 - 850 * m_page_up + 85, 0); m_tp_up_tuo.transform.localScale = new Vector3(1, 1, 1); m_tp_up_tuo.SetActive(true); } } } int num = 0; for (int i = 0; i < msg.infos.Count; ++i) { protocol.game.map_show ms = msg.infos[i]; GameObject obj = (GameObject)Instantiate(m_play_select_sub1); obj.name = "small_sub"; obj.transform.parent = m_left_view1.transform; obj.transform.localPosition = new Vector3(0, 182 - 85 * num - 850 * cur_page, 0); obj.transform.localScale = new Vector3(1, 1, 1); obj.GetComponent <UIButtonMessage>().target = this.gameObject; obj.GetComponent <play_select_sub1>().reset(ms, cur_page); obj.SetActive(true); m_second.Add(obj); num++; } if (fx == -1) { if (cur_page > 0) { m_tp_up_tuo = (GameObject)Instantiate(m_up_tuo); m_tp_up_tuo.transform.parent = m_left_view1.transform; m_tp_up_tuo.transform.localPosition = new Vector3(0, 182 - 850 * cur_page + 85, 0); m_tp_up_tuo.transform.localScale = new Vector3(1, 1, 1); m_tp_up_tuo.SetActive(true); } } else { if (cur_page < m_max_page - 1) { m_tp_down_tuo = (GameObject)Instantiate(m_down_tuo); m_tp_down_tuo.transform.parent = m_left_view1.transform; m_tp_down_tuo.transform.localPosition = new Vector3(0, 182 - 850 * cur_page - 850, 0); m_tp_down_tuo.transform.localScale = new Vector3(1, 1, 1); m_tp_down_tuo.SetActive(true); } } }