---++!! !BlueprintAppDev __description__: 娴忚銆佷娇鐢ㄣ€佸埗浣?D宸ョ▼鍥撅紱涓庢湅鍙嬪垎浜綘鐨?D浣滃搧. 涓昏鏄畝鍖栫敤鎴峰湪骞虫椂鍜屾煇浜汚PP涓殑鍒涗綔銆傚簲璇ヤ篃浼氭湁浜哄垱閫犲嚭闈炲父濂界殑宸ョ▼鍥撅紝鍦ㄥ叧绯荤綉涓祦浼犲紑鏉ャ€傜帺瀹剁殑鑳屽寘涓彲浠ユ湁鏈嬪弸鐨勶紝鑷繁鐨勶紝浠栦汉鐨勫伐绋嬪浘绾搞€傚伐绋嬪浘APP鏄畼鏂规瘮杈冮噸瑕佺殑APP涔嬩竴 %TOC{title="Contents:"}% %STARTINCLUDE% ---++ Blueprint app for Paraworld | *Title* | Blueprint app for Paraworld | | *Author(s)* | LiXizhi | | *Date* | 2008/1/12 | | *File* | script/kids/3DMapSystemApp/BlueprintApp/app_main.lua | ---+++ Description db registration insert script INSERT INTO apps VALUES (NULL, 'Blueprint_GUID', 'Blueprint', '1.0.0', 'http://www.paraengine.com/apps/Blueprint_v1.zip', 'YourCompany', 'enUS', 'script/kids/3DMapSystemApp/BlueprintApp/IP.xml', '', 'script/kids/3DMapSystemApp/BlueprintApp/app_main.lua', 'Map3DSystem.App.Blueprint.MSGProc', 1); %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemApp/BlueprintApp/app_main.lua"); </verbatim> ---+++ Member Functions ---++++ !Map3DSystem.App.Blueprint.OnConnection requires ------------------------------------------- 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.Blueprint.OnConnection(app, connectMode)</verbatim> __parameters__ | *app* | the object representing the current application in the IDE. | | *connectMode* | | ---++++ !Map3DSystem.App.Blueprint.OnDisconnection Receives notification that the Add-in is being unloaded. __syntax__ <verbatim>function Map3DSystem.App.Blueprint.OnDisconnection(app, disconnectMode)</verbatim> __parameters__ | *app* | | | *disconnectMode* | | ---++++ !Map3DSystem.App.Blueprint.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.Blueprint.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.Blueprint.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.Blueprint.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.Blueprint.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.Blueprint.OnRenderBox(mcmlData)</verbatim> __parameters__ | *mcmlData* | | ---++++ !Map3DSystem.App.Blueprint.Navigate called when the user wants to nagivate to the 3D world location relavent to this application __syntax__ <verbatim>function Map3DSystem.App.Blueprint.Navigate()</verbatim> ---++++ !Map3DSystem.App.Blueprint.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.Blueprint.GotoHomepage()</verbatim> ---++++ !Map3DSystem.App.Blueprint.DoQuickAction called when user clicks the quick action for this application. __syntax__ <verbatim>function Map3DSystem.App.Blueprint.DoQuickAction()</verbatim> ---++++ !Map3DSystem.App.Blueprint.OnActivateDesktop Add terrain, sky and ocean button to the toolbar. __syntax__ <verbatim>function Map3DSystem.App.Blueprint.OnActivateDesktop()</verbatim> ---++++ !Map3DSystem.App.Blueprint.OnDeactivateDesktop deactivate:clear miniscene graphs if any. __syntax__ <verbatim>function Map3DSystem.App.Blueprint.OnDeactivateDesktop()</verbatim> ---++++ !Map3DSystem.App.Blueprint.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.Blueprint.MSGProc(window, msg)</verbatim> __parameters__ | *window* | | | *msg* | | ---++ Bills Of Materials window for a given blueprint | *Title* | Bills Of Materials window for a given blueprint | | *Author(s)* | LiXizhi | | *Date* | 2008/1/12 | | *File* | script/kids/3DMapSystemApp/BlueprintApp/BomWnd.lua | ---+++ Description %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemApp/BlueprintApp/BomWnd.lua"); -- to create a bom local bom -- = {radius= 10, center = {x,y,z}}; bom = Map3DSystem.App.Blueprint.CreateNewBom(bom); Map3DSystem.App.Blueprint.SelectBom(bom); -- to open a bom local bom = Map3DSystem.App.Blueprint.LoadBomFromFile(filename); if(bom~=nil) then bom.center.x, bom.center.y,bom.center.z = ParaScene.GetPlayer():GetPosition(); Map3DSystem.App.Blueprint.SelectBom(bom); else _guihelper.MessageBox("鏃犳硶鎵撳紑宸ョ▼鍥炬枃浠?"..filename); end </verbatim> ---+++ Member Functions ---++++ !BomWnd.Bom:new <verbatim> common control library NPL.load("(gl)script/ide/common_control.lua"); local BomWnd = {} commonlib.setfield("Map3DSystem.App.Blueprint.BomWnd", BomWnd); BomWnd.BomStatus = { -- a newly created empty bom, Empty = nil, -- a bom that is being designed. Designing = 1, -- a bom that is being built by user manually. Building = 2, -- a bom that is being automatically deployed. Deploying = 3, -- a bom that is being previewed in miniscenegraph, user needs to decide whether to build it themselves or buy it. Preview = 4, }; a single bom template BomWnd.Bom = { -- item GUID string. if this is nil, the item is never uploaded before. id = nil, author = nil, name = nil, description = nil, -- E price and P price. priceE = nil, priceP = nil, -- array of objects {} in building order objects = nil, ------------------------------------------- -- per instance ------------------------------------------- -- point of reference {x, y, z} center = nil, -- the radius of the building site. this determines how large we should rendering the construction spot. radius = 10, -- facing facing = 0, -- status of type BomWnd.BomStatus status = nil, -- the number of steps (objects) that have been deployed during automatic deploy or build. -- if this number equals to the size of Bom.objects, then the building is finished. BuildingStep = 0, -- whether to ignore wrong object creation bIgnoreWrongCreation = nil, }</verbatim>; TODO: a list of active boms in the scene. BomWnd.Boms = {}; the currently selected bom that the current BomWnd is bind to. BomWnd.CurBom = nil; create a new bom __syntax__ <verbatim>function BomWnd.Bom:new(o)</verbatim> __parameters__ | *o* | | ---++++ !BomWnd.Bom:ClearAll clear all objects __syntax__ <verbatim>function BomWnd.Bom:ClearAll()</verbatim> ---++++ !BomWnd.Bom:AddObject add a new object to the bom list. it is usually the table returned from ObjEditor.GetObjectParams(). however, one needs to manually assign an optional field called cmdName, which contains information about command button (Icon to display, etc) if objParam.cmdName is nil, the icon in the BomWnd for this object will be a question mark, indicating that it will only be deployed when user is implementing manually. __syntax__ <verbatim>function BomWnd.Bom:AddObject(objParam)</verbatim> __parameters__ | *objParam* | | ---++++ !Map3DSystem.App.Blueprint.CreateNewBom create a new bom. One can later call SelectBom to select it by UI. * _param_ __bom__ : partial class of BomWnd.Bom. if bom is nil, a default one at the current player position will be created. otherwise, the caller can specify where to create the bom and how big is the construction site. * _return_ __return__ : the bom object created. __syntax__ <verbatim>function Map3DSystem.App.Blueprint.CreateNewBom(bom)</verbatim> __parameters__ | *bom* | partial class of BomWnd.Bom. if bom is nil, a default one at the current player position will be created. otherwise, the caller can specify where to create the bom and how big is the construction site. | ---++++ !Map3DSystem.App.Blueprint.LoadBomFromFile load bom from file. it returned the bom object. it may return nil if failed. __syntax__ <verbatim>function Map3DSystem.App.Blueprint.LoadBomFromFile(filename)</verbatim> __parameters__ | *filename* | | ---++++ !BomWnd.SelectAllToBom select all things in the bom region to bom's object list __syntax__ <verbatim>function BomWnd.SelectAllToBom()</verbatim> ---++++ !BomWnd.UpdateTreeView private: update the BOM tree view according to the curren bom list's objects __syntax__ <verbatim>function BomWnd.UpdateTreeView()</verbatim> ---++++ !Map3DSystem.App.Blueprint.SelectBom select a bom as the current bom and display its BomWnd. when a bom is (de)selected, it will (un)hook object creation events. * _param_ __bom__ : the bom object to be selected. if nil, nothing will be selected. __syntax__ <verbatim>function Map3DSystem.App.Blueprint.SelectBom(bom)</verbatim> __parameters__ | *bom* | the bom object to be selected. if nil, nothing will be selected. | ---++++ !Map3DSystem.App.Blueprint.UpdateScenegraphHelper update the 3d helper in the miniscenegraph. __syntax__ <verbatim>function Map3DSystem.App.Blueprint.UpdateScenegraphHelper(bom)</verbatim> __parameters__ | *bom* | | ---++++ !Map3DSystem.App.Blueprint.ShowBomWnd display the bom window. It will rebuilt bom each time it is called. __syntax__ <verbatim>function Map3DSystem.App.Blueprint.ShowBomWnd(_app)</verbatim> __parameters__ | *app* | | ---++++ !Map3DSystem.App.Blueprint.BomHookProc hook procedure to detect what object the user has created. __syntax__ <verbatim>function Map3DSystem.App.Blueprint.BomHookProc(nCode, appName, msg)</verbatim> __parameters__ | *nCode* | | | *appName* | | | *msg* | | ---++++ !BomWnd.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 BomWnd.Show(bShow, _parent, parentWindow)</verbatim> __parameters__ | *bShow* | boolean to show or hide. if nil, it will toggle current setting. | | *parent* | | | *parentWindow* | | ---++++ !BomWnd.OnDestroy destory the control __syntax__ <verbatim>function BomWnd.OnDestroy()</verbatim> ---++++ !BomWnd.SaveBom save the bom to file and optional publish it to app server. __syntax__ <verbatim>function BomWnd.SaveBom()</verbatim> ---++++ !BomWnd.BuyBom Purchase the bom __syntax__ <verbatim>function BomWnd.BuyBom()</verbatim> ---++++ !BomWnd.DIYBom TODO: save the bom to file and optional publish it to app server. __syntax__ <verbatim>function BomWnd.DIYBom()</verbatim> ---++++ !BomWnd.PreviewBom TODO: switch to preview mode __syntax__ <verbatim>function BomWnd.PreviewBom()</verbatim> ---++++ !BomWnd.FinishBom TODO: finish DIY building __syntax__ <verbatim>function BomWnd.FinishBom()</verbatim> ---++++ !BomWnd.OnSizeChangeBlueprint when the user changes the size of the miniscene graph. __syntax__ <verbatim>function BomWnd.OnSizeChangeBlueprint(sCtrlName)</verbatim> __parameters__ | *sCtrlName* | | ---++++ !BomWnd.OnClickPreviewInPlace preview a ready-made blueprint in the current 3D scene using miniscenegraph. __syntax__ <verbatim>function BomWnd.OnClickPreviewInPlace()</verbatim> ---++++ !BomWnd.OnClickPreviewRelocateCenter relocate the center position of the construction site at the current player location * _param_ __x__ :,y,z: if nil, the current player position is used. __syntax__ <verbatim>function BomWnd.OnClickPreviewRelocateCenter(x,y,z)</verbatim> __parameters__ | *x* | ,y,z: if nil, the current player position is used. | | *y* | | | *z* | | ---++++ !BomWnd.OnClickClose close __syntax__ <verbatim>function BomWnd.OnClickClose()</verbatim> ---++++ !BomWnd.MSGProc normal windows messages here __syntax__ <verbatim>function BomWnd.MSGProc(window, msg)</verbatim> __parameters__ | *window* | | | *msg* | | ---++ template: windows form or modeless dialog | *Title* | template: windows form or modeless dialog | | *Author(s)* | [your name], original template by LiXizhi | | *Date* | 2007/2/7 | | *File* | script/kids/3DMapSystemApp/BlueprintApp/Homepage.lua | ---+++ Description %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemApp/BlueprintApp/Homepage.lua"); Homepage.Show(); </verbatim> ---+++ Member Functions ---++++ !Homepage.Show common control library NPL.load("(gl)script/ide/common_control.lua"); if(not Homepage) then Homepage={}; end * _param_ __bShow__ : boolean to show or hide. if nil, it will toggle current setting. __syntax__ <verbatim>function Homepage.Show(bShow)</verbatim> __parameters__ | *bShow* | boolean to show or hide. if nil, it will toggle current setting. | ---++++ !Homepage.OnDestory destory the control __syntax__ <verbatim>function Homepage.OnDestory()</verbatim> ---++ save a collection of objects on the construction site | *Title* | save a collection of objects on the construction site | | *Author(s)* | LiXizhi | | *Date* | 2008/1/14 | | *File* | script/kids/3DMapSystemApp/BlueprintApp/SaveBom.lua | ---+++ Description %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemApp/BlueprintApp/SaveBom.lua"); SaveBom.ShowWnd(_app); </verbatim> ---+++ Member Functions ---++++ !Map3DSystem.App.Blueprint.ShowWnd common control library NPL.load("(gl)script/ide/common_control.lua"); commonlib.setfield("Map3DSystem.App.Blueprint.SaveBom", {}); create and show a sub window of a given application * _param_ ____ :_app: the os.app object. __syntax__ <verbatim>function Map3DSystem.App.Blueprint.ShowWnd(_app)</verbatim> __parameters__ | *app* | | ---++++ !Map3DSystem.App.Blueprint.SaveBom.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.App.Blueprint.SaveBom.Show(bShow, _parent, parentWindow)</verbatim> __parameters__ | *bShow* | boolean to show or hide. if nil, it will toggle current setting. | | *parent* | | | *parentWindow* | | ---++++ !Map3DSystem.App.Blueprint.SaveBom.OnDestory destory the control __syntax__ <verbatim>function Map3DSystem.App.Blueprint.SaveBom.OnDestory()</verbatim> ---++++ !Map3DSystem.App.Blueprint.SaveBom.OnMouseDown ---------------------------------------------------- window events ---------------------------------------------------- mouse down position Map3DSystem.App.Blueprint.SaveBom.lastMouseDown = {x = 0, y=0} Map3DSystem.App.Blueprint.SaveBom.lastMousePos = {x = 0, y=0} whether mouse button is down Map3DSystem.App.Blueprint.SaveBom.IsMouseDown = false; __syntax__ <verbatim>function Map3DSystem.App.Blueprint.SaveBom.OnMouseDown()</verbatim> ---++++ !Map3DSystem.App.Blueprint.SaveBom.OnSave save the current to a file and call the inventory give function. __syntax__ <verbatim>function Map3DSystem.App.Blueprint.SaveBom.OnSave()</verbatim> %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