forked from NPLPackages/main
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,594 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
script/apps/Aries/Creator/Game/Code/NplMicroRobot/MicrobitEmulatorPage.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<!-- "script/apps/Aries/Creator/Game/Code/NplMicroRobot/MicrobitEmulatorPage.html" --> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<title></title> | ||
</head> | ||
<body> | ||
<pe:mcml> | ||
<script refresh="false" type="text/npl" src="MicrobitEmulatorPage.lua"><![CDATA[ | ||
NPL.load("(gl)script/apps/Aries/Creator/Game/game_logic.lua"); | ||
local GameLogic = commonlib.gettable("MyCompany.Aries.Game.GameLogic") | ||
MicrobitEmulatorPage = NPL.load("(gl)script/apps/Aries/Creator/Game/Code/NplMicroRobot/MicrobitEmulatorPage.lua"); | ||
MicrobitEmulatorPage.OnInit(); | ||
local page = document:GetPageCtrl(); | ||
|
||
function OnMicrobitShowString(args,msg) | ||
msg = msg or {}; | ||
local txt = msg.msg or "" | ||
page:SetValue("console",txt); | ||
end | ||
function ClosePage() | ||
GameLogic.GetCodeGlobal():UnregisterTextEvent("microbit_show_string",OnMicrobitShowString) | ||
page:CloseWindow(); | ||
end | ||
function OnClick(name) | ||
GameLogic:event(System.Core.Event:new():init(name)) | ||
end | ||
function OnSelect(name,value) | ||
value = string.format("microbit_gesture_%s",value); | ||
GameLogic:event(System.Core.Event:new():init(value)) | ||
end | ||
|
||
GameLogic.GetCodeGlobal():RegisterTextEvent("microbit_show_string", OnMicrobitShowString) | ||
]]></script> | ||
<aries:window mode="thin" title='<%=L"Microbit模拟器"%>' onclose="ClosePage"> | ||
<div style="width:300px;height:280px;"> | ||
<div style="width:297px;height:244px;margin-left:-4px;margin-top:5px;background:url(Mod/NplMicroRobot/textures/microbit.png#0 0 366 298)" > | ||
<div style="position:relative;margin-left:15px;margin-top:105px;"> | ||
<input type="button" name="microbit_btn_A" onclick="OnClick" style="width:35px;height:35px;"/> | ||
</div> | ||
<div style="position:relative;margin-left:249px;margin-top:105px;"> | ||
<input type="button" name="microbit_btn_B" onclick="OnClick" style="width:35px;height:35px;"/> | ||
</div> | ||
<div style="position:relative;margin-left:180px;margin-top:5px;"> | ||
<select name='options' AllowUserEdit="false" style="width:100px;height:22px" onselect="OnSelect"> | ||
<option value="Shake" selected="true">Shake</option> | ||
<option value="LogoUp">LogoUp</option> | ||
<option value="LogoDown">LogoDown</option> | ||
<option value="ScreenUp">ScreenUp</option> | ||
<option value="ScreenDown">ScreenDown</option> | ||
<option value="TiltLeft">TiltLeft</option> | ||
<option value="TiltRight">TiltRight</option> | ||
<option value="FreeFall">FreeFall</option> | ||
<option value="ThreeG">ThreeG</option> | ||
<option value="SixG">SixG</option> | ||
<option value="EightG">EightG</option> | ||
</select> | ||
</div> | ||
<div style="position:relative;margin-left:90px;margin-top:65px;width:125px;height:120px;"> | ||
<input name="console" AlwaysShowCurLineBackground="false" rows="3" height="100%" ReadOnly="true" UseSystemControl="true" style="textcolor:#ffffff;line-height:16" fontsize="12"/> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</aries:window> | ||
</pe:mcml> | ||
</body> | ||
</html> | ||
|
38 changes: 38 additions & 0 deletions
38
script/apps/Aries/Creator/Game/Code/NplMicroRobot/MicrobitEmulatorPage.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--[[ | ||
Title: MicrobitEmulatorPage | ||
Author(s): leio | ||
Date: 2020.1.17 | ||
Desc: | ||
use the lib: | ||
------------------------------------------------------------ | ||
local MicrobitEmulatorPage = NPL.load("(gl)script/apps/Aries/Creator/Game/Code/NplMicroRobot/MicrobitEmulatorPage.lua"); | ||
MicrobitEmulatorPage.ShowPage(); | ||
------------------------------------------------------------ | ||
]] | ||
local MicrobitEmulatorPage = NPL.export(); | ||
MicrobitEmulatorPage.url = "script/apps/Aries/Creator/Game/Code/NplMicroRobot/MicrobitEmulatorPage.html"; | ||
function MicrobitEmulatorPage.OnInit() | ||
MicrobitEmulatorPage.page = document:GetPageCtrl(); | ||
end | ||
function MicrobitEmulatorPage.ShowPage() | ||
local params = { | ||
url = MicrobitEmulatorPage.url, | ||
name = "MicrobitEmulatorPage.ShowPage", | ||
app_key=MyCompany.Aries.app.app_key, | ||
isShowTitleBar = false, | ||
DestroyOnClose = true, | ||
bToggleShowHide = false, | ||
enable_esc_key = true, | ||
style = CommonCtrl.WindowFrame.ContainerStyle, | ||
allowDrag = true, | ||
zorder = -1, | ||
click_through = false, | ||
directPosition = true, | ||
align = "_lt", | ||
x = 0, | ||
y = 80, | ||
width = 300, | ||
height = 280, | ||
} | ||
System.App.Commands.Call("File.MCMLWindowFrame", params); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.