---++!! !AppManager %TOC{title="Contents:"}% %STARTINCLUDE% ---++ Managing the loading, unloading and message dispatching for all applications. | *Title* | Managing the loading, unloading and message dispatching for all applications. | | *Author(s)* | LiXizhi | | *Date* | 2008/1/1 | | *File* | script/kids/3DMapSystemApp/AppManager.lua | ---+++ Description ParaEngine's APP IDE features a number of targeted, programmable object models. By using these models, you can access the underlying components and events. Each model contains types and members that represent worlds, mainbar, menus, events, user profiles, 3D objects, and more. Consequently, you can extend the functionality of the IDE, and integrate other applications into the IDE to increase the fun and social interactions among users. Feature Highlights: - App Registration: Map3DSystem.App.Registration manages application registration and unregistration. One can use XML files (IP.xml) to define the registration settings for add-ins. See also [SampleIP.XML] - Application Template Wizard: Create a new application by using the solution manager in the .Net IDE or by duplicating and editing the [BaseApp.lua] file. - Map3DSystem.UI.MainBar and Map3DSystem.UI.MainMenu: Host your custom commands as buttons in the MainBar and MainMenu. - Map3DSystem.UI.Windows.RegisterWindowFrame: makes it easier to create your own custom windows that host your application UI in various window styles like modal dialog, resizable window, toolbar, etc. - TODO: now enables you to specify the style of a button, such as text only, icon only, or text and icon. You can also create additional types of controls to place in the toolbars and menus, such as listbox controls, editbox controls, and drop-down menu controls. - Localization: On the one time init of connection event, app can retrieve the current IDE's language settings by calling ParaEngine.GetLocale(). The app can then use different resource files for different language. - Application add-in Security: One can change global application addin security settings: Allow add-in components to load. Checked by default. When checked, add-ins are allowed to load from local disk or from a ParaEngine trusted website. Allow add-in components to load from a URL. Unchecked by default. When checked, add-ins are allowed to be loaded from external Web sites. Even checked, the installation of the external app still needs user confirmation. - programmable components models: the NPL source code and doc as well as all open source offical applications provide overview and examples of programmable components models that a third party application can use. - please note Application code is executed in a sandbox where some IO and log functions may be limited to certain folders. %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemApp/AppManager.lua"); </verbatim> ---+++ Member Functions ---++++ !Map3DSystem.App.AppManager.Startup requires NPL.load("(gl)script/ide/os.lua"); NPL.load("(gl)script/kids/3DMapSystemApp/AppHelper.lua"); NPL.load("(gl)script/kids/3DMapSystemApp/AppRegistration.lua"); NPL.load("(gl)script/kids/3DMapSystemApp/BaseApp.lua"); NPL.load("(gl)script/kids/3DMapSystemApp/app.lua"); NPL.load("(gl)script/kids/3DMapSystemApp/API/ParaworldAPI.lua"); -------------------------------------- app security setting -------------------------------------- if(not Map3DSystem.App.Security) then Map3DSystem.App.Security={}; end Map3DSystem.App.Security.AllowTrustedAddin = true; Map3DSystem.App.Security.AllowExternalAddin = nil; -------------------------------------- app manager class pipeline: AppManager.Startup(), For each world( AppManager.SetupUI(), LoadWorld, AppManager.LoadUserProfile(), play), AppManager.Shutdown() ------------------------------------- this function is called when IDE starts up. __syntax__ <verbatim>function Map3DSystem.App.AppManager.Startup()</verbatim> ---++++ !Map3DSystem.App.AppManager.StartupApp startup only the given app. * _param_ __row__ : the database app record. You can get it from database or create it manually. __syntax__ <verbatim>function Map3DSystem.App.AppManager.StartupApp(row)</verbatim> __parameters__ | *row* | the database app record. You can get it from database or create it manually. | ---++++ !Map3DSystem.App.AppManager.LoadUserProfile call the render box function for all applications that is in the user profile or the current world's app attributes * _param_ __userProfile__ : mcml table. __syntax__ <verbatim>function Map3DSystem.App.AppManager.LoadUserProfile(userProfile)</verbatim> __parameters__ | *userProfile* | mcml table. | ---++++ !Map3DSystem.App.AppManager.OnWorldLoad send APP_WORLD_LOAD msg for each installed application, whenever a new world is loaded (just before the 3d scene is enabled, yet after world data is loaded). per-world attributes is available here. This message is sent before APP_RENDER_BOX. e.g. the CCS (character app) changes the avatar to the user defined avatar in this place just before the world show up. Synchronous preprocessing code can also take place here,since there will be a progress bar informing the world loading progress. __syntax__ <verbatim>function Map3DSystem.App.AppManager.OnWorldLoad()</verbatim> ---++++ !Map3DSystem.App.AppManager.OnWorldClosing send APP_WORLD_CLOSING msg is for each installed application, whenever a world is being closed. However, the application can set msg.DisableClosing = true to disallow closing, such as asking the user to save the world. * _return_ ____ : true if any app disallow closing __syntax__ <verbatim>function Map3DSystem.App.AppManager.OnWorldClosing()</verbatim> __parameters__ | *return* | true if any app disallow closing | ---++++ !Map3DSystem.App.AppManager.OnWorldClosed send APP_WORLD_CLOSING msg for each installed application, whenever a world is being closed. However, the application can set msg.DisableClosing = true to disallow closing, such as asking the user to save the world. __syntax__ <verbatim>function Map3DSystem.App.AppManager.OnWorldClosed()</verbatim> ---++++ !Map3DSystem.App.AppManager.SetupUI call this function to setup UI of all currently loaded applications. it will also add homepage icons to mainmenu for all user added applications. __syntax__ <verbatim>function Map3DSystem.App.AppManager.SetupUI()</verbatim> ---++++ !Map3DSystem.App.AppManager.Shutdown this function is called when IDE is shut down __syntax__ <verbatim>function Map3DSystem.App.AppManager.Shutdown()</verbatim> ---++++ !Map3DSystem.App.AppManager.AddApp <verbatim>-------------------------------------- app list -------------------------------------- if(not Map3DSystem.App.AppManager.applist) then Map3DSystem.App.AppManager.applist = {}; end how an application is currently connected with the IDE. Map3DSystem.App.AppManager.ConnectionStatus = { -- application is not loaded. and should be loaded at properly time without the need of user confirmation. NotLoaded = nil, -- loaded application Loaded = 1, -- locked. Locked = 2, -- downloading from remote server Downloading = 3, -- User needs to confirm in order for this application to be loaded or added. This usually happens when a new application is successfully downloaded from the server. RequestUserConfirm = 4, }</verbatim> add app to manager __syntax__ <verbatim>function Map3DSystem.App.AppManager.AddApp(app_key, app)</verbatim> __parameters__ | *app* | | | *key* | | | *app* | | ---++++ !Map3DSystem.App.AppManager.GetApp get app structure by its app_key __syntax__ <verbatim>function Map3DSystem.App.AppManager.GetApp(app_key)</verbatim> __parameters__ | *app* | | | *key* | | ---++++ !Map3DSystem.App.AppManager.GetNextApp return an iterator of (app_key, app) pairs. __syntax__ <verbatim>function Map3DSystem.App.AppManager.GetNextApp ()</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