I have been trying to parse MT's uii files these days and perform XML analysis through rapidxml. Here is also an episode, because we need to recursively find a child element through the attribute name, the result of this recursive function has never been completed before the error is found.CodeTo commemorate:
Void Global: findnodebyattribute (const char * strnodeattr, xml_node <> * pnode, xml_node <> * & rresult) {If (pnode) {xml_node <> * pergnode = NULL; char * pnameattr = NULL; xml_attribute <char> * pattr = NULL; For (pergnode = pnode; pergnode = pergnode-> next_sibling ()) {pattr = pergnode-> first_attribute ("name"); If (pattr) {pnameattr = pattr-> value (); If (strcmp (pnameattr, strnodeattr) = 0) rresult = pergnode; elsefindnodebyattribute (strnodeattr, pergnode-> first_node (), rresult );}}}}
Later with a compilation tool, found that MT itself even cocos2d-x ccnode class have re-written a cluaui_node, so gave up the idea. Taking into account the need to redo new things, we certainly will not use the original file and parsing method, the reason is very simple: we cannot get the MT editor.
In the afternoon, the Group members discussed how to proceed to the next step. The result was that the UI editor of cocosbuilder was used to re-import the original Mt resources to cocosbuilder and then generate the desired target file.
This is good, because I want to reverse parse the UI goal of MT a little far away.