Beispiel #1
0
def _initializeTables(gdatas):
    '''
    初始化所有的桌子对象
    '''
    if _DEBUG:
        debug('initializeTables begin')
    srvid = gdata.serverId()
    roomids = gdata.srvIdRoomIdListMap().get(srvid, None)  # 获取所有房间ids
    if roomids:
        allrooms = gdata.roomIdDefineMap()  # 房间定义映射
        tyrooms = gdata.rooms()  # 所有房间实例字典
        for roomid in roomids:
            room = tyrooms[roomid]
            roomdefine = allrooms[roomid]
            gameins = gdata.games()[roomdefine.gameId]  # 房间游戏实例TYGame
            if _DEBUG:
                debug('initializeTables roomid=', roomid, 'tableCount=',
                      roomdefine.tableCount)
            if roomdefine.tableCount > 0:  # 桌子数
                baseid = roomid * 10000 + 1  # 桌子开始的id
                for x in xrange(roomdefine.tableCount):
                    tableid = baseid + x
                    tableins = gameins.newTable(room, tableid)  # 创建桌子
                    room.maptable[tableid] = tableins  # 桌子映射实例
    if _DEBUG:
        debug('initializeTables end')
Beispiel #2
0
def __initializeTables(gdatas):
    '''
    初始化所有的桌子对象
    '''
    if _DEBUG:
        debug('initializeTables begin')
    srvid = gdata.serverId()
    roomids = gdata.srvIdRoomIdListMap().get(srvid, None)
    if roomids:
        allrooms = gdata.roomIdDefineMap()
        tyrooms = gdata.rooms()
        for roomid in roomids:
            room = tyrooms[roomid]
            roomdefine = allrooms[roomid]
            gameins = gdata.games()[roomdefine.gameId]
            if _DEBUG:
                debug('initializeTables roomid=', roomid, 'tableCount=',
                      roomdefine.tableCount)
            if roomdefine.tableCount > 0:
                baseid = roomid * 10000 + 1
                for x in xrange(roomdefine.tableCount):
                    tableid = baseid + x
                    tableins = gameins.newTable(room, tableid)
                    assert (isinstance(tableins, TYTable))
                    room.maptable[tableid] = tableins
    if _DEBUG:
        debug('initializeTables end')
Beispiel #3
0
def __initializeTables(gdatas):
    '''
    初始化所有的桌子对象
    '''
    if _DEBUG:
        debug('initializeTables begin')
    srvid = gdata.serverId()
    roomids = gdata.srvIdRoomIdListMap().get(srvid, None)
    if roomids:
        allrooms = gdata.roomIdDefineMap()
        tyrooms = gdata.rooms()
        for roomid in roomids:
            room = tyrooms[roomid]
            roomdefine = allrooms[roomid]
            gameins = gdata.games()[roomdefine.gameId]
            if _DEBUG:
                debug('initializeTables roomid=', roomid, 'tableCount=', roomdefine.tableCount)
            if roomdefine.tableCount > 0:
                baseid = roomid * 10000 + 1
                for x in xrange(roomdefine.tableCount):
                    tableid = baseid + x
                    tableins = gameins.newTable(room, tableid)
                    assert (isinstance(tableins, TYTable))
                    room.maptable[tableid] = tableins
    if _DEBUG:
        debug('initializeTables end')
Beispiel #4
0
 def initGameAfter(self):
     """
     此方法由系统进行调用
     游戏初始化的后处理
     """
     serverType = gdata.serverType()
     if serverType == gdata.SRV_TYPE_TABLE:
         roomIds = gdata.srvIdRoomIdListMap().get(gdata.serverId(), None)
         if roomIds:
             from freetime.core.timer import FTLoopTimer
             from newfish.servers.room.rpc import room_remote
             allRooms = gdata.roomIdDefineMap()
             for roomId in roomIds:
                 ctrlRoomId = allRooms[roomId].parentId
                 tableCount = allRooms[roomId].tableCount
                 # 目前GR、GT是同时启动,GT启动完成时,GR不一定启动完成,所以暂时延后调用
                 FTLoopTimer(3, 0, room_remote.initializedGT, ctrlRoomId,
                             roomId, tableCount).start()
Beispiel #5
0
def __initializeRooms(gdatas):
    '''
    初始化所有的房间对象
    '''
    if _DEBUG:
        debug('initializeRooms begin')
    from poker.entity.game.rooms import getInstance
    srvid = gdata.serverId()
    roomids = gdata.srvIdRoomIdListMap().get(srvid, None)
    if roomids:
        tyrooms = {}
        gdatas['tyrooms.instance.dict'] = tyrooms
        allrooms = gdata.roomIdDefineMap()
        for roomid in roomids:
            roomdefine = allrooms[roomid]
            roomins = getInstance(roomdefine)
            assert (isinstance(roomins, TYRoom))
            tyrooms[roomid] = roomins
        gdatas['tyrooms.instance.dict'] = makeReadonly(tyrooms)
    if _DEBUG:
        debug('initializeRooms end')
Beispiel #6
0
def __initializeRooms(gdatas):
    '''
    初始化所有的房间对象
    '''
    if _DEBUG:
        debug('initializeRooms begin')
    from poker.entity.game.rooms import getInstance
    srvid = gdata.serverId()
    roomids = gdata.srvIdRoomIdListMap().get(srvid, None)
    if roomids:
        tyrooms = {}
        gdatas['tyrooms.instance.dict'] = tyrooms
        allrooms = gdata.roomIdDefineMap()
        for roomid in roomids:
            roomdefine = allrooms[roomid]
            roomins = getInstance(roomdefine)
            assert (isinstance(roomins, TYRoom))
            tyrooms[roomid] = roomins
        gdatas['tyrooms.instance.dict'] = makeReadonly(tyrooms)
    if _DEBUG:
        debug('initializeRooms end')
Beispiel #7
0
def _initializeRooms(gdatas):
    '''
    初始化所有的房间对象
    '''
    if _DEBUG:
        debug('initializeRooms begin')
    from poker.entity.game.rooms import getInstance  # 获取房间实例
    srvid = gdata.serverId()
    roomids = gdata.srvIdRoomIdListMap().get(srvid, None)  # 获取所有房间ids
    if _DEBUG:
        debug('initializeRooms srvid=', srvid, 'roomids=', roomids)
    if roomids:
        tyrooms = {}
        gdatas['tyrooms.instance.dict'] = tyrooms  # 房间实例dict
        allrooms = gdata.roomIdDefineMap()  # 房间定义的映射
        if _DEBUG:
            debug('initializeRooms allroomsid=', allrooms.keys())
        for roomid in roomids:
            roomdefine = allrooms[roomid]
            roomins = getInstance(roomdefine)  # 房间实例子
            tyrooms[roomid] = roomins  # 房间id: 实例
        gdatas['tyrooms.instance.dict'] = makeReadonly(tyrooms)
    if _DEBUG:
        debug('initializeRooms end')
Beispiel #8
0
def _main():
    ftlog.info('zzzzzz', gdata.serverId())  # GT0044001_999
    ftlog.info(
        'zzzzzz', gdata.srvIdRoomIdListMap()
    )  # {'GT0044001_999': [441011001, 441021001, 441031001, 441041001, 443011001, 443021001, 444021001, 444031001, 444041001, 444051001, 444111001, 444121001, 444141001, 444151001, 444991001, 445011001, 446011001]}
    ftlog.info('zzzzzz', gdata.allServersMap())
Beispiel #9
0
# bigRoomIds = gdata.gameIdBigRoomidsMap().get(FISH_GAMEID)
# ftlog.info(bigRoomIds, 'zzzzzzzzz')
# [44101, 44102, 44103, 44104, 44301, 44302, 44402, 44403, 44404,
#  44405, 44411, 44412, 44414, 44415, 44499, 44501, 44601]

# ctrlRoomIds = []
# for bigRoomId in bigRoomIds:
#     roomConf = gdata.getRoomConfigure(bigRoomId)
#     ctrlRoomIds.extend(gdata.bigRoomidsMap().get(bigRoomId, []))
# ctrlRoomIds.sort()
# ftlog.info(ctrlRoomIds, 'cccccccccccc')
# [441011000, 441021000, 441031000, 441041000, 443011000, 443021000, 444021000,
# 444031000, 444041000, 444051000, 444111000, 444121000, 444141000, 444151000,
# 444991000, 445011000, 446011000

ftlog.info('zzzzzzzzzzzzzzccccccccc', gdata.srvIdRoomIdListMap())
# {'GT0044001_999': [441011001, 441021001, 441031001, 441041001, 443011001, 443021001, 444021001, 444031001, 444041001, 444051001, 444111001, 444121001, 444141001, 444151001, 444991001, 445011001, 446011001]}
ftlog.info("roomIdDefineMap", gdata.roomIdDefineMap())

import freetime.util.log as ftlog
from freetime.core.timer import FTLoopTimer
from poker.entity.configure import gdata


def _main():
    ftlog.info('zzzzzz', gdata.serverId())  # GT0044001_999
    ftlog.info(
        'zzzzzz', gdata.srvIdRoomIdListMap()
    )  # {'GT0044001_999': [441011001, 441021001, 441031001, 441041001, 443011001, 443021001, 444021001, 444031001, 444041001, 444051001, 444111001, 444121001, 444141001, 444151001, 444991001, 445011001, 446011001]}
    ftlog.info('zzzzzz', gdata.allServersMap())