Skip to content

Commit ae6dbf5

Browse files
committed
Add Shortcut API
1 parent cabf26d commit ae6dbf5

File tree

11 files changed

+742
-21
lines changed

11 files changed

+742
-21
lines changed

example/app/consts.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
local M = {}
22

3-
M.game_width = 1250
3+
M.game_width = 1600
44
M.game_height = 1500
55

66
M.gui_order = {BACKGROUND = 0, DEFAULT = 1, TRANSITION = 14, DEBUG = 15}

example/transition.gui

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ background_color {
1111
}
1212
nodes {
1313
position {
14-
x: 625.0
14+
x: 800.0
1515
y: 750.0
1616
z: 0.0
1717
w: 1.0
@@ -29,7 +29,7 @@ nodes {
2929
w: 1.0
3030
}
3131
size {
32-
x: 1258.0
32+
x: 1608.0
3333
y: 1508.0
3434
z: 0.0
3535
w: 1.0
@@ -62,6 +62,7 @@ nodes {
6262
alpha: 1.0
6363
template_node_child: false
6464
size_mode: SIZE_MODE_MANUAL
65+
custom_type: 0
6566
}
6667
layers {
6768
name: "common"

example/ysdkdebug/pg_shortcut.lua

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
local druid = require("druid.druid")
2+
local druid_style = require("example.ysdkdebug.druid_style")
3+
local table_util = require("example.ysdkdebug.table_util")
4+
5+
local yagames = require("yagames.yagames")
6+
7+
local log_print = require("example.ysdkdebug.log_print")
8+
local print = log_print.print
9+
10+
local M = {}
11+
12+
function M.can_show_prompt_handler(self)
13+
yagames.shortcut_can_show_prompt(function(self, err, result)
14+
print("yagames.shortcut_can_show_prompt():", err or table_util.tostring(result))
15+
end)
16+
end
17+
18+
function M.show_prompt_handler(self)
19+
yagames.shortcut_show_prompt(function(self, err, result)
20+
print("yagames.shortcut_show_prompt():", err or table_util.tostring(result))
21+
end)
22+
end
23+
24+
function M.init(self)
25+
druid_style.make_button(self, "button_shortcut_can_show_prompt", M.can_show_prompt_handler)
26+
druid_style.make_button(self, "button_shortcut_show_prompt", M.show_prompt_handler)
27+
end
28+
29+
return M

0 commit comments

Comments
 (0)