EnvAppDev

description: 缂栬緫鑷劧鐜鐨勫簲鐢ㄧ▼搴? 鍖呮嫭澶╃┖銆佹捣娲嬨€侀檰鍦扮瓑

Contents:

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);

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Env/app_main.lua");

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 ConnectMode.

syntax

function Map3DSystem.App.Env.OnConnection(app, connectMode)

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

function Map3DSystem.App.Env.OnDisconnection(app, disconnectMode)

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 CommandStatusWanted
  • return __ : returns according to statusWanted. it may return an integer by adding values in CommandStatus.

syntax

function Map3DSystem.App.Env.OnQueryStatus(app, commandName, statusWanted)

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 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

function Map3DSystem.App.Env.OnExec(app, commandName, params)

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

function Map3DSystem.App.Env.OnRenderBox(mcmlData)

parameters

mcmlData  

Map3DSystem.App.Env.Navigate

called when the user wants to nagivate to the 3D world location relavent to this application

syntax

function Map3DSystem.App.Env.Navigate()

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

function Map3DSystem.App.Env.GotoHomepage()

Map3DSystem.App.Env.DoQuickAction

called when user clicks the quick action for this application.

syntax

function Map3DSystem.App.Env.DoQuickAction()

Map3DSystem.App.Env.OnActivateDesktop

Add terrain, sky and ocean button to the toolbar.

syntax

function Map3DSystem.App.Env.OnActivateDesktop()

Map3DSystem.App.Env.OnDeactivateDesktop

syntax

function Map3DSystem.App.Env.OnDeactivateDesktop()

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

function Map3DSystem.App.Env.MSGProc(window, msg)

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

TIP Sample Code

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

Member Functions

OceanPage.OnInit

called to init page

syntax

function OceanPage.OnInit()

OceanPage.OnOceanColorChanged


page events

called when the Ocean color changes

syntax

function OceanPage.OnOceanColorChanged(r,g,b)

parameters

r  
g  
b  

OceanPage.OnChangeRenderTechnique

technique

syntax

function OceanPage.OnChangeRenderTechnique(name, value)

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

function OceanPage.WaterLevel(fOffset, bEnable)

parameters

fOffset offset
bEnable  

OceanPage.OnOceanLevelSlider

called when the Ocean color changes

syntax

function OceanPage.OnOceanLevelSlider(value)

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

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Env/Sky.lua");

Member Functions

Map3DSystem.UI.Sky.ShowWnd

display the sky panel.

syntax

function Map3DSystem.UI.Sky.ShowWnd(_app)

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

function Map3DSystem.UI.Sky.Show(bShow, _parent, parentWindow)

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

function Map3DSystem.UI.Sky.Show(bShow)

parameters

bShow  

Map3DSystem.UI.Sky.OnChangeSkybox


functions

called when the sky box need to be changed

syntax

function Map3DSystem.UI.Sky.OnChangeSkybox(nIndex)

parameters

nIndex  

Map3DSystem.UI.Sky.OnFogColorChanged

called when the fog color changes

syntax

function Map3DSystem.UI.Sky.OnFogColorChanged()

Map3DSystem.UI.Sky.OnSkyColorChanged

called when the sky color changes

syntax

function Map3DSystem.UI.Sky.OnSkyColorChanged()

Map3DSystem.UI.Sky.OnTimeSliderChanged

UI handler

syntax

function Map3DSystem.UI.Sky.OnTimeSliderChanged()

Map3DSystem.UI.Sky.UpdateTimeSliderUI

update time slider UI

syntax

function Map3DSystem.UI.Sky.UpdateTimeSliderUI()

Map3DSystem.UI.Sky.UpdateFogColorUI

update fog color UI

syntax

function Map3DSystem.UI.Sky.UpdateFogColorUI()

Map3DSystem.UI.Sky.UpdateSkyColorUI

update sky color UI

syntax

function Map3DSystem.UI.Sky.UpdateSkyColorUI()

Environment sky page

Title Environment sky page
Author(s) LiXizhi
Date 2008/6/8
File script/kids/3DMapSystemUI/Env/SkyPage.lua

Description

TIP Sample Code

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

Member Functions

SkyPage.DS_SkyBox_Func

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

datasource function for pe:gridview

syntax

function SkyPage.DS_SkyBox_Func(index)

parameters

index  

SkyPage.OnInit

called to init page

syntax

function SkyPage.OnInit()

SkyPage.OnChangeSkybox


page events

called when the sky box need to be changed

syntax

function SkyPage.OnChangeSkybox(nIndex)

parameters

nIndex  

SkyPage.OnTimeSliderChanged

called when time slider changes

syntax

function SkyPage.OnTimeSliderChanged(value)

parameters

value  

SkyPage.OnFogColorChanged

called when the fog color changes

syntax

function SkyPage.OnFogColorChanged(r,g,b)

parameters

r  
g  
b  

SkyPage.OnSkyColorChanged

called when the sky color changes

syntax

function SkyPage.OnSkyColorChanged(r,g,b)

parameters

r  
g  
b  

SkyPage.OnClickUseSimulatedSky

enable/disable simulated sky

syntax

function SkyPage.OnClickUseSimulatedSky(bChecked, mcmlNode)

parameters

bChecked  
mcmlNode  

SkyPage.OnClickSimSkyTab

update the page

syntax

function SkyPage.OnClickSimSkyTab()

SkyPage.OnUpdateSimSky

update sky

syntax

function SkyPage.OnUpdateSimSky(name, values)

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

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/InGame/Terrain.lua");

Member Functions

Map3DSystem.UI.Terrain.MSGProc

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

syntax

function Map3DSystem.UI.Terrain.MSGProc(window, msg)

parameters

window  
msg  

Map3DSystem.UI.Terrain.Show

show or hide the water panel, bShow == nil, toggle current setting

syntax

function Map3DSystem.UI.Terrain.Show(bShow)

parameters

bShow  

Map3DSystem.UI.Terrain.OnSetCustomTextureBrushSize


functions

user specified brush size

syntax

function Map3DSystem.UI.Terrain.OnSetCustomTextureBrushSize()

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

function Map3DSystem.UI.Terrain.OnSetTextureBrushSize(nSize)

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

function Map3DSystem.UI.Terrain.OnTerrainTexturePaint(nIndex)

parameters

nIndex  

Map3DSystem.UI.Terrain.OnSetCustomTerrainBrushSize

user specified brush size

syntax

function Map3DSystem.UI.Terrain.OnSetCustomTerrainBrushSize()

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

function Map3DSystem.UI.Terrain.OnSetTerrainBrushSize(nSize)

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

TIP Sample Code

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

Member Functions

TerrainPage.DS_TerrainTex_Func

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

datasource function for pe:gridview

syntax

function TerrainPage.DS_TerrainTex_Func(index)

parameters

index  

TerrainPage.OnInit

called to init page

syntax

function TerrainPage.OnInit()

TerrainPage.GaussianHill


page events

syntax

function TerrainPage.GaussianHill(height)

parameters

height  

TerrainPage.Flatten

syntax

function TerrainPage.Flatten()

TerrainPage.Roughen_Smooth

syntax

function TerrainPage.Roughen_Smooth(bRoughen)

parameters

bRoughen  

TerrainPage.OnTerrainTexturePaint

called to paint textures on to the terrain surface using the current brushes.

syntax

function TerrainPage.OnTerrainTexturePaint(FileNameOrIndex)

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

function TerrainPage.OnSetTerrainBrushSize(nSize, bSilent)

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

function TerrainPage.OnSetTextureBrushSize(nSize, bSilent)

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

function TerrainPage.Reset_TerrainMod()

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

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/InGame/Water.lua");

Member Functions

Map3DSystem.UI.Water.Show

show or hide the water panel, bShow == nil, toggle current setting

syntax

function Map3DSystem.UI.Water.Show(bShow)

parameters

bShow  

Map3DSystem.UI.Water.OnOceanColorChanged


functions

called when the ocean color changes

syntax

function Map3DSystem.UI.Water.OnOceanColorChanged()

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

function Map3DSystem.UI.Water.WaterLevel(fOffset, bEnable)

parameters

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