def run(self): if getDirsize(self.resPath) < getDirsize(self.newPath): print "has pack res" repalceDirName(self.resPath,self.newPath) return for item in self.walkFiles(self.resPath): newItem = item.replace(self.resPath, self.newPath,1) if os.path.exists(newItem) and os.path.getmtime(item) <= os.path.getmtime(newItem): continue newDir = os.path.dirname(newItem) extName = os.path.splitext(newItem)[1] if extName in [".DS_Store"]: continue if not os.path.exists(newDir): os.makedirs(newDir) self.copyfile(item,newItem,extName in self.blankList) if extName in self.zipList: os.system(self.pngquant + " --speed=1 --ext .png --skip-if-larger --force 256 " + newItem) print "压缩: ", newItem if extName in self.hashList: self.encodeDataAndSave(newItem) print "加密: ", newItem self.remove_unuse() repalceDirName(self.resPath,self.newPath)
def syncRes(): res = os.path.join(project_path, "res") res_new = os.path.join(project_path, "res-new") if os.path.exists(res_new): if getDirsize(res) < getDirsize(res_new): repalceDirName(res, res_new) print "change dir %s form %s" % (res, res_new) syncAI() syncEffect() syncMovieClip() syncSound() syncSoundEn() syncBackground() syncElement() syncPropSkillIcon() syncSkillIcon() syncTankIcon() syncTankHeadIcon() syncEditor() syncCocosEffect() syncPveMap() os.system('svn up %s' % res) checkSVNStatus(project_path, ["res"]) os.system('svn ci %s -m "同步资源"' % res)
def handr_for_ios(): cmd = input("1:readyForIOS 2:backToNormal\n") if cmd == 1: __decodeJS__() repalceDirName("../res","../res-new") os.system("cp ../main.js ../mainjs/main.js") os.system('cocos jscompile -s ../mainjs -d ../mainjs') elif cmd == 2: backToJS() repalceDirName("../res","../res-new")
def syncRes(): res = os.path.join(project_path, "res") res_new = os.path.join(project_path, "res-new") if os.path.exists(res_new): if getDirsize(res) < getDirsize(res_new): repalceDirName(res, res_new) print "change dir %s form %s" % (res, res_new) syncAI() syncEffect() syncMovieClip() syncSound() syncBackground() syncElement() syncPropSkillIcon() syncSkillIcon() syncTankIcon() syncTankHeadIcon() syncEditor() syncCocosEffect() syncPveMap()
def __decodeJS__(DIR="../src"): if not os.path.exists(os.path.join(DIR, "app.jsc")): command = 'cocos jscompile -s' + DIR + ' -d ' + DIR + '_new' os.system(command) repalceDirName(DIR,DIR + '_new')
def backToJS(DIR="../src"): if os.path.exists(os.path.join(DIR, "app.jsc")): repalceDirName(DIR,DIR + '_new') os.system("rm -rf %s"%(DIR + "_new"))
def resBackToNormal(self): if os.path.exists(self.newPath) and getDirsize(self.resPath) < getDirsize(self.newPath): repalceDirName(self.resPath,self.newPath) print "back successfully"
def compilejs(f, t): os.system("cocos jscompile -s %s -d %s" % (f, t)) repalceDirName(f, t)