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(): loadList = [] for root, dirs, files in os.walk("./res/images/"): for filename in files: if filename.split(".")[1] == "png": loadList.append({ "name": filename.split(".")[0], "path": root + filename }) for root, dirs, files in os.walk("./res/"): for filename in files: if filename.split(".")[1] == "wav": loadList.append({ "name": filename.split(".")[0], "path": root + filename }) loadingLayer = LoadingSample1() addChild(loadingLayer) def next(result): loadingLayer.remove() initCoverPage(result) LoadManage.load(loadList, loadingLayer.setProgress, next)
def main(): loadList = [{ "name": "avatar", "path": "./avatar.jpg" }, { "name": "girl", "path": "./girl.jpg" }] LoadManage.load(loadList, None, 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" : "./sample.wav"}, {"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)