當前位置:首頁 » 編程軟體 » ccbi反編譯ccb

ccbi反編譯ccb

發布時間: 2022-07-29 17:37:16

❶ cocosbuilder停止維護了嗎

話說現在很少用cocosbuilder了,因為雖然布局比較簡單,但是在綁定和個性化設置等方面都不方便,所以我現在很少用,但是有時候仍有幾個前輩非要用,然後就搞得我在看他們代碼的時候就不得不跟著搞
在兩個星期的折磨中,遇到了幾個常見的問題會導致工程崩潰.所以總結一下
1.資源圖片或者字體丟失,因為修改過的ccb資源有時候只是細節上的差別,而如果剛好是那部分的資源丟失,直接會崩潰,最簡單實用的辦法就是一個一個的看,同時也要看隱藏的,如果有丟失,補上去就可以了
2.ccb資源有其他的ccb文件,而剛好是其他的那個ccb文件錯誤,這樣的話也是和資源丟失那樣崩潰,這個也是你一個一個的看了
3.設置的tag值錯誤,比如說你在ccb裡面沒有設置20這個tag值,但是後面又直接讀取這個tag,這就會錯誤,當然,如果你設置了tag,那就不需要在代碼裡面在設置了,雖然不會出錯
4.看你的ccb的特效是否正確,有時候因為ccb文件裡面的特效文件丟失,就喝第一個一樣會出現錯誤,這個要查找就是自己點擊特效運行,看是否正常
注意,在xcode中,就算改了ccb文件,xcode也不會立即生效的,所以最完整的步驟就是
1.修改ccb文件,2.把原來的ccbi文件刪除,然後把這個ccb工程clean一下,然後重新publish一下重新生成ccbi文件
3.把xcode重新clean一下,然後在運行就行了.
當然,有次我的電腦特別悲催,這樣幹了也是沒有出效果,最後不得不重啟了電腦,又按照上面的三個步驟走了一遍他才生效了,所以最終還是靠的耐心
cocosbuilder作為一個ui設計的推動者,我們會記得,但是估計也會離我們越來越遠,所以只需要簡單會用就行了,這個軟體說實話,真的不好用

❷ 怎麼讀取嵌套CCB

我遇到同樣的問題.正在找辦法解決..

我的已經解決:

其實CCBFile *ccbFileNode = (CCBFile*)node; 這一句里的node是空.往上看:

// Read properties

ccNodeLoader->parseProperties(node, pParent, this);

這個裡面 parseProperties沒有把node弄出來,因此下面是NULL.

為什麼parseProperties裡面沒把node弄出來呢?進parseProperties函數裡面看:

應該是在大switch裡面的

case CCBReader::PropertyType::CCB_FILE:

這個case裡面有

Node * ccbFileNode = this->parsePropTypeCCBFile(pNode, pParent, ccbReader);

進parsePropTypeCCBFile裡面一步步斷點看:

發現

// Load sub file

std::string path = FileUtils::getInstance()->fullPathForFilename(ccbFileName.c_str());

的path為'',即空字元串.導致接下來的node不生成.那麼進fullPathForFilename裡面看:

兩層循環裡面發現

_searchPathArray

這個東西,看看裡面的字元串數組.

把這個數組里的每一個字元產拼接上filename(你的子ccbi文件的相對路徑),看看是不是都不能得到真實資源的位置呢?是的話..那就是了.

所以要加幾個searchPaths使這里的_searchPathArray裡面能使其找到資源才行!


我使用的是Cocos2D-JS 3.6.1 對應 Cocos2D-X 3.6.

在JS端使用了

if (screenSize.width > 960 && screenSize.height > 640) {

cc.log('HDR mode');

cc.director.setContentScaleFactor(4.0);

cc.loader.resPath = 'res/HDR';

var designSize = cc.size(480, 320);

} else if (screenSize.width > 480 && screenSize.height > 320) {

cc.log('HD mode');

cc.director.setContentScaleFactor(2.0);

cc.loader.resPath = 'res/HD';

var designSize = cc.size(480, 320);

} else {

cc.log('SD mode');

cc.director.setContentScaleFactor(2.0);

cc.loader.resPath = 'res/SD';

var designSize = cc.size(480, 320);

}

來設置不同解析度所用的圖片資源.而ccbi資源在res裡面沒有配置..

怎麼配置?

上面多寫一句cc.loader.resPath = 'res'即可.

它跟其它的cc.loader.resPath = 'res/HD'等不矛盾.

寫幾遍就相當於在c++層的_searchPathArray裡面多加一條路徑.

ps:反正我是有巨坑的感覺
-Ethan.來自藌柚軟體科技

❸ cocos2dx裡面怎麼使用cocosbuilder

2012年過年年回來一直沒有可以用於寫博客的新收獲,以致於擔心2013年2月份的博客數量能否達到4篇,以保證我博客頭像下鋥亮的」恆「。新公司可以直接上網是我這三個月來博客數量倍增的主要原因。好了不多說了,回歸正題。

這里主要是一些除CocosBuilder本身Document之外的一些使用教程。CocosBuilder的基本使用這裡面是不會提及的,因為CocosBuilder本身就帶了此時市面上最全的說明文檔。不習慣看說明文檔的童鞋們請硬著頭皮看一下,順便當做英語六級補習課。本文的使用的CocosBuilder版本是CocosBuilder-2.1,基於的Cocos2d-x版本是Cocos2d-x 2.0.4。
本教程將使用CocosBuilder創建Project時自帶的HelloCocosBuilder.ccb作為素材,在Cocos2d-x 2.0.4中載入並呈現出來。

首先創建一個Cocos2dx的一個模版項目(後面稱之為A項目)
然後使用CocosBuilder在A項目資源文件夾下面創建一個Project,然後點擊【File】-》【Publish】。這樣我們就可以在A項目的資源文件夾下找到HelloCocosBuilder.ccbi。
將HelloCocosBuilder.ccbi加入到A項目的xCode項目管理中。將HelloCocosBuilder.ccbi拖入到xCode中,一般放入Resouces文件下面。特別注意,在彈出的提示框中,一定要勾選想要添加到的target(下面附帶截圖)。

這點很重要,很多windows開發人員(或許就是我)總認為資源不必加入項目文件中(即開發環境中項目文件列表),程序是能夠搜索到的,但是xCode開發ios程序時,xCode會把需要的文件拷貝到ios device目錄中,如果你不把需要的文件加入項目文件中,那麼xCode不會幫你拷貝,到時候生成的app中就沒有這個資源。
打開AppDelegate.cpp文件,修改applicationDidFinishLaunching函數。

[cpp] view plain

由於HelloCocosBuilder.ccbi中沒有涉及任何外部資源,所以無須添加外部資源到項目文件中。
Cocos2d-x中CocosBuilder文件的載入沒有Cocos2d版本的那麼好,沒有提供一個便利函數,一句話載入,以致於新手需要上網所搜如何載入。上面的載入代碼也是我從網上搜到的,然後自己稍微改的精簡一些。具體含義我也沒有深究,很是好奇的童鞋可以自己探索一下。
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());

// turn on display FPS
pDirector->setDisplayStats(true);

// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);

//read ccbi file
CCBReader* pReader = new CCBReader( CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary() );
pReader->autorelease();

pDirector->runWithScene( pReader->( "HelloCocosBuilder.ccbi" ) );

return true;
}
【Command】+R,運行程序就能看到Hello CocosBuilder在模擬器中央。
雖然這個教程很簡單,但是本人斷斷續續也搞了一天多,主要出錯在於上面的第三步,以及自己建立的CocosBuilder Project文件本身有問題。以後我會在項目中不斷挖掘CocosBuilder的用處,然後貼出系列教程。

❹ lua 判斷一個對象是不是節點

cocosbuilder 中的設置
在cocosbuilder中 找到需要綁定的CCMenuItemImage

把code connections 中 設置 為 owner var 並填寫自定義對象名
設置一個 CCMenuItemImage 叫 close

CCLabelTTF
CCScale9Sprite
等其他對象類似 選 owner var 並設置 自定義對象名

也可以通過設置tag 可以在lua中通過tag 讀取對象

在lua中載入ccbi 並載入指定ccbi中指定的對象進行操作

lua中的代碼
載入ccbi方式:
proxy= LuaProxy:create() --使用luaproxy 庫 新建一個proxy對象
local n = proxy:readCCBFromFile("xxx.ccbi") -- 載入你設置的ccbi文件
local l = tolua.cast(n, "CCLayer") -- 把ccbi 轉換對cclayer對象

載入此ccbi中各種對象的 方式:
載入各種對象中xxx 指的時 ccbi中其對象的code connections 中 設置 為 owner var 並在後填寫的相應對象名稱

上圖中 CCMenuItemImage 叫 close 則載入代碼為
--把ccbi中的菜單項轉換成lua中的菜單項對象
local menuItem= proxy:getNode"close","CCMenuItem"
--把轉換好的菜單項綁定回調事件
proxy:handleMenuEvent(menuItem,function()
print("點擊了關閉菜單")
end)

--其他常用的對象的載入方式 xxx為ccbi中自定義的對象名
--把ccbi中定義的CCLabelTTF轉換成 lua中CCLabelTTF 對象
local ttf=tolua.cast(proxy:getNode"xxx","CCLabelTTF")
--把ccbi中的精靈對象轉化成lua的精靈對象
local sprite = tolua.cast(proxy:getNode"xxx","CCSprite")
--把ccbi中的菜單對象轉換成lua中的菜單對象
local menu= tolua.cast(proxy:getNode"xxx","CCMenu")
--把ccbi中的菜單項轉換成lua中的菜單項對象
local menuItem= proxy:getNode"xxx","CCMenuItem"
--把轉換好的菜單項綁定回調事件
proxy:handleMenuEvent(menuItem,function()

end)
--把ccbi中的九宮格 轉換成 lua中的九宮格對象
local ccsprite9 = proxy:getNode"xxx","CCScale9Sprite"
--把ccbi中的按鈕轉換成lua中的按鈕對象
local ccontrol = tolua.cast(proxy:getNode"xxx","CCControlButton")
--給轉換好的按鈕綁定事件
proxy:handleButtonEvent(ccontrol, function(ccontrol, event)
-- 按鈕的 事件
end, CCControlEventTouchUpInside)

❺ 如何在 CocosBuilder里使用時間軸Callback 功能

You can use CocosBuilder for creating character animations, animating complete scenes or just about any animation you can imagine. The animation editor has full support for multiple resolutions, easing between keyframes, boned animations and multiple timelines to name a few of the features.
你可以使用CocosBuilder創建角色動畫,場景動畫或者其他一些動畫。動畫編輯器完全支持多解析度,動畫關鍵幀,骨骼動畫以及多條時間軸等功能。

The Basics
基礎
In the bottom of the main window you can find the timeline. You use the timeline to create your animations.
在下圖中你可以看到時間軸,你可以使用時間軸來創建你的動畫。

By default your ccb-file has a single timeline that is 10 seconds long. CocosBuilder edits animations at a frame rate of 30 frames per second, but when you play back the animation in your app it will use whatever you have set cocos2d to use (the default in cocos2d is 60 fps). The current time is displayed in the top right corner, and has the format minute:second:frame. The blue vertical line also shows the current time. Click the time display to change the ration of the current timeline.
默認情況下你的ccb文件僅有一條長為10秒鍾的時間軸。Cocosbuilder以每秒鍾30幀的速率編輯動畫,但當你的你的應用中播放動畫的時候,動畫將以你在cocos2d中設置的速率播放(默認是60fps)。當前的時間在右上角顯示出來,格式為分鍾:秒:幀。藍色豎線也顯示了當前的所在的時間。點擊上方的時間顯示(水平進度條)來改變當前時間軸單位時間之間的距離。

Adding Keyframes
添加關鍵幀
Animations in CocosBuilder are keyframe based. You can add keyframes to different properties of a node and CocosBuilder will automatically interpolate between the keyframes, optionally with different types of easing.
CocosBuilder中的動畫是以關鍵幀為基礎的。你可以為節點的不同屬性添加關鍵幀,CocosBuilder會自動地在關鍵幀中插入不同類型的過渡效果。
To add a keyframe, first expand the view of the node by clicking the triangle to the right of the name of the node. This will reveal all the animatable properties of the node. What can be animated varies slightly depending on what type of node you have selected. Once the properties are visible you can click the property in the timeline with the option key held down. This will create a new keyframe at the time of the click. Alternatively, you can create a new keyframe at the time of the time marker by selecting a node then choosing Insert Keyframe in the Animation menu.
首先通過點擊節點名稱左邊的小三角展開節點。這將把節點中所有可製作動畫的屬性展現出來。根據你所選擇節點類型的不同,可以製作成動畫的屬性會有少許不同。按住鍵盤上的option鍵,點擊時間軸上的屬性,這將在你當前點擊的時間點上建立一個關鍵幀。或者,選中節點後,你可以通過Animation菜單中的Insert Keyframe(插入關鍵幀)子菜單來創建一個關鍵幀。
Keyframes are automatically added at the current time if you transform a node in the canvas area, given that the transformed property already has one or more keyframes in the timeline.
如果你在畫布區域對節點進行變形的操作,那麼在當前時間點會自動創建一個關鍵幀。

Editing Keyframes
編輯關鍵幀
You edit a specific keyframe of a node by moving the time marker to the time of the keyframe and selecting the node. You can focus on a keyframe by double clicking it (which will select the node and move the time marker).
如果你要編輯一個關鍵幀,你要先選中節點,然後把時間標記移動到關鍵幀的時間點上。你可以通過雙擊一個關鍵幀把它設置為焦點(這個操作會選中節點並移動時間軸)。
You can select keyframes and move them together by dragging a selection box around them. You can also and paste keyframes between nodes. Make sure you only have one selected node when pasting the keyframes. The keyframes will be pasted starting at the time of the time marker.
你可以把關鍵幀進行框選後一起移動。你還可以在節點間拷貝粘貼關鍵幀。當你粘貼關鍵幀的時候,確保你只選中了一個節點。
If you have selected a set of keyframes it is possible to reverse the order of them by selecting Reverse Selected Keyframes in the Animation menu. Use the Stretch Selected Keyframes… option to speed up or slow down an animation by a scaling factor.
如果你選中了一組關鍵幀,那麼你可以通過Animation菜單中的Revert Selected Keyframes(反轉選定關鍵幀)子菜單來把它們的順序反轉。通過Stretch Selected Keyframes…(拉伸選定關鍵幀)子菜單來加速或者減緩你的動畫(通過輸入縮放系數)。

Importing a Sequence of Images
導入一系列圖片
If you have an animation created by sprite frames it can be tedious to move each indivial frame to the timeline. CocosBuilder simplifies this process by automatically importing a sequence of images. Select the frames that you want to import in the left hand project view, then select a CCSprite in the timeline. Now choose Create Frames from Selected Resources in the Animation menu. The frames will automatically be created at the start of the marker. If you need to slow down the animation, select the newly created keyframes and use the Stretch Selected Keyframes… command.
如果你的動畫是通過一組精靈幀實現的,你可以把每一個單獨的幀拖放到時間軸上去,但是CocosBuilder簡化了這個過程,你可以一口氣導入一系列圖片資源。在左側的項目視圖中,選擇你想要導入的一系列動畫幀的資源圖片,在時間軸上選擇CCScprite(精靈),然後在Animation菜單中選擇Create Frames from Selected Resources子菜單,這些幀會自動地在時間點的起始位置創建。如果你想放慢動畫,選擇剛剛創建好的關鍵幀並使用Stretch Selected Keyframes…子菜單來達到這個效果。

Applying Easing
使用關鍵幀過渡
CocosBuilder offers a carefully selected subset of the easings provided by cocos2d. To apply an easing right click between two keyframes and select the type of easing that you want to apply.
CocosBuilder提供了精心挑選的一組cocos2d的過渡(Easing)效果。在兩個關鍵幀中點擊右鍵然後選擇你想要的過渡效果。

Some of the easings have additional options, after the easing has been applied you can right click again and select Easing Setting… from the popup menu.
有一些過渡效果有一些額外的參數,使用過渡效果後你可以再次右鍵點擊並從彈出菜單中選擇Easing… Setting(過渡設置)。

Using Multiple Timelines
使用多條時間軸
A very powerful feature of CocosBuilder's animation editor is the ability to have multiple timelines in a single file. You can name the different sequences and play them back from your code by using their name. It's even possible to smoothly transition between the different timelines.
CocosBuilder動畫編輯器一項最為強大的功能是在一個文件中使用多條時間軸。你可以為不同的序列命名並在你的代碼中通過這個名字來調用這個動畫。更牛X的是你可以在不同的時間軸間實現無縫過渡。
To select, add or edit your timelines use the timeline popup menu:
在時間軸的彈出菜單中選擇:添加或者是編輯你的時間軸:

In the edit timelines dialog you can get an overview of your timelines, rename them, add new ones and (optionally) set one of the timelines to automatically start playback directly when the ccbi-file is loaded by your app.
在編輯時間軸的對話框中,你會看到你的時間軸的概要信息,你可以重命名,添加一個新的時間軸或者指定其中一個時間軸作為當ccbi文件載入時自動播放的時間軸。

Properties in timelines that do not have keyframes set share their values across timelines. E.g. if you move one node in one timeline it will be moved in all timelines as long as they do not have a keyframe set for the position property. It can sometimes be useful to add a single keyframe to a property just to override the shared value for a specific timeline.
如果一個時間軸的屬性上沒有設定關鍵幀,那麼它就會被其他時間軸的關鍵幀所影響,比如:如果你在一個時間軸里移動了一個節點,它也會在所有沒有定義位置關鍵幀的時間軸裡面移動。你可以通過給一個時間軸設定一個單幀來避免被其他時間軸的關鍵幀所覆蓋。

Chaining Timelines
鏈接時間軸
You can automatically play back a sequence of timelines by chaining them. You can also use this feature for automatically looping a timeline.
你可以把多條時間軸鏈接起來並播放。你也可以利用這個功能來自動地循環播放一條時間軸。

To have a timeline play in sequence, click the No chained timeline text and select the timeline you want to play right after the current one.
如果要使用鏈接時間軸的功能,點擊No chained timeline(無鏈接時間軸)文字並選擇當前時間軸結束後你想繼續播放的時間軸。

Playing Back Animations in Code
在代碼中播放動畫
To programmatically control the animations you create with CocosBuilder you will need to retrieve the CCBAnimationManager. The animation manager will be assigned to the nodes userObject when the ccbi-file is loaded.
為了讓CocosBuilder創建的動畫在你的代碼中播放,你需要使用CCBAnimationManager。在ccbi文件載入時,動畫管理器會被指定給userObject節點。
CCNode* myNodeGraph = [CCBReader nodeGraphFromFile:@"myFile.ccbi"];
CCBAnimationManager* animationManager = myNodeGraph.userObject;

The animation manager will be returned as an autoreleased object. To play back a specific timeline call the runAnimationsForSequenceNamed: method. If a timeline is currently playing it will be immediately stopped when calling this method.
動畫管理器會返回一個自釋放的對象。調用runAnimationsForSequenceNamed:方法來播放一個指定的時間軸。如果一個時間軸已經在播放了,它會被立即停止。
[animationManager runAnimationsForSequenceNamed:@"My Timeline"];

Optionally, you can use a tween ration to smoothly transition to the new timeline. Where possible linear interpolations will be used for the transition.
或者你也可以使用tweenDuration參數平滑地過渡到一個新的時間軸。
[animationManager runAnimationsForSequenceNamed:@"My Timeline" tweenDuration:0.5f];

It is also possible to receive a callback whenever a timeline has finished playing. You will receive these callbacks even if another timeline is chained in sequence. Use the CCBAnimationManagerDelegate to receive the callbacks.
還可以為時間軸播放完畢時設定一個回調函數。就算有另外一個時間軸被鏈接起來,你還是可以使用這些回調函數。使用CCBAnimationManagerDelegate來接收回調函數。

❻ cocosbuilder中ccbi文件過時怎麼解決

通過升高CocosBuilder的版本來解決的,那麼其實找到低一點版本的CCBReader理論上來說也是可以解決的!

❼ ccbi文件可以打開嗎

cb文件可以打開,但是ccbi文件打開了意義也不是太大了,都亂了。
如果要看ccbi文件,最好是拿到它對應的ccb文件看,或者有個方法我也沒試過,你可以試試看,就是等ccbi文件載入到程序後斷點看它的內容,找到動畫對應的內容看。

熱點內容
誇克編程 發布:2025-02-07 21:43:43 瀏覽:526
電源450適合哪些配置 發布:2025-02-07 21:25:24 瀏覽:429
微信密碼一般要多少位以上 發布:2025-02-07 21:24:19 瀏覽:877
sqldecimal轉換 發布:2025-02-07 21:17:50 瀏覽:656
鋼管查詢源碼 發布:2025-02-07 21:15:25 瀏覽:425
濱州伺服器租賃地址 發布:2025-02-07 21:13:41 瀏覽:438
thinkphp刪除資料庫數據 發布:2025-02-07 21:12:03 瀏覽:945
安卓智能手機哪個更便宜 發布:2025-02-07 21:10:24 瀏覽:144
織夢資料庫連接 發布:2025-02-07 21:09:32 瀏覽:353
緩解情緒解壓的句子 發布:2025-02-07 21:04:23 瀏覽:535