Exemplo n.º 1
0
    def __init__(self):
        GameObject.__init__(self)
        iRoomRules.__init__(self)

        self.owner_uid = 0
        self.agent = None
        self.roomID = None

        # 状态0:未开始游戏, 1:某一局游戏中
        self.state = 0

        # 存放该房间内的玩家mailbox
        self.players_dict = {}
        self.players_list = [None] * const.ROOM_PLAYER_NUMBER

        # 上局庄家
        self.last_dealer_idx = 0
        # 庄家index
        self.dealer_idx = 0
        # 当前控牌的玩家index
        self.current_idx = 0
        # 对当前打出的牌可以进行操作的玩家的index, 服务端会限时等待他的操作
        self.wait_idx_list = []
        self.wait_op = None
        # 房间基础轮询timer
        self._poll_timer = None
        # 玩家操作限时timer
        self._op_timer = None
        # 一局游戏结束后, 玩家准备界面等待玩家确认timer
        self._next_game_timer = None

        #财神
        self.kingTile = 0
        #打出财神的玩家idx
        self.discardKingTileIdx = -2

        self.current_round = 0
        self.all_discard_tiles = []
        # 最后一位出牌的玩家
        self.last_player_idx = -1
        # 房间开局所有操作的记录(aid, src, des, tile)
        self.op_record = []
        # 确认继续的玩家
        self.confirm_next_idx = []

        # 解散房间操作的发起者
        self.dismiss_room_from = -1
        # 解散房间操作开始的时间戳
        self.dismiss_room_ts = 0
        # 解散房间操作投票状态
        self.dismiss_room_state_list = [0, 0, 0, 0]
        self.dismiss_timer = None
        #目前老庄数
        self.curOldDealNum = self.startOldDealNum
        #等待玩家确认胡的dict
        self.wait_for_win_dict = {}

        # self.addTimer(const.ROOM_EXIST_TIME, 0, const.TIMER_TYPE_ROOM_EXIST)
        self.roomOpenTime = time.time()
Exemplo n.º 2
0
	def __init__(self):
		GameObject.__init__(self)
		iRoomRules.__init__(self)

		self.owner_uid = 0
		self.agent = None
		self.roomID = None

		# 状态0:未开始游戏, 1:某一局游戏中
		self.state = 0

		# 存放该房间内的玩家mailbox
		self.players_dict = {}
		self.players_list = [None] * self.player_num
		self.origin_players_list = [None] * const.ROOM_PLAYER_NUMBER

		# 庄家index
		self.dealer_idx = 0
		# 当前控牌的玩家index
		self.current_idx = 0
		# 对当前打出的牌可以进行操作的玩家的index, 服务端会限时等待他的操作
		self.wait_idx_list = []
		self.wait_op = None
		# 房间基础轮询timer
		self._poll_timer = None
		# 玩家操作限时timer
		self._op_timer = None
		# 一局游戏结束后, 玩家准备界面等待玩家确认timer
		self._next_game_timer = None

		#财神(多个)
		self.kingTiles = []

		self.current_round = 0
		self.all_discard_tiles = []
		# 最后一位出牌的玩家
		self.last_player_idx = -1
		# 房间开局所有操作的记录(aid, src, des, tile)
		self.op_record = []
		# 确认继续的玩家
		self.confirm_next_idx = []

		# 解散房间操作的发起者
		self.dismiss_room_from = -1
		# 解散房间操作开始的时间戳
		self.dismiss_room_ts = 0
		# 解散房间操作投票状态
		self.dismiss_room_state_list = [0] * self.player_num
		self.dismiss_timer = None
		# 等待玩家确认胡的dict
		self.wait_for_win_dict = {} # waitIdx:{"state": 0, "formIdx": idx, "win_op":aid, "quantity":4, "result":[]}

		# self.addTimer(const.ROOM_EXIST_TIME, 0, const.TIMER_TYPE_ROOM_EXIST)
		self.roomOpenTime = time.time()
Exemplo n.º 3
0
    def __init__(self):
        GameObject.__init__(self)
        iRoomRules.__init__(self)

        self.owner_uid = 0
        self.agent = None
        self.roomID = None

        # 状态0:未开始游戏, 1:某一局游戏中
        self.state = 0

        # 存放该房间内的玩家mailbox
        self.players_dict = {}
        self.players_list = [None] * const.ROOM_PLAYER_NUMBER
        self.origin_players_list = [None] * const.ROOM_PLAYER_NUMBER
        # 控牌玩家
        self.controller_idx = -1
        # 控牌玩家出的牌
        self.controller_discard_list = []
        # 等待出牌玩家
        self.wait_idx = -1
        # 桌牌
        self.deskPokerList = [[] for i in range(const.ROOM_PLAYER_NUMBER)]
        #玩家出完牌的顺序
        self.show_empty_list = []
        # 当前局数
        self.current_round = 0
        # 翻牌
        self.key_card = 0
        # 交换顺序
        self.swap_list = [i for i in range(const.ROOM_PLAYER_NUMBER)]
        # 房间开局所有操作的记录(idx, op, cards, insteadCards)
        self.op_record = []
        # 房间基础轮询timer
        self._poll_timer = None
        # 玩家操作限时timer
        self._op_timer = None
        # 一局游戏结束后, 玩家准备界面等待玩家确认timer
        self._next_game_timer = None
        # 确认继续的玩家
        self.confirm_next_idx = []
        # 解散房间操作的发起者
        self.dismiss_room_from = -1
        # 解散房间操作开始的时间戳
        self.dismiss_room_ts = 0
        # 解散房间操作投票状态
        self.dismiss_room_state_list = [0, 0, 0, 0]
        self.dismiss_timer = None

        self.roomOpenTime = time.time()
Exemplo n.º 4
0
	def __init__(self):
		BaseEntity.__init__(self)
		GameObject.__init__(self)
		iRoomRules.__init__(self)

		self.agent = None
		self.roomID = utility.gen_room_id()

		# 状态0:未开始游戏, 1:某一局游戏中
		self.state = const.ROOM_WAITING

		# 存放该房间内的玩家mailbox
		self.players_dict = {}
		self.players_list = [None] * self.player_num
		self.origin_players_list = [None] * self.player_num

		# 打出财神的index
		self.discard_king_idx = -1

		# 庄家index
		self.dealer_idx = 0
		# 当前控牌的玩家index
		self.current_idx = 0
		# 对当前打出的牌可以进行操作的玩家的index, 服务端会限时等待他的操作
		# 房间基础轮询timer
		self._poll_timer = None
		# 玩家操作限时timer
		self._op_timer = None
		# 一局游戏结束后, 玩家准备界面等待玩家确认timer
		self._next_game_timer = None

		#财神(多个)
		self.kingTiles = []
		#圈风
		self.prevailing_wind = const.WIND_EAST
		#一圈中玩家坐庄次数
		self.dealerNumList = [0] * self.player_num

		self.current_round = 0
		self.all_discard_tiles = []
		# 最后一位出牌的玩家
		self.last_player_idx = -1
		# 房间开局所有操作的记录(aid, src, des, tile)
		self.op_record = []
		# 房间开局操作的记录对应的记录id
		self.record_id = -1
		# 确认继续的玩家
		self.confirm_next_idx = []
		# 解散房间操作的发起者
		self.dismiss_room_from = -1
		# 解散房间操作开始的时间戳
		self.dismiss_room_ts = 0
		# 解散房间操作投票状态
		self.dismiss_room_state_list = [0] * self.player_num
		self.dismiss_timer = None
		# 房间创建时间
		self.roomOpenTime = time.time()
		# 玩家操作列表
		self.wait_op_info_list = []
		# 杠后摸牌延时操作时的标志位,例如主要在延时中出现解散房间操作时需要拒绝操作,同上
		self.wait_force_delay_kong_draw = False

		# 过胡状态
		self.pass_win_list = [0] * self.player_num
		# 听牌所在位置
		self.tingTileList = [0] * self.player_num
		# 可胡牌列表,只记录能获胜的玩家的胡牌列表
		self.canWinTiles = []

		# 牌局记录
		self.game_result = {}

		# 房间所属的茶楼桌子, 仅茶楼中存在
		self.club_table = None
		# 增加房间销毁定时器
		self.timeout_timer = self.add_timer(const.ROOM_TTL, self.timeoutDestroy)
Exemplo n.º 5
0
	def __init__(self):
		BaseEntity.__init__(self)
		GameObject.__init__(self)
		iRoomRules.__init__(self)

		self.agent = None
		self.roomID = utility.gen_room_id()

		# 状态0:未开始游戏, 1:某一局游戏中
		self.state = const.ROOM_WAITING

		# 存放该房间内的玩家mailbox
		self.players_dict = {}
		self.players_list = [None] * self.player_num
		self.origin_players_list = [None] * self.player_num

		# 打出财神的index
		self.discard_king_idx = -1

		# 庄家index
		self.dealer_idx = 0
		# 当前控牌的玩家index
		self.current_idx = 0
		# 对当前打出的牌可以进行操作的玩家的index, 服务端会限时等待他的操作
		# 房间基础轮询timer
		self._poll_timer = None
		# 玩家操作限时timer
		self._op_timer = None
		# 一局游戏结束后, 玩家准备界面等待玩家确认timer
		self._next_game_timer = None

		#财神(多个)
		self.kingTiles = []
		#圈风
		self.prevailing_wind = const.WIND_EAST
		#一圈中玩家坐庄次数
		self.dealerNumList = [0] * self.player_num

		self.current_round = 0
		self.all_discard_tiles = []
		# 最后一位出牌的玩家
		self.last_player_idx = -1
		# 房间开局所有操作的记录(aid, src, des, tile)
		self.op_record = []
		# 房间开局操作的记录对应的记录id
		self.record_id = -1
		# 确认继续的玩家
		self.confirm_next_idx = []
		# 解散房间操作的发起者
		self.dismiss_room_from = -1
		# 解散房间操作开始的时间戳
		self.dismiss_room_ts = 0
		# 解散房间操作投票状态
		self.dismiss_room_state_list = [0] * self.player_num
		self.dismiss_timer = None
		# 房间创建时间
		self.roomOpenTime = time.time()
		# 玩家操作列表
		self.wait_op_info_list = []
		# 杠后摸牌延时操作时的标志位,例如主要在延时中出现解散房间操作时需要拒绝操作,同上
		self.wait_force_delay_kong_draw = False

		# 牌局记录
		self.game_result = {}
		# 当前老庄数
		self.cur_dealer_mul = self.begin_dealer_mul

		# 房间所属的茶楼桌子, 仅茶楼中存在
		self.club_table = None
		# 增加房间销毁定时器
		self.timeout_timer = self.add_timer(const.ROOM_TTL, self.timeoutDestroy)

		# 本轮出牌分数
		self.curround_score = 0
		# 一轮刚开始的标志
		self.round_start = True
		# 玩家要不起的标志位
		self.op_pass_flag = 0
		# 玩家胜利个数,每当有玩家胜利,个数加一
		self.player_win_num = 0
		# 控牌玩家出牌列表
		self.controller_discard_list = []
		# 等待出牌的玩家
		self.waitIdx = -1
		# 玩家出牌列表
		self.deskPokerList = [[],[],[],[]]
		# 胜利玩家列表
		self.win_list = []
		# 玩家本局游戏彻底结束的列表
		self.round_end_list = []
		# 玩家本局得分(除了奖励分)
		self.curScoreList = [0] * self.player_num
		# 玩家本局最终得分(除了奖励分)
		self.lastScoreList = [0] * self.player_num
		# 玩家本局得奖
		self.curPrizeList = [0] * self.player_num
Exemplo n.º 6
0
	def __init__(self):
		BaseEntity.__init__(self)
		GameObject.__init__(self)
		iRoomRules.__init__(self)

		self.agent = None
		self.roomID = utility.gen_room_id()

		# 状态0:未开始游戏, 1:某一局游戏中
		self.state = const.ROOM_WAITING

		# 存放该房间内的玩家mailbox
		self.players_dict = {}
		self.players_list = [None] * self.player_num
		self.origin_players_list = [None] * self.player_num

		# 庄家index
		self.dealer_idx = -1
		# 当前控牌的玩家index
		self.current_idx = 0
		# 对当前打出的牌可以进行操作的玩家的index, 服务端会限时等待他的操作
		# 房间基础轮询timer
		self._poll_timer = None
		# 玩家操作限时timer
		self._op_timer = None
		# 玩家操作限时timer 启动时间
		self._op_timer_timestamp = 0
		# 一局游戏结束后, 玩家准备界面等待玩家确认timer
		self._next_game_timer = None

		self.current_round = 0
		self.last_player_idx = -1
		# 房间开局所有操作的记录(aid, src, des, [data])
		self.op_record = []
		# 房间开局操作的记录对应的记录id
		self.record_id = -1
		# 确认继续的玩家
		self.confirm_next_idx = []
		# 解散房间操作的发起者
		self.dismiss_room_from = -1
		# 解散房间操作开始的时间戳
		self.dismiss_room_ts = 0
		# 解散房间操作投票状态
		self.dismiss_room_state_list = [0] * self.player_num
		self.dismiss_timer = None
		# 房间创建时间
		self.roomOpenTime = time.time()
		# 玩家操作列表
		self.wait_op_info_list = []
		# 牌局记录
		self.game_result = {}
		# 房间所属的茶楼桌子, 仅茶楼中存在
		self.club_table = None
		# 增加房间销毁定时器
		self.timeout_timer = self.add_timer(const.ROOM_TTL, self.timeoutDestroy)
		# 抢庄倍数(0不抢, 1:一倍....)
		self.fight_dealer_mul_list = [-1] * self.player_num
		# 叫地主分数
		self.bet_score_list = [-1] * self.player_num
		self.cur_allow_op = const.OP_NONE
		# 续房的标记
		self._continue_room_flag = False
		# 地主的三张牌
		self.host_cards = []
		self.last_discard_idx = -1
		self.discard_record = LimitQueue(3)
		# 上一个win的玩家
		self.last_win_idx = 0
		self.boom_times = 0