---++!! !EnvAppDev __description__: 缂栬緫鑷劧鐜鐨勫簲鐢ㄧ▼搴? 鍖呮嫭澶╃┖銆佹捣娲嬨€侀檰鍦扮瓑 %TOC{title="Contents:"}% %STARTINCLUDE% ---++ Env app for Paraworld | *Title* | Env app for Paraworld | | *Author(s)* | LiXizhi | | *Date* | 2008/2/14 | | *File* | script/kids/3DMapSystemUI/Env/app_main.lua | ---+++ Description editing environment of the world, such as sky, ocean, and terrain. db registration insert script INSERT INTO apps VALUES (NULL, 'Env_GUID', 'Env', '1.0.0', 'http://www.paraengine.com/apps/Env_v1.zip', 'YourCompany', 'enUS', 'script/kids/3DMapSystemUI/Env/IP.xml', '', 'script/kids/3DMapSystemUI/Env/app_main.lua', 'Map3DSystem.App.Env.MSGProc', 1); %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/Env/app_main.lua"); </verbatim> ---+++ Member Functions ---++++ !Map3DSystem.App.Env.OnConnection requires create class commonlib.setfield("Map3DSystem.App.Env", {}); ------------------------------------------- event handlers ------------------------------------------- OnConnection method is the obvious point to place your UI (menus, mainbars, tool buttons) through which the user will communicate to the app. This method is also the place to put your validation code if you are licensing the add-in. You would normally do this before putting up the UI. If the user is not a valid user, you would not want to put the UI into the IDE. * _param_ __app__ : the object representing the current application in the IDE. * _param_ __connectMode__ : type of Map3DSystem.App.ConnectMode. __syntax__ <verbatim>function Map3DSystem.App.Env.OnConnection(app, connectMode)</verbatim> __parameters__ | *app* | the object representing the current application in the IDE. | | *connectMode* | | ---++++ !Map3DSystem.App.Env.OnDisconnection Receives notification that the Add-in is being unloaded. __syntax__ <verbatim>function Map3DSystem.App.Env.OnDisconnection(app, disconnectMode)</verbatim> __parameters__ | *app* | | | *disconnectMode* | | ---++++ !Map3DSystem.App.Env.OnQueryStatus This is called when the command's availability is updated When the user clicks a command (menu or mainbar button), the QueryStatus event is fired. The QueryStatus event returns the current status of the specified named command, whether it is enabled, disabled, or hidden in the CommandStatus parameter, which is passed to the msg by reference (or returned in the event handler). * _param_ __commandName__ : The name of the command to determine state for. Usually in the string format "Category.SubCate.Name". * _param_ __statusWanted__ : what status of the command is queried. it is of type Map3DSystem.App.CommandStatusWanted * _return_ ____ : returns according to statusWanted. it may return an integer by adding values in Map3DSystem.App.CommandStatus. __syntax__ <verbatim>function Map3DSystem.App.Env.OnQueryStatus(app, commandName, statusWanted)</verbatim> __parameters__ | *app* | | | *commandName* | The name of the command to determine state for. Usually in the string format "Category.SubCate.Name". | | *statusWanted* | | | *return* | returns according to statusWanted. it may return an integer by adding values in Map3DSystem.App.CommandStatus. | ---++++ !Map3DSystem.App.Env.OnExec This is called when the command is invoked.The Exec is fired after the QueryStatus event is fired, assuming that the return to the statusOption parameter of QueryStatus is supported and enabled. This is the event where you place the actual code for handling the response to the user click on the command. * _param_ __commandName__ : The name of the command to determine state for. Usually in the string format "Category.SubCate.Name". __syntax__ <verbatim>function Map3DSystem.App.Env.OnExec(app, commandName, params)</verbatim> __parameters__ | *app* | | | *commandName* | The name of the command to determine state for. Usually in the string format "Category.SubCate.Name". | | *params* | | ---++++ !Map3DSystem.App.Env.OnRenderBox Change and render the 3D world with mcml data that is usually retrieved from the current user's profile page for this application. __syntax__ <verbatim>function Map3DSystem.App.Env.OnRenderBox(mcmlData)</verbatim> __parameters__ | *mcmlData* | | ---++++ !Map3DSystem.App.Env.Navigate called when the user wants to nagivate to the 3D world location relavent to this application __syntax__ <verbatim>function Map3DSystem.App.Env.Navigate()</verbatim> ---++++ !Map3DSystem.App.Env.GotoHomepage called when user clicks to check out the homepage of this application. Homepage usually includes: developer info, support, developer worlds information, app global news, app updates, all community user rating, active users, trade, currency transfer, etc. __syntax__ <verbatim>function Map3DSystem.App.Env.GotoHomepage()</verbatim> ---++++ !Map3DSystem.App.Env.DoQuickAction called when user clicks the quick action for this application. __syntax__ <verbatim>function Map3DSystem.App.Env.DoQuickAction()</verbatim> ---++++ !Map3DSystem.App.Env.OnActivateDesktop Add terrain, sky and ocean button to the toolbar. __syntax__ <verbatim>function Map3DSystem.App.Env.OnActivateDesktop()</verbatim> ---++++ !Map3DSystem.App.Env.OnDeactivateDesktop __syntax__ <verbatim>function Map3DSystem.App.Env.OnDeactivateDesktop()</verbatim> ---++++ !Map3DSystem.App.Env.MSGProc ------------------------------------------- client world database function helpers. ------------------------------------------- ------------------------------------------ all related messages ------------------------------------------ ----------------------------------------------------- APPS can be invoked in many ways: Through app Manager mainbar or menu command or buttons Command Line 3D World installed apps ----------------------------------------------------- __syntax__ <verbatim>function Map3DSystem.App.Env.MSGProc(window, msg)</verbatim> __parameters__ | *window* | | | *msg* | | ---++ Environment Ocean page | *Title* | Environment Ocean page | | *Author(s)* | LiXizhi | | *Date* | 2008/6/8 | | *File* | script/kids/3DMapSystemUI/Env/OceanPage.lua | ---+++ Description %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/Env/OceanPage.lua"); -- call below to load window Map3DSystem.App.Commands.Call("File.MCMLWindowFrame", { url="script/kids/3DMapSystemUI/Env/OceanPage.html", name="OceanPage", app_key=Map3DSystem.App.AppKeys["Env"], isShowTitleBar = false, isShowToolboxBar = false, isShowStatusBar = false, initialWidth = 200, alignment = "Left", }); </verbatim> ---+++ Member Functions ---++++ !OceanPage.OnInit called to init page __syntax__ <verbatim>function OceanPage.OnInit()</verbatim> ---++++ !OceanPage.OnOceanColorChanged ------------------------ page events ------------------------ called when the Ocean color changes __syntax__ <verbatim>function OceanPage.OnOceanColorChanged(r,g,b)</verbatim> __parameters__ | *r* | | | *g* | | | *b* | | ---++++ !OceanPage.OnChangeRenderTechnique technique __syntax__ <verbatim>function OceanPage.OnChangeRenderTechnique(name, value)</verbatim> __parameters__ | *name* | | | *value* | | ---++++ !OceanPage.WaterLevel [[ set the current water level by the current player's position plus the offset. * _param_ __fOffset__ : offset * _param_ __bEnable__ : true to enable water, false to disable. ]] __syntax__ <verbatim>function OceanPage.WaterLevel(fOffset, bEnable)</verbatim> __parameters__ | *fOffset* | offset | | *bEnable* | | ---++++ !OceanPage.OnOceanLevelSlider called when the Ocean color changes __syntax__ <verbatim>function OceanPage.OnOceanLevelSlider(value)</verbatim> __parameters__ | *value* | | ---++ Sky in main bar for 3D Map system | *Title* | Sky in main bar for 3D Map system | | *Author(s)* | WangTian, LiXizhi | | *Date* | 2007/9/17 | | *File* | script/kids/3DMapSystemUI/Env/Sky.lua | ---+++ Description Show the Sky panel in game UI %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/Env/Sky.lua"); </verbatim> ---+++ Member Functions ---++++ !Map3DSystem.UI.Sky.ShowWnd display the sky panel. __syntax__ <verbatim>function Map3DSystem.UI.Sky.ShowWnd(_app)</verbatim> __parameters__ | *app* | | ---++++ !Map3DSystem.UI.Sky.Show * _param_ __bShow__ : boolean to show or hide. if nil, it will toggle current setting. * _param_ ____ :_parent: parent window inside which the content is displayed. it can be nil. __syntax__ <verbatim>function Map3DSystem.UI.Sky.Show(bShow, _parent, parentWindow)</verbatim> __parameters__ | *bShow* | boolean to show or hide. if nil, it will toggle current setting. | | *parent* | | | *parentWindow* | | ---++++ !Map3DSystem.UI.Sky.Show show or hide the sky panel, bShow == nil, toggle current setting __syntax__ <verbatim>function Map3DSystem.UI.Sky.Show(bShow)</verbatim> __parameters__ | *bShow* | | ---++++ !Map3DSystem.UI.Sky.OnChangeSkybox ---------------------------------------------------------- functions ---------------------------------------------------------- called when the sky box need to be changed __syntax__ <verbatim>function Map3DSystem.UI.Sky.OnChangeSkybox(nIndex)</verbatim> __parameters__ | *nIndex* | | ---++++ !Map3DSystem.UI.Sky.OnFogColorChanged called when the fog color changes __syntax__ <verbatim>function Map3DSystem.UI.Sky.OnFogColorChanged()</verbatim> ---++++ !Map3DSystem.UI.Sky.OnSkyColorChanged called when the sky color changes __syntax__ <verbatim>function Map3DSystem.UI.Sky.OnSkyColorChanged()</verbatim> ---++++ !Map3DSystem.UI.Sky.OnTimeSliderChanged UI handler __syntax__ <verbatim>function Map3DSystem.UI.Sky.OnTimeSliderChanged()</verbatim> ---++++ !Map3DSystem.UI.Sky.UpdateTimeSliderUI update time slider UI __syntax__ <verbatim>function Map3DSystem.UI.Sky.UpdateTimeSliderUI()</verbatim> ---++++ !Map3DSystem.UI.Sky.UpdateFogColorUI update fog color UI __syntax__ <verbatim>function Map3DSystem.UI.Sky.UpdateFogColorUI()</verbatim> ---++++ !Map3DSystem.UI.Sky.UpdateSkyColorUI update sky color UI __syntax__ <verbatim>function Map3DSystem.UI.Sky.UpdateSkyColorUI()</verbatim> ---++ Environment sky page | *Title* | Environment sky page | | *Author(s)* | LiXizhi | | *Date* | 2008/6/8 | | *File* | script/kids/3DMapSystemUI/Env/SkyPage.lua | ---+++ Description %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/Env/SkyPage.lua"); -- call below to load window Map3DSystem.App.Commands.Call("File.MCMLWindowFrame", { url="script/kids/3DMapSystemUI/Env/SkyPage.html", name="SkyPage", app_key=Map3DSystem.App.AppKeys["Env"], isShowTitleBar = false, isShowToolboxBar = false, isShowStatusBar = false, initialWidth = 200, alignment = "Left", }); </verbatim> ---+++ Member Functions ---++++ !SkyPage.DS_SkyBox_Func <verbatim> skybox db table SkyPage.skyboxes = { [1] = {name = "skybox1", text="娌欎笜榄斿牎", file = "model/Skybox/Skybox1/Skybox1.x", bg = "Texture/kidui/middle/sky/btn_sky1.png"}, [2] = {name = "skybox2", text="鏅寸┖涓囬噷", file = "model/Skybox/skybox2/skybox2.x", bg = "Texture/kidui/middle/sky/btn_sky2.png"}, [3] = {name = "skybox3", text="鍐板ぉ闆湴", file = "model/Skybox/Skybox3/Skybox3.x", bg = "Texture/kidui/middle/sky/btn_sky3.png"}, [4] = {name = "skybox4", text="澶栧お绌烘槦鐞?, file = "model/Skybox/skybox4/skybox4.x", bg = "Texture/kidui/middle/sky/btn_sky4.png"}, [5] = {name = "skybox5", text="澶曢槼瑗夸笅", file = "model/Skybox/Skybox5/Skybox5.x", bg = "Texture/kidui/middle/sky/btn_sky5.png"}, [6] = {name = "skybox6", text="澶滅┖绻佹槦", file = "model/Skybox/Skybox6/Skybox6.x", bg = "Texture/kidui/middle/sky/btn_sky5.png"}, }</verbatim>; datasource function for pe:gridview __syntax__ <verbatim>function SkyPage.DS_SkyBox_Func(index)</verbatim> __parameters__ | *index* | | ---++++ !SkyPage.OnInit called to init page __syntax__ <verbatim>function SkyPage.OnInit()</verbatim> ---++++ !SkyPage.OnChangeSkybox ------------------------ page events ------------------------ called when the sky box need to be changed __syntax__ <verbatim>function SkyPage.OnChangeSkybox(nIndex)</verbatim> __parameters__ | *nIndex* | | ---++++ !SkyPage.OnTimeSliderChanged called when time slider changes __syntax__ <verbatim>function SkyPage.OnTimeSliderChanged(value)</verbatim> __parameters__ | *value* | | ---++++ !SkyPage.OnFogColorChanged called when the fog color changes __syntax__ <verbatim>function SkyPage.OnFogColorChanged(r,g,b)</verbatim> __parameters__ | *r* | | | *g* | | | *b* | | ---++++ !SkyPage.OnSkyColorChanged called when the sky color changes __syntax__ <verbatim>function SkyPage.OnSkyColorChanged(r,g,b)</verbatim> __parameters__ | *r* | | | *g* | | | *b* | | ---++++ !SkyPage.OnClickUseSimulatedSky enable/disable simulated sky __syntax__ <verbatim>function SkyPage.OnClickUseSimulatedSky(bChecked, mcmlNode)</verbatim> __parameters__ | *bChecked* | | | *mcmlNode* | | ---++++ !SkyPage.OnClickSimSkyTab update the page __syntax__ <verbatim>function SkyPage.OnClickSimSkyTab()</verbatim> ---++++ !SkyPage.OnUpdateSimSky update sky __syntax__ <verbatim>function SkyPage.OnUpdateSimSky(name, values)</verbatim> __parameters__ | *name* | | | *values* | | ---++ Terrain in main bar for 3D Map system | *Title* | Terrain in main bar for 3D Map system | | *Author(s)* | WangTian, LiXizhi | | *Date* | 2007/9/17 | | *File* | script/kids/3DMapSystemUI/Env/Terrain.lua | ---+++ Description Show the Terrain panel in game UI %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/InGame/Terrain.lua"); </verbatim> ---+++ Member Functions ---++++ !Map3DSystem.UI.Terrain.MSGProc <verbatim> this override default terrain texture list Map3DSystem.UI.Terrain.terrainTexList = { [1]={filename = "Texture/tileset/generic/StoneRoad.dds"}, [2]={filename = "Texture/tileset/generic/sandRock.dds"}, [3]={filename = "Texture/tileset/generic/sandSmallRock.dds"}, [4]={filename = "Texture/tileset/generic/greengrass.dds"}, [5]={filename = "Texture/tileset/generic/stonegrass.dds"}, [6]={filename = "Texture/tileset/generic/GridMarker.dds"}, }</verbatim>; __syntax__ <verbatim>function Map3DSystem.UI.Terrain.MSGProc(window, msg)</verbatim> __parameters__ | *window* | | | *msg* | | ---++++ !Map3DSystem.UI.Terrain.Show show or hide the water panel, bShow == nil, toggle current setting __syntax__ <verbatim>function Map3DSystem.UI.Terrain.Show(bShow)</verbatim> __parameters__ | *bShow* | | ---++++ !Map3DSystem.UI.Terrain.OnSetCustomTextureBrushSize ---------------------------------------------------------- functions ---------------------------------------------------------- [[ user specified brush size]] __syntax__ <verbatim>function Map3DSystem.UI.Terrain.OnSetCustomTextureBrushSize()</verbatim> ---++++ !Map3DSystem.UI.Terrain.OnSetTextureBrushSize set the current terrain texture brush size and update the UI * _param_ __nSize__ : if this is nil, the current brush size is used, if not the current brush size will be set accordingly __syntax__ <verbatim>function Map3DSystem.UI.Terrain.OnSetTextureBrushSize(nSize)</verbatim> __parameters__ | *nSize* | if this is nil, the current brush size is used, if not the current brush size will be set accordingly | ---++++ !Map3DSystem.UI.Terrain.OnTerrainTexturePaint [[ called to paint textures on to the terrain surface]] __syntax__ <verbatim>function Map3DSystem.UI.Terrain.OnTerrainTexturePaint(nIndex)</verbatim> __parameters__ | *nIndex* | | ---++++ !Map3DSystem.UI.Terrain.OnSetCustomTerrainBrushSize [[ user specified brush size]] __syntax__ <verbatim>function Map3DSystem.UI.Terrain.OnSetCustomTerrainBrushSize()</verbatim> ---++++ !Map3DSystem.UI.Terrain.OnSetTerrainBrushSize set the current terrain brush size and update the UI * _param_ __nSize__ : if this is nil, the current brush size is used, if not the current brush size will be set accordingly __syntax__ <verbatim>function Map3DSystem.UI.Terrain.OnSetTerrainBrushSize(nSize)</verbatim> __parameters__ | *nSize* | if this is nil, the current brush size is used, if not the current brush size will be set accordingly | ---++ Environment Terrain page | *Title* | Environment Terrain page | | *Author(s)* | LiXizhi | | *Date* | 2008/6/8 | | *File* | script/kids/3DMapSystemUI/Env/TerrainPage.lua | ---+++ Description %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/Env/TerrainPage.lua"); -- call below to load window Map3DSystem.App.Commands.Call("File.MCMLWindowFrame", { url="script/kids/3DMapSystemUI/Env/TerrainPage.html", name="TerrainPage", app_key=Map3DSystem.App.AppKeys["Env"], isShowTitleBar = false, isShowToolboxBar = false, isShowStatusBar = false, initialWidth = 200, alignment = "Left", }); </verbatim> ---+++ Member Functions ---++++ !TerrainPage.DS_TerrainTex_Func <verbatim> Terrain texture db table TerrainPage.terrainTexList = { {filename = "Texture/tileset/generic/StoneRoad.dds"}, {filename = "Texture/tileset/generic/sandRock.dds"}, {filename = "Texture/tileset/generic/sandSmallRock.dds"}, {filename = "Texture/tileset/generic/greengrass.dds"}, {filename = "Texture/tileset/generic/stonegrass.dds"}, {filename = "Texture/tileset/generic/GridMarker.dds"}, }</verbatim>; datasource function for pe:gridview __syntax__ <verbatim>function TerrainPage.DS_TerrainTex_Func(index)</verbatim> __parameters__ | *index* | | ---++++ !TerrainPage.OnInit called to init page __syntax__ <verbatim>function TerrainPage.OnInit()</verbatim> ---++++ !TerrainPage.GaussianHill ------------------------ page events ------------------------ __syntax__ <verbatim>function TerrainPage.GaussianHill(height)</verbatim> __parameters__ | *height* | | ---++++ !TerrainPage.Flatten __syntax__ <verbatim>function TerrainPage.Flatten()</verbatim> ---++++ !TerrainPage.Roughen_Smooth __syntax__ <verbatim>function TerrainPage.Roughen_Smooth(bRoughen)</verbatim> __parameters__ | *bRoughen* | | ---++++ !TerrainPage.OnTerrainTexturePaint called to paint textures on to the terrain surface using the current brushes. __syntax__ <verbatim>function TerrainPage.OnTerrainTexturePaint(FileNameOrIndex)</verbatim> __parameters__ | *FileNameOrIndex* | | ---++++ !TerrainPage.OnSetTerrainBrushSize set the current terrain brush size * _param_ __nSize__ : if this is nil, the current brush size is used, if not the current brush size will be set accordingly __syntax__ <verbatim>function TerrainPage.OnSetTerrainBrushSize(nSize, bSilent)</verbatim> __parameters__ | *nSize* | if this is nil, the current brush size is used, if not the current brush size will be set accordingly | | *bSilent* | | ---++++ !TerrainPage.OnSetTextureBrushSize set the current terrain texture brush size * _param_ __nSize__ : if this is nil, the current brush size is used, if not the current brush size will be set accordingly __syntax__ <verbatim>function TerrainPage.OnSetTextureBrushSize(nSize, bSilent)</verbatim> __parameters__ | *nSize* | if this is nil, the current brush size is used, if not the current brush size will be set accordingly | | *bSilent* | | ---++++ !TerrainPage.Reset_TerrainMod reset brush settings. __syntax__ <verbatim>function TerrainPage.Reset_TerrainMod()</verbatim> ---++ Water in main bar for 3D Map system | *Title* | Water in main bar for 3D Map system | | *Author(s)* | WangTian, LiXizhi | | *Date* | 2007/9/17 | | *File* | script/kids/3DMapSystemUI/Env/Water.lua | ---+++ Description Show the Water panel in game UI %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/InGame/Water.lua"); </verbatim> ---+++ Member Functions ---++++ !Map3DSystem.UI.Water.Show show or hide the water panel, bShow == nil, toggle current setting __syntax__ <verbatim>function Map3DSystem.UI.Water.Show(bShow)</verbatim> __parameters__ | *bShow* | | ---++++ !Map3DSystem.UI.Water.OnOceanColorChanged ----------------------------------------- functions ----------------------------------------- called when the ocean color changes __syntax__ <verbatim>function Map3DSystem.UI.Water.OnOceanColorChanged()</verbatim> ---++++ !Map3DSystem.UI.Water.WaterLevel [[ set the current water level by the current player's position plus the offset. * _param_ __fOffset__ : offset * _param_ __bEnable__ : true to enable water, false to disable. ]] __syntax__ <verbatim>function Map3DSystem.UI.Water.WaterLevel(fOffset, bEnable)</verbatim> __parameters__ | *fOffset* | offset | | *bEnable* | | %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