mirror of
https://github.com/britzl/monarch.git
synced 2025-09-27 18:12:22 +02:00
Allow data to be passed when showing or going back
This commit is contained in:
@@ -181,6 +181,69 @@ nodes {
|
||||
text_leading: 1.0
|
||||
text_tracking: 0.0
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 320.0
|
||||
y: 1050.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
rotation {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
scale {
|
||||
x: 1.0
|
||||
y: 1.0
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
size {
|
||||
x: 200.0
|
||||
y: 100.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 1.0
|
||||
y: 1.0
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "<text>"
|
||||
font: "example"
|
||||
id: "level"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_CENTER
|
||||
outline {
|
||||
x: 1.0
|
||||
y: 1.0
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
shadow {
|
||||
x: 1.0
|
||||
y: 1.0
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
line_break: false
|
||||
parent: "root"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
alpha: 1.0
|
||||
outline_alpha: 1.0
|
||||
shadow_alpha: 1.0
|
||||
template_node_child: false
|
||||
text_leading: 1.0
|
||||
text_tracking: 0.0
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
max_nodes: 512
|
||||
|
@@ -3,6 +3,9 @@ local transitions = require "monarch.transitions.gui"
|
||||
|
||||
function init(self)
|
||||
msg.post(".", "acquire_input_focus")
|
||||
|
||||
local data = monarch.data(hash("game"))
|
||||
gui.set_text(gui.get_node("level"), tostring(data.level))
|
||||
|
||||
self.transition = transitions.create(gui.get_node("root"))
|
||||
.show_in(transitions.slide_in_right, gui.EASING_OUTQUAD, 0.6, 0)
|
||||
@@ -14,7 +17,7 @@ end
|
||||
function on_input(self, action_id, action)
|
||||
if action_id == hash("touch") and action.released then
|
||||
if gui.pick_node(gui.get_node("win_button"), action.x, action.y) then
|
||||
monarch.show(hash("menu"), { clear = true }, function()
|
||||
monarch.show(hash("menu"), { clear = true }, nil, function()
|
||||
print("showing menu done")
|
||||
end)
|
||||
end
|
||||
|
@@ -14,7 +14,7 @@ end
|
||||
function on_input(self, action_id, action)
|
||||
if action_id == hash("touch") and action.released then
|
||||
if gui.pick_node(gui.get_node("startgame_button"), action.x, action.y) then
|
||||
monarch.show(hash("popup"), nil, function()
|
||||
monarch.show(hash("popup"), nil, nil, function()
|
||||
print("showing popup done")
|
||||
end)
|
||||
end
|
||||
|
@@ -18,7 +18,7 @@ function on_input(self, action_id, action)
|
||||
if action_id == hash("touch") and action.released then
|
||||
if gui.pick_node(self.ok, action.x, action.y) then
|
||||
print("ok")
|
||||
monarch.show(hash("pregame"), nil, function()
|
||||
monarch.show(hash("pregame"), nil, nil, function()
|
||||
print("pregame show done")
|
||||
end)
|
||||
elseif gui.pick_node(self.cancel, action.x, action.y) then
|
||||
|
@@ -17,7 +17,7 @@ function on_input(self, action_id, action)
|
||||
if action_id == hash("touch") and action.released then
|
||||
if gui.pick_node(self.play, action.x, action.y) then
|
||||
print("play")
|
||||
monarch.show(hash("game"), nil, function()
|
||||
monarch.show(hash("game"), nil, { level = 1 }, function()
|
||||
print("showing game done")
|
||||
end)
|
||||
elseif gui.pick_node(self.back, action.x, action.y) then
|
||||
|
Reference in New Issue
Block a user