本文整理汇总了Python中cocos.scene.Scene.layer_map方法的典型用法代码示例。如果您正苦于以下问题:Python Scene.layer_map方法的具体用法?Python Scene.layer_map怎么用?Python Scene.layer_map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cocos.scene.Scene
的用法示例。
在下文中一共展示了Scene.layer_map方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from cocos.scene import Scene [as 别名]
# 或者: from cocos.scene.Scene import layer_map [as 别名]
def main():
#from pyglet.gl import Config as GLConfig
from cocos.director import director
from cocos.layer import MultiplexLayer
from cocos.scene import Scene
#gl_config = GLConfig(sample_buffers=1, samples=4)
setup_resources()
#import time
#a = time.time()
config = Config()
director.init()
scene = Scene()
# TODO: Fetch.
client_ip = 'localhost'
client_port = 9998
client = Client(config.config, client_ip, client_port)
connect = ConnectScreen(scene, client.sender.connect, lambda: client.sender.client_id, next_layer=JoinGameMenu)
layers = (
TitleScreen(scene),
MainMenu(config.config, scene),
JoinGameMenu(config.config, scene, connect),
SettingsMenu(config.config, scene),
QuitScreen(scene),
KickScreen(scene),
ConnectFailedScreen(scene),
connect,
client,
)
scene.layer_map = {l.__class__: i for i, l in enumerate(layers)}
layers = MultiplexLayer(*layers)
scene.add(layers)
#b = time.time()
#print(b-a)
director.run(scene)