

lua
local CCS_RES_PATH = "res/ccs/";
local PLIST_PATH = CCS_RES_PATH .. "MainScene/TextAtlas_gua.plist";
local CSB_PATH = CCS_RES_PATH .. "MainScene/MainScene.csb";
-- 注意路径要从 res/ 之后开始写
local spriteFrameCache = cc.SpriteFrameCache:getInstance()
spriteFrameCache:addSpriteFrames(PLIST_PATH)
-- 1. 创建节点
local rootNode = cc.CSLoader:createNode(CSB_PATH)
GUI:Attach_LeftBottom_T():addChild(rootNode) -- 添加到主界面最顶层左下挂接点
-- 2. 创建并运行动画
local action = cc.CSLoader:createTimeline(CSB_PATH)
rootNode:runAction(action)
action:gotoFrameAndPlay(0, true)
lua
local function patchCSB(filePath)
-- 以读写二进制模式打开
local file = io.open(filePath, "r+b")
-- 定位到 52 字节
file:seek("set", 52)
-- 写入
file:write("2#1#0#0")
file:close()
end