public void player_leave_room(string hub_name, Int64 room_id) { foreach (var match_room in match_list) { if (match_room.hub_name != hub_name || match_room.room_id != room_id) { continue; } match_room.player_num--; if (match_room.player_num <= 0) { match_list.Remove(match_room); hub.hub.hubs.call_hub(match_room.hub_name, "match", "free_match_room", match_room.room_id); } return; } var _match_room = new matchInfo(hub_name, room_id); _match_room.player_num = 3; match_list.Add(_match_room); }
public void join_match() { var client_uuid = hub.hub.gates.current_client_uuid; if (server.disable) { hub.hub.gates.call_client(client_uuid, "room", "disable_game"); return; } var _proxy = server.players.get_player_uuid(client_uuid); if (_proxy == null) { log.log.error(new System.Diagnostics.StackFrame(true), service.timerservice.Tick, "not exit player:{0}", client_uuid); return; } foreach (var match_room in match_list) { hub.hub.gates.call_client(_proxy.uuid, "match", "on_match_mj_huanghuang_room", match_room.hub_name, match_room.room_id); match_room.player_num++; log.log.trace(new System.Diagnostics.StackFrame(true), service.timerservice.Tick, "match_room.player_num:{0}", match_room.player_num); if (match_room.player_num >= 4) { match_list.Remove(match_room); } return; } createroomimpl.create_mj_huanghuang_room("nil", 4, (Int64)GameCommon.GameScore.Two, (Int64)GameCommon.GameTimes.unlimited, (Int64)GameCommon.PayRule.MatchPay, (string hub_name, Int64 room_id) => { var match_room = new matchInfo(hub_name, room_id); match_room.player_num++; match_list.Add(match_room); hub.hub.gates.call_client(_proxy.uuid, "match", "on_match_mj_huanghuang_room", hub_name, room_id); }); }