Esempio n. 1
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");
        }
Esempio n. 2
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");
        }