---++!! !MiniMapAppDev __description__: 鍦?D涓栫晫涓樉绀哄皬鍦板浘锛氬寘鎷帺瀹跺拰NPC浣嶇疆, 搴旂敤绋嬪簭浼犻€佺偣浣嶇疆绛 %TOC{title="Contents:"}% %STARTINCLUDE% ---++ 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 ---++ File.MapPosLogPage show/hide the map position log page. it is a convinient place to remember position in current 3d world. <verbatim> Map3DSystem.App.Commands.Call("File.MapPosLogPage"); </verbatim> 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); %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/MiniMap/app_main.lua"); </verbatim> ---+++ 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 Map3DSystem.App.ConnectMode. __syntax__ <verbatim>function Map3DSystem.App.MiniMap.OnConnection(app, connectMode)</verbatim> __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__ <verbatim>function Map3DSystem.App.MiniMap.OnDisconnection(app, disconnectMode)</verbatim> __parameters__ | *app* | | | *disconnectMode* | | ---++++ !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 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.MiniMap.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.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__ <verbatim>function Map3DSystem.App.MiniMap.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.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__ <verbatim>function Map3DSystem.App.MiniMap.OnRenderBox(mcmlData)</verbatim> __parameters__ | *mcmlData* | | ---++++ !Map3DSystem.App.MiniMap.Navigate called when the user wants to nagivate to the 3D world location relavent to this application __syntax__ <verbatim>function Map3DSystem.App.MiniMap.Navigate()</verbatim> ---++++ !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__ <verbatim>function Map3DSystem.App.MiniMap.GotoHomepage()</verbatim> ---++++ !Map3DSystem.App.MiniMap.DoQuickAction called when user clicks the quick action for this application. __syntax__ <verbatim>function Map3DSystem.App.MiniMap.DoQuickAction()</verbatim> ---++++ !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__ <verbatim>function Map3DSystem.App.MiniMap.OnWorldLoad()</verbatim> ---++++ !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__ <verbatim>function Map3DSystem.App.MiniMap.MSGProc(window, msg)</verbatim> __parameters__ | *window* | | | *msg* | | ---++ Generate Mini Map Page | *Title* | Generate Mini Map Page | | *Author(s)* | LiXizhi | | *Date* | 2008/10/5 | | *File* | script/kids/3DMapSystemUI/MiniMap/GenMiniMapPage.lua | ---+++ Description %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/MiniMap/GenMiniMapPage.lua"); Map3DSystem.App.MiniMap.GenMiniMapPage.Show() </verbatim> ---+++ 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__ <verbatim>function GenMiniMapPage.OnInit()</verbatim> ---++++ !GenMiniMapPage.OnGenMap generate a mini map and save it to temp/minimap.png. __syntax__ <verbatim>function GenMiniMapPage.OnGenMap(name, values)</verbatim> __parameters__ | *name* | | | *values* | | ---++ MapPosLogPage.html | *Title* | MapPosLogPage.html | | *Author(s)* | LiXizhi | | *Date* | 2008/9/2 | | *File* | script/kids/3DMapSystemUI/MiniMap/MapPosLogPage.lua | ---+++ Description %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/MiniMap/MapPosLogPage.lua"); Map3DSystem.App.MiniMap.MapPosLogPage.Show() </verbatim> ---+++ 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__ <verbatim>function MapPosLogPage.OnInit()</verbatim> ---++++ !MapPosLogPage.OnClickGotoPos click to goto a position __syntax__ <verbatim>function MapPosLogPage.OnClickGotoPos(name, values) </verbatim> __parameters__ | *name* | | | *values* | | ---++++ !MapPosLogPage.GotoPos goto a position __syntax__ <verbatim>function MapPosLogPage.GotoPos(x, y)</verbatim> __parameters__ | *x* | | | *y* | | ---++++ !MapPosLogPage.OnClickCreatePos TODO: create a new pos __syntax__ <verbatim>function MapPosLogPage.OnClickCreatePos(name, values)</verbatim> __parameters__ | *name* | | | *values* | | ---++ 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) %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/MiniMap/MiniMapManager.lua"); </verbatim> ---+++ Member Functions ---++++ !Map3DSystem.UI.MiniMapManager.InitDefaultAssets <verbatim> 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 }</verbatim>; __syntax__ <verbatim>function Map3DSystem.UI.MiniMapManager.InitDefaultAssets()</verbatim> ---++++ !Map3DSystem.UI.MiniMapManager.RegisterAvatarObject register the avatar object in the mini map __syntax__ <verbatim>function Map3DSystem.UI.MiniMapManager.RegisterAvatarObject()</verbatim> ---++++ !Map3DSystem.UI.MiniMapManager.RegisterCameraObject register the camera object in the mini map __syntax__ <verbatim>function Map3DSystem.UI.MiniMapManager.RegisterCameraObject()</verbatim> ---++++ !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__ <verbatim>function Map3DSystem.UI.MiniMapManager.RegisterOPCObject(opcname, assetname, texturename)</verbatim> __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 * _param_ __opcname__ : OPC name __syntax__ <verbatim>function Map3DSystem.UI.MiniMapManager.UnregisterOPCObject(opcname)</verbatim> __parameters__ | *opcname* | OPC name | ---++++ !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__ <verbatim>function Map3DSystem.UI.MiniMapManager.RegisterPortalObject(portalname, texturename)</verbatim> __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__ <verbatim>function Map3DSystem.UI.MiniMapManager.UnregisterPortalObject(portalname)</verbatim> __parameters__ | *portalname* | Portal name | ---++ Mini Map Page | *Title* | Mini Map Page | | *Author(s)* | LiXizhi | | *Date* | 2008/6/22 | | *File* | script/kids/3DMapSystemUI/MiniMap/MiniMapPage.lua | ---+++ Description %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/MiniMap/MiniMapPage.lua"); Map3DSystem.App.MiniMap.MiniMapPage.Show() </verbatim> ---+++ 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__ <verbatim>function MiniMapPage.OnInit()</verbatim> ---++++ !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__ <verbatim>function MiniMapPage.Show(bShow, x, y)</verbatim> __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__ <verbatim>function MiniMapPage.OnCheckFixMap(checked)</verbatim> __parameters__ | *checked* | | ---++++ !MiniMapPage.OnClose open using external system web browser, such as ie __syntax__ <verbatim>function MiniMapPage.OnClose()</verbatim> ---++ 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 %T% __Sample Code__ <verbatim> 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 </verbatim> ---+++ Member Functions ---++++ !MiniMapWnd.Show <verbatim> 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, }</verbatim>; 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__ <verbatim>function MiniMapWnd.Show(bShow, parentUI)</verbatim> __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__ <verbatim>function MiniMapWnd.InitMiniSceneGraph()</verbatim> ---++++ !MiniMapWnd.OnFramemove private local _elapsedtime = 0; __syntax__ <verbatim>function MiniMapWnd.OnFramemove()</verbatim> ---++++ !MiniMapWnd.UpdateCamera update camera object position and direction __syntax__ <verbatim>function MiniMapWnd.UpdateCamera()</verbatim> ---++++ !MiniMapWnd.UpdatePortal update portal object position __syntax__ <verbatim>function MiniMapWnd.UpdatePortal()</verbatim> ---++++ !MiniMapWnd.UpdateAvatar update avatar object position __syntax__ <verbatim>function MiniMapWnd.UpdateAvatar()</verbatim> ---++++ !MiniMapWnd.UpdateOPC update opc object position __syntax__ <verbatim>function MiniMapWnd.UpdateOPC()</verbatim> ---++++ !MiniMapWnd.IsMapFixed ---------------------------- public functions ---------------------------- when character changes position, whether to rotate map or rotate character. __syntax__ <verbatim>function MiniMapWnd.IsMapFixed()</verbatim> ---++++ !MiniMapWnd.SetMapFixed when character changes position, whether to rotate map or rotate character. __syntax__ <verbatim>function MiniMapWnd.SetMapFixed(bCheck)</verbatim> __parameters__ | *bCheck* | | %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