DesktopWnd
Desktop window for 3d map system
Title |
Desktop window for 3d map system |
Author(s) |
WangTian, |
Date |
2008/1/23 |
File |
script/kids/3DMapSystemUI/Desktop/DesktopWnd.lua |
Description
Add desktop icons
One can add commands icons to Startup, Online, Offline command groups. Each commands may contain a url or UICallback function.
However, most desktop icons are advised to be mcml url only.
example
Map3DSystem.UI.Desktop.AddDesktopItem({ButtonText="iconText", icon = "icon path", url="Some URL here"}, "Startup.Credits");
Map3DSystem.UI.Desktop.AddDesktopItem({ButtonText="iconText", icon = "icon path", url="Some URL here"}, "Online.MyProfile");
Map3DSystem.UI.Desktop.AddDesktopItem({ButtonText="iconText", icon = "icon path", url="Some URL here"}, "Offline.Tutorial");
Desktop Front page
goto a url page on the desktop front page. call below
Map3DSystem.UI.Desktop.GotoDesktopPage(url)
change the desktop images
Map3DSystem.UI.Desktop.SetBackgroundImage(filename)
Sample Code
NPL.load("(gl)script/kids/3DMapSystemUI/Desktop/DesktopWnd.lua");
Map3DSystem.UI.Desktop.Show();
-- to add desktop icon that has a showUI callback at startup
Map3DSystem.UI.Desktop.AddDesktopItem({ButtonText="iconText", icon = "icon path", OnShowUICallback}, "Startup.Credits");
-- to add desktop icon that opens an url page.
Map3DSystem.UI.Desktop.AddDesktopItem({ButtonText="iconText", icon = "icon path", url}, "Startup.Credits");
Member Functions
Desktop.AddDesktopItem
common control library
NPL.load("(gl)script/kids/3DMapSystem_Data.lua");
local L = CommonCtrl.Locale("ParaWorld");
if(not Map3DSystem.UI.Desktop) then Map3DSystem.UI.Desktop = {}; end
local Desktop = Map3DSystem.UI.Desktop;
Desktop.LoginBarMCML = "script/kids/3DMapSystemUI/Desktop/LoginPage.html"
Desktop.NewAccountUrl = "http://www.minixyz.com/cn_01/register.aspx";
Themes and Images
Desktop.DesktopBG = "Texture/3DMapSystem/Desktop/BG.png";--"Texture/3DMapSystem/Desktop/DesktopBG.png";
Desktop.HeaderBG = ""; --"Texture/3DMapSystem/Desktop/TopFrameBG.png: 10 200 10 0"
Desktop.ParaWorldLogo = "Texture/3DMapSystem/brand/paraworld_text_256X128.png"; -- "Texture/3DMapSystem/Desktop/Logo_cn.png; 0 0 192 192"; -- TODO: locale
Desktop.ParaWorldLogo128 = "Texture/3DMapSystem/Desktop/Logo_cn_128.png"; -- TODO: locale
Desktop.ParaWorldSlogen = ""; -- "Texture/3DMapSystem/Desktop/ParaEngineTenet.png"
Desktop.StartupBarBG = ""; -- "Texture/3DMapSystem/Desktop/StartupBarBG.png";
Desktop.LoginBarBG = ""; -- "Texture/3DMapSystem/Desktop/LoginBarBG.png";
Desktop.LoginButton_Norm = "Texture/3DMapSystem/Desktop/LoginButton_Norm.png: 15 15 15 15";
Desktop.LoginButton_HL = "Texture/3DMapSystem/Desktop/LoginButton_HL.png: 15 15 15 15";
Desktop.LoginButton_Norm = "Texture/3DMapSystem/Desktop/LoginPageButton3.png: 15 15 15 16";
Desktop.LoginButton_HL = "Texture/3DMapSystem/Desktop/LoginPageButton_HL3.png: 15 15 15 16";
Fonts
Desktop.LoginBarFont = "System;12;norm";
Desktop.LoginBarFontBold = "Verdana;12;bold";
Desktop.LastShowGridViewName = nil;
Desktop.LastShowGridRow = nil;
Desktop.LastShowGridColumn = nil;
Desktop.LastUrl = nil;
preinstalled desktop icons. other applications may add to this icon list at startup time.
Desktop.icons = {
name = "Desktop",
text = "Desktop",
Nodes={
{
-- "Startup" contains panel or command icons that are shown at startup.
name = "Startup",
text = "Startup",
-- child objects
Nodes = {},
},
{
-- "Online" contains icons that are only shown when user is signed in.
name = "Online",
text = "Online",
-- child objects
Nodes = {},
},
{
-- "Offline" contains icons that are only shown when user is signed in as offline.
name = "Offline",
text = "Offline",
-- child objects
Nodes = {},
},
}
};
Edited LXZ 2008.1.28. Add a desk top command at given position. This function is usually called during an application's startup connection event (not UISetup)
- param command :; type of Map3DSystem.App.Command, or a new table that contains {ButtonText="iconText", icon = "icon path", OnShowUICallback = nil or function (bShow, _parent,parentWindow) .. end}
- param position : this is a tree path string of folder names separated by dot. The desktop has a predefined folder structure, which is "Startup.anyname": "Startup" contains panel or command icons that are shown at startup. "Online.anyname": "Online" contains icons that are only shown when user is signed in. "Offline.anyname", "Offline" contains icons that are only shown when user is signed in as offline.
- 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
function Desktop.AddDesktopItem(command, position, posIndex)
parameters
command |
; type of Map3DSystem.App.Command, or a new table that contains {ButtonText="iconText", icon = "icon path", OnShowUICallback = nil or function (bShow, _parent,parentWindow) .. end} |
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. |
Desktop.GetItemIndex
return a desktop icon index by its position. This function is mosted called before
AddDesktopItem to determine where to insert a new command.
- param position : this is a tree path string of folder names separated by dot e.g. "Startup.anyname"
- 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
function Desktop.GetItemIndex(position)
parameters
position |
this is a tree path string of folder names separated by dot e.g. "Startup.anyname" |
Desktop.AddStartupBarApplication
obsoleted: no longer used
syntax
function Desktop.AddStartupBarApplication(appTable)
parameters
Desktop.SetBackgroundImage
public: set the background image: 1020*700
- param filename : nil or a file path
syntax
function Desktop.SetBackgroundImage(filename)
parameters
filename |
nil or a file path |
Desktop.ShowStartupPanel
always show the first cell as the startup panel.
- param bForceUpdate : if true, it will rebuilt the UI for the cell at row, column even it is the same as last click.
syntax
function Desktop.ShowStartupPanel(bForceUpdate)
parameters
bForceUpdate |
if true, it will rebuilt the UI for the cell at row, column even it is the same as last click. |
Desktop.GetAppCanvas
the middle application canvas
syntax
function Desktop.GetAppCanvas()
Desktop.OnClickGridCell
show the current app display and hide the last app display
if the same current and last app display, hide current
- param bShow : true or nil to show, false to hide,
- param bForceUpdate : if true, it will rebuilt the UI for the cell at row, column even it is the same as last click.
syntax
function Desktop.OnClickGridCell(gridviewName, row, column, bShow, bForceUpdate)
parameters
gridviewName |
|
row |
|
column |
|
bShow |
true or nil to show, false to hide, |
bForceUpdate |
|
Desktop.ShowOnline
switch to login page.
syntax
function Desktop.ShowOnline()
Desktop.OnClickCallback_ExitApp
Exit app button.
syntax
function Desktop.OnClickCallback_ExitApp()
Desktop.LoadEmptyScene
switch to in-game empty scene for testing. TODO: remove this.
syntax
function Desktop.LoadEmptyScene()
Desktop.LoadDemoScene
switch to in-game demo scene for testing. TODO: remove this.
syntax
function Desktop.LoadDemoScene()
Desktop.OnLoginOfflineMode
to offline mode.
syntax
function Desktop.OnLoginOfflineMode()
Desktop.OnClickNewAccount
click to create new account
syntax
function Desktop.OnClickNewAccount(ctrlName, values)
parameters
Desktop.OnClickConnect
Authenticate user and check client version.
syntax
function Desktop.OnClickConnect(ctrlName, values)
parameters
Desktop.GotoDesktopPage
goto a url page on the desktop front page.
- param url : url of the page
- param cachePolicy : nil or a cache policy. if nil, it defaults to 1 day.
syntax
function Desktop.GotoDesktopPage(url, cachepolicy)
parameters
url |
url of the page |
cachepolicy |
|