def __init__(self):
		KBEngine.Entity.__init__(self)
		KBEngine.addSpaceGeometryMapping(self.spaceID,None,"spaces/mjRoom")
		KBEngine.globalData["Room_%i" % self.spaceID] = self
		self.roomInfo = roomInfo(self.roomKey,self.playerMaxCount)
		self.game = None
		self.clearPublicRoomInfo()
Beispiel #2
0
	def __init__(self):
		KBEngine.Entity.__init__(self)
		
		# 把自己移动到一个不可能触碰陷阱的地方
		self.position = (999999.0, 0.0, 0.0)

		# 这个房间中所有的玩家
		self.avatars = {}
		
		# 这个房间中产生的所有粮食
		self.foods = []
		
		# 这个房间中产生的所有粉碎球
		self.smashs = []
		
		# 告诉客户端加载地图
		KBEngine.addSpaceGeometryMapping(self.spaceID, None, "spaces/gameMap")
		
		DEBUG_MSG('created space[%d] entityID = %i, res = %s.' % (self.roomKeyC, self.id, "spaces/gameMap"))
		
		# 让baseapp和cellapp都能够方便的访问到这个房间的mailbox
		KBEngine.globalData["Room_%i" % self.spaceID] = self.base
	
		# 设置房间必要的数据,客户端可以获取之后做一些显示和限制
		KBEngine.setSpaceData(self.spaceID, "GAME_MAP_SIZE",  str(GameConfigs.GAME_MAP_SIZE))
		KBEngine.setSpaceData(self.spaceID, "ROOM_MAX_PLAYER",  str(GameConfigs.ROOM_MAX_PLAYER))
		KBEngine.setSpaceData(self.spaceID, "GAME_ROUND_TIME",  str(GameConfigs.GAME_ROUND_TIME))
		
		# 开始记录一局游戏时间, 时间结束后将玩家踢出空间同时销毁自己和空间
		self._destroyTimer = self.addTimer(GameConfigs.GAME_ROUND_TIME, 0, TIMER_TYPE_DESTROY)
		
		# 开启一个timer周期性的平衡粮食和粉碎球的数量
		self.addTimer(0.1, GameConfigs.GAME_BALANCE_MASS_TIME, TIMER_TYPE_BALANCE_MASS)
Beispiel #3
0
	def __init__(self):
		KBEngine.Entity.__init__(self)

		# 把自己移动到一个不可能触碰陷阱的地方
		self.position = (0.0, 0.0, 0.0)

		self.avatars = {}

		self.frameBegin = False

		self.roomFarmeId = 1

		operation = TEntityFrame().createFromDict({"entityid":0,"cmd_type":0,"datas":b''})

		self.emptyFrame = TFrameData().createFromDict({"frameid":0,"operation":[operation]})
		self.currFrame = copy.deepcopy(self.emptyFrame)


		# 告诉客户端加载地图
		KBEngine.addSpaceGeometryMapping(self.spaceID, None, "spaces/gameMap")

		DEBUG_MSG('created space[%d] entityID = %i, res = %s.' % (self.roomKeyC, self.id, "spaces/gameMap"))

		# 让baseapp和cellapp都能够方便的访问到这个房间的entityCall
		KBEngine.globalData["Room_%i" % self.spaceID] = self.base

		self.addTimer(1,0.00001,TIMER_TYPE_ROOM_TICK)
		self.addTimer(600,0,TIMER_TYPE_DESTORY)
Beispiel #4
0
    def __init__(self):
        GameObject.__init__(self)
        DEBUG_MSG('created space[%d] entityID = %i.' %
                  (self.spaceUType, self.id))

        KBEngine.addSpaceGeometryMapping(self.spaceID, None,
                                         "../../res/Media/Scenes/Scene1")
        KBEngine.globalData["space_%i" % self.spaceID] = self.base
Beispiel #5
0
 def __init__(self):
     KBEngine.Entity.__init__(self)
     KBEngine.addSpaceGeometryMapping(self.spaceID, None, "spaces/rowingGameRoom")
     KBEngine.globalData["Room_%i" % self.spaceID] = self
     self.roomInfo = roomInfo(self.roomKey, self.MaxPlayerCount)
     self.gameState = None
     self.countDown = 0
     self.finishGameCount = 0
     self.endTime = COUNT_DOWN_TIME_GAME_END
     print("cell room init")
Beispiel #6
0
	def __init__(self):
		KBEngine.Entity.__init__(self)
		GameObject.__init__(self)
		
		resPath = d_spaces.datas.get(self.spaceUType)['resPath']
		KBEngine.addSpaceGeometryMapping(self.spaceID, None, resPath)

		DEBUG_MSG('created space[%d] entityID = %i, res = %s.' % (self.spaceUType, self.id, resPath))
		
		KBEngine.globalData["space_%i" % self.spaceID] = self.base
Beispiel #7
0
	def __init__(self):
		KBEngine.Entity.__init__(self)
		GameObject.__init__(self)
		
		resPath = d_spaces.datas.get(self.spaceUType)['resPath']
		KBEngine.addSpaceGeometryMapping(self.spaceID, None, resPath)

		DEBUG_MSG('created space[%d] entityID = %i, res = %s.' % (self.spaceUType, self.id, resPath))
		
		KBEngine.globalData["space_%i" % self.spaceID] = self.base
	def __init__(self):
		KBEngine.Entity.__init__(self)
		GameObject.__init__(self)
		
		# 一个space代表的是一个抽象的空间,这里向这个抽象的空间添加了几何资源数据,如果数据是3D场景的
		# 该space中使用navigate寻路使用的是3D的API,如果是2D的几何数据navigate使用的是astar寻路
		resPath = d_spaces.datas.get(self.spaceUType)['resPath']
		KBEngine.addSpaceGeometryMapping(self.spaceID, None, resPath)

		DEBUG_MSG('created space[%d] entityID = %i, res = %s.' % (self.spaceUType, self.id, resPath))
		
		KBEngine.globalData["space_%i" % self.spaceID] = self.base
Beispiel #9
0
    def __init__(self):
        KBEngine.Entity.__init__(self)
        GameObject.__init__(self)

        # 一个space代表的是一个抽象的空间,这里向这个抽象的空间添加了几何资源数据,如果数据是3D场景的
        # 该space中使用navigate寻路使用的是3D的API,如果是2D的几何数据navigate使用的是astar寻路
        resPath = d_spaces.datas.get(self.spaceUType)['resPath']
        #KBEngine.addSpaceGeometryMapping(self.spaceID, None, resPath, True, {0 : "srv_xinshoucun_1.navmesh", 1 : "srv_xinshoucun.navmesh"})
        KBEngine.addSpaceGeometryMapping(self.spaceID, None, resPath)

        DEBUG_MSG('created space[%d] entityID = %i, res = %s.' %
                  (self.spaceUType, self.id, resPath))

        KBEngine.globalData["space_%i" % self.spaceID] = self.base
Beispiel #10
0
    def __init__(self):
        GameObject.__init__(self)

        resPath = d_spaces.datas.get(self.spaceUType)["resPath"]

        if resPath == "":
            resPath = "../../res/Media/Scenes/Scene1"
            KBEngine.addSpaceGeometryMapping(self.spaceID, None, resPath)
        else:
            KBEngine.addSpaceGeometryMapping(self.spaceID, None, resPath)

        DEBUG_MSG("created space[%d] entityID = %i, res = %s." % (self.spaceUType, self.id, resPath))

        KBEngine.globalData["space_%i" % self.spaceID] = self.base
Beispiel #11
0
    def __init__(self):
        KBEngine.Space.__init__(self)

        KBEngine.addSpaceGeometryMapping(self.spaceID, None,
                                         "spaces/MmoMapOne")
        # KBEngine.addSpaceGeometryMapping(self.spaceID, None, "spaces/MmoMapTwo")

        #随机创建多个Monster
        for i in range(random.randint(5, 8)):
            MonsterProps = {
                "Name": "怪物_" + str(i),
                "HP": 500,
            }
            KBEngine.createEntity(
                "PtMonster", self.spaceID,
                Math.Vector3(random.randint(-7, 7), 0.7, random.randint(-7,
                                                                        7)),
                Math.Vector3(0, 0, random.randint(0, 360)), MonsterProps)
Beispiel #12
0
 def __init__(self):
     KBEngine.Entity.__init__(self)
     KBEngine.addSpaceGeometryMapping(self.spaceID, None,
                                      "spaces/gameMap")  #告诉客户端加载地图
     KBEngine.globalData["Room_%i" % self.spaceID] = self
     self.playerEntityList = [0, 0, 0]  #玩家列表
     self.landlordPoker = []  #地主牌
     self.electQueue = Queue(3)  #叫地主玩家队列
     self.funcDict = {}  #函数的字典映射
     self.lastPlayPokerData = {
         "poker": 0,
         "type": 0,
         "count": 0
     }  #上一个玩家打牌的数据:卡牌和类型
     self.round = 0
     self.landlord = 0  #地主
     self.nextPlayer = 0  #轮到谁出牌
     self.readyNum = 0  #已准备游戏的玩家数量
     self.lastPlayer = 0  #上一个出牌的玩家
Beispiel #13
0
    def __init__(self):
        KBEngine.Entity.__init__(self)

        # 把自己移动到一个不可能触碰陷阱的地方
        self.position = (0.0, 0.0, 0.0)

        self.avatars = {}

        self.state = GameConfigs.ENTITY_STATE_UNKNOW

        self.onStateChange(GameConfigs.ROOM_STATE_FREE)

        # 告诉客户端加载地图
        KBEngine.addSpaceGeometryMapping(self.spaceID, None, "spaces/gameMap")

        DEBUG_MSG('created space[%d] entityID = %i, res = %s.' %
                  (self.roomKeyC, self.id, "spaces/gameMap"))

        # 让baseapp和cellapp都能够方便的访问到这个房间的entityCall
        KBEngine.globalData["Room_%i" % self.spaceID] = self.base
Beispiel #14
0
    def __init__(self):
        KBEngine.Space.__init__(self)

        KBEngine.addSpaceGeometryMapping(self.spaceID, None, "spaces/MmoMapOne")
Beispiel #15
0
	def __init__(self):
		GameObject.__init__(self)
		DEBUG_MSG('created space[%d] entityID = %i.' % (self.spaceUType, self.id))
		
		KBEngine.addSpaceGeometryMapping(self.spaceID, None, "../../res/Media/Scenes/Scene1")
		KBEngine.globalData["space_%i" % self.spaceID] = self.base
Beispiel #16
0
	def __init__(self):
		GameObject.__init__(self)
		DEBUG_MSG('created space[%d] res=%s, entityID = %i.' % (self.spaceUType, d_spaces.datas[self.spaceUType].get("resPath", ""), self.id))
		
		KBEngine.addSpaceGeometryMapping(self.spaceID, None, d_spaces.datas[self.spaceUType].get("resPath", ""))
		KBEngine.globalData["space_%i" % self.spaceID] = self.base