Exemple #1
0
    public void net_message(s_net_message message)
    {
        if (message.m_opcode == opclient_t.OPCODE_VIEW_MAP)
        {
            protocol.game.smsg_view_map _msg = net_http._instance.parse_packet <protocol.game.smsg_view_map> (message.m_byte);
            m_max_page = _msg.page;
            if (m_page_fx == 0)
            {
                clear_second();
            }
            add_second(_msg, m_page_fx);
            change_second();
        }
        if (message.m_opcode == opclient_t.OPCODE_VIEW_COMMENT)
        {
            protocol.game.smsg_view_comment _msg = net_http._instance.parse_packet <protocol.game.smsg_view_comment> (message.m_byte);
            show_map(_msg.infos);
            reset_pinlun(_msg.comments);
            m_right_view.GetComponent <UIScrollView>().ResetPosition();
            for (int i = 0; i < m_second.Count; ++i)
            {
                if (m_second[i].GetComponent <play_select_sub1>().m_ms.id == _msg.infos.id)
                {
                    m_second[i].GetComponent <play_select_sub1>().reset(_msg.infos.finish, _msg.infos.pas, _msg.infos.amount, _msg.infos.like);
                }
            }
            mario._instance.m_self.set_per(_msg.infos.head, _msg.infos.country, _msg.infos.owner_name, _msg.infos.name);
        }
        if (message.m_opcode == opclient_t.OPCODE_PLAY_MAP)
        {
            if (mario._instance.m_self.guide == 201)
            {
                mario._instance.m_self.guide = 202;
            }
            if (message.m_res == -1)
            {
                mario._instance.show_tip(game_data._instance.get_language_string("play_select_gui_tlbz"));
                protocol.game.msg_life_error _msg1 = net_http._instance.parse_packet <protocol.game.msg_life_error> (message.m_byte);
                mario._instance.m_self.set_reset_time(_msg1.server_time, _msg1.life_time);
                return;
            }
            protocol.game.smsg_play_map _msg = net_http._instance.parse_packet <protocol.game.smsg_play_map> (message.m_byte);
            mario_tool._instance.onRaid(m_id.ToString(), 1);
            bool flag = game_data._instance.load_mission(m_id, _msg.map_data, _msg.x, _msg.y);
            if (!flag)
            {
                return;
            }
            mario._instance.change_state(e_game_state.egs_play, 2, delegate()
            {
                if (this.gameObject.activeSelf)
                {
                    this.gameObject.SetActive(false);
                }
                else
                {
                    mario._instance.hide_clear_gui();
                }
            });
        }
        if (message.m_opcode == opclient_t.OPCODE_FAVORITE_MAP)
        {
            protocol.game.smsg_favorite_map _msg = net_http._instance.parse_packet <protocol.game.smsg_favorite_map> (message.m_byte);
            m_mi.favorite = _msg.num;
            m_mi.collect  = 1 - m_mi.collect;
            show_map(m_mi);
        }
        if (message.m_opcode == opclient_t.OPCODE_COMMENT)
        {
            mario._instance.show_tip(game_data._instance.get_language_string("play_select_gui_fbpl"));
            m_pinglun.GetComponent <ui_show_anim>().hide_ui();
            protocol.game.smsg_comment _msg = net_http._instance.parse_packet <protocol.game.smsg_comment> (message.m_byte);
            m_comments.Insert(0, _msg.comment);
            if (m_comments.Count > 10)
            {
                m_comments.RemoveAt(m_comments.Count - 1);
            }
            reset_pinlun(m_comments);
        }
        if (message.m_opcode == opclient_t.OPCODE_SEARCH_MAP)
        {
            m_search.GetComponent <ui_show_anim>().hide_ui();
            protocol.game.smsg_view_map _msg = net_http._instance.parse_packet <protocol.game.smsg_view_map> (message.m_byte);
            if (_msg.infos.Count == 0)
            {
                mario._instance.show_tip(game_data._instance.get_language_string("play_select_gui_mzdt"));
                return;
            }
            clear_second();
            add_second(_msg, 0);
            change_second();
        }
        if (message.m_opcode == opclient_t.OPCODE_VIEW_MAP_POINT_RANK)
        {
            protocol.game.smsg_view_map_point_rank _msg = net_http._instance.parse_packet <protocol.game.smsg_view_map_point_rank> (message.m_byte);
            mario._instance.show_paihang_gui(_msg, m_mi.id);
        }
        if (message.m_opcode == opclient_t.OPCODE_VIEW_VIDEO)
        {
            protocol.game.smsg_view_video _msg = net_http._instance.parse_packet <protocol.game.smsg_view_video> (message.m_byte);
            bool flag = game_data._instance.load_mission(m_mi.id, _msg.map_data, null, null);
            if (!flag)
            {
                return;
            }
            game_data._instance.load_inputs(_msg.video_data);
            mario._instance.change_state(e_game_state.egs_review, 2, delegate() { this.gameObject.SetActive(false); mario._instance.hide_paihang_gui(); });
        }
        if (message.m_opcode == opclient_t.OPCODE_VIEW_PLAYER)
        {
            protocol.game.smsg_view_player _msg = net_http._instance.parse_packet <protocol.game.smsg_view_player> (message.m_byte);
            mario._instance.show_player_gui(_msg);
        }
        if (message.m_opcode == opclient_t.OPCODE_MISSION_VIEW)
        {
            protocol.game.smsg_mission_view _msg = net_http._instance.parse_packet <protocol.game.smsg_mission_view> (message.m_byte);
            mario._instance.m_self.br_life  = _msg.life;
            mario._instance.m_self.br_index = _msg.index;
            mario._instance.m_self.br_start = _msg.start;
            mario._instance.m_self.br_hard  = _msg.hard;
            mario._instance.m_self.br_max   = _msg.br_max;

            m_back.SetActive(false);
            m_back1.SetActive(false);
            m_back2.SetActive(true);
            show_br();
        }
        if (message.m_opcode == opclient_t.OPCODE_MISSION_START || message.m_opcode == opclient_t.OPCODE_MISSION_CONTINUE)
        {
            if (message.m_opcode == opclient_t.OPCODE_MISSION_START)
            {
                mario._instance.m_self.br_index = 0;
                mario._instance.m_self.br_life  = 100;
                mario._instance.m_self.br_start = 1;
                mario._instance.m_self.br_hard  = m_bhard;
                mario._instance.m_start_type    = 0;
            }
            else
            {
                mario._instance.m_start_type = 2;
            }
            protocol.game.smsg_mission_play _msg = net_http._instance.parse_packet <protocol.game.smsg_mission_play> (message.m_byte);
            mario._instance.m_self.set_br(_msg.user_head, _msg.user_country, _msg.user_name, _msg.map_name);
            game_data._instance.load_mission(-1, _msg.map_data, _msg.x, _msg.y);
            mario._instance.change_state(e_game_state.egs_br_road, 2, delegate() { this.gameObject.SetActive(false); });
        }
        if (message.m_opcode == opclient_t.OPCODE_DOWNLOAD_MAP)
        {
            mario._instance.m_self.download_num++;
            mario._instance.show_tip(game_data._instance.get_language_string("play_select_gui_dlok"));
        }
        if (message.m_opcode == opclient_t.OPCODE_MISSION_DROP)
        {
            mario._instance.m_self.br_start = 0;
            show_br();
        }
    }
Exemple #2
0
    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);
            }
        }
    }