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.
- 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:
------------------------------------------------------------------------------------------------------------
//Register eventAddUserString
MyGUI::LayoutManager& REFLayoutManager = MyGUI::LayoutManager::getInstance();
REFLayoutManager.eventAddUserString += MyGUI::newDelegate(m_pImpl,
&CGameGUIManagerImpl::OnAddUserString);
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
//eventAddUserString Implement
------------------------------------------------------------------------------------------------------------
void OnAddUserString(MyGUI::Widget* pSender, const std::string& strKey, const std::string& strKeyValue)
{
const std::string& strTypeName = pSender->getTypeName();
if((strTypeName == "TextBox") ||
(strTypeName == "ProgressBar"))
{
CMappingInformation Data;
Data.m_pTargetWidget = pSender;
m_mapUserNameMapping[strKey].push_back(Data);
}
//Register the same click function
if(strKey == "Script")
pSender->eventMouseButtonClick += MyGUI::newDelegate(this, &CGameGUIManagerImpl::OnScriptMouseButtionClick);
}
//eventMouseButtonClick Implement, run self's lua script
void OnScriptMouseButtionClick(MyGUI::Widget* pSender)
{
m_LUAContex.ResetFromString(pSender->getUserString("Script"), false);
}
------------------------------------------------------------------------------------------------------------
//MyGUI Layout Data, the red characters is script data.
local Camera = SceneManager:GetCamera()
Camera:ResetSnapTarget(CCamera.CAMERA_SNAP_TYPE_BACK)
Camera:ReplacePitchAngle(-45.0, true)
Camera:ReplacePitchAngle(-45.0, true)
------------------------------------------------------------------------------------------------------------
The reference video:
The reference video:
Dream continues in...
沒有留言:
張貼留言