2013年11月28日 星期四

Use LUA + LUABind + MyGUI achieve WOW LUA bind UI functionality

WOW origin using the GUI binding LUA, players realize homemade one touch change equipment and small bags into one big bag of features that make me feel very stunning, can be made ​​if the player UI features, and that planning will be able to own get.

Later developed MMO, GUI always changed again, even to the last completed Milestone and went on to be published after the change ... had reason than analysis:

Use Name Mapping way to determine the corresponding source code related functions to design a new UI must have in order to verify the functionality by modifying the source code.

Due to the need to verify the source code through the function, so the person making the necessary information through the UI to implement the program staff to confirm the function, cause to a lot of waitting time.

WOW provides a solution that is a GUI program logic data from the Script to complete, I implement this concept is use Ogre3D + LUA + LUABind + MyGUI. MyGUI provides a user data, you can use this information to reach a binding script processing, the following is the work I intended to reach：

Listen to MyGUI of LayoutManager in the eventAddUserString event, the relevant binding events all referring to the same function (for example eventMouseButtonClick, the general practice is to be judged by Name is an element that has been pressed, and then decide to be tied to the relative corresponding processing function, because it is using Script, naturally, did not recognize the name of the necessary).

When happened eventMouseButtonClick, do it corresponds Script.

In this part of the relevant offer code processing, mainly deal when Reset rotate button is clicked, it will reset the camera for the role of treatment, and LUABind part here LUA does not provide, people want to know the details, please refer to this link.LUA+LUABind+Decoda：
------------------------------------------------------------------------------------------------------------