---++!! !AppDesktop %TOC{title="Contents:"}% %STARTINCLUDE% ---++ public desktop functions | *Title* | public desktop functions | | *Author(s)* | LiXizhi | | *Date* | 2008/6/12 | | *File* | script/kids/3DMapSystemUI/Desktop/AppDesktop.lua | ---+++ Description The following public desktop functions can be called by any application to change the desktop settings. ---++ Desktop Mode Desktop mode controls whether the scene objects are interactive or editable by the user. Please note that desktop mode only filters current user input, the actual action taken is still subject to user access right (user roles). This means that even desktop mode is not editable, application can still programatically edit objects as long as user access right does not prohibit it. Hence desktop mode is just a handy status mode that application developers can use to toggle the filtering of user inputs at the app system level. desktop mode is set to "game" before desktop switching, so an application usually need to change its desktop mode in its APP_ACTIVATE_DESKTOP event handler. The most important modes are "edit" mode and "game" mode. "edit" mode can both edit and interact with the scene, where "game" mode can interact with but not edit the scene. *Example*: <verbatim> Map3DSystem.UI.AppDesktop.ChangeMode("game") Map3DSystem.UI.AppDesktop.ChangeMode("edit") </verbatim> ---++ Desktop User Whether user is logged in. *Example*: <verbatim> if(Map3DSystem.UI.AppDesktop.CheckUser()) then -- Do your function. end </verbatim> ---++ Desktop Functions More information, on following things, see code doc. <verbatim> local app_key = Map3DSystem.UI.AppDesktop.GetCurDesktopAppKey() </verbatim> %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/Desktop/AppDesktop.lua"); Map3DSystem.UI.AppDesktop.OnInit() Map3DSystem.UI.AppDesktop.LoadDesktop() </verbatim> ---+++ Member Functions ---++++ !AppDesktop.ChangeMode <verbatim> current destop mode. Map3DSystem.UI.DesktopMode = { -- whether scene objects are editable, such as create and delete by the user, IsEditable = false, -- whether scene objects are interactive, such as sitting on a chair, drive a char, etc. -- the right mouse popup menu will be disabled if this is false. IsInteractive = true, -- univeral selection is enabled. CanSelect = true, -- can select a character? CanSelectCharacter = true, -- can select a model? CanSelectModel = true, -- can click on character? CanClickCharacter = true, -- can display right click context menu? CanContextMenu = true, -- can mount on the closest character usually by pressing the left shift key CanMountClosest = true, -- can click on the closest character usually by pressing the left control key CanClickClosest = true, -- can show nearby x-reference marker CanShowNearByXrefMarker = true, -- can show closet character marker CanShowClosestCharMarker = true, }; predefined mode AppDesktop.PredefinedMode = { ["game"]={ IsEditable = false, IsInteractive = true, CanSelect = true, CanSelectCharacter = true, CanSelectModel = false, CanClickCharacter = true, CanContextMenu = false, CanMountClosest = true, CanClickClosest = true, CanShowNearByXrefMarker = false, CanShowClosestCharMarker = true, CanClickXrefMarker = false, CanClickModelActionScript = true, }, ["chat"]={ IsEditable = false, IsInteractive = true, CanSelect = false, CanSelectCharacter = false, CanSelectModel = false, CanClickCharacter = true, CanContextMenu = false, CanMountClosest = true, CanClickClosest = true, CanShowNearByXrefMarker = false, CanShowClosestCharMarker = true, CanClickXrefMarker = false, CanClickModelActionScript = false, }, ["edit"]={ IsEditable = true, IsInteractive = true, CanSelect = true, CanSelectCharacter = true, CanSelectModel = true, CanClickCharacter = true, CanContextMenu = true, CanMountClosest = true, CanClickClosest = true, CanShowNearByXrefMarker = true, CanShowClosestCharMarker = true, CanClickXrefMarker = true, CanClickModelActionScript = true, }, ["dummy"]={ IsEditable = false, IsInteractive = false, CanSelect = false, CanSelectCharacter = false, CanSelectModel = false, CanClickCharacter = false, CanContextMenu = false, CanMountClosest = false, CanClickClosest = false, CanShowNearByXrefMarker = false, CanShowClosestCharMarker = false, CanClickXrefMarker = false, CanClickModelActionScript = false, }</verbatim>, }; Change the desktop mode. desktop mode controls whether the scene objects are interactive or editable. it will also deselect any selected object when mode is changed * _param_ ____ : The most important modes are "edit" mode, "game" mode and "dummy" mode. If mode is nil, it default to "game" mode. more info, please see AppDesktop.PredefinedMode __syntax__ <verbatim>function AppDesktop.ChangeMode(mode)</verbatim> __parameters__ | *mode* | | ---++++ !AppDesktop.OnInit one time init, call this only once when game engine start. It will init both menu and app task bar. __syntax__ <verbatim>function AppDesktop.OnInit()</verbatim> ---++++ !AppDesktop.LoadDesktop show menu and app task bar. It will call application UI setup internally. * _param_ __bExclusiveMode__ : if true, it menu and taskbar will not be created * _note_ ____ : call this function on LoadWorld function __syntax__ <verbatim>function AppDesktop.LoadDesktop(bExclusiveMode)</verbatim> __parameters__ | *bExclusiveMode* | if true, it menu and taskbar will not be created | ---++++ !AppDesktop.CheckUser ---------------------------------------- public functions * _param_ __cmdredirect__ : this is usually nil. otherwise it will be the name of the command to be called when user finished log in via UI. * _return_ ____ : return true, if user is logged in. otherwise it prompts the user to log in. __syntax__ <verbatim>function AppDesktop.CheckUser(cmdredirect)</verbatim> __parameters__ | *cmdredirect* | this is usually nil. otherwise it will be the name of the command to be called when user finished log in via UI. | ---++++ !AppDesktop.GetCurDesktopAppKey * _return_ ____ : return the current app whose desktop is active. __syntax__ <verbatim>function AppDesktop.GetCurDesktopAppKey()</verbatim> __parameters__ | *return* | return the current app whose desktop is active. | ---++++ !AppDesktop.SetDefaultApp set the default app * _param_ __app__ :_key: app key. * _param_ __bSwitch__ : if true, we will activate it immediately. __syntax__ <verbatim>function AppDesktop.SetDefaultApp(app_key, bSwitch)</verbatim> __parameters__ | *app* | _key: app key. | | *key* | | | *bSwitch* | | %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