mirror of
https://github.com/defold/extension-iap
synced 2025-09-27 09:02:18 +02:00
Almost done
This commit is contained in:
181
main/main.gui
181
main/main.gui
@@ -169,7 +169,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 485.0
|
||||
x: 530.0
|
||||
y: 56.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
@@ -199,7 +199,7 @@ nodes {
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "reset"
|
||||
id: "restore"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
alpha: 1.0
|
||||
@@ -226,7 +226,7 @@ nodes {
|
||||
w: 1.0
|
||||
}
|
||||
size {
|
||||
x: 300.0
|
||||
x: 200.0
|
||||
y: 88.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
@@ -240,12 +240,12 @@ nodes {
|
||||
type: TYPE_BOX
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
texture: "button/button_normal"
|
||||
id: "reset/larrybutton"
|
||||
id: "restore/larrybutton"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_CENTER
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
parent: "reset"
|
||||
parent: "restore"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
@@ -258,6 +258,7 @@ nodes {
|
||||
clipping_visible: true
|
||||
clipping_inverted: false
|
||||
alpha: 1.0
|
||||
overridden_fields: 4
|
||||
template_node_child: true
|
||||
size_mode: SIZE_MODE_MANUAL
|
||||
}
|
||||
@@ -294,9 +295,9 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Reset"
|
||||
text: "Restore"
|
||||
font: "larryfont"
|
||||
id: "reset/larrylabel"
|
||||
id: "restore/larrylabel"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_CENTER
|
||||
@@ -314,7 +315,7 @@ nodes {
|
||||
}
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
line_break: false
|
||||
parent: "reset/larrybutton"
|
||||
parent: "restore/larrybutton"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
alpha: 1.0
|
||||
@@ -705,7 +706,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 159.0
|
||||
x: 109.0
|
||||
y: 56.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
@@ -762,7 +763,7 @@ nodes {
|
||||
w: 1.0
|
||||
}
|
||||
size {
|
||||
x: 300.0
|
||||
x: 200.0
|
||||
y: 88.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
@@ -794,6 +795,7 @@ nodes {
|
||||
clipping_visible: true
|
||||
clipping_inverted: false
|
||||
alpha: 1.0
|
||||
overridden_fields: 4
|
||||
template_node_child: true
|
||||
size_mode: SIZE_MODE_MANUAL
|
||||
}
|
||||
@@ -1019,6 +1021,165 @@ nodes {
|
||||
text_leading: 1.0
|
||||
text_tracking: 0.0
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 320.0
|
||||
y: 56.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_TEMPLATE
|
||||
id: "pending"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
alpha: 1.0
|
||||
template: "/dirtylarry/button.gui"
|
||||
template_node_child: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 0.0
|
||||
y: 0.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: 88.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 1.0
|
||||
y: 1.0
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
texture: "button/button_normal"
|
||||
id: "pending/larrybutton"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_CENTER
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
parent: "pending"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
z: 32.0
|
||||
w: 32.0
|
||||
}
|
||||
clipping_mode: CLIPPING_MODE_NONE
|
||||
clipping_visible: true
|
||||
clipping_inverted: false
|
||||
alpha: 1.0
|
||||
overridden_fields: 4
|
||||
template_node_child: true
|
||||
size_mode: SIZE_MODE_MANUAL
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 0.0
|
||||
y: 0.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: "Pending"
|
||||
font: "larryfont"
|
||||
id: "pending/larrylabel"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_CENTER
|
||||
outline {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.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: "pending/larrybutton"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
alpha: 1.0
|
||||
outline_alpha: 1.0
|
||||
shadow_alpha: 1.0
|
||||
overridden_fields: 8
|
||||
template_node_child: true
|
||||
text_leading: 1.0
|
||||
text_tracking: 0.0
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
max_nodes: 512
|
||||
|
@@ -36,11 +36,21 @@ local function log(fmt, ...)
|
||||
gui.set_text(gui.get_node("log"), s)
|
||||
end
|
||||
|
||||
local function process_pending_transactions()
|
||||
log("iap.process_pending_transactions()")
|
||||
iap.process_pending_transactions()
|
||||
end
|
||||
|
||||
local function buy(id)
|
||||
log("iap.buy() " .. id)
|
||||
iap.buy(id)
|
||||
end
|
||||
|
||||
local function restore()
|
||||
log("iap.restore()")
|
||||
iap.restore()
|
||||
end
|
||||
|
||||
local function list()
|
||||
log("iap.list()")
|
||||
for item, button in pairs(item_buttons) do
|
||||
@@ -67,12 +77,12 @@ end
|
||||
|
||||
|
||||
local function buy_listener(self, transaction, error)
|
||||
pprint(transaction, error)
|
||||
pprint(transaction)
|
||||
if error then
|
||||
log("iap.buy() error %s - %s", tostring(error.error), tostring(error.reason))
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
if iap.get_provider_id() == iap.PROVIDER_ID_GOOGLE and transaction.ident == NON_CONSUMABLE then
|
||||
log("iap.buy() ok - google")
|
||||
gui.set_color(gui.get_node("reset/larrylabel"), vmath.vector4(1,1,1,1))
|
||||
@@ -109,5 +119,11 @@ function on_input(self, action_id, action)
|
||||
dirtylarry:button("list", action_id, action, function()
|
||||
list()
|
||||
end)
|
||||
dirtylarry:button("restore", action_id, action, function()
|
||||
restore()
|
||||
end)
|
||||
dirtylarry:button("pending", action_id, action, function()
|
||||
process_pending_transactions()
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user