Пример #1
0
        private void OnGameEvent(GameEvent evt)
        {
            switch (evt.type)
            {
            case EventID.PLAYER_ENTER_GAME:
            {
                long char_idx = evt.Get <long>(0);
                this.OnPlayerLogin(char_idx);
            }
            break;

            case EventID.PLAYER_LEAVE_GAME:
            {
                long char_idx = evt.Get <long>(0);
                this.OnPlayerLogout(char_idx);
            }
            break;

            case EventID.NET_DISCONNECT_FIGHT_SRV:
            {
                ushort server_uid = evt.Get <ushort>(0);
                this.OnFightServerLeave(server_uid);
            }
            break;
            }
        }
Пример #2
0
        private void OnGameEvent(GameEvent evt)
        {
            switch (evt.type)
            {
            case EventID.DB_NEW_EVENT:
            {
                long    target_char_idx = evt.Get <long>(0);
                DBEvent db_evt;
                if (m_event_members.TryGetValue(target_char_idx, out db_evt))
                {
                    db_evt.Load();
                }
            }
            break;

            case EventID.PLAYER_ENTER_GAME:
            {
                long char_idx = evt.Get <long>(0);
                this.OnPlayerLogin(char_idx);
            }
            break;

            case EventID.PLAYER_LEAVE_GAME:
            {
                long char_idx = evt.Get <long>(0);
                this.OnPlayerLogout(char_idx);
            }
            break;
            }
        }
Пример #3
0
        private void OnRecvPing(GameEvent evt)
        {
            eServerType server_type = evt.Get <eServerType>(0);
            uint        packet_id   = evt.Get <uint>(1);
            long        tick        = evt.Get <long>(2);
            long        offset_time = evt.Get <long>(3);
            uint        flags       = evt.Get <uint>(4);

            string str = string.Format("{0} ID:{1}, 时间:{2}, 延迟:{3}, 标记:{4}", server_type, packet_id, tick, offset_time, flags);

            m_list_ping.Items.Add(str);
            if (m_list_ping.Items.Count > 8)
            {
                m_list_ping.Items.RemoveAt(0);
            }
        }
Пример #4
0
        private void OnGameEvent(GameEvent evt)
        {
            switch (evt.type)
            {
            case ClientEventID.NET_CONNECTED_OPEN:
            {
                if (!m_active)
                {
                    break;
                }
                long conn_idx = evt.Get <long>(0);
                if (!m_connectes.Contains(conn_idx))
                {
                    m_connectes.Add(conn_idx);
                }
            }
            break;

            case ClientEventID.NET_CONNECTED_CLOSE:
            {
                if (!m_active)
                {
                    break;
                }
                long conn_idx = evt.Get <long>(0);
                m_connectes.Remove(conn_idx);
            }
            break;

            case ClientEventID.SWITCH_PRESSURE:
            {
                ePressureType type     = evt.Get <ePressureType>(0);
                bool          is_start = evt.Get <bool>(1);
                if (type == ePressureType.Login && is_start)
                {
                    m_pressure_info = evt.Get <sPressureLoginInfo>(2);
                    this.Start();
                }
                else
                {
                    this.Stop();
                }
            }
            break;
            }
        }
Пример #5
0
        private void OnGameEvent(GameEvent evt)
        {
            switch (evt.type)
            {
            case EventID.PLAYER_ENTER_GAME:
            {
                long char_idx = evt.Get <long>(0);
                this.OnPlayerLogin(char_idx);
            }
            break;

            case EventID.PLAYER_LEAVE_GAME:
            {
                long char_idx = evt.Get <long>(0);
                this.OnPlayerLogout(char_idx);
            }
            break;
            }
        }
 private void OnGameEvent(GameEvent evt)
 {
     switch (evt.type)
     {
     case ClientEventID.SWITCH_PRESSURE:
     {
         ePressureType type     = evt.Get <ePressureType>(0);
         bool          is_start = evt.Get <bool>(1);
         if (type == ePressureType.CreateUser && is_start)
         {
             m_pressure_info = evt.Get <sCreateUserInfo>(2);
             this.Start();
         }
         else
         {
             this.Stop();
         }
     }
     break;
     }
 }
Пример #7
0
        private void OnGameEvent(GameEvent evt)
        {
            switch (evt.type)
            {
            case ClientEventID.NET_CONNECTED_OPEN:
            {
                this.ShowState(eFormStatusType.Account, "已连接");
            }
            break;

            case ClientEventID.NET_CONNECTED_CLOSE:
            {
                this.ShowState(eFormStatusType.Account, "未连接");
                this.ShowState(eFormStatusType.User, "未登陆");
                this.ShowState(eFormStatusType.Scene, "当前场景");
            }
            break;

            case ClientEventID.SHOW_MESSAGE:
            {
                string msg   = evt.Get <string>(0);
                string title = evt.Get <string>(1);
                MessageBox.Show(msg, title, MessageBoxButtons.OK);
            }
            break;

            case ClientEventID.SHOW_STATUS:
            {
                eFormStatusType type = evt.Get <eFormStatusType>(0);
                switch (type)
                {
                case eFormStatusType.Account:
                case eFormStatusType.User:
                case eFormStatusType.Scene:
                    string msg = evt.Get <string>(1);
                    this.ShowState(type, msg);
                    break;

                case eFormStatusType.Log:
                    msg = evt.Get <string>(1);
                    this.ShowState(type, msg);
                    break;
                }
            }
            break;

            case ClientEventID.OPEN_FORM:
            {
                eFormType form_type = evt.Get <eFormType>(0);
                switch (form_type)
                {
                case eFormType.CreateUser:
                    CreateUserForm create_form = new CreateUserForm();
                    create_form.ShowDialog();
                    break;
                }
            }
            break;
            }
        }
Пример #8
0
        private void OnGameEvent(GameEvent evt)
        {
            switch (evt.type)
            {
            case ClientEventID.CREATE_COMPLETE:
            {
                MessageBox.Show("创建完成", "提示", MessageBoxButtons.OK);
                m_tabLogin_Start.Text    = "开始";
                m_tabLogin_Start.Enabled = true;
                EnableTabPage(true, m_tabUser);
                EnableLoginTabPage(true);
                this.SetCreateProgress(0, 1);
            }
            break;

            case ClientEventID.CREATE_PROGRESS:
            {
                int cur   = evt.Get <int>(0);
                int total = evt.Get <int>(1);
                this.SetCreateProgress(cur, total);
            }
            break;
            }
        }
        private void OnGameEvent(GameEvent evt)
        {
            switch (evt.type)
            {
            case ClientEventID.NET_CONNECTED_OPEN:
            {
                if (!m_active)
                {
                    break;
                }
                long conn_idx = evt.Get <long>(0);
                if (!m_connectes.ContainsKey(conn_idx))
                {
                    MoveClient client = new MoveClient();
                    client.Setup(conn_idx, m_pressure_info.start_account + m_connectes.Count);
                    m_connectes.Add(conn_idx, client);
                }
            }
            break;

            case ClientEventID.NET_CONNECTED_CLOSE:
            {
                if (!m_active)
                {
                    break;
                }
                long       conn_idx = evt.Get <long>(0);
                MoveClient client;
                if (m_connectes.TryGetValue(conn_idx, out client))
                {
                }
                m_connectes.Remove(conn_idx);
            }
            break;

            case ClientEventID.SWITCH_PRESSURE:
            {
                ePressureType type     = evt.Get <ePressureType>(0);
                bool          is_start = evt.Get <bool>(1);
                if (type == ePressureType.Move && is_start)
                {
                    m_pressure_info = evt.Get <sPressureMoveInfo>(2);
                    this.Start();
                }
                else
                {
                    this.Stop();
                }
            }
            break;

            case ClientEventID.RECV_DATA:
            {
                if (!m_active)
                {
                    break;
                }
                long       conn_idx = evt.Get <long>(0);
                ushort     header   = evt.Get <ushort>(1);
                ByteArray  data     = evt.Get <ByteArray>(2);
                MoveClient client;
                if (m_connectes.TryGetValue(conn_idx, out client))
                {
                    client.OnNetworkServer(header, data);
                }
            }
            break;
            }
        }
        private void OnGameEvent(GameEvent evt)
        {
            switch (evt.type)
            {
            case ClientEventID.NET_CONNECTED_OPEN:
            {
                if (!m_active)
                {
                    break;
                }
                long conn_idx = evt.Get <long>(0);
                if (!m_connectes.Contains(conn_idx))
                {
                    m_connectes.Add(conn_idx);
                }
            }
            break;

            case ClientEventID.NET_CONNECTED_CLOSE:
            {
                if (!m_active)
                {
                    break;
                }
                long conn_idx = evt.Get <long>(0);
                m_connectes.Remove(conn_idx);
            }
            break;

            case ClientEventID.SWITCH_PRESSURE:
            {
                ePressureType type     = evt.Get <ePressureType>(0);
                bool          is_start = evt.Get <bool>(1);
                if (type == ePressureType.Net && is_start)
                {
                    m_pressure_info = evt.Get <sPressureNetInfo>(2);
                    this.Start();
                }
                else
                {
                    this.Stop();
                }
            }
            break;

            case ClientEventID.RECV_DATA:
            {
                if (!m_active)
                {
                    break;
                }
                long      conn_idx = evt.Get <long>(0);
                ushort    header   = evt.Get <ushort>(1);
                ByteArray data     = evt.Get <ByteArray>(2);
                if (header == gs2c.msg.ENCRYPT)
                {
                    m_had_recv_encrypt = true;
                    PacketBase packet = PacketPools.Get(header);
                    packet.Read(data);
                    GlobalID.ENCRYPT_KEY = (packet as gs2c.EncryptInfo).key;
                    PacketPools.Recover(packet);
                }
            }
            break;
            }
        }