def changeGameVersion(version, jsonPath): di = json.loads(readFile(jsonPath)) pppp = di['version'].split(".") pppp[2] = version di['version'] = '.'.join(pppp) writeToFile(jsonPath, json.dumps(di, indent=2)) print "change game_verison.json to ", version
def hand_test(): root = "/Users/tanzuoliang/Documents/plan/天天坦克/cocos_effect" # root = '/Users/tanzuoliang/Downloads/cocos_effect_1' p = "%s/src/resource.js" % root e_list = [ os.path.splitext(r.replace("%s/res/cocos_effect/" % root, ""))[0] for r in glob.glob("%s/res/cocos_effect/*.ExportJson" % root) ] g_resources = [ r.replace("%s/" % root, "") for r in glob.glob("%s/res/cocos_effect/*.*" % root) ] import json ret = "var g_resources = %s;\nvar e_list = %s" % (json.dumps(g_resources), json.dumps(e_list)) # print ret writeToFile(p, ret)
def handleplatformjson(chan, fPath, isTV): obj = json.loads(readFile(fPath)) obj['platform_name'] = chan obj['isTV'] = isTV """ 1 : facebook 2 : wx """ obj['share_type'] = 2 """ 1: 简体中文 2: 英文 """ obj['lang'] = 1 """ 是否显示JS错误 """ obj['showError'] = False """ platform_type 目前没用到 """ writeToFile(fPath, json.dumps(obj, indent=2))
def encodeDataAndSave(self,path): writeToFile(path, self.encodeData(readFile(path,"rb")))
handleMainjs() copyFile("mainjs/main.jsc", os.path.join(savePath, "main.jsc")) z.write(os.path.join(savePath, "main.jsc"), "main.jsc") curcode = "0" version_txt = "hot_out/.hot_res_config" if os.path.exists(version_txt): with open(version_txt) as f: curcode = f.read() if not os.path.exists("hot_out"): os.makedirs("hot_out") next_version = str(int(curcode) + 1) writeToFile(version_txt, next_version) import json """ { "version":"1.0.0" } """ def changeGameVersion(version, jsonPath): di = json.loads(readFile(jsonPath)) pppp = di['version'].split(".") pppp[2] = version di['version'] = '.'.join(pppp) writeToFile(jsonPath, json.dumps(di, indent=2))