---++!! !AppMainMenu %TOC{title="Contents:"}% %STARTINCLUDE% ---++ Mainmenu in InGame UI for 3D Map system | *Title* | Mainmenu in InGame UI for 3D Map system | | *Author(s)* | Andy, Xizhi | | *Date* | 2007/12/29 | | *File* | script/kids/3DMapSystemUI/Desktop/MainMenu.lua | ---+++ Description Show the main menu in game UI %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/Desktop/MainMenu.lua"); Map3DSystem.UI.MainMenu.InitMainMenu(); Map3DSystem.UI.MainMenu.SendMessage({type = Map3DSystem.UI.MainMenu.MSGTYPE.MENU_SHOW}); </verbatim> ---+++ Member Functions ---++++ !Map3DSystem.UI.MainMenu.AddMenuCommand <verbatim> messge types Map3DSystem.UI.MainMenu.MSGTYPE = { MENU_SHOW = 1000, }</verbatim> add a menu command at given position. the parent folders must be created beforehand, otherwise it will be inserted to the first unfound folder. if there is already an object at the position, the add command will do nothing. * _param_ __command__ :; type of Map3DSystem.App.Command * _param_ __position__ : this is a tree path string of folder names separated by dot e.g. "Tools.Artist", "File.Save", "File.Open". * _param_ __posIndex__ : if position is a item in another folder, this is the index at which to add the item. if nil, it is added to end, if 1 it is the beginning. __syntax__ <verbatim>function Map3DSystem.UI.MainMenu.AddMenuCommand(command, position, posIndex)</verbatim> __parameters__ | *command* | ; type of Map3DSystem.App.Command | | *position* | | | *posIndex* | if position is a item in another folder, this is the index at which to add the item. if nil, it is added to end, if 1 it is the beginning. | ---++++ !Map3DSystem.UI.MainMenu.GetAppCommands return an iterator for all menu commands whose appKey is same as input * _param_ __appKey__ : appKey we search for. __syntax__ <verbatim>function Map3DSystem.UI.MainMenu.GetAppCommands(appKey)</verbatim> __parameters__ | *appKey* | appKey we search for. | ---++++ !Map3DSystem.UI.MainMenu.GetItemIndex return a menu item index by its position. This function is mosted called before AddMenuCommand to determine where to insert a new command. * _param_ __position__ : this is a tree path string of folder names separated by dot e.g. "Tools.Artist", "File.Save", "File.Open". * _return_ __nil__ : if not found, other the item index integer is returned. please note that the index may change when new items are added later on. __syntax__ <verbatim>function Map3DSystem.UI.MainMenu.GetItemIndex(position)</verbatim> __parameters__ | *position* | this is a tree path string of folder names separated by dot e.g. "Tools.Artist", "File.Save", "File.Open". | ---++++ !Map3DSystem.UI.MainMenu.OnClickCommand call the application command __syntax__ <verbatim>function Map3DSystem.UI.MainMenu.OnClickCommand(treeNode)</verbatim> __parameters__ | *treeNode* | | ---++++ !Map3DSystem.UI.MainMenu.InitMainMenu call this only once during the game. init main bar: this does not show the menu, it just build the data structure and messaging system. __syntax__ <verbatim>function Map3DSystem.UI.MainMenu.InitMainMenu()</verbatim> ---++++ !Map3DSystem.UI.MainMenu.SendMessage send a message to MainMenu:main window handler Map3DSystem.UI.MainMenu.SendMessage({type = Map3DSystem.UI.MainMenu.MSGTYPE.MENU_SHOW}); __syntax__ <verbatim>function Map3DSystem.UI.MainMenu.SendMessage(msg)</verbatim> __parameters__ | *msg* | | ---++++ !Map3DSystem.UI.MainMenu.MSGProc main bar: MainMenu window handler __syntax__ <verbatim>function Map3DSystem.UI.MainMenu.MSGProc(window, msg)</verbatim> __parameters__ | *window* | | | *msg* | | ---++++ !Map3DSystem.UI.MainMenu.Show private: for autohide animation. local function OnMenuAutoHideToggle(bShow, uiobj) if(bShow and uiobj and uiobj:IsValid()) then if(not Map3DSystem.UI.MainMenu.FadeInMotion_) then -- create animation if not create before. NPL.load("(gl)script/ide/Motion/AnimatorEngine.lua"); Map3DSystem.UI.MainMenu.FadeInMotion_ = CommonCtrl.Motion.AnimatorEngine:new({framerate=24}); local groupManager = CommonCtrl.Motion.AnimatorManager:new(); local layerManager = CommonCtrl.Motion.LayerManager:new(); local PopupAnimator = CommonCtrl.Motion.Animator:new(); PopupAnimator:Init("script/kids/3DMapSystemUI/styles/MenuFadeInMotionData.xml", uiobj.id); layerManager:AddChild(PopupAnimator); groupManager:AddChild(layerManager); groupManager:AddChild(layerBGManager); Map3DSystem.UI.MainMenu.FadeInMotion_:SetAnimatorManager(groupManager); end -- play animation Map3DSystem.UI.MainMenu.FadeInMotion_:doPlay(); end end show or hide main bar UI __syntax__ <verbatim>function Map3DSystem.UI.MainMenu.Show(bShow)</verbatim> __parameters__ | *bShow* | | ---++++ !Map3DSystem.UI.MainMenu.UpdateUI update UI according to data __syntax__ <verbatim>function Map3DSystem.UI.MainMenu.UpdateUI()</verbatim> %STOPINCLUDE%
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r1 - 2008-02-29
-
LiXizhi
Home
Site map
CCWeb web
HaqiTeen web
Main web
ParaEngine web
TWiki web
Main Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
导航页WebTopMenu
Preferences
开发指南
Getting Started
ParacraftSDK
NPL
MCML
NPL Reference Manual
美术Mod
Account
Log In
English
简体中文
簡體中文
E
dit
A
ttach
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback