ScreenShotAppDev
description: 快速屏幕截图、上传图片、浏览其他玩家上传的图片
ScreenShot? app for Paraworld
| Title |
ScreenShot? app for Paraworld |
| Author(s) |
LiXizhi |
| Date |
2008/1/5 |
| File |
script/kids/3DMapSystemUI/ScreenShot/app_main.lua |
Description
db registration insert script
INSERT INTO apps VALUES (NULL, 'ScreenShot_GUID', 'ScreenShot', '1.0.0', 'http://www.paraengine.com/apps/ScreenShot_v1.zip', 'YourCompany', 'enUS', 'script/kids/3DMapSystemUI/ScreenShot/IP.xml', '', 'script/kids/3DMapSystemUI/ScreenShot/app_main.lua', 'MyCompany.Apps.ScreenShot.MSGProc', 1);
Sample Code
NPL.load("(gl)script/kids/3DMapSystemUI/ScreenShot/app_main.lua");
Member Functions
MyCompany.Apps.ScreenShot.OnConnection
requires
create class
commonlib.setfield("MyCompany.Apps.ScreenShot", {});
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 MyCompany.Apps.ScreenShot.OnConnection(app, connectMode)
parameters
| app |
the object representing the current application in the IDE. |
| connectMode |
|
MyCompany.Apps.ScreenShot.OnDisconnection
Receives notification that the Add-in is being unloaded.
syntax
function MyCompany.Apps.ScreenShot.OnDisconnection(app, disconnectMode)
parameters
MyCompany.Apps.ScreenShot.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 MyCompany.Apps.ScreenShot.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. |
MyCompany.Apps.ScreenShot.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 MyCompany.Apps.ScreenShot.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 |
|
MyCompany.Apps.ScreenShot.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 MyCompany.Apps.ScreenShot.OnRenderBox(mcmlData)
parameters
MyCompany.Apps.ScreenShot.Navigate
called when the user wants to nagivate to the 3D world location relavent to this application
syntax
function MyCompany.Apps.ScreenShot.Navigate()
MyCompany.Apps.ScreenShot.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 MyCompany.Apps.ScreenShot.GotoHomepage()
MyCompany.Apps.ScreenShot.DoQuickAction
called when user clicks the quick action for this application.
syntax
function MyCompany.Apps.ScreenShot.DoQuickAction()
MyCompany.Apps.ScreenShot.OnKeyDownProc
key down callback. Hook for F11 key
syntax
function MyCompany.Apps.ScreenShot.OnKeyDownProc(nCode, appName, msg)
parameters
MyCompany.Apps.ScreenShot.MSGProc
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 MyCompany.Apps.ScreenShot.MSGProc(window, msg)
parameters
code behind page for SnapshotPage? .html
| Title |
code behind page for SnapshotPage? .html |
| Author(s) |
LiXizhi |
| Date |
2008/4/28 |
| File |
script/kids/3DMapSystemUI/ScreenShot/SnapshotPage.lua |
Description
Take a screen shot. This is an sample
MCML page for some commonly used
MCML controls
Sample Code
NPL.load("(gl)script/kids/3DMapSystemUI/ScreenShot/SnapshotPage.lua");
MyCompany.Apps.ScreenShot.SnapshotPage.TakeSnapshot(filepath,width,height, IncludeUI)
Member Functions
SnapshotPage.OnInit
default snapshot
DefaultSnapShot? = "Screen Shots/auto.jpg"
page event handlers
load default values.
syntax
function SnapshotPage.OnInit()
SnapshotPage.OnClickDoAction
user clicks the do action button, we will perform the action according to the radio box selection.
syntax
function SnapshotPage.OnClickDoAction(name, values)
parameters
SnapshotPage.OnClickTakeSnapshot
take screen shot again using the current settings, and update the UI.
syntax
function SnapshotPage.OnClickTakeSnapshot()
SnapshotPage.OnClickOpenSnapshotDir
open in windows explorer
syntax
function SnapshotPage.OnClickOpenSnapshotDir()
SnapshotPage.OnSelectImageSize
User clicks the drop down box to select a new image resolution, update the UI.
syntax
function SnapshotPage.OnSelectImageSize(name, filepath)
parameters
SnapshotPage.OnClickSaveSetting
Save settings.
syntax
function SnapshotPage.OnClickSaveSetting(name, values)
parameters
SnapshotPage.OnSelectFile
User clicks an image file, preview it
syntax
function SnapshotPage.OnSelectFile(name, filepath)
parameters
SnapshotPage.OnSelectFolder
user selects a new screenshot folder, update treeview
syntax
function SnapshotPage.OnSelectFolder(name, folderPath)
parameters
SnapshotPage.OnClickSetAsCurrent
set selected file as current file, so that it can be send to friends, etc.
syntax
function SnapshotPage.OnClickSetAsCurrent()
SnapshotPage.OnClickOpenFolder
open current folder in external file browser
syntax
function SnapshotPage.OnClickOpenFolder()
SnapshotPage.OnClickDeleteFile
delete the selected file
syntax
function SnapshotPage.OnClickDeleteFile()
SnapshotPage.TakeSnapshot
public function
public function: call this function to take a new screen shot.
- param filepath :,width,height, IncludeUI? : all input can be nil.
- return __ : true if succeed
syntax
function SnapshotPage.TakeSnapshot(filepath,width,height, IncludeUI)
parameters
| filepath |
,width,height, IncludeUI? : all input can be nil. |
| width |
|
| height |
|
| IncludeUI |
|
Upload Artwork. [OBSOLETED on 2008.4.29: use SnapshotPage? .html instead!]
| Title |
Upload Artwork. [OBSOLETED on 2008.4.29: use SnapshotPage? .html instead!] |
| Author(s) |
LiXizhi |
| Date |
2008/1/10 |
| File |
script/kids/3DMapSystemUI/ScreenShot/UploadArtwork.lua |
Description
Sample Code
NPL.load("(gl)script/kids/3DMapSystemUI/ScreenShot/UploadArtwork.lua");
UploadArtwork.Show();
Member Functions
UploadArtwork.ShowHistory
web service
for testing local web services
UploadArtwork.webservice_UploadUserFile = CommonCtrl.Locale("KidsUI")("UploadUserFile.asmx");
UploadArtwork.webservice_SubmitArticle = CommonCtrl.Locale("KidsUI")("SubmitArticle.asmx");
UploadArtwork.webservice_UploadUserFile = "http://localhost:1225/KidsMovieSite/UploadUserFile.asmx";
UploadArtwork.webservice_SubmitArticle = "http://localhost:1225/KidsMovieSite/SubmitArticle.asmx";
appearance
UploadArtwork.pagetab_bg = "Texture/kidui/worldmanager/tab_unselected.png"
UploadArtwork.pagetab_selected_bg = "Texture/kidui/worldmanager/tab_selected.png"
UploadArtwork.button_bg = "Texture/kidui/explorer/button.png"
UploadArtwork.listbox_bg = "Texture/kidui/explorer/listbox_bg.png"
UploadArtwork.dropdownarrow_bg = "Texture/kidui/explorer/dropdown_arrow.png"
UploadArtwork.dropdownlist_cont_bg = "Texture/kidui/explorer/editbox256x32.png"
UploadArtwork.editbox_bg = "Texture/kidui/explorer/editbox128x32.png"
UploadArtwork.editbox_long_bg = "Texture/kidui/explorer/editbox256x32.png"
tab pages
UploadArtwork.tabpages = {"UploadArt_tabPage_Web", "UploadArt_tabPage_Local",};
UploadArtwork.tabbuttons = {"UploadArt_tabPage_Web_TabBtn", "UploadArt_tabPage_Local_TabBtn",};
constants
UploadArtwork.historyfile = "temp/artwork_history.txt";
current work
UploadArtwork.current = {
IsFinished = true,
category = 101,
Title = "",
ImageURL = "",
articleURL = "",
Abstract = "",
};
syntax
function UploadArtwork.ShowHistory(bShow)
parameters
UploadArtwork.Show
- param bShow : boolean to show or hide. if nil, it will toggle current setting.
syntax
function UploadArtwork.Show(bShow)
parameters
| bShow |
boolean to show or hide. if nil, it will toggle current setting. |
UploadArtwork.Close
close window
syntax
function UploadArtwork.Close()
UploadArtwork.OnClickUpload
when the user clicked the upload button
syntax
function UploadArtwork.OnClickUpload()
UploadArtwork.OnClickUpload_imp
call this function to load image if the user is already authenticated.
syntax
function UploadArtwork.OnClickUpload_imp()