예제 #1
0
        static void onClientDisconnect(string client_uuid)
        {
            log.log.trace(new System.Diagnostics.StackFrame(), service.timerservice.Tick, "begin onClientDisconnect");

            if (players == null)
            {
                return;
            }

            var _proxy = players.get_playerproxy(client_uuid);

            if (_proxy == null)
            {
                return;
            }

            table _table = server.tables.get_mj_huanghuang_table(_proxy.room_id);

            if (_table == null)
            {
                return;
            }

            if (_table.in_game)
            {
                _table.broadcast("mj_huanghuang", "player_disconnect", _proxy.unionid);
            }

            log.log.trace(new System.Diagnostics.StackFrame(), service.timerservice.Tick, "end onClientDisconnect");
        }
예제 #2
0
        // client call
        public void enter_mj_huanghuang_room(Int64 room_id)
        {
            log.log.trace(new System.Diagnostics.StackFrame(), service.timerservice.Tick, "begin enter_mj_huanghuang_room");

            log.log.trace(new System.Diagnostics.StackFrame(true), service.timerservice.Tick, "enter_mj_huanghuang_room");
            var client_uuid = hub.hub.gates.current_client_uuid;

            table _table = server.tables.get_mj_huanghuang_table(room_id);

            if (_table == null)
            {
                hub.hub.gates.call_client(client_uuid, "room", "exist_room");
                return;
            }
            else
            {
                if (_table.is_free)
                {
                    hub.hub.gates.call_client(client_uuid, "room", "exist_room");
                    return;
                }
            }


            if (server.disable)
            {
                hub.hub.gates.call_client(client_uuid, "room", "disable_game");

                return;
            }
            hub.hub.hubs.call_hub("lobby", "lobby", "get_player_info_enter_room", hub.hub.name, client_uuid, room_id, false);

            log.log.trace(new System.Diagnostics.StackFrame(), service.timerservice.Tick, "end enter_mj_huanghuang_room");
        }
예제 #3
0
        public void player_info_enter_room(Int64 room_id, string uuid, string unionid, Int64 game_id, string nickname, string headimg, Int64 sex, Int64 rank_score, bool is_renconnect)
        {
            log.log.trace(new System.Diagnostics.StackFrame(), service.timerservice.Tick, "begin player_info_enter_room");

            log.log.trace(new System.Diagnostics.StackFrame(true), service.timerservice.Tick, "player_info_enter_room:{0}", room_id);
            table _table = server.tables.get_mj_huanghuang_table(room_id);

            if (_table != null && !_table.is_free)
            {
                if (!is_renconnect)
                {
                    log.log.trace(new System.Diagnostics.StackFrame(true), service.timerservice.Tick, "join_table");
                    _table.join_table(room_id, uuid, unionid, game_id, nickname, headimg, sex, rank_score);
                }
                else
                {
                    log.log.trace(new System.Diagnostics.StackFrame(true), service.timerservice.Tick, "rejoin_table");
                    _table.rejoin_table(room_id, uuid, unionid, game_id, nickname, headimg, sex, rank_score);
                }
            }
            else
            {
                log.log.trace(new System.Diagnostics.StackFrame(true), service.timerservice.Tick, "exist_room");
                hub.hub.gates.call_client(uuid, "room", "exist_room");
            }

            log.log.trace(new System.Diagnostics.StackFrame(), service.timerservice.Tick, "end player_info_enter_room");
        }
예제 #4
0
        // client call
        public void exit_mj_huanghuang_room(Int64 room_id)
        {
            log.log.trace(new System.Diagnostics.StackFrame(), service.timerservice.Tick, "begin exit_mj_huanghuang_room");

            log.log.trace(new System.Diagnostics.StackFrame(true), service.timerservice.Tick, "exit_mj_huanghuang_room");
            table _table      = server.tables.get_mj_huanghuang_table(room_id);
            var   client_uuid = hub.hub.gates.current_client_uuid;

            if (_table != null && !_table.in_game)
            {
                _table.exit_table((string)client_uuid);
            }

            log.log.trace(new System.Diagnostics.StackFrame(), service.timerservice.Tick, "end exit_mj_huanghuang_room");
        }
예제 #5
0
        // lobby hub call
        public void create_mj_huanghuang_room(string unionid, Int64 peopleNum, Int64 score, Int64 times, Int64 payRule, string callback_id)
        {
            log.log.trace(new System.Diagnostics.StackFrame(), service.timerservice.Tick, "begin create_mj_huanghuang_room");

            if (!server.tables.is_busy())
            {
                log.log.trace(new System.Diagnostics.StackFrame(), service.timerservice.Tick, "peopleNum:{0}, score:{1}, times:{2}, payRule:{3}", peopleNum, score, times, payRule);

                Int64 room_id = server.tables.create_mj_huanghuang_table();
                table _table  = server.tables.get_mj_huanghuang_table(room_id);
                _table.set_room_info(peopleNum, score, times, payRule);
                _table.set_room_owner(unionid);
                hub.hub.hubs.call_hub("lobby", "lobby", "on_create_mj_huanghuang_room_real", room_id, callback_id);

                hub.hub.timer.addticktime(60 * 1000, (Int64 tick) => {
                    if (!_table.is_free && !_table.in_game)
                    {
                        if (_table.site.Count <= 0)
                        {
                            ArrayList _uuids = new ArrayList();
                            foreach (var item in _table.players_uuid)
                            {
                                _uuids.Add(item.Key);
                            }
                            for (int i = _table.players_uuid.Count - 1; i >= 0; i--)
                            {
                                _table.exit_table((string)_uuids[i]);
                            }

                            hub.hub.hubs.call_hub("lobby", "lobby", "disband_room", _table.owner, room_id);

                            server.tables.free_mj_huanghuang_table(room_id);
                        }
                    }
                    else
                    {
                        log.log.trace(new System.Diagnostics.StackFrame(true), service.timerservice.Tick, "桌子为空");
                    }
                });
            }

            log.log.trace(new System.Diagnostics.StackFrame(), service.timerservice.Tick, "end create_mj_huanghuang_room");
        }