def main(): # save the file paths which need to be loaded loadList = [ {"name" : "player", "path" : "./images/player.png"}, {"name" : "bg", "path" : "./images/bg.jpg"}, {"name" : "item0", "path" : "./images/item0.png"}, {"name" : "item1", "path" : "./images/item1.png"}, {"name" : "item2", "path" : "./images/item2.png"}, {"name" : "item3", "path" : "./images/item3.png"}, {"name" : "item4", "path" : "./images/item4.png"}, {"name" : "item5", "path" : "./images/item5.png"}, {"name" : "item6", "path" : "./images/item6.png"}, {"name" : "item7", "path" : "./images/item7.png"} ] # create loading page loadingPage = LoadingSample1() addChild(loadingPage) def loadComplete(result): loadingPage.remove() gameInit(result) # load files LoadManage.load(loadList, loadingPage.setProgress, loadComplete)
def main(): # save the file paths which need to be loaded loadList = [ {"name" : "map", "path" : "./images/map.jpg"}, {"name" : "guanyu_mov", "path" : "./images/guanyu_mov.png"}, {"name" : "guanyu_atk", "path" : "./images/guanyu_atk.png"}, {"name" : "soldier1_atk", "path" : "./images/soldier1_atk.png"}, {"name" : "soldier1_mov", "path" : "./images/soldier1_mov.png"}, {"name" : "soldier2_mov", "path" : "./images/soldier2_mov.png"}, {"name" : "xiahoudun_atk", "path" : "./images/xiahoudun_atk.png"}, {"name" : "xiahoudun_mov", "path" : "./images/xiahoudun_mov.png"}, ] # create loading page loadingPage = LoadingSample2() addChild(loadingPage) def loadComplete(result): global dataList loadingPage.remove() dataList = result gameInit() # load files LoadManage.load(loadList, loadingPage.setProgress, loadComplete)
def main(): global loadingPage # save the file path which needs to be loaded loadList = [{"name": "bg", "path": "./images/bg.jpg"}] # create loading page loadingPage = LoadingSample2() addChild(loadingPage) # load file LoadManage.load(loadList, loadingPage.setProgress, gameInit)
def main(): # save the file paths which need to be loaded loadList = [ { "name": "map", "path": "./images/map.jpg" }, { "name": "guanyu_mov", "path": "./images/guanyu_mov.png" }, { "name": "guanyu_atk", "path": "./images/guanyu_atk.png" }, { "name": "soldier1_atk", "path": "./images/soldier1_atk.png" }, { "name": "soldier1_mov", "path": "./images/soldier1_mov.png" }, { "name": "soldier2_mov", "path": "./images/soldier2_mov.png" }, { "name": "xiahoudun_atk", "path": "./images/xiahoudun_atk.png" }, { "name": "xiahoudun_mov", "path": "./images/xiahoudun_mov.png" }, ] # create loading page loadingPage = LoadingSample2() addChild(loadingPage) def loadComplete(result): global dataList loadingPage.remove() dataList = result gameInit() # load files LoadManage.load(loadList, loadingPage.setProgress, loadComplete)
def main(): global loadingBar loadList = [ {"name" : "1", "path" : "./1.png"}, {"name" : "2", "path" : "./2.png"}, {"name" : "3", "path" : "./3.png"} ] loadingBar = LoadingSample2() addChild(loadingBar) LoadManage.load(loadList, loadingBar.setProgress, demoInit)
def main(): global loadingPage # save the file path which needs to be loaded loadList = [ {"name" : "bg", "path" : "./images/bg.jpg"} ] # create loading page loadingPage = LoadingSample2() addChild(loadingPage) # load file LoadManage.load(loadList, loadingPage.setProgress, gameInit)
def main(): global loadingBar loadList = [{ "name": "atk", "path": "./atk.png" }, { "name": "mov", "path": "./mov.png" }] loadingBar = LoadingSample2() addChild(loadingBar) LoadManage.load(loadList, loadingBar.setProgress, demoInit)
def main(): global loadingBar loadList = [ {"name" : "bgm", "path" : "./bgm.mp3"}, {"name" : "1", "path" : "./1.jpg"}, {"name" : "2", "path" : "./2.jpg"}, {"name" : "3", "path" : "./3.jpg"}, {"name" : "4", "path" : "./4.jpg"} ] loadingBar = LoadingSample3() addChild(loadingBar) LoadManage.load(loadList, loadingBar.setProgress, demoInit)
def main(): global loadingBar loadList = [{ "name": "1", "path": "./1.png" }, { "name": "2", "path": "./2.png" }, { "name": "3", "path": "./3.png" }] loadingBar = LoadingSample2() addChild(loadingBar) LoadManage.load(loadList, loadingBar.setProgress, demoInit)
def main(): # 资源列表,列出了所有需要调用的图片资源及路径 loadList = [ { "name": "player0", "path": "./images/player0.png" }, #游戏角色图片0 { "name": "player1", "path": "./images/player1.png" }, #游戏角色图片1 { "name": "player2", "path": "./images/player2.png" }, #游戏角色图片2 { "name": "player3", "path": "./images/player3.png" }, #游戏角色图片3 { "name": "player00", "path": "./images/player00.png" }, #游戏角色图片00 { "name": "player01", "path": "./images/player01.png" }, #游戏角色图片01 { "name": "player02", "path": "./images/player02.png" }, #游戏角色图片02 { "name": "player03", "path": "./images/player03.png" }, #游戏角色图片03 { "name": "bg", "path": "./images/bg.jpg" }, #游戏背景图片 { "name": "bg1", "path": "./images/bg1.png" }, #规则说明背景图片 { "name": "bg2", "path": "./images/bg2.png" }, #设置界面 { "name": "bg3", "path": "./images/bg3.png" }, #确认设置界面 { "name": "item0", "path": "./images/item0.png" }, #加分物体1 { "name": "item1", "path": "./images/item1.png" }, #加分物体2 { "name": "item2", "path": "./images/item2.png" }, #加分物体3 { "name": "item3", "path": "./images/item3.png" }, #加分物体4 { "name": "item4", "path": "./images/item4.png" }, #减分物体1 { "name": "item5", "path": "./images/item5.png" }, #减分物体2 { "name": "item6", "path": "./images/item6.png" }, #减分物体3 { "name": "item7", "path": "./images/item7.png" }, #减分物体4 { "name": "button0", "path": "./images/button0.png" }, #开始按钮 { "name": "button1", "path": "./images/button1.png" }, #规则介绍按钮 { "name": "button2", "path": "./images/button2.png" }, #返回按钮 { "name": "level0", "path": "./images/level0.png" }, #简单模式 { "name": "level1", "path": "./images/level1.png" }, #中等模式 { "name": "level2", "path": "./images/level2.png" }, #复杂模式 { "name": "choice", "path": "./images/choice.png" }, #选择框 { "name": "result0", "path": "./images/result0.png" }, #失败装饰品 { "name": "result1", "path": "./images/result1.png" } #胜利装饰品 ] # 加载页 loadingPage = LoadingSample1() #LoadingSample1类在ui.py文件中,是LoadingSample的子类,()中写的是继承的父类,在这里只是标准的类对象生成格式 addChild(loadingPage) #addChild是一个用于把显示对象加到自身这个层上的函数,详见utils.py文件中的全局函数addChild def loadComplete(result): loadingPage.remove() #把loading页面删除 #LoadingSample1类中的父类display.py文件中的DisplayObject类的remove函数,进而使用到了同文件中DisplayObjectContainer类中的removeChild类 gameInit(result) #游戏界面初始化 #本文件中的一个全局函数,用于初始化游戏 # 加载文件的命令,实现 LoadManage.load(loadList, loadingPage.setProgress, loadComplete)