RoomHostAppDev
description: 为应用程序开发商和用户集中的提供创建、加入他人世界的房间服务
RoomHostApp? app for Paraworld
| Title |
RoomHostApp? app for Paraworld |
| Author(s) |
LiXizhi |
| Date |
2008/1/5 |
| File |
script/kids/3DMapSystemApp/RoomHostApp/app_main.lua |
Description
db registration insert script
INSERT INTO apps VALUES (NULL, 'RoomHostApp_GUID', 'RoomHostApp', '1.0.0', 'http://www.paraengine.com/apps/RoomHostApp_v1.zip', 'YourCompany', 'enUS', 'script/kids/3DMapSystemApp/RoomHostApp/IP.xml', '', 'script/kids/3DMapSystemApp/RoomHostApp/app_main.lua', 'Map3DSystem.App.RoomHostApp.MSGProc', 1);
Sample Code
NPL.load("(gl)script/kids/3DMapSystemApp/RoomHostApp/app_main.lua");
Member Functions
Map3DSystem.App.RoomHostApp.OnConnection
requires
create class
commonlib.setfield("Map3DSystem.App.RoomHostApp", {});
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
function Map3DSystem.App.RoomHostApp.OnConnection(app, connectMode)
parameters
| app |
the object representing the current application in the IDE. |
| connectMode |
|
Map3DSystem.App.RoomHostApp.OnDisconnection
Receives notification that the Add-in is being unloaded.
syntax
function Map3DSystem.App.RoomHostApp.OnDisconnection(app, disconnectMode)
parameters
Map3DSystem.App.RoomHostApp.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
function Map3DSystem.App.RoomHostApp.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 Map3DSystem? .App.CommandStatus. |
Map3DSystem.App.RoomHostApp.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.RoomHostApp.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.RoomHostApp.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.RoomHostApp.OnRenderBox(mcmlData)
parameters
Map3DSystem.App.RoomHostApp.Navigate
called when the user wants to nagivate to the 3D world location relavent to this application
syntax
function Map3DSystem.App.RoomHostApp.Navigate()
Map3DSystem.App.RoomHostApp.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.RoomHostApp.GotoHomepage()
Map3DSystem.App.RoomHostApp.DoQuickAction
called when user clicks the quick action for this application.
syntax
function Map3DSystem.App.RoomHostApp.DoQuickAction()
Map3DSystem.App.RoomHostApp.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.RoomHostApp.MSGProc(window, msg)
parameters
Map3DSystem.App.RoomHostApp.OnDestory
destory the control
syntax
function Map3DSystem.App.RoomHostApp.OnDestory()
Map3DSystem.App.RoomHostApp.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.App.RoomHostApp.Show(bShow, _parent, parentWindow)
parameters
| bShow |
boolean to show or hide. if nil, it will toggle current setting. |
| parent |
|
| parentWindow |
|
RoomHostService?
| Title |
RoomHostService? |
| Author(s) |
LiXizhi |
| Date |
2008/1/12 |
| File |
script/kids/3DMapSystemApp/RoomHostApp/RoomHostService.lua |
Description
Sample Code
NPL.load("(gl)script/kids/3DMapSystemApp/RoomHostApp/RoomHostService.lua");
Member Functions
Map3DSystem.App.RoomHostService.CreateRoom
requires
create class
if(not
Map3DSystem? .App.RoomHostService) then
Map3DSystem? .App.RoomHostService = {} end
Send a request to server to create a new room for a given application using the current user session and user_id.
- param password : whether room is locked by password.
syntax
function Map3DSystem.App.RoomHostService.CreateRoom(app_key, roomName, password, MinTimeOut, MaxPeopleAllowed, level)
parameters
| app |
|
| key |
|
| roomName |
|
| password |
whether room is locked by password. |
| MinTimeOut |
|
| MaxPeopleAllowed |
|
| level |
|
Map3DSystem.App.RoomHostService.JoinRoom
Send a request to join a given room.
syntax
function Map3DSystem.App.RoomHostService.JoinRoom(app_key, room_id, password)
parameters
Map3DSystem.App.RoomHostService.GetRoomList
Send a request to get all latest rooms of an application.
- param app :_key: if application key is nil, it will return latest rooms regardless of applications.
- param pageNumber : 1 based index of page.
- param ItemsPerPage : default to 10
syntax
function Map3DSystem.App.RoomHostService.GetRoomList(app_key, pageNumber, ItemsPerPage)
parameters
| app |
_key: if application key is nil, it will return latest rooms regardless of applications. |
| key |
|
| pageNumber |
|
| ItemsPerPage |
default to 10 |
Map3DSystem.App.RoomHostService.GetAppList
Get applications with active rooms. For example we can sort by hottest or latest, etc.
- param pageNumber : 1 based index of page.
- param ItemsPerPage : default to 10
syntax
function Map3DSystem.App.RoomHostService.GetAppList(sortMethod, pageNumber, ItemsPerPage)
parameters
| sortMethod |
|
| pageNumber |
1 based index of page. |
| ItemsPerPage |
|
A room list control that can be used by many applications for room services.
| Title |
A room list control that can be used by many applications for room services. |
| Author(s) |
LiXizhi |
| Date |
2007/2/7 |
| File |
script/kids/3DMapSystemApp/RoomHostApp/RoomListCtl.lua |
Description
Sample Code
NPL.load("(gl)script/kids/3DMapSystemApp/RoomHostApp/RoomListCtl.lua");
local ctl = Map3DSystem.App.RoomListCtl:new{
name = "RoomListCtl1",
alignment = "_lt",
left=0, top=0,
width = 512,
height = 290,
parent = nil,
};
ctl:Show();
Member Functions
RoomListCtl:new
common control library
NPL.load("(gl)script/ide/common_control.lua");
define a new control in the common control libary
default member attributes
local RoomListCtl = {
-- the top level control name
name = "RoomListCtl1",
-- normal window size
alignment = "_lt",
left = 0,
top = 0,
width = 512,
height = 290,
parent = nil,
bShowLevel = true,
}
Map3DSystem? .App.RoomListCtl =
RoomListCtl? ;
constructor
syntax
function RoomListCtl:new (o)
parameters
RoomListCtl:Destroy
Destroy the UI control
syntax
function RoomListCtl:Destroy ()
RoomListCtl:Show
- param bShow : boolean to show or hide. if nil, it will toggle current setting.
syntax
function RoomListCtl:Show(bShow)
parameters
| bShow |
boolean to show or hide. if nil, it will toggle current setting. |
RoomListCtl.OnClose
close the given control
syntax
function RoomListCtl.OnClose(sCtrlName)
parameters
RoomListCtl.OnClickRoomNode
this function is called, when a room node is clicked.
syntax
function RoomListCtl.OnClickRoomNode(treeNode)
parameters
RoomListCtl.DrawRoomNodeHandler
owner draw function to
RoomListCtl?
syntax
function RoomListCtl.DrawRoomNodeHandler(_parent, treeNode)
parameters