MiniMapAppDev
description: 鍦?D涓栫晫涓樉绀哄皬鍦板浘锛氬寘鎷帺瀹跺拰NPC浣嶇疆, 搴旂敤绋嬪簭浼犻€佺偣浣嶇疆绛
MiniMap app for Paraworld
Title |
MiniMap app for Paraworld |
Author(s) |
Andy, port to app by LiXizhi |
Date |
2008/1/5 |
File |
script/kids/3DMapSystemUI/MiniMap/app_main.lua |
Description
show/hide the map position log page. it is a convinient place to remember position in current 3d world.
Map3DSystem.App.Commands.Call("File.MapPosLogPage");
db registration insert script
INSERT INTO apps VALUES (NULL, 'MiniMap_GUID', 'MiniMap', '1.0.0', 'http://www.paraengine.com/apps/MiniMap_v1.zip', 'YourCompany', 'enUS', 'script/kids/3DMapSystemUI/MiniMap/IP.xml', '', 'script/kids/3DMapSystemUI/MiniMap/app_main.lua', 'Map3DSystem.App.MiniMap.MSGProc', 1);
Sample Code
NPL.load("(gl)script/kids/3DMapSystemUI/MiniMap/app_main.lua");
Member Functions
Map3DSystem.App.MiniMap.OnConnection
requires
create class
commonlib.setfield("Map3DSystem.App.MiniMap", {});
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.MiniMap.OnConnection(app, connectMode)
parameters
app |
the object representing the current application in the IDE. |
connectMode |
|
Map3DSystem.App.MiniMap.OnDisconnection
Receives notification that the Add-in is being unloaded.
syntax
function Map3DSystem.App.MiniMap.OnDisconnection(app, disconnectMode)
parameters
Map3DSystem.App.MiniMap.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.MiniMap.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.MiniMap.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.MiniMap.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.MiniMap.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.MiniMap.OnRenderBox(mcmlData)
parameters
Map3DSystem.App.MiniMap.Navigate
called when the user wants to nagivate to the 3D world location relavent to this application
syntax
function Map3DSystem.App.MiniMap.Navigate()
Map3DSystem.App.MiniMap.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.MiniMap.GotoHomepage()
Map3DSystem.App.MiniMap.DoQuickAction
called when user clicks the quick action for this application.
syntax
function Map3DSystem.App.MiniMap.DoQuickAction()
Map3DSystem.App.MiniMap.OnWorldLoad
called whenever a new world is loaded (just before the 3d scene is enabled, yet after world data is loaded).
syntax
function Map3DSystem.App.MiniMap.OnWorldLoad()
Map3DSystem.App.MiniMap.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.MiniMap.MSGProc(window, msg)
parameters
Generate Mini Map Page
Title |
Generate Mini Map Page |
Author(s) |
LiXizhi |
Date |
2008/10/5 |
File |
script/kids/3DMapSystemUI/MiniMap/GenMiniMapPage.lua |
Description
Sample Code
NPL.load("(gl)script/kids/3DMapSystemUI/MiniMap/GenMiniMapPage.lua");
Map3DSystem.App.MiniMap.GenMiniMapPage.Show()
Member Functions
GenMiniMapPage.OnInit
create class
local
GenMiniMapPage = {};
commonlib.setfield("Map3DSystem.App.MiniMap.GenMiniMapPage",
GenMiniMapPage);
on init show the current avatar in pe:avatar
syntax
function GenMiniMapPage.OnInit()
GenMiniMapPage.OnGenMap
generate a mini map and save it to temp/minimap.png.
syntax
function GenMiniMapPage.OnGenMap(name, values)
parameters
Title |
MapPosLogPage.html |
Author(s) |
LiXizhi |
Date |
2008/9/2 |
File |
script/kids/3DMapSystemUI/MiniMap/MapPosLogPage.lua |
Description
Sample Code
NPL.load("(gl)script/kids/3DMapSystemUI/MiniMap/MapPosLogPage.lua");
Map3DSystem.App.MiniMap.MapPosLogPage.Show()
Member Functions
MapPosLogPage.OnInit
create class
local
MapPosLogPage = {};
commonlib.setfield("Map3DSystem.App.MiniMap.MapPosLogPage",
MapPosLogPage);
on init show the current avatar in pe:avatar
syntax
function MapPosLogPage.OnInit()
MapPosLogPage.OnClickGotoPos
click to goto a position
syntax
function MapPosLogPage.OnClickGotoPos(name, values)
parameters
MapPosLogPage.GotoPos
goto a position
syntax
function MapPosLogPage.GotoPos(x, y)
parameters
MapPosLogPage.OnClickCreatePos
TODO: create a new pos
syntax
function MapPosLogPage.OnClickCreatePos(name, values)
parameters
mini map manager for paraworld
Title |
mini map manager for paraworld |
Author(s) |
WangTian |
Date |
2008/1/14 |
File |
script/kids/3DMapSystemUI/MiniMap/MiniMapManager.lua |
Description
mini map manager will handle all the mini map related data
including portal and OPC position(
JGSL support)
Sample Code
NPL.load("(gl)script/kids/3DMapSystemUI/MiniMap/MiniMapManager.lua");
Member Functions
Map3DSystem.UI.MiniMapManager.InitDefaultAssets
mini map north direction
Map3DSystem.UI.MiniMapManager.northDir = 0;
scale applied to every mini map object, including avatar, OPC, camera and portal
mini map objects will have the same X and Z coordinate in ParaScene
Map3DSystem.UI.MiniMapManager.assetScale = 4;
Y positions divide the mini map objects into several layers
avatar is always on top of OPCs .etc
Map3DSystem.UI.MiniMapManager.cameraPosY = 3;
Map3DSystem.UI.MiniMapManager.portalPosY = 4;
Map3DSystem.UI.MiniMapManager.OPCPosY = 5;
Map3DSystem.UI.MiniMapManager.avatarPosY = 6;
if(not Map3DSystem.UI.MiniMapManager.PortalList) then Map3DSystem.UI.MiniMapManager.PortalList = {}; end
if(not Map3DSystem.UI.MiniMapManager.OPCList) then Map3DSystem.UI.MiniMapManager.OPCList = {}; end
use the main character as user avatar
Map3DSystem.UI.MiniMapManager.AvatarName = Map3DSystem.User.Name;
Map3DSystem.UI.MiniMapManager.AssetListDefault = {
-- LXZ 2008.6.29, for release purposes, following are no longer used. If they are used in future, move to the map folder, instead of test folder.
["assetAvatarDefault"] = "model/test/ryb/red/red.x",
["assetPortalDefault"] = "model/test/ryb/blue/blue.x",
["assetOPCDefault"] = "model/test/ryb/yellow/yellow.x",
["assetCameraDefault"] = "model/test/ryb/camera/camera.x",
["ground"] = "model/map3D/map3D.x", -- added LXZ 2008.6.29 for ground texture
}
;
syntax
function Map3DSystem.UI.MiniMapManager.InitDefaultAssets()
Map3DSystem.UI.MiniMapManager.RegisterAvatarObject
register the avatar object in the mini map
syntax
function Map3DSystem.UI.MiniMapManager.RegisterAvatarObject()
Map3DSystem.UI.MiniMapManager.RegisterCameraObject
register the camera object in the mini map
syntax
function Map3DSystem.UI.MiniMapManager.RegisterCameraObject()
Map3DSystem.UI.MiniMapManager.RegisterOPCObject
register the OPC object in mini map
- param opcname : OPC name
- param assetname : if no asset name is specified, use default asset name
- param texturename : background file shown on local map or other 2D map implementation, if no texture name is specified, use default texture name
syntax
function Map3DSystem.UI.MiniMapManager.RegisterOPCObject(opcname, assetname, texturename)
parameters
opcname |
OPC name |
assetname |
|
texturename |
background file shown on local map or other 2D map implementation, if no texture name is specified, use default texture name |
Map3DSystem.UI.MiniMapManager.UnregisterOPCObject
unregister the OPC object in mini map
syntax
function Map3DSystem.UI.MiniMapManager.UnregisterOPCObject(opcname)
parameters
Map3DSystem.UI.MiniMapManager.RegisterPortalObject
register the Portal object in mini map
- param portalname : Portal object name
- param assetname : if no asset name is specified, use default asset name
- param texturename : background file shown on local map or other 2D map implementation, if no texture name is specified, use default texture name
syntax
function Map3DSystem.UI.MiniMapManager.RegisterPortalObject(portalname, texturename)
parameters
portalname |
Portal object name |
texturename |
background file shown on local map or other 2D map implementation, if no texture name is specified, use default texture name |
Map3DSystem.UI.MiniMapManager.UnregisterPortalObject
unregister the Portal object in mini map
- param portalname : Portal name
syntax
function Map3DSystem.UI.MiniMapManager.UnregisterPortalObject(portalname)
parameters
Mini Map Page
Title |
Mini Map Page |
Author(s) |
LiXizhi |
Date |
2008/6/22 |
File |
script/kids/3DMapSystemUI/MiniMap/MiniMapPage.lua |
Description
Sample Code
NPL.load("(gl)script/kids/3DMapSystemUI/MiniMap/MiniMapPage.lua");
Map3DSystem.App.MiniMap.MiniMapPage.Show()
Member Functions
MiniMapPage.OnInit
create class
local
MiniMapPage = {};
commonlib.setfield("Map3DSystem.App.MiniMap.MiniMapPage",
MiniMapPage);
on init show the current avatar in pe:avatar
syntax
function MiniMapPage.OnInit()
MiniMapPage.Show
toggle show/hide mini map window
- param x :,y: position at which to display the window. If nil, the center of screen is used.
syntax
function MiniMapPage.Show(bShow, x, y)
parameters
bShow |
|
x |
,y: position at which to display the window. If nil, the center of screen is used. |
y |
|
MiniMapPage.OnCheckFixMap
whether to rotate map or not.
syntax
function MiniMapPage.OnCheckFixMap(checked)
parameters
MiniMapPage.OnClose
open using external system web browser, such as ie
syntax
function MiniMapPage.OnClose()
mini map for paraworld
Title |
mini map for paraworld |
Author(s) |
WangTian |
Date |
2008/1/14, updated LXZ 2006.6.22. removed timer with framemove and added to mini map app via MiniMapPage. |
File |
script/kids/3DMapSystemUI/MiniMap/MiniMapWnd.lua |
Description
mini map version one consists of a fixed size square map zone plus an expandable portal list
Sample Code
NPL.load("(gl)script/kids/3DMapSystemUI/MiniMap/MiniMapWnd.lua");
Map3DSystem.UI.MiniMapWnd.Show(bShow, parentUI)
Map3DSystem.UI.MiniMapWnd.SetMapFixed(true)
Map3DSystem.UI.MiniMapWnd.IsMapFixed()
Map3DSystem.UI.MiniMapWnd.OnLoadMiniMap = function(MiniMapWnd)
-- log(MiniMapWnd.minimap_filePath)
end
Map3DSystem.UI.MiniMapWnd.OnUpdateMark = function(MiniMapWnd, angle)
-- angle is the character angle.
end
Member Functions
MiniMapWnd.Show
function of function(MiniMapWnd) end, it is called when a minimap is just loaded. usually needs update according to MiniMapWnd.minimap_filePath
MiniMapWnd.OnLoadMiniMap = nil;
function of function(MiniMapWnd) end, it is called when need to update the marks on the map
MiniMapWnd.OnUpdateMark = nil;
the image file path
MiniMapWnd.minimap_filePath = nil;
MiniMapWnd.MainMenuHeight = 22;
MiniMapWnd.CanvasWidth = 200;
MiniMapWnd.CanvasHeight = 200;
update every 0.1 second
MiniMapWnd.updateInterval = 0.2;
MiniMapWnd.RenderSize = 128;
mouse wheel zoom range in meters
MiniMapWnd.MinZoomDistance = 20
MiniMapWnd.MaxZoomDistance = 500
initial zoom distance
MiniMapWnd.DefaultZoomDistance = 200;
how many mouse delta steps to zoom between min and max, a log step size maybe better than linear one like this.
MiniMapWnd.ZoomStepCount = 50;
when character changes position, whether to rotate map or rotate character.
MiniMapWnd.bIsMapFixed = true;
in case MiniMapWnd.bIsMapFixed is true, this is the angle to rotation, it is automatically set according to current character facing.
MiniMapWnd.mapRotation = 0;
objects location and size on the minimap are scaled by this to prevent camera culling when zooming.
local unit_scale = 0.1;
whether to draw using 3D camera or not
MiniMapWnd.Use3DCamera = false
whether to draw using 3D avatar or not
MiniMapWnd.Use3DAvatar = false
whether to show tooltip when mouse over map objects.
MiniMapWnd.ShowTooltip = false
whether show the coordinate
MiniMapWnd.ShowCoordinate = true
local DefaultSettings = {
MinZoomDistance = 20,
MaxZoomDistance = 500,
DefaultZoomDistance = 300,
ZoomStepCount = 50,
ShowCoordinate = true,
bIsMapFixed = true,
-- left top map position in world coordinates
minimap_x = 0,
minimap_y = 0,
-- minimap size
minimap_size = 533.333,
}
;
commonlib.partialcopy(
MiniMapWnd,
DefaultSettings);
- param bShow : show or hide the mini map
- param parentUI : parent container inside which the content is displayed. it can be nil.
syntax
function MiniMapWnd.Show(bShow, parentUI)
parameters
bShow |
show or hide the mini map |
parentUI |
|
MiniMapWnd.InitMiniSceneGraph
create and initialize the mini map mini scene graph
NOTE: one time init
syntax
function MiniMapWnd.InitMiniSceneGraph()
MiniMapWnd.OnFramemove
private
local _elapsedtime = 0;
syntax
function MiniMapWnd.OnFramemove()
MiniMapWnd.UpdateCamera
update camera object position and direction
syntax
function MiniMapWnd.UpdateCamera()
MiniMapWnd.UpdatePortal
update portal object position
syntax
function MiniMapWnd.UpdatePortal()
MiniMapWnd.UpdateAvatar
update avatar object position
syntax
function MiniMapWnd.UpdateAvatar()
MiniMapWnd.UpdateOPC
update opc object position
syntax
function MiniMapWnd.UpdateOPC()
MiniMapWnd.IsMapFixed
public functions
when character changes position, whether to rotate map or rotate character.
syntax
function MiniMapWnd.IsMapFixed()
MiniMapWnd.SetMapFixed
when character changes position, whether to rotate map or rotate character.
syntax
function MiniMapWnd.SetMapFixed(bCheck)
parameters