AppDesktop

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:

   Map3DSystem.UI.AppDesktop.ChangeMode("game")
   Map3DSystem.UI.AppDesktop.ChangeMode("edit")

Desktop User

Whether user is logged in.

Example:

   if(Map3DSystem.UI.AppDesktop.CheckUser()) then
      -- Do your function. 
   end

Desktop Functions

More information, on following things, see code doc.
   local app_key = Map3DSystem.UI.AppDesktop.GetCurDesktopAppKey()

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Desktop/AppDesktop.lua");
Map3DSystem.UI.AppDesktop.OnInit()
Map3DSystem.UI.AppDesktop.LoadDesktop()

Member Functions

AppDesktop.ChangeMode

 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,
}
, };

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 PredefinedMode

syntax

function AppDesktop.ChangeMode(mode)

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

function AppDesktop.OnInit()

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

function AppDesktop.LoadDesktop(bExclusiveMode)

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

function AppDesktop.CheckUser(cmdredirect)

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

function AppDesktop.GetCurDesktopAppKey()

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

function AppDesktop.SetDefaultApp(app_key, bSwitch)

parameters

app _key: app key.
key  
bSwitch  
Topic revision: r1 - 2008-02-29 - LiXizhi
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback