first
1
.import/.gdignore
Normal file
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1,3 @@
|
||||
source_md5="8b2693d49a529f0c49e9fc34e83d3aaa"
|
||||
dest_md5="0af5e2d86183443cbd8f6d3196cda481"
|
||||
|
BIN
.import/Tank Town V2.png-08c956fc5009403ed62839d990ebaf50.stex
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="8b2693d49a529f0c49e9fc34e83d3aaa"
|
||||
dest_md5="bf817dc874b11b0dfcefaf8c34d3c307"
|
||||
|
BIN
.import/Tank Town V2.png-9a71ef29ce758f006bf4551e5170da54.stex
Normal file
3
.import/android.png-fb2caea48032eea3d74244daf04c3454.md5
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="f4b4f85907b184d9e397a6ff63f6ce72"
|
||||
dest_md5="5be099a36bdf2c27d567c38fe51f4f9f"
|
||||
|
BIN
.import/android.png-fb2caea48032eea3d74244daf04c3454.stex
Normal file
3
.import/box.png-196cb2b6d7422a4ab3b9c60b5a994fe3.md5
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="e34f6838dc85a9800d72ca02e5290d16"
|
||||
dest_md5="67b96e815e9f9092154bc9009dbb8123"
|
||||
|
BIN
.import/box.png-196cb2b6d7422a4ab3b9c60b5a994fe3.stex
Normal file
3
.import/enemy.png-f7d9f81714867a24a08e299bb600e611.md5
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="d84b20a4723ca8ec5545c2c99699474a"
|
||||
dest_md5="dd3176c4cc91f48dded2f76c041b4ca5"
|
||||
|
BIN
.import/enemy.png-f7d9f81714867a24a08e299bb600e611.stex
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="2159e5e3c0a3f08caaa4653955b12279"
|
||||
dest_md5="0a61b50f5151e2a0e094e43b57b4c35b"
|
||||
|
BIN
.import/icon-1024.png-2958e8f3e03f08146a840475cdd3cd61.stex
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="c15584810ad94ea7ef679c58fe0e1858"
|
||||
dest_md5="00ee2785af01b9527f444ddc1879fedd"
|
||||
|
BIN
.import/icon-120.png-f1130a47a81f19626ca0e688a5d38d3a.stex
Normal file
3
.import/icon-15.png-befc05bf38293c8cfe2bd393c6e153c6.md5
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="50e28167ca4d52622270ac728d424d61"
|
||||
dest_md5="88e8c42bc4e81ab7ea3958e3c9e48da2"
|
||||
|
BIN
.import/icon-15.png-befc05bf38293c8cfe2bd393c6e153c6.stex
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="9d0cd33193aad3daec08e68d2ba0471c"
|
||||
dest_md5="b8f17e81423910c62384ad8b935cff4f"
|
||||
|
BIN
.import/icon-500.png-551469a97496c83ff13bc47c2b1cdefa.stex
Normal file
3
.import/icon-76.png-81101785e7e41d0daa72dddaf6f4956f.md5
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="161febcc2c64bbfa259a57b89434b8ce"
|
||||
dest_md5="c76956748bead53fe1f1f1929cf37234"
|
||||
|
BIN
.import/icon-76.png-81101785e7e41d0daa72dddaf6f4956f.stex
Normal file
3
.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
|
||||
dest_md5="26ea799ea0a3da9e753b3ebe822e0570"
|
||||
|
BIN
.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex
Normal file
3
.import/ios.png-09946c77d84d877ee235a3ef7222fc0c.md5
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="163696855a2264825c4b3f1c60271d57"
|
||||
dest_md5="d867d38ba9da7a92b66f4ef8d20883e8"
|
||||
|
BIN
.import/ios.png-09946c77d84d877ee235a3ef7222fc0c.stex
Normal file
3
.import/music.ogg-6849ed60109f01916f243ace862e95fb.md5
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="932b771ad808fc298f615227d050ec43"
|
||||
dest_md5="deaae9245814d83fa2b904287e449d43"
|
||||
|
BIN
.import/music.ogg-6849ed60109f01916f243ace862e95fb.oggstr
Normal file
3
.import/poing.jpeg-b1ae7a0b5e3bb646b5b1cf5ae07e3b86.md5
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="5ba87031cb02945fb9ed3ccdbd282bbc"
|
||||
dest_md5="b31c147db95dc18ff0f8960e532e993a"
|
||||
|
BIN
.import/poing.jpeg-b1ae7a0b5e3bb646b5b1cf5ae07e3b86.stex
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="c2ff3ee413d4d2395dc48b39ec2f3a6e"
|
||||
dest_md5="b1647a55dc19646db9564c1312414faa"
|
||||
|
BIN
.import/retrowave.png-b70d674409984a3af1a2bdf9451dd5af.stex
Normal file
55
Bullet.tscn
Normal file
@ -0,0 +1,55 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://box.png" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="GDScript" id=3]
|
||||
resource_name = "Bullet"
|
||||
script/source = "extends KinematicBody2D
|
||||
|
||||
|
||||
var velocity = Vector2(0,-1)
|
||||
var speed = 300
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = \"text\"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
func _physics_process(delta):
|
||||
|
||||
move_and_collide(velocity.normalized() * delta * speed)
|
||||
pass
|
||||
|
||||
|
||||
func _on_Area2D_area_entered(area):
|
||||
if !area.is_in_group(\"Border\"):
|
||||
queue_free()
|
||||
pass # Replace with function body.
|
||||
"
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 3.33333, 3.33333 )
|
||||
|
||||
[node name="Node2D" type="KinematicBody2D"]
|
||||
scale = Vector2( 1.5, 1.5 )
|
||||
script = SubResource( 3 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2( 3.73522e-06, -3.41733e-06 )
|
||||
scale = Vector2( 1.1, 1.1 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="." groups=["Bullet"]]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
position = Vector2( 5.96046e-08, -5.96046e-08 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[connection signal="area_entered" from="Area2D" to="." method="_on_Area2D_area_entered"]
|
79
Entity.tscn
Normal file
@ -0,0 +1,79 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://enemy.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Font/super-legend-boy-font/SuperLegendBoy-4w8Y.ttf" type="DynamicFontData" id=2]
|
||||
|
||||
[sub_resource type="GDScript" id=1]
|
||||
script/source = "extends KinematicBody2D
|
||||
|
||||
var velocity = Vector2(0,1)
|
||||
var speed = 50
|
||||
signal on_Death
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
var text = randi() % 4
|
||||
$Label.text = (text+1) as String
|
||||
var Progressbars = get_tree().get_nodes_in_group(\"XP\")
|
||||
for Progressbar in Progressbars:
|
||||
Progressbar.connect(\"full_bar\", self, \"set_speed\")
|
||||
pass # Replace with function body.
|
||||
|
||||
func _physics_process(delta):
|
||||
move_and_collide(velocity.normalized() * delta * speed)
|
||||
pass
|
||||
|
||||
func _on_Area2D_area_entered(area):
|
||||
if area.is_in_group(\"Bullet\"):
|
||||
var text = $Label.text as int
|
||||
if text > 1:
|
||||
$Label.text = (text-1) as String
|
||||
else:
|
||||
var value = 1
|
||||
emit_signal(\"on_Death\", value)
|
||||
queue_free()
|
||||
if area.is_in_group(\"Border\"):
|
||||
get_tree().change_scene(\"res://GameOver.tscn\")
|
||||
pass # Replace with function body.
|
||||
|
||||
func set_speed(value):
|
||||
speed += value
|
||||
"
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 4, 4 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=3]
|
||||
size = 12
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[node name="Node2D" type="KinematicBody2D" groups=["Enemy"]]
|
||||
position = Vector2( 64, 64 )
|
||||
scale = Vector2( 12, 12 )
|
||||
script = SubResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
scale = Vector2( 0.9, 0.9 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
margin_left = -3.33333
|
||||
margin_top = -4.0
|
||||
margin_right = 8.66667
|
||||
margin_bottom = 10.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
rect_min_size = Vector2( 8, 8 )
|
||||
rect_scale = Vector2( 0.545, 0.639 )
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "1"
|
||||
|
||||
[connection signal="area_entered" from="Area2D" to="." method="_on_Area2D_area_entered"]
|
BIN
Export/Game.exe
Normal file
BIN
Export/Game.pck
Normal file
BIN
Font/super-legend-boy-font/SuperLegendBoy-4w8Y.ttf
Normal file
@ -0,0 +1,63 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Font Software License Agreement - Non-Commercial</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Chequered Ink Ltd.</h2>
|
||||
<h3>Font Software License Agreement - Non-Commercial</h3><br/>
|
||||
<h4>1. Definition of terms</h4>
|
||||
<ul>
|
||||
<li>"the Agreement" refers to this agreement and all of the text herein.</li>
|
||||
<li>"Font Software" means software or instructions which generate a typeface on screen or in print.</li>
|
||||
<li>"the Product" refers to the single instance of Font Software supplied with this license.</li>
|
||||
<li>"Licensed Unit" means a PC, Tablet, Printer or other device, owned by the individual or company engaging in the Agreement, that can reasonably make use of the Product.</li>
|
||||
<li>"Personal, Non-Commercial use" means any use that is not intended to generate money, to aid in the generation of money, or to aid a person, organisation or product with the aim of commercial success.</li>
|
||||
<li>"License Payment" means a payment made to Chequered Ink Ltd. by the individual or company engaging in the Agreement with the intention of becoming eligible to use the Product.</li>
|
||||
</ul>
|
||||
|
||||
<h4>2. Eligibility and the agreement</h4>
|
||||
<ul>
|
||||
<li>You are eligible to use the Product under these terms only if you are an individual or non-profit organisation using the product for Personal, Non-Commercial use.</li>
|
||||
<li>You are not eligible to use the Product if (i) you are excluded from doing so by the laws of England & Wales, the laws of the jurisdiction where you are making use of the Product, or by international law, (ii) you intend to use the Product for criminal activity, (iii) you fail to meet the eligibility criteria above, or (iv) the Agreement has been previously terminated by Chequered Ink Ltd.</li>
|
||||
<li>Retention of the text of the Agreement is not proof of eligibility.</li>
|
||||
</ul>
|
||||
|
||||
<h4>3. Scope and use</h4>
|
||||
<ul>
|
||||
<li>You are hereby granted a non-exclusive, non-assignable, non-transferable license to access the Product (i) only in a single Licensed Unit, (ii) only for Personal, Non-Commercial use, and (iii) subject to the terms and conditions of the Agreement.</li>
|
||||
<li>You may embed the Product only into an electronic document that is (i) for Personal, Non-Commercial use, (ii) distributed in a secure format that protects the Product from extraction, (iii) not designed to serve the same function as the product, i.e. the document must not allow end-users to use glyphs from the Product for use in their own documents.</li>
|
||||
<li>You may not install the Product on a server unless all devices capable of accessing the Product are Licensed Units.</li>
|
||||
<li>You may embed the Product in an electronic document for printing and viewing use, and provide the document to a third-party for printing use only.</li>
|
||||
<li>You may use the product in graphics, videos, video games and other visual media as long as they meet the criteria defined above for electronic documents.</li>
|
||||
<li>You may not lend, rent, sublicense, sell, redistribute, disassemble, reverse-engineer, decompile, modify, adapt or merge the Product.</li>
|
||||
<li>You may not use the product for activity considered illegal in England & Wales, in the jurisdiction where you are making use of the Product or by international law.</li>
|
||||
<li>You may not remove watermarks, materials, restrictions or copyright notices from the Product.</li>
|
||||
</ul>
|
||||
|
||||
<h4>4. Intellectual property</h4>
|
||||
<ul>
|
||||
<li>You agree that the Product is the intellectual property of Chequered Ink Ltd. and protected by copyright law and intellectual property rights of England & Wales, by the copyright law and intellectual property rights of other nations and by international treaties.</li>
|
||||
<li>This license does not grant you any intellectual property rights over the Product.</li>
|
||||
</ul>
|
||||
|
||||
<h4>5. Liability</h4>
|
||||
<ul>
|
||||
<li>You agree that you are liable for the content of electronic documents and print materials you create using the Product, and to exempt Chequered Ink Ltd. from any blame following your own illegal use of the Product.</li>
|
||||
<li>Chequered Ink Ltd. may not be held responsible for damages caused by improper use of the product, including any use that breaches the terms of the Agreement.</li>
|
||||
<li>Chequered Ink Ltd. extends a guarantee that the Product will work as described for up to 90 (Ninety) days, and will provide either a replacement or a refund in the event that the Product provably ceases to function. The maximum refund Chequered Ink Ltd. will pay will not exceed the original License Payment.</li>
|
||||
</ul>
|
||||
|
||||
<h4>6. Termination</h4>
|
||||
<ul>
|
||||
<li>Upon failure by you (or any other person given authorised access to a Licensed Unit) to comply with the terms of the Agreement, Chequered Ink Ltd. reserves the right to terminate the Agreement.</li>
|
||||
<li>If the Agreement has been terminated by either party you will cease to use the Product and destroy all copies of the Product you possess.</li>
|
||||
<li>Termination of the Agreement shall not preclude Chequered Ink Ltd. from taking legal action to recover damages resulting from breaching of the Agreement.</li>
|
||||
</ul>
|
||||
|
||||
<h4>7. Additional Terms Of Use</h4>
|
||||
<ul>
|
||||
<li>You agree to read and abide by Chequered Ink Ltd.'s general terms of use as described in the document at the following location: "http://chequered.ink/terms-of-use/". In case of a conflict between the general terms of use and this Agreement, this Agreement shall control.</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,6 @@
|
||||
[{000214A0-0000-0000-C000-000000000046}]
|
||||
Prop3=19,11
|
||||
[InternetShortcut]
|
||||
IDList=
|
||||
URL=https://chequered.ink/font-license/
|
||||
HotKey=0
|
53
Game.gd
Normal file
@ -0,0 +1,53 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
const SlotClass = preload("res://Slot.gd")
|
||||
var Panzer_Temp = preload("res://Panzer.tscn")
|
||||
onready var game_slots = $VBoxContainer/PanzerSlots
|
||||
var holding_item = null
|
||||
|
||||
signal speed_shoot
|
||||
|
||||
func _ready():
|
||||
for gam_slot in game_slots.get_children():
|
||||
gam_slot.connect("gui_input", self, "slot_gui_input", [gam_slot])
|
||||
|
||||
|
||||
func slot_gui_input(event: InputEvent, slot: SlotClass):
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == BUTTON_LEFT && event.pressed:
|
||||
if holding_item != null:
|
||||
if!slot.Panzer:
|
||||
slot.putIntoSlot(holding_item)
|
||||
holding_item = null
|
||||
else:
|
||||
var temp_item = slot.Panzer
|
||||
slot.pickFromSlot()
|
||||
temp_item.global_position = event.global_position
|
||||
slot.putIntoSlot(holding_item)
|
||||
holding_item = temp_item
|
||||
elif slot.Panzer:
|
||||
holding_item = slot.Panzer
|
||||
slot.pickFromSlot()
|
||||
holding_item.global_position = get_global_mouse_position()
|
||||
|
||||
func _input(event):
|
||||
if holding_item:
|
||||
holding_item.global_position = get_global_mouse_position()
|
||||
pass
|
||||
|
||||
|
||||
func _on_Panzer_pressed():
|
||||
if holding_item == null:
|
||||
var Panzer = null
|
||||
Panzer = Panzer_Temp.instance()
|
||||
add_child(Panzer)
|
||||
holding_item = Panzer
|
||||
holding_item.global_position = get_global_mouse_position()
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_Speed_pressed():
|
||||
var value = 0.5
|
||||
emit_signal("speed_shoot", value)
|
||||
pass # Replace with function body.
|
204
Game.tscn
Normal file
@ -0,0 +1,204 @@
|
||||
[gd_scene load_steps=13 format=2]
|
||||
|
||||
[ext_resource path="res://box.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Slot.gd" type="Script" id=2]
|
||||
[ext_resource path="res://Game.gd" type="Script" id=3]
|
||||
[ext_resource path="res://Spawner.gd" type="Script" id=4]
|
||||
[ext_resource path="res://retrowave.png" type="Texture" id=5]
|
||||
[ext_resource path="res://Font/super-legend-boy-font/SuperLegendBoy-4w8Y.ttf" type="DynamicFontData" id=6]
|
||||
[ext_resource path="res://Overlay.tscn" type="PackedScene" id=7]
|
||||
|
||||
[sub_resource type="TileSet" id=1]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=4]
|
||||
extents = Vector2( 288, 20 )
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=3]
|
||||
texture = ExtResource( 1 )
|
||||
region_rect = Rect2( 0, 0, 8, 8 )
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=2]
|
||||
texture = ExtResource( 1 )
|
||||
region_rect = Rect2( 0, 0, 8, 8 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=5]
|
||||
font_data = ExtResource( 6 )
|
||||
|
||||
[node name="Game" type="Node2D"]
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
position = Vector2( 288, 592 )
|
||||
scale = Vector2( 0.463768, 0.5 )
|
||||
texture = ExtResource( 5 )
|
||||
|
||||
[node name="TileMap" type="TileMap" parent="."]
|
||||
tile_set = SubResource( 1 )
|
||||
format = 1
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
margin_top = 760.0
|
||||
margin_right = 576.0
|
||||
margin_bottom = 800.0
|
||||
rect_min_size = Vector2( 575, 32 )
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="Panel" groups=["Border"]]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Panel/Area2D"]
|
||||
position = Vector2( 288, 20 )
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[node name="Spawner" type="GridContainer" parent="."]
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = -128.0
|
||||
margin_right = 575.0
|
||||
custom_constants/hseparation = 21
|
||||
columns = 4
|
||||
|
||||
[node name="Spawner 1" type="Panel" parent="Spawner"]
|
||||
margin_right = 128.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_styles/panel = SubResource( 3 )
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Spawner 2" type="Panel" parent="Spawner"]
|
||||
margin_left = 149.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_styles/panel = SubResource( 3 )
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Spawner 3" type="Panel" parent="Spawner"]
|
||||
margin_left = 298.0
|
||||
margin_right = 426.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_styles/panel = SubResource( 3 )
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Spawner 4" type="Panel" parent="Spawner"]
|
||||
margin_left = 447.0
|
||||
margin_right = 575.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_styles/panel = SubResource( 3 )
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_top = 800.0
|
||||
margin_right = 575.0
|
||||
margin_bottom = 1200.0
|
||||
|
||||
[node name="PanzerSlots" type="GridContainer" parent="VBoxContainer"]
|
||||
margin_right = 575.0
|
||||
margin_bottom = 266.0
|
||||
custom_constants/vseparation = 10
|
||||
custom_constants/hseparation = 21
|
||||
columns = 4
|
||||
|
||||
[node name="Slot 1" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
margin_right = 128.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Slot 2" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
margin_left = 149.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Slot 3" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
margin_left = 298.0
|
||||
margin_right = 426.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Slot 4" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
margin_left = 447.0
|
||||
margin_right = 575.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Slot 5" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
margin_top = 138.0
|
||||
margin_right = 128.0
|
||||
margin_bottom = 266.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Slot 6" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
margin_left = 149.0
|
||||
margin_top = 138.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 266.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Slot 7" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
margin_left = 298.0
|
||||
margin_top = 138.0
|
||||
margin_right = 426.0
|
||||
margin_bottom = 266.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Slot 8" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
margin_left = 447.0
|
||||
margin_top = 138.0
|
||||
margin_right = 575.0
|
||||
margin_bottom = 266.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="ButtonGrid" type="GridContainer" parent="VBoxContainer"]
|
||||
margin_top = 270.0
|
||||
margin_right = 575.0
|
||||
margin_bottom = 398.0
|
||||
columns = 4
|
||||
|
||||
[node name="Speed" type="Button" parent="VBoxContainer/ButtonGrid"]
|
||||
margin_right = 128.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Speed"
|
||||
|
||||
[node name="Panzer" type="Button" parent="VBoxContainer/ButtonGrid"]
|
||||
margin_left = 132.0
|
||||
margin_right = 260.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Panzer"
|
||||
|
||||
[node name="Control" parent="." instance=ExtResource( 7 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 575.0
|
||||
margin_bottom = 0.0
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/ButtonGrid/Speed" to="." method="_on_Speed_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ButtonGrid/Panzer" to="." method="_on_Panzer_pressed"]
|
48
GameOver.tscn
Normal file
@ -0,0 +1,48 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="GDScript" id=1]
|
||||
script/source = "extends Control
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = \"text\"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
|
||||
|
||||
func _on_Button_pressed():
|
||||
get_tree().change_scene(\"res://Game.tscn\")
|
||||
pass # Replace with function body.
|
||||
"
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = SubResource( 1 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -20.0
|
||||
margin_top = -20.0
|
||||
margin_right = 20.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="Button" type="Button" parent="VBoxContainer"]
|
||||
margin_right = 57.0
|
||||
margin_bottom = 20.0
|
||||
text = "Restart"
|
||||
icon_align = 1
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/Button" to="." method="_on_Button_pressed"]
|
59
Overlay.tscn
Normal file
@ -0,0 +1,59 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="GDScript" id=1]
|
||||
script/source = "extends Control
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = \"text\"
|
||||
|
||||
onready var pBar = $CanvasLayer/ProgressBar
|
||||
|
||||
signal full_bar
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
var Enemies = get_tree().get_nodes_in_group(\"Enemy\")
|
||||
for Enemy in Enemies:
|
||||
Enemy.connect(\"on_Death\", self, \"on_Death_listed\")
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
if pBar.value == pBar.max_value:
|
||||
var value = 50
|
||||
emit_signal(\"full_bar\", value)
|
||||
pBar.value = 0
|
||||
pBar.max_value += 10
|
||||
pass
|
||||
|
||||
func on_Death_listed(value):
|
||||
pBar.value += value
|
||||
"
|
||||
|
||||
[node name="Control" type="Control" groups=["XP"]]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_bottom = -1040.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = SubResource( 1 )
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="ProgressBar" type="ProgressBar" parent="CanvasLayer"]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
margin_left = -144.0
|
||||
margin_top = 48.0
|
||||
margin_right = 48.0
|
||||
margin_bottom = 62.0
|
||||
rect_scale = Vector2( 1.5, 1.5 )
|
||||
max_value = 10.0
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
margin_right = 184.0
|
||||
margin_bottom = 160.0
|
51
Panzer.tscn
Normal file
@ -0,0 +1,51 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://assets/Tank Town V2.png" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="GDScript" id=1]
|
||||
script/source = "extends Node2D
|
||||
|
||||
var Time = 0
|
||||
const bulletPath = preload(\"res://Bullet.tscn\")
|
||||
var speed = 2.5
|
||||
onready var GameNode
|
||||
|
||||
func _ready():
|
||||
GameNode = find_parent(\"Game\")
|
||||
GameNode.connect(\"speed_shoot\", self, \"set_shoot_speed\")
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
Time += delta
|
||||
if Time > speed and get_parent() != GameNode: #wenn er nicht gehoben wird dann:
|
||||
shoot()
|
||||
Time = 0
|
||||
pass
|
||||
|
||||
func shoot():
|
||||
var bullet = bulletPath.instance()
|
||||
find_parent(\"Game\").add_child(bullet)
|
||||
bullet.position = $Position2D.global_position
|
||||
|
||||
func set_shoot_speed(value):
|
||||
if speed != 0.5:
|
||||
speed -= value
|
||||
print(speed)
|
||||
pass
|
||||
"
|
||||
|
||||
[node name="ShooterObject" type="Node2D"]
|
||||
position = Vector2( 64, 64 )
|
||||
scale = Vector2( 2, 2 )
|
||||
z_index = 1
|
||||
script = SubResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
scale = Vector2( 3, 3 )
|
||||
z_index = 1
|
||||
texture = ExtResource( 1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 48, 16, 16 )
|
||||
|
||||
[node name="Position2D" type="Position2D" parent="."]
|
||||
position = Vector2( 0.5, -28 )
|
24
Slot.gd
Normal file
@ -0,0 +1,24 @@
|
||||
extends Panel
|
||||
|
||||
var PanzerType = preload("res://Panzer.tscn")
|
||||
var Panzer = null
|
||||
|
||||
func _ready():
|
||||
if randi() % 2 == 0:
|
||||
Panzer = PanzerType.instance()
|
||||
add_child(Panzer)
|
||||
|
||||
|
||||
func pickFromSlot():
|
||||
remove_child(Panzer)
|
||||
var GameNode = find_parent("Game")
|
||||
GameNode.add_child(Panzer)
|
||||
Panzer = null
|
||||
|
||||
func putIntoSlot(new_panzer):
|
||||
Panzer = new_panzer
|
||||
Panzer.position = Vector2(64, 64)
|
||||
var GameNode = find_parent("Game")
|
||||
GameNode.remove_child(Panzer)
|
||||
add_child(Panzer)
|
||||
|
20
Spawner.gd
Normal file
@ -0,0 +1,20 @@
|
||||
extends Panel
|
||||
|
||||
var enemy_pre = preload("res://Entity.tscn")
|
||||
var enemy = null
|
||||
var Time = 0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
if randi() % 2 == 0:
|
||||
enemy = enemy_pre.instance()
|
||||
add_child(enemy)
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
Time += delta
|
||||
if Time > 5:
|
||||
if randi() % 2 == 0:
|
||||
enemy = enemy_pre.instance()
|
||||
add_child(enemy)
|
||||
Time = 0
|
1
addons/admob/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.zip
|
21
addons/admob/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Poing Studios
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
BIN
addons/admob/assets/android.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
35
addons/admob/assets/android.png.import
Normal file
@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/android.png-fb2caea48032eea3d74244daf04c3454.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/admob/assets/android.png"
|
||||
dest_files=[ "res://.import/android.png-fb2caea48032eea3d74244daf04c3454.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
addons/admob/assets/fonts/arial.ttf
Normal file
BIN
addons/admob/assets/fonts/orange_juice_2_0.ttf
Normal file
BIN
addons/admob/assets/icon-1024.png
Normal file
After Width: | Height: | Size: 263 KiB |
35
addons/admob/assets/icon-1024.png.import
Normal file
@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon-1024.png-2958e8f3e03f08146a840475cdd3cd61.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/admob/assets/icon-1024.png"
|
||||
dest_files=[ "res://.import/icon-1024.png-2958e8f3e03f08146a840475cdd3cd61.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
addons/admob/assets/icon-120.png
Normal file
After Width: | Height: | Size: 13 KiB |
35
addons/admob/assets/icon-120.png.import
Normal file
@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon-120.png-f1130a47a81f19626ca0e688a5d38d3a.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/admob/assets/icon-120.png"
|
||||
dest_files=[ "res://.import/icon-120.png-f1130a47a81f19626ca0e688a5d38d3a.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
addons/admob/assets/icon-15.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
35
addons/admob/assets/icon-15.png.import
Normal file
@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon-15.png-befc05bf38293c8cfe2bd393c6e153c6.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/admob/assets/icon-15.png"
|
||||
dest_files=[ "res://.import/icon-15.png-befc05bf38293c8cfe2bd393c6e153c6.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
addons/admob/assets/icon-500.png
Normal file
After Width: | Height: | Size: 55 KiB |
35
addons/admob/assets/icon-500.png.import
Normal file
@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon-500.png-551469a97496c83ff13bc47c2b1cdefa.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/admob/assets/icon-500.png"
|
||||
dest_files=[ "res://.import/icon-500.png-551469a97496c83ff13bc47c2b1cdefa.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
addons/admob/assets/icon-76.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
35
addons/admob/assets/icon-76.png.import
Normal file
@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon-76.png-81101785e7e41d0daa72dddaf6f4956f.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/admob/assets/icon-76.png"
|
||||
dest_files=[ "res://.import/icon-76.png-81101785e7e41d0daa72dddaf6f4956f.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
addons/admob/assets/ios.png
Normal file
After Width: | Height: | Size: 23 KiB |
35
addons/admob/assets/ios.png.import
Normal file
@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/ios.png-09946c77d84d877ee235a3ef7222fc0c.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/admob/assets/ios.png"
|
||||
dest_files=[ "res://.import/ios.png-09946c77d84d877ee235a3ef7222fc0c.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
addons/admob/assets/music.ogg
Normal file
15
addons/admob/assets/music.ogg.import
Normal file
@ -0,0 +1,15 @@
|
||||
[remap]
|
||||
|
||||
importer="ogg_vorbis"
|
||||
type="AudioStreamOGGVorbis"
|
||||
path="res://.import/music.ogg-6849ed60109f01916f243ace862e95fb.oggstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/admob/assets/music.ogg"
|
||||
dest_files=[ "res://.import/music.ogg-6849ed60109f01916f243ace862e95fb.oggstr" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
BIN
addons/admob/assets/poing.jpeg
Normal file
After Width: | Height: | Size: 8.0 KiB |
35
addons/admob/assets/poing.jpeg.import
Normal file
@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/poing.jpeg-b1ae7a0b5e3bb646b5b1cf5ae07e3b86.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/admob/assets/poing.jpeg"
|
||||
dest_files=[ "res://.import/poing.jpeg-b1ae7a0b5e3bb646b5b1cf5ae07e3b86.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
0
addons/admob/downloads/android/.gitkeep
Normal file
0
addons/admob/downloads/ios/.gitkeep
Normal file
7
addons/admob/plugin.cfg
Normal file
@ -0,0 +1,7 @@
|
||||
[plugin]
|
||||
|
||||
name="AdMob"
|
||||
description="The AdMob of Plugin for Android and iOS."
|
||||
author="Poing Studios"
|
||||
version="1.3.2"
|
||||
script="src/core/AdMob.gd"
|
27
addons/admob/src/core/AdMob.gd
Normal file
@ -0,0 +1,27 @@
|
||||
tool
|
||||
extends EditorPlugin
|
||||
|
||||
var AdMobEditor : Control
|
||||
|
||||
func _enter_tree():
|
||||
add_autoload_singleton("MobileAds", "res://addons/admob/src/singletons/MobileAds.gd")
|
||||
AdMobEditor = load("res://addons/admob/src/core/AdMobEditor.tscn").instance()
|
||||
get_editor_interface().get_editor_viewport().add_child(AdMobEditor)
|
||||
AdMobEditor.hide()
|
||||
|
||||
func _exit_tree():
|
||||
remove_autoload_singleton("MobileAds")
|
||||
get_editor_interface().get_editor_viewport().remove_child(AdMobEditor)
|
||||
AdMobEditor.queue_free()
|
||||
|
||||
func has_main_screen():
|
||||
return true
|
||||
|
||||
func make_visible(visible):
|
||||
AdMobEditor.visible = visible
|
||||
|
||||
func get_plugin_name():
|
||||
return "AdMob"
|
||||
|
||||
func get_plugin_icon():
|
||||
return load("res://addons/admob/assets/icon-15.png")
|
16
addons/admob/src/core/AdMobEditor.gd
Normal file
@ -0,0 +1,16 @@
|
||||
tool
|
||||
extends Control
|
||||
var AdMobSettings = preload("res://addons/admob/src/utils/AdMobSettings.gd").new()
|
||||
|
||||
|
||||
func _on_AndroidButton_pressed():
|
||||
OS.shell_open("https://github.com/Poing-Studios/godot-admob-android#installation")
|
||||
|
||||
func _on_iOSButton_pressed():
|
||||
OS.shell_open("https://github.com/Poing-Studios/godot-admob-ios#installation")
|
||||
|
||||
func _on_AdMobButton_pressed():
|
||||
OS.shell_open("https://github.com/Poing-Studios/godot-admob-editor")
|
||||
|
||||
func _on_PoingButton_pressed():
|
||||
OS.shell_open("https://github.com/Poing-Studios")
|
244
addons/admob/src/core/AdMobEditor.tscn
Normal file
@ -0,0 +1,244 @@
|
||||
[gd_scene load_steps=23 format=2]
|
||||
|
||||
[ext_resource path="res://addons/admob/assets/android.png" type="Texture" id=1]
|
||||
[ext_resource path="res://addons/admob/assets/poing.jpeg" type="Texture" id=2]
|
||||
[ext_resource path="res://addons/admob/assets/fonts/arial.ttf" type="DynamicFontData" id=3]
|
||||
[ext_resource path="res://addons/admob/src/core/AdMobEditor.gd" type="Script" id=4]
|
||||
[ext_resource path="res://addons/admob/assets/ios.png" type="Texture" id=5]
|
||||
[ext_resource path="res://addons/admob/assets/icon-76.png" type="Texture" id=6]
|
||||
[ext_resource path="res://addons/admob/src/core/components/ad_format/BannerAdFormat.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://addons/admob/src/core/components/General.tscn" type="PackedScene" id=8]
|
||||
[ext_resource path="res://addons/admob/src/core/components/ad_format/InterstitialAdFormat.tscn" type="PackedScene" id=9]
|
||||
[ext_resource path="res://addons/admob/src/core/components/ad_format/RewardedAdFormat.tscn" type="PackedScene" id=10]
|
||||
[ext_resource path="res://addons/admob/src/core/components/ad_format/RewardedInterstitialAdFormat.tscn" type="PackedScene" id=11]
|
||||
[ext_resource path="res://addons/admob/src/core/components/Downloads.tscn" type="PackedScene" id=12]
|
||||
[ext_resource path="res://addons/admob/src/core/components/Debug.tscn" type="PackedScene" id=13]
|
||||
[ext_resource path="res://addons/admob/src/core/SupportVersion.gd" type="Script" id=14]
|
||||
[ext_resource path="res://addons/admob/src/core/CurrentVersion.gd" type="Script" id=15]
|
||||
[ext_resource path="res://addons/admob/src/core/VersionSupportedHTTPRequest.tscn" type="PackedScene" id=16]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 0.839216, 0.0352941, 0.0352941, 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
size = 30
|
||||
use_filter = true
|
||||
font_data = ExtResource( 3 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=4]
|
||||
size = 20
|
||||
use_filter = true
|
||||
font_data = ExtResource( 3 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=3]
|
||||
bg_color = Color( 1, 0.772549, 0, 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=6]
|
||||
size = 20
|
||||
outline_size = 1
|
||||
outline_color = Color( 0, 0, 0, 1 )
|
||||
use_filter = true
|
||||
font_data = ExtResource( 3 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=5]
|
||||
bg_color = Color( 0.172549, 0.568627, 0.992157, 1 )
|
||||
|
||||
[node name="AdMobEditor" type="Control"]
|
||||
pause_mode = 2
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
rect_clip_content = true
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="TopPanel" type="Panel" parent="."]
|
||||
anchor_right = 1.0
|
||||
margin_bottom = 40.0
|
||||
rect_min_size = Vector2( 0, 35 )
|
||||
custom_styles/panel = SubResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true,
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Description" type="Label" parent="TopPanel"]
|
||||
anchor_right = 1.0
|
||||
margin_right = -401.4
|
||||
margin_bottom = 40.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
text = "AdMob Editor"
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Icons" type="Control" parent="TopPanel"]
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
margin_left = -395.4
|
||||
margin_right = 0.600037
|
||||
margin_bottom = 40.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="AndroidButton" type="TextureButton" parent="TopPanel/Icons"]
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
margin_left = -158.6
|
||||
margin_right = -118.6
|
||||
margin_bottom = 40.0
|
||||
mouse_default_cursor_shape = 2
|
||||
texture_normal = ExtResource( 1 )
|
||||
expand = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="iOSButton" type="TextureButton" parent="TopPanel/Icons"]
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
margin_left = -118.145
|
||||
margin_right = -78.1449
|
||||
margin_bottom = 40.0
|
||||
mouse_default_cursor_shape = 2
|
||||
texture_normal = ExtResource( 5 )
|
||||
expand = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="AdMobButton" type="TextureButton" parent="TopPanel/Icons"]
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
margin_left = -79.9999
|
||||
margin_right = -39.9999
|
||||
margin_bottom = 40.0
|
||||
mouse_default_cursor_shape = 2
|
||||
texture_normal = ExtResource( 6 )
|
||||
expand = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="PoingButton" type="TextureButton" parent="TopPanel/Icons"]
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
margin_left = -40.0
|
||||
margin_bottom = 40.0
|
||||
mouse_default_cursor_shape = 2
|
||||
texture_normal = ExtResource( 2 )
|
||||
expand = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MiddleScrollContainer" type="ScrollContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = 40.0
|
||||
margin_right = 6.10352e-05
|
||||
margin_bottom = -34.9996
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="TabContainer" type="TabContainer" parent="MiddleScrollContainer"]
|
||||
margin_right = 600.0
|
||||
margin_bottom = 949.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tab_align = 0
|
||||
|
||||
[node name="General" parent="MiddleScrollContainer/TabContainer" instance=ExtResource( 8 )]
|
||||
|
||||
[node name="Debug" parent="MiddleScrollContainer/TabContainer" instance=ExtResource( 13 )]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="Banner" parent="MiddleScrollContainer/TabContainer" instance=ExtResource( 7 )]
|
||||
visible = false
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="Interstitial" parent="MiddleScrollContainer/TabContainer" instance=ExtResource( 9 )]
|
||||
visible = false
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="Rewarded" parent="MiddleScrollContainer/TabContainer" instance=ExtResource( 10 )]
|
||||
visible = false
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="RewardedInterstitial" parent="MiddleScrollContainer/TabContainer" instance=ExtResource( 11 )]
|
||||
visible = false
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="Downloads" parent="MiddleScrollContainer/TabContainer" instance=ExtResource( 12 )]
|
||||
visible = false
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="BottomPanel" type="Panel" parent="."]
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = -35.0
|
||||
rect_min_size = Vector2( 0, 35 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true,
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="SupportVersion" type="RichTextLabel" parent="BottomPanel"]
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = -35.0
|
||||
margin_right = -158.0
|
||||
custom_fonts/normal_font = SubResource( 4 )
|
||||
custom_styles/normal = SubResource( 3 )
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "[rainbow sat=10]iOS[/rainbow][color=black]:v2.1.0[/color] [rainbow sat=10]Android[/rainbow][color=black]:v2.1.0[/color]"
|
||||
text = "iOS:v2.1.0 Android:v2.1.0"
|
||||
script = ExtResource( 14 )
|
||||
|
||||
[node name="VersionSupportedHTTPRequest" parent="BottomPanel/SupportVersion" instance=ExtResource( 16 )]
|
||||
|
||||
[node name="CurrentVersion" type="Label" parent="BottomPanel"]
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -158.0
|
||||
margin_top = -35.0
|
||||
rect_min_size = Vector2( 0, 35 )
|
||||
custom_fonts/font = SubResource( 6 )
|
||||
custom_styles/normal = SubResource( 5 )
|
||||
text = "Version: 1.3.0"
|
||||
align = 2
|
||||
script = ExtResource( 15 )
|
||||
|
||||
[connection signal="pressed" from="TopPanel/Icons/AndroidButton" to="." method="_on_AndroidButton_pressed"]
|
||||
[connection signal="pressed" from="TopPanel/Icons/iOSButton" to="." method="_on_iOSButton_pressed"]
|
||||
[connection signal="pressed" from="TopPanel/Icons/AdMobButton" to="." method="_on_AdMobButton_pressed"]
|
||||
[connection signal="pressed" from="TopPanel/Icons/PoingButton" to="." method="_on_PoingButton_pressed"]
|
7
addons/admob/src/core/CurrentVersion.gd
Normal file
@ -0,0 +1,7 @@
|
||||
tool
|
||||
extends Label
|
||||
|
||||
var AdMobGlobals = preload("res://addons/admob/src/utils/AdMobGlobals.gd")
|
||||
|
||||
func _ready():
|
||||
text = "Version: " + AdMobGlobals.get_plugin_version()
|
8
addons/admob/src/core/SupportVersion.gd
Normal file
@ -0,0 +1,8 @@
|
||||
tool
|
||||
extends RichTextLabel
|
||||
|
||||
var support_version_text = "[rainbow sat=10]iOS[/rainbow][color=black]:%s[/color] [rainbow sat=10]Android[/rainbow][color=black]:%s[/color]"
|
||||
|
||||
|
||||
func _on_VersionSupportedHTTPRequest_supported_version_changed(value_dictionary):
|
||||
bbcode_text = support_version_text % [value_dictionary.ios, value_dictionary.android]
|
16
addons/admob/src/core/VersionSupportedHTTPRequest.gd
Normal file
@ -0,0 +1,16 @@
|
||||
tool
|
||||
extends HTTPRequest
|
||||
|
||||
signal supported_version_changed(value_dictionary)
|
||||
|
||||
var AdMobGlobals = preload("res://addons/admob/src/utils/AdMobGlobals.gd")
|
||||
|
||||
func _ready():
|
||||
request("https://gist.githubusercontent.com/gumaciel/ba15bd85ebcc87866c24a819de37cc9a/raw/admob_editor_versions_supported.json")
|
||||
|
||||
|
||||
func _on_VersionSupportedHTTPRequest_request_completed(result, response_code, headers, body):
|
||||
var json = JSON.parse(body.get_string_from_utf8())
|
||||
|
||||
var version_support : Dictionary = json.result[AdMobGlobals.get_plugin_version()]
|
||||
emit_signal("supported_version_changed", version_support)
|
8
addons/admob/src/core/VersionSupportedHTTPRequest.tscn
Normal file
@ -0,0 +1,8 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/admob/src/core/VersionSupportedHTTPRequest.gd" type="Script" id=1]
|
||||
|
||||
[node name="VersionSupportedHTTPRequest" type="HTTPRequest"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[connection signal="request_completed" from="." to="." method="_on_VersionSupportedHTTPRequest_request_completed"]
|
29
addons/admob/src/core/components/Debug.gd
Normal file
@ -0,0 +1,29 @@
|
||||
tool
|
||||
extends VBoxContainer
|
||||
|
||||
onready var AdMobEditor : Control = find_parent("AdMobEditor")
|
||||
onready var DebugOnRelease : Control = $TabContainer/Release/DebugOnRelease
|
||||
onready var IsReal : Control = $TabContainer/Release/IsReal
|
||||
onready var TestEuropeUserConsent : Control = $TabContainer/General/TestEuropeUserConsent
|
||||
|
||||
func _ready():
|
||||
DebugOnRelease.pressed = AdMobEditor.AdMobSettings.config.debug.is_debug_on_release
|
||||
IsReal.pressed = AdMobEditor.AdMobSettings.config.debug.is_real
|
||||
TestEuropeUserConsent.pressed = AdMobEditor.AdMobSettings.config.debug.is_test_europe_user_consent
|
||||
|
||||
IsReal.disabled = not DebugOnRelease.pressed
|
||||
|
||||
|
||||
func _on_DebugOnRelease_pressed():
|
||||
AdMobEditor.AdMobSettings.config.debug.is_debug_on_release = DebugOnRelease.pressed
|
||||
if DebugOnRelease.pressed:
|
||||
IsReal.disabled = false
|
||||
else:
|
||||
IsReal.disabled = true
|
||||
|
||||
func _on_IsReal_pressed():
|
||||
AdMobEditor.AdMobSettings.config.debug.is_real = IsReal.pressed
|
||||
|
||||
func _on_TestEuropeUserConsent_pressed():
|
||||
AdMobEditor.AdMobSettings.config.debug.is_test_europe_user_consent = TestEuropeUserConsent.pressed
|
||||
|
68
addons/admob/src/core/components/Debug.tscn
Normal file
@ -0,0 +1,68 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/admob/src/core/components/Debug.gd" type="Script" id=1]
|
||||
|
||||
[node name="Debug" type="VBoxContainer"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="TabContainer" type="TabContainer" parent="."]
|
||||
margin_right = 151.0
|
||||
margin_bottom = 582.0
|
||||
tab_align = 0
|
||||
|
||||
[node name="General" type="VBoxContainer" parent="TabContainer"]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="TestEuropeUserConsent" type="CheckBox" parent="TabContainer/General"]
|
||||
margin_right = 193.0
|
||||
margin_bottom = 24.0
|
||||
text = "Test Europe User Consent"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Release" type="VBoxContainer" parent="TabContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="DebugOnRelease" type="CheckBox" parent="TabContainer/Release"]
|
||||
margin_right = 143.0
|
||||
margin_bottom = 24.0
|
||||
text = "Debug on Release"
|
||||
|
||||
[node name="IsReal" type="CheckBox" parent="TabContainer/Release"]
|
||||
margin_top = 28.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 52.0
|
||||
disabled = true
|
||||
pressed = true
|
||||
text = "Is Real"
|
||||
|
||||
[node name="Advice" type="Label" parent="TabContainer/Release"]
|
||||
margin_top = 56.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 546.0
|
||||
text = "Advice: `Is Real` will ALWAYS be true unless `Debug on Release` is true.
|
||||
|
||||
So if `Debug on Release` is true it will consider the value of `Is Real` on this page when the game is exported as \"Release\".
|
||||
|
||||
In other words, you don't need to change anything on this page as it may cause bugs in your app once it's in the store.
|
||||
|
||||
Note: The `Test Europe User Consent` button even if it is true, when the application goes to production, that value will be false IF `Debug on Release` is false."
|
||||
autowrap = true
|
||||
|
||||
[connection signal="pressed" from="TabContainer/General/TestEuropeUserConsent" to="." method="_on_TestEuropeUserConsent_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Release/DebugOnRelease" to="." method="_on_DebugOnRelease_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Release/IsReal" to="." method="_on_IsReal_pressed"]
|
184
addons/admob/src/core/components/Downloads.gd
Normal file
@ -0,0 +1,184 @@
|
||||
tool
|
||||
extends VBoxContainer
|
||||
|
||||
onready var AdMobEditor : Control = find_parent("AdMobEditor")
|
||||
|
||||
onready var godot_version : String = "v" + String(Engine.get_version_info().major) + "." + String(Engine.get_version_info().minor) + "." + String(Engine.get_version_info().patch)
|
||||
var actual_downloading_file : String = ""
|
||||
var downloaded_plugin_version : String = ""
|
||||
var version_support : Dictionary
|
||||
|
||||
var android_dictionary : Dictionary = {
|
||||
"version" : ["CURRENT"],
|
||||
"download_directory" : "res://addons/admob/downloads/android"
|
||||
} setget set_android_dictionary
|
||||
|
||||
var ios_dictionary : Dictionary = {
|
||||
"version" : ["CURRENT"],
|
||||
"download_directory" : "res://addons/admob/downloads/ios"
|
||||
} setget set_ios_dictionary
|
||||
|
||||
var current_dir_download_label = "Current Download Directory: %s"
|
||||
var download_complete_message = "Download of %s completed! \n%s"
|
||||
|
||||
func set_android_dictionary(value):
|
||||
android_dictionary = value
|
||||
$TabContainer/Android/ChangeDirectoryHBoxContainer/DownloadDirectoryLabel.text = current_dir_download_label % android_dictionary.download_directory
|
||||
|
||||
func set_ios_dictionary(value):
|
||||
ios_dictionary = value
|
||||
$TabContainer/iOS/ChangeDirectoryHBoxContainer/DownloadDirectoryLabel.text = current_dir_download_label % ios_dictionary.download_directory
|
||||
|
||||
func _ready():
|
||||
$DontHaveConnectionPanelContainer/Label.text %= $VerifyNetworkGithub.server_to_test
|
||||
|
||||
if godot_version[godot_version.length()-1] == "0":
|
||||
godot_version = godot_version.substr(0, godot_version.length()-2)
|
||||
|
||||
set_process(false)
|
||||
set_version_platform_supported("ios")
|
||||
set_version_platform_supported("android")
|
||||
$TabContainer/Android/ChangeDirectoryHBoxContainer/DownloadDirectoryLabel.text = current_dir_download_label % android_dictionary.download_directory
|
||||
$TabContainer/iOS/ChangeDirectoryHBoxContainer/DownloadDirectoryLabel.text = current_dir_download_label % ios_dictionary.download_directory
|
||||
|
||||
func set_version_platform_supported(platform):
|
||||
if platform == "android":
|
||||
$TabContainer/Android/VersionHBoxContainer/AndroidVersion.clear()
|
||||
for i in android_dictionary.version:
|
||||
$TabContainer/Android/VersionHBoxContainer/AndroidVersion.add_item(i)
|
||||
elif platform == "ios":
|
||||
$TabContainer/iOS/VersionHBoxContainer/iOSVersion.clear()
|
||||
for i in ios_dictionary.version:
|
||||
$TabContainer/iOS/VersionHBoxContainer/iOSVersion.add_item(i)
|
||||
|
||||
|
||||
func _process(delta):
|
||||
var bodySize = $TabContainer/HTTPRequest.get_body_size()
|
||||
var downloadedBytes = $TabContainer/HTTPRequest.get_downloaded_bytes()
|
||||
var percent = int(downloadedBytes*100/bodySize)
|
||||
$ProgressBar.value = percent
|
||||
|
||||
|
||||
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
||||
if response_code != 200:
|
||||
$AdviceAcceptDialog.dialog_text = "!!!DOWNLOAD FAILED!!!"
|
||||
$ProgressBar.value = 0
|
||||
else:
|
||||
$AdviceAcceptDialog.dialog_text = download_complete_message % [actual_downloading_file, downloaded_plugin_version]
|
||||
|
||||
set_process(false)
|
||||
$AdviceAcceptDialog.popup_centered()
|
||||
|
||||
|
||||
func _on_DownloadGoogleMobileAdsSdkiOS_pressed():
|
||||
var file_name = "googlemobileadssdkios.zip"
|
||||
var plugin_version = version_support.ios
|
||||
$TabContainer/HTTPRequest.download_file = ios_dictionary.download_directory + "/" + file_name
|
||||
$TabContainer/HTTPRequest.request("https://github.com/Poing-Studios/godot-admob-ios/releases/download/" + plugin_version + "/" + file_name)
|
||||
actual_downloading_file = file_name
|
||||
downloaded_plugin_version = "iOS Plugin Version: " + plugin_version
|
||||
|
||||
set_process(true)
|
||||
|
||||
func _on_DownloadiOSTemplate_pressed():
|
||||
var ios_version = $TabContainer/iOS/VersionHBoxContainer/iOSVersion.text
|
||||
if ios_version == "CURRENT":
|
||||
ios_version = godot_version
|
||||
|
||||
var file_name = "ios-template-" + ios_version + ".zip"
|
||||
var plugin_version = version_support.ios
|
||||
$TabContainer/HTTPRequest.download_file = ios_dictionary.download_directory + "/" + file_name
|
||||
$TabContainer/HTTPRequest.request("https://github.com/Poing-Studios/godot-admob-ios/releases/download/" + plugin_version + "/" + file_name)
|
||||
actual_downloading_file = file_name
|
||||
downloaded_plugin_version = "iOS Plugin Version: " + plugin_version
|
||||
|
||||
set_process(true)
|
||||
|
||||
func _on_DownloadAndroidTemplate_pressed():
|
||||
var android_version = $TabContainer/Android/VersionHBoxContainer/AndroidVersion.text.to_lower()
|
||||
if android_version == "current":
|
||||
android_version = godot_version
|
||||
|
||||
var android_target = $TabContainer/Android/TargetHBoxContainer/MenuButton.text.to_lower()
|
||||
|
||||
if android_target == "current":
|
||||
android_target = "mono" if Engine.has_singleton("GodotSharp") else "standard"
|
||||
|
||||
|
||||
var file_name = "android-"+ android_target + "-template-" + android_version + ".zip"
|
||||
var plugin_version = version_support.android
|
||||
$TabContainer/HTTPRequest.download_file = android_dictionary.download_directory + "/" + file_name
|
||||
$TabContainer/HTTPRequest.request("https://github.com/Poing-Studios/godot-admob-android/releases/download/" + plugin_version + "/" + file_name)
|
||||
actual_downloading_file = file_name
|
||||
|
||||
downloaded_plugin_version = "Android Plugin Version: " + plugin_version
|
||||
|
||||
set_process(true)
|
||||
|
||||
|
||||
func _on_AndroidChangeDirectoryFileDialog_dir_selected(dir):
|
||||
self.android_dictionary.download_directory = dir
|
||||
|
||||
func _on_AndroidChangeDirectoryButton_pressed():
|
||||
$TabContainer/Android/ChangeDirectoryHBoxContainer/AndroidChangeDirectoryFileDialog.popup_centered()
|
||||
|
||||
|
||||
func _on_iOSChangeDirectoryFileDialog_dir_selected(dir):
|
||||
self.ios_dictionary.download_directory = dir
|
||||
|
||||
func _on_iOSChangeDirectoryButton_pressed():
|
||||
$TabContainer/iOS/ChangeDirectoryHBoxContainer/iOSChangeDirectoryFileDialog.popup_centered()
|
||||
|
||||
|
||||
func _on_AndroidOpenDirectoryButton_pressed():
|
||||
var path_directory = ProjectSettings.globalize_path(android_dictionary.download_directory)
|
||||
OS.shell_open(str("file://", path_directory))
|
||||
|
||||
|
||||
func _on_iOSOpenDirectoryButton_pressed():
|
||||
var path_directory = ProjectSettings.globalize_path(ios_dictionary.download_directory)
|
||||
OS.shell_open(str("file://", path_directory))
|
||||
|
||||
|
||||
func _on_VerifyNetworkGithub_network_status_changed(value : int):
|
||||
if value == $VerifyNetworkGithub.CONNECTED:
|
||||
$TabContainer.visible = true
|
||||
$DontHaveConnectionPanelContainer.visible = false
|
||||
else:
|
||||
$TabContainer.visible = false
|
||||
$DontHaveConnectionPanelContainer.visible = true
|
||||
|
||||
|
||||
func _on_VersionSupportedHTTPRequest_supported_version_changed(value_dictionary : Dictionary):
|
||||
version_support = value_dictionary
|
||||
$VersionsAndroidSupportedHTTPRequest.request("https://api.github.com/repos/Poing-Studios/godot-admob-android/releases/tags/"+version_support["android"])
|
||||
$VersionsiOSSupportedHTTPRequest.request("https://api.github.com/repos/Poing-Studios/godot-admob-ios/releases/tags/"+version_support["ios"])
|
||||
|
||||
|
||||
func get_versions_platform_supported(body):
|
||||
var json = JSON.parse(body.get_string_from_utf8())
|
||||
|
||||
var regex = RegEx.new()
|
||||
regex.compile("[v](([0-9])+(\\.{0,1}([0-9]))*)+")
|
||||
|
||||
var versions_supported : Array
|
||||
|
||||
for asset in json.result["assets"]:
|
||||
var godot_version = asset["name"]
|
||||
|
||||
var regex_result = regex.search(godot_version)
|
||||
if regex_result:
|
||||
if not versions_supported.has(regex_result.get_string()):
|
||||
versions_supported.append(regex_result.get_string())
|
||||
|
||||
return versions_supported
|
||||
|
||||
|
||||
|
||||
func _on_VersionsiOSSupportedHTTPRequest_request_completed(result, response_code, headers, body):
|
||||
ios_dictionary.version.append_array(get_versions_platform_supported(body))
|
||||
set_version_platform_supported("ios")
|
||||
|
||||
func _on_VersionsAndroidSupportedHTTPRequest_request_completed(result, response_code, headers, body):
|
||||
android_dictionary.version.append_array(get_versions_platform_supported(body))
|
||||
set_version_platform_supported("android")
|
265
addons/admob/src/core/components/Downloads.tscn
Normal file
@ -0,0 +1,265 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://addons/admob/src/core/components/Downloads.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/admob/src/core/components/VerifyNetworkGithub.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/admob/src/core/VersionSupportedHTTPRequest.tscn" type="PackedScene" id=3]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 0, 1, 0.109804, 1 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=2]
|
||||
|
||||
[node name="Downloads" type="VBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
margin_bottom = 31.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Advice" type="Label" parent="."]
|
||||
margin_right = 720.0
|
||||
margin_bottom = 65.0
|
||||
text = "This screen is just to download the AdMob plugin referring to the current version of your Godot, IT WILL NOT INSTALL.
|
||||
|
||||
To install you need to follow the Android or iOS installation guide clicking on the icons on top screen."
|
||||
autowrap = true
|
||||
|
||||
[node name="ProgressBar" type="ProgressBar" parent="."]
|
||||
margin_top = 69.0
|
||||
margin_right = 720.0
|
||||
margin_bottom = 83.0
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
custom_styles/fg = SubResource( 1 )
|
||||
custom_styles/bg = SubResource( 2 )
|
||||
|
||||
[node name="AdviceAcceptDialog" type="AcceptDialog" parent="."]
|
||||
margin_top = 104.0
|
||||
margin_right = 500.0
|
||||
margin_bottom = 162.0
|
||||
popup_exclusive = true
|
||||
window_title = "Alerta!"
|
||||
dialog_text = "Download of %s completed! \\n%s"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="TabContainer" type="TabContainer" parent="."]
|
||||
margin_top = 87.0
|
||||
margin_right = 720.0
|
||||
margin_bottom = 215.0
|
||||
|
||||
[node name="HTTPRequest" type="HTTPRequest" parent="TabContainer"]
|
||||
|
||||
[node name="Android" type="VBoxContainer" parent="TabContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="ChangeDirectoryHBoxContainer" type="HBoxContainer" parent="TabContainer/Android"]
|
||||
margin_right = 712.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="DownloadDirectoryLabel" type="Label" parent="TabContainer/Android/ChangeDirectoryHBoxContainer"]
|
||||
margin_top = 3.0
|
||||
margin_right = 440.0
|
||||
margin_bottom = 17.0
|
||||
text = "Current Download Directory: res://addons/admob/downloads/android"
|
||||
|
||||
[node name="AndroidChangeDirectoryButton" type="Button" parent="TabContainer/Android/ChangeDirectoryHBoxContainer"]
|
||||
margin_left = 444.0
|
||||
margin_right = 585.0
|
||||
margin_bottom = 20.0
|
||||
text = "CHANGE DIRECTORY"
|
||||
|
||||
[node name="AndroidOpenDirectoryButton" type="Button" parent="TabContainer/Android/ChangeDirectoryHBoxContainer"]
|
||||
margin_left = 589.0
|
||||
margin_right = 712.0
|
||||
margin_bottom = 20.0
|
||||
text = "OPEN DIRECTORY"
|
||||
|
||||
[node name="AndroidChangeDirectoryFileDialog" type="FileDialog" parent="TabContainer/Android/ChangeDirectoryHBoxContainer"]
|
||||
margin_left = 380.0
|
||||
margin_right = 780.0
|
||||
margin_bottom = 250.0
|
||||
rect_min_size = Vector2( 400, 250 )
|
||||
window_title = "Open a Directory"
|
||||
mode = 2
|
||||
current_dir = "res://addons/admob/downloads/android"
|
||||
current_path = "res://addons/admob/downloads/android/"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VersionHBoxContainer" type="HBoxContainer" parent="TabContainer/Android"]
|
||||
margin_top = 24.0
|
||||
margin_right = 712.0
|
||||
margin_bottom = 44.0
|
||||
|
||||
[node name="Label" type="Label" parent="TabContainer/Android/VersionHBoxContainer"]
|
||||
margin_top = 3.0
|
||||
margin_right = 52.0
|
||||
margin_bottom = 17.0
|
||||
text = "Version:"
|
||||
|
||||
[node name="AndroidVersion" type="OptionButton" parent="TabContainer/Android/VersionHBoxContainer"]
|
||||
margin_left = 56.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 20.0
|
||||
text = "CURRENT"
|
||||
items = [ "CURRENT", null, false, 0, null, "v3.2.2", null, false, 1, null, "v3.2.3", null, false, 2, null, "v3.3.1", null, false, 3, null, "v3.3.2", null, false, 4, null, "v3.3.3", null, false, 5, null, "v3.3.4", null, false, 6, null, "v3.3", null, false, 7, null, "v3.4.1", null, false, 8, null, "v3.4.2", null, false, 9, null, "v3.4.3", null, false, 10, null, "v3.4.4", null, false, 11, null, "v3.4", null, false, 12, null ]
|
||||
selected = 0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="TargetHBoxContainer" type="HBoxContainer" parent="TabContainer/Android"]
|
||||
margin_top = 48.0
|
||||
margin_right = 712.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="Label" type="Label" parent="TabContainer/Android/TargetHBoxContainer"]
|
||||
margin_top = 3.0
|
||||
margin_right = 43.0
|
||||
margin_bottom = 17.0
|
||||
text = "Target:"
|
||||
|
||||
[node name="MenuButton" type="OptionButton" parent="TabContainer/Android/TargetHBoxContainer"]
|
||||
margin_left = 47.0
|
||||
margin_right = 134.0
|
||||
margin_bottom = 20.0
|
||||
text = "CURRENT"
|
||||
items = [ "CURRENT", null, false, 0, null, "STANDARD", null, false, 1, null, "MONO", null, false, 2, null ]
|
||||
selected = 0
|
||||
|
||||
[node name="DownloadAndroidTemplate" type="Button" parent="TabContainer/Android"]
|
||||
margin_top = 72.0
|
||||
margin_right = 712.0
|
||||
margin_bottom = 92.0
|
||||
text = "Download Android Template"
|
||||
|
||||
[node name="iOS" type="VBoxContainer" parent="TabContainer"]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 24.0
|
||||
margin_right = 599.0
|
||||
margin_bottom = 354.0
|
||||
|
||||
[node name="ChangeDirectoryHBoxContainer" type="HBoxContainer" parent="TabContainer/iOS"]
|
||||
margin_right = 1690.0
|
||||
margin_bottom = 250.0
|
||||
|
||||
[node name="DownloadDirectoryLabel" type="Label" parent="TabContainer/iOS/ChangeDirectoryHBoxContainer"]
|
||||
margin_top = 118.0
|
||||
margin_right = 411.0
|
||||
margin_bottom = 132.0
|
||||
text = "Current Download Directory: res://addons/admob/downloads/ios"
|
||||
|
||||
[node name="iOSChangeDirectoryButton" type="Button" parent="TabContainer/iOS/ChangeDirectoryHBoxContainer"]
|
||||
margin_left = 415.0
|
||||
margin_right = 556.0
|
||||
margin_bottom = 250.0
|
||||
text = "CHANGE DIRECTORY"
|
||||
|
||||
[node name="iOSOpenDirectoryButton" type="Button" parent="TabContainer/iOS/ChangeDirectoryHBoxContainer"]
|
||||
margin_left = 560.0
|
||||
margin_right = 683.0
|
||||
margin_bottom = 250.0
|
||||
text = "OPEN DIRECTORY"
|
||||
|
||||
[node name="iOSChangeDirectoryFileDialog" type="FileDialog" parent="TabContainer/iOS/ChangeDirectoryHBoxContainer"]
|
||||
visible = true
|
||||
margin_left = 687.0
|
||||
margin_right = 1087.0
|
||||
margin_bottom = 250.0
|
||||
rect_min_size = Vector2( 400, 250 )
|
||||
window_title = "Open a Directory"
|
||||
mode = 2
|
||||
current_dir = "res://addons/admob/downloads/ios"
|
||||
current_path = "res://addons/admob/downloads/ios/"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VersionHBoxContainer" type="HBoxContainer" parent="TabContainer/iOS"]
|
||||
margin_top = 254.0
|
||||
margin_right = 1690.0
|
||||
margin_bottom = 274.0
|
||||
|
||||
[node name="Label" type="Label" parent="TabContainer/iOS/VersionHBoxContainer"]
|
||||
margin_top = 3.0
|
||||
margin_right = 52.0
|
||||
margin_bottom = 17.0
|
||||
text = "Version:"
|
||||
|
||||
[node name="iOSVersion" type="OptionButton" parent="TabContainer/iOS/VersionHBoxContainer"]
|
||||
margin_left = 56.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 20.0
|
||||
text = "CURRENT"
|
||||
items = [ "CURRENT", null, false, 0, null, "v3.3.1", null, false, 1, null, "v3.3.2", null, false, 2, null, "v3.3.3", null, false, 3, null, "v3.3.4", null, false, 4, null, "v3.3", null, false, 5, null, "v3.4.1", null, false, 6, null, "v3.4.2", null, false, 7, null, "v3.4.3", null, false, 8, null, "v3.4.4", null, false, 9, null, "v3.4", null, false, 10, null ]
|
||||
selected = 0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="DownloadiOSTemplate" type="Button" parent="TabContainer/iOS"]
|
||||
margin_top = 278.0
|
||||
margin_right = 1690.0
|
||||
margin_bottom = 298.0
|
||||
text = "Download iOS Template"
|
||||
|
||||
[node name="DownloadGoogleMobileAdsSdkiOS" type="Button" parent="TabContainer/iOS"]
|
||||
margin_top = 302.0
|
||||
margin_right = 1690.0
|
||||
margin_bottom = 322.0
|
||||
text = "Download GoogleMobileAdsSdkiOS"
|
||||
|
||||
[node name="DontHaveConnectionPanelContainer" type="PanelContainer" parent="."]
|
||||
visible = false
|
||||
margin_top = 219.0
|
||||
margin_right = 720.0
|
||||
margin_bottom = 263.0
|
||||
|
||||
[node name="Label" type="RichTextLabel" parent="DontHaveConnectionPanelContainer"]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 713.0
|
||||
margin_bottom = 37.0
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "[b]You don't have connection to the Server: %s, please verify your connection in order to Download[/b]"
|
||||
text = "You don't have connection to the Server: https://github.com/, please verify your connection in order to Download"
|
||||
fit_content_height = true
|
||||
scroll_active = false
|
||||
|
||||
[node name="VerifyNetworkGithub" type="HTTPRequest" parent="."]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="VerifyAgainTimer" type="Timer" parent="VerifyNetworkGithub"]
|
||||
wait_time = 60.0
|
||||
autostart = true
|
||||
|
||||
[node name="VersionSupportedHTTPRequest" parent="." instance=ExtResource( 3 )]
|
||||
|
||||
[node name="VersionsAndroidSupportedHTTPRequest" type="HTTPRequest" parent="."]
|
||||
|
||||
[node name="VersionsiOSSupportedHTTPRequest" type="HTTPRequest" parent="."]
|
||||
|
||||
[connection signal="request_completed" from="TabContainer/HTTPRequest" to="." method="_on_HTTPRequest_request_completed"]
|
||||
[connection signal="pressed" from="TabContainer/Android/ChangeDirectoryHBoxContainer/AndroidChangeDirectoryButton" to="." method="_on_AndroidChangeDirectoryButton_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Android/ChangeDirectoryHBoxContainer/AndroidOpenDirectoryButton" to="." method="_on_AndroidOpenDirectoryButton_pressed"]
|
||||
[connection signal="dir_selected" from="TabContainer/Android/ChangeDirectoryHBoxContainer/AndroidChangeDirectoryFileDialog" to="." method="_on_AndroidChangeDirectoryFileDialog_dir_selected"]
|
||||
[connection signal="pressed" from="TabContainer/Android/DownloadAndroidTemplate" to="." method="_on_DownloadAndroidTemplate_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/iOS/ChangeDirectoryHBoxContainer/iOSChangeDirectoryButton" to="." method="_on_iOSChangeDirectoryButton_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/iOS/ChangeDirectoryHBoxContainer/iOSOpenDirectoryButton" to="." method="_on_iOSOpenDirectoryButton_pressed"]
|
||||
[connection signal="dir_selected" from="TabContainer/iOS/ChangeDirectoryHBoxContainer/iOSChangeDirectoryFileDialog" to="." method="_on_iOSChangeDirectoryFileDialog_dir_selected"]
|
||||
[connection signal="pressed" from="TabContainer/iOS/DownloadiOSTemplate" to="." method="_on_DownloadiOSTemplate_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/iOS/DownloadGoogleMobileAdsSdkiOS" to="." method="_on_DownloadGoogleMobileAdsSdkiOS_pressed"]
|
||||
[connection signal="network_status_changed" from="VerifyNetworkGithub" to="." method="_on_VerifyNetworkGithub_network_status_changed"]
|
||||
[connection signal="request_completed" from="VerifyNetworkGithub" to="VerifyNetworkGithub" method="_on_VerifyNetworkGithub_request_completed"]
|
||||
[connection signal="timeout" from="VerifyNetworkGithub/VerifyAgainTimer" to="VerifyNetworkGithub" method="_on_VerifyAgainTimer_timeout"]
|
||||
[connection signal="supported_version_changed" from="VersionSupportedHTTPRequest" to="." method="_on_VersionSupportedHTTPRequest_supported_version_changed"]
|
||||
[connection signal="request_completed" from="VersionsAndroidSupportedHTTPRequest" to="." method="_on_VersionsAndroidSupportedHTTPRequest_request_completed"]
|
||||
[connection signal="request_completed" from="VersionsiOSSupportedHTTPRequest" to="." method="_on_VersionsiOSSupportedHTTPRequest_request_completed"]
|
20
addons/admob/src/core/components/Enabled.gd
Normal file
@ -0,0 +1,20 @@
|
||||
tool
|
||||
extends CheckBox
|
||||
|
||||
onready var AdMobEditor : Control = find_parent("AdMobEditor")
|
||||
|
||||
func _ready() -> void:
|
||||
pressed = AdMobEditor.AdMobSettings.config.general.is_enabled
|
||||
|
||||
|
||||
func _on_Enabled_pressed():
|
||||
if not pressed:
|
||||
pressed = true
|
||||
$ConfirmationDialog.show()
|
||||
else:
|
||||
AdMobEditor.AdMobSettings.config.general.is_enabled = pressed
|
||||
|
||||
|
||||
func _on_ConfirmationDialog_confirmed() -> void:
|
||||
pressed = false
|
||||
AdMobEditor.AdMobSettings.config.general.is_enabled = pressed
|
15
addons/admob/src/core/components/General.gd
Normal file
@ -0,0 +1,15 @@
|
||||
tool
|
||||
extends VBoxContainer
|
||||
|
||||
onready var AdMobEditor : Control = find_parent("AdMobEditor")
|
||||
|
||||
func _ready():
|
||||
$ChildDirectedTreatment.pressed = AdMobEditor.AdMobSettings.config.general.is_for_child_directed_treatment
|
||||
$MaxAdContentRating/Value.selected = AdMobEditor.AdMobSettings.MAX_AD_RATING.find(AdMobEditor.AdMobSettings.config.general.max_ad_content_rating)
|
||||
|
||||
|
||||
func _on_ChildDirectedTreatment_pressed():
|
||||
AdMobEditor.AdMobSettings.config.general.is_for_child_directed_treatment = $ChildDirectedTreatment.pressed
|
||||
|
||||
func _on_MaxAdContentRating_item_selected(index):
|
||||
AdMobEditor.AdMobSettings.config.general.max_ad_content_rating = AdMobEditor.AdMobSettings.MAX_AD_RATING[index]
|
78
addons/admob/src/core/components/General.tscn
Normal file
@ -0,0 +1,78 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/admob/src/core/components/General.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/admob/src/core/components/Enabled.gd" type="Script" id=2]
|
||||
|
||||
[node name="General" type="VBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Enabled" type="CheckBox" parent="."]
|
||||
margin_right = 592.0
|
||||
margin_bottom = 24.0
|
||||
pressed = true
|
||||
text = "Enabled"
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ConfirmationDialog" type="ConfirmationDialog" parent="Enabled"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -334.0
|
||||
margin_top = -46.0
|
||||
margin_right = 334.0
|
||||
margin_bottom = 46.0
|
||||
dialog_text = "If \"Enabled\" is false then ads will no longer work, are you sure?
|
||||
|
||||
Note: You can disable ads if the user purchases by IAP, that's why this attribute can be useful."
|
||||
|
||||
[node name="ChildDirectedTreatment" type="CheckBox" parent="."]
|
||||
margin_top = 28.0
|
||||
margin_right = 592.0
|
||||
margin_bottom = 52.0
|
||||
text = "Child Directed Treatment"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MaxAdContentRating" type="HBoxContainer" parent="."]
|
||||
margin_top = 56.0
|
||||
margin_right = 592.0
|
||||
margin_bottom = 76.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Key" type="Label" parent="MaxAdContentRating"]
|
||||
margin_top = 3.0
|
||||
margin_right = 132.0
|
||||
margin_bottom = 17.0
|
||||
text = "MaxAdContentRating"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Value" type="OptionButton" parent="MaxAdContentRating"]
|
||||
margin_left = 136.0
|
||||
margin_right = 183.0
|
||||
margin_bottom = 20.0
|
||||
text = "PG"
|
||||
items = [ "G", null, false, 0, null, "PG", null, false, 1, null, "T", null, false, 2, null, "MA", null, false, 3, null ]
|
||||
selected = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="pressed" from="Enabled" to="Enabled" method="_on_Enabled_pressed"]
|
||||
[connection signal="confirmed" from="Enabled/ConfirmationDialog" to="Enabled" method="_on_ConfirmationDialog_confirmed"]
|
||||
[connection signal="pressed" from="ChildDirectedTreatment" to="." method="_on_ChildDirectedTreatment_pressed"]
|
||||
[connection signal="item_selected" from="MaxAdContentRating/Value" to="." method="_on_MaxAdContentRating_item_selected"]
|
18
addons/admob/src/core/components/VerifyNetworkGithub.gd
Normal file
@ -0,0 +1,18 @@
|
||||
tool
|
||||
extends HTTPRequest
|
||||
|
||||
enum {CONNECTED = 200}
|
||||
|
||||
signal network_status_changed(value)
|
||||
|
||||
export var server_to_test = "https://github.com/"
|
||||
|
||||
func _ready():
|
||||
request(server_to_test)
|
||||
|
||||
func _on_VerifyNetworkGithub_request_completed(result, response_code, headers, body):
|
||||
emit_signal("network_status_changed", response_code)
|
||||
|
||||
|
||||
func _on_VerifyAgainTimer_timeout():
|
||||
request(server_to_test)
|
14
addons/admob/src/core/components/ad_format/AdFormat.tscn
Normal file
@ -0,0 +1,14 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/admob/src/core/components/ad_format/unit_ids/UnitIds.tscn" type="PackedScene" id=1]
|
||||
|
||||
[node name="AdFormat" type="VBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="UnitIds" parent="." instance=ExtResource( 1 )]
|
||||
margin_right = 500.0
|
||||
margin_bottom = 60.0
|
23
addons/admob/src/core/components/ad_format/BannerAdFormat.gd
Normal file
@ -0,0 +1,23 @@
|
||||
tool
|
||||
extends VBoxContainer
|
||||
onready var AdMobEditor : Control = find_parent("AdMobEditor")
|
||||
|
||||
func _ready():
|
||||
$RespectSafeArea.connect("value_changed", self, "_on_RespectSafeArea_value_changed")
|
||||
|
||||
$BannerSizeHBoxContainer/BannerSize.selected = AdMobEditor.AdMobSettings.BANNER_SIZE.find(AdMobEditor.AdMobSettings.config.banner.size)
|
||||
$RespectSafeArea.pressed = AdMobEditor.AdMobSettings.config.banner.respect_safe_area
|
||||
$BannerShowInstantly.pressed = AdMobEditor.AdMobSettings.config.banner.show_instantly
|
||||
$BannerOnTop.pressed = AdMobEditor.AdMobSettings.config.banner.position
|
||||
|
||||
func _on_BannerSize_item_selected(index):
|
||||
AdMobEditor.AdMobSettings.config.banner.size = AdMobEditor.AdMobSettings.BANNER_SIZE[index]
|
||||
|
||||
func _on_BannerShowInstantly_pressed():
|
||||
AdMobEditor.AdMobSettings.config.banner.show_instantly = $BannerShowInstantly.pressed#
|
||||
|
||||
func _on_BannerOnTop_pressed():
|
||||
AdMobEditor.AdMobSettings.config.banner.position = int($BannerOnTop.pressed)
|
||||
|
||||
func _on_RespectSafeArea_value_changed(value : bool):
|
||||
AdMobEditor.AdMobSettings.config.banner.respect_safe_area = value
|
@ -0,0 +1,86 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/admob/src/core/components/ad_format/AdFormat.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://addons/admob/src/core/components/ad_format/BannerAdFormat.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/admob/src/core/components/ad_format/RespectSafeArea.gd" type="Script" id=3]
|
||||
|
||||
[node name="BannerAdFormat" instance=ExtResource( 1 )]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="BannerSizeHBoxContainer" type="HBoxContainer" parent="." index="0"]
|
||||
margin_right = 500.0
|
||||
margin_bottom = 20.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="BannerSizeHBoxContainer" index="0"]
|
||||
margin_top = 3.0
|
||||
margin_right = 75.0
|
||||
margin_bottom = 17.0
|
||||
text = "Banner Size"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="BannerSize" type="OptionButton" parent="BannerSizeHBoxContainer" index="1"]
|
||||
margin_left = 79.0
|
||||
margin_right = 243.0
|
||||
margin_bottom = 20.0
|
||||
text = "MEDIUM_RECTANGLE"
|
||||
items = [ "BANNER", null, false, 0, null, "MEDIUM_RECTANGLE", null, false, 1, null, "FULL_BANNER", null, false, 2, null, "LEADERBOARD", null, false, 3, null, "ADAPTIVE", null, false, 4, null, "SMART_BANNER", null, false, 5, null ]
|
||||
selected = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="RespectSafeArea" type="CheckBox" parent="." index="1"]
|
||||
margin_top = 24.0
|
||||
margin_right = 500.0
|
||||
margin_bottom = 48.0
|
||||
pressed = true
|
||||
text = "Respect Safe Area (RECOMMEND TRUE)"
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="ConfirmationDialog" type="ConfirmationDialog" parent="RespectSafeArea" index="0"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -250.0
|
||||
margin_top = -114.0
|
||||
margin_right = 250.0
|
||||
margin_bottom = 114.0
|
||||
window_title = "!!!WARNING!!!"
|
||||
dialog_text = "IT'S NOT RECOMMENDED LEAVE THIS AS FALSE
|
||||
|
||||
According to Google AdMob documentation for iOS: Banner ads must be placed in the \"Safe Area\" to avoid being obscured by rounded corners, sensor housing, and the Home indicator.
|
||||
|
||||
Read here: https://developers.google.com/admob/ios/x-ad-rendering"
|
||||
dialog_autowrap = true
|
||||
|
||||
[node name="BannerShowInstantly" type="CheckBox" parent="." index="2"]
|
||||
margin_top = 52.0
|
||||
margin_right = 500.0
|
||||
margin_bottom = 76.0
|
||||
pressed = true
|
||||
text = "Show Banner Instantly"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="BannerOnTop" type="CheckBox" parent="." index="3"]
|
||||
margin_top = 80.0
|
||||
margin_right = 500.0
|
||||
margin_bottom = 104.0
|
||||
text = "Banner On Top"
|
||||
|
||||
[node name="UnitIds" parent="." index="4"]
|
||||
margin_top = 108.0
|
||||
margin_bottom = 168.0
|
||||
|
||||
[connection signal="item_selected" from="BannerSizeHBoxContainer/BannerSize" to="." method="_on_BannerSize_item_selected"]
|
||||
[connection signal="pressed" from="RespectSafeArea" to="RespectSafeArea" method="_on_RespectSafeArea_pressed"]
|
||||
[connection signal="confirmed" from="RespectSafeArea/ConfirmationDialog" to="RespectSafeArea" method="_on_ConfirmationDialog_confirmed"]
|
||||
[connection signal="pressed" from="BannerShowInstantly" to="." method="_on_BannerShowInstantly_pressed"]
|
||||
[connection signal="pressed" from="BannerOnTop" to="." method="_on_BannerOnTop_pressed"]
|
@ -0,0 +1,5 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/admob/src/core/components/ad_format/AdFormat.tscn" type="PackedScene" id=1]
|
||||
|
||||
[node name="InterstitialAdFormat" instance=ExtResource( 1 )]
|
@ -0,0 +1,17 @@
|
||||
tool
|
||||
extends CheckBox
|
||||
|
||||
signal value_changed(value)
|
||||
|
||||
|
||||
func _on_ConfirmationDialog_confirmed():
|
||||
pressed = false
|
||||
emit_signal("value_changed", pressed)
|
||||
|
||||
|
||||
func _on_RespectSafeArea_pressed():
|
||||
if not pressed:
|
||||
pressed = true
|
||||
$ConfirmationDialog.show()
|
||||
else:
|
||||
emit_signal("value_changed", pressed)
|
@ -0,0 +1,5 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/admob/src/core/components/ad_format/AdFormat.tscn" type="PackedScene" id=1]
|
||||
|
||||
[node name="RewardedAdFormat" instance=ExtResource( 1 )]
|
@ -0,0 +1,5 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/admob/src/core/components/ad_format/AdFormat.tscn" type="PackedScene" id=1]
|
||||
|
||||
[node name="RewardedInterstitialAdFormat" instance=ExtResource( 1 )]
|
@ -0,0 +1,44 @@
|
||||
tool
|
||||
extends HBoxContainer
|
||||
|
||||
var AdUnit = preload("res://addons/admob/src/core/components/ad_format/unit_ids/ad_unit_operational_system/ad_unit/AdUnit.tscn")
|
||||
|
||||
onready var AdMobEditor : Control = find_parent("AdMobEditor")
|
||||
onready var ad_format_name = AdMobEditor.AdMobSettings.pascal2snake(get_parent().name)
|
||||
|
||||
func _ready():
|
||||
for operational_system in $OperationalSystemTabContainer.get_children():
|
||||
for unit_name in (AdMobEditor.AdMobSettings.config[ad_format_name].unit_ids[operational_system.name] as Dictionary):
|
||||
var unit_id = AdMobEditor.AdMobSettings.config[ad_format_name].unit_ids[operational_system.name][unit_name]
|
||||
instance_ad_unit(operational_system.name, false, unit_name, unit_id)
|
||||
get_node("OperationalSystemTabContainer/"+operational_system.name+"/AddAdUnitButton").connect("pressed", self, "_on_AddAdUnitButton_pressed", [operational_system.name])
|
||||
|
||||
|
||||
func _on_AdUnitChanged(name_value: String, id_value: String, old_name_value :String, system):
|
||||
remove_ad_unit(system, name_value)
|
||||
remove_ad_unit(system, old_name_value)
|
||||
add_ad_unit(system, name_value, id_value)
|
||||
|
||||
func _on_AdUnitRemoved(name_value : String, system):
|
||||
remove_ad_unit(system, name_value)
|
||||
|
||||
func _on_AddAdUnitButton_pressed(system):
|
||||
instance_ad_unit(system, true)
|
||||
|
||||
|
||||
func add_ad_unit(operational_system : String, name_value: String, id_value : String):
|
||||
AdMobEditor.AdMobSettings.config[ad_format_name].unit_ids[operational_system][name_value] = id_value
|
||||
|
||||
func remove_ad_unit(operational_system : String, name_value: String):
|
||||
AdMobEditor.AdMobSettings.config[ad_format_name].unit_ids[operational_system].erase(name_value)
|
||||
AdMobEditor.AdMobSettings.save_config()
|
||||
|
||||
func instance_ad_unit(system : String, is_editing : bool, unit_name : String = "", unit_id : String = ""):
|
||||
var tab_container = get_node("OperationalSystemTabContainer/"+system+"/AdUnitVBoxContainer")
|
||||
var ad_unit = AdUnit.instance()
|
||||
tab_container.add_child(ad_unit)
|
||||
ad_unit.connect("AdUnitChanged", self, "_on_AdUnitChanged", [system])
|
||||
ad_unit.connect("AdUnitRemoved", self, "_on_AdUnitRemoved", [system])
|
||||
ad_unit.Name.text = unit_name
|
||||
ad_unit.Id.text = unit_id
|
||||
ad_unit.is_editing = is_editing
|
@ -0,0 +1,50 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/admob/src/core/components/ad_format/unit_ids/UnitIds.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/admob/src/core/components/ad_format/unit_ids/ad_unit_operational_system/AdUnitOperationalSystem.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="UnitIds" type="HBoxContainer"]
|
||||
margin_right = 600.0
|
||||
margin_bottom = 84.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Description" type="Label" parent="."]
|
||||
margin_top = 35.0
|
||||
margin_right = 58.0
|
||||
margin_bottom = 49.0
|
||||
text = "UNIT IDS"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="OperationalSystemTabContainer" type="TabContainer" parent="."]
|
||||
margin_left = 62.0
|
||||
margin_right = 262.0
|
||||
margin_bottom = 84.0
|
||||
rect_min_size = Vector2( 200, 0 )
|
||||
rect_clip_content = true
|
||||
mouse_filter = 1
|
||||
tab_align = 0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Android" parent="OperationalSystemTabContainer" instance=ExtResource( 2 )]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="iOS" parent="OperationalSystemTabContainer" instance=ExtResource( 2 )]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
@ -0,0 +1,23 @@
|
||||
[gd_scene format=2]
|
||||
|
||||
[node name="AdUnitOperationalSystem" type="VBoxContainer"]
|
||||
margin_right = 382.0
|
||||
margin_bottom = 159.0
|
||||
rect_clip_content = true
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="AdUnitVBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_right = 382.0
|
||||
margin_bottom = 135.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="AddAdUnitButton" type="Button" parent="."]
|
||||
margin_top = 139.0
|
||||
margin_right = 382.0
|
||||
margin_bottom = 159.0
|
||||
text = "ADD"
|
@ -0,0 +1,75 @@
|
||||
tool
|
||||
extends GridContainer
|
||||
|
||||
signal AdUnitChanged(name_value, id_value, old_name_value)
|
||||
signal AdUnitRemoved(name_value)
|
||||
|
||||
onready var Name := $Name
|
||||
onready var Id := $Id
|
||||
onready var ChildrenParent := get_parent().get_children()
|
||||
onready var AddAdUnitButtonParent := get_parent().get_parent().get_node("AddAdUnitButton")
|
||||
|
||||
var old_name_value := ""
|
||||
var is_editing := true setget set_is_editing
|
||||
|
||||
func _ready():
|
||||
if get_index() == 0:
|
||||
$GridContainer/RemoveButton.disabled = true
|
||||
|
||||
func change_state(editing : bool) -> void:
|
||||
if editing:
|
||||
editing_state()
|
||||
else:
|
||||
not_editing_state()
|
||||
|
||||
func editing_state() -> void:
|
||||
$GridContainer/ConfirmButton.visible = true
|
||||
$GridContainer/EditButton.visible = false
|
||||
Name.editable = true
|
||||
Id.editable = true
|
||||
for ad_unit in ChildrenParent:
|
||||
if ad_unit.get_index() != get_index():
|
||||
if ad_unit.get_index() != 0: ad_unit.get_node("GridContainer/RemoveButton").disabled = true
|
||||
ad_unit.get_node("GridContainer/EditButton").disabled = true
|
||||
AddAdUnitButtonParent.disabled = true
|
||||
|
||||
func not_editing_state():
|
||||
$GridContainer/ConfirmButton.visible = false
|
||||
$GridContainer/EditButton.visible = true
|
||||
Name.editable = false
|
||||
Id.editable = false
|
||||
for ad_unit in ChildrenParent:
|
||||
if ad_unit.get_index() != 0: ad_unit.get_node("GridContainer/RemoveButton").disabled = false
|
||||
ad_unit.get_node("GridContainer/EditButton").disabled = false
|
||||
AddAdUnitButtonParent.disabled = false
|
||||
|
||||
|
||||
func set_is_editing(value : bool):
|
||||
change_state(value)
|
||||
|
||||
func _on_RemoveButton_pressed():
|
||||
if (get_parent().get_child_count() > 1):
|
||||
self.is_editing = false
|
||||
emit_signal("AdUnitRemoved", Name.text)
|
||||
queue_free()
|
||||
|
||||
func _on_ConfirmButton_pressed():
|
||||
if Name.text != "" && Id.text != "":
|
||||
for ad_unit in ChildrenParent:
|
||||
if ad_unit.get_index() != get_index():
|
||||
if ad_unit.Name.text == Name.text:
|
||||
$Alerts/UniqueNameAcceptDialog.popup_centered()
|
||||
return
|
||||
else:
|
||||
$Alerts/NameIdEmptyAcceptDialog.popup_centered()
|
||||
return
|
||||
emit_signal("AdUnitChanged", Name.text, Id.text, old_name_value)
|
||||
self.is_editing = false
|
||||
|
||||
|
||||
func _on_AdUnit_text_entered(new_text):
|
||||
$GridContainer/ConfirmButton.emit_signal("pressed")
|
||||
|
||||
func _on_EditButton_pressed():
|
||||
old_name_value = Name.text
|
||||
self.is_editing = true
|
@ -0,0 +1,97 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/admob/src/core/components/ad_format/unit_ids/ad_unit_operational_system/ad_unit/AdUnit.gd" type="Script" id=1]
|
||||
|
||||
[node name="AdUnit" type="GridContainer"]
|
||||
margin_right = 220.0
|
||||
margin_bottom = 24.0
|
||||
columns = 3
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Name" type="LineEdit" parent="."]
|
||||
margin_right = 108.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
text = "<insert-name>"
|
||||
align = 1
|
||||
expand_to_text_length = true
|
||||
virtual_keyboard_enabled = false
|
||||
|
||||
[node name="Id" type="LineEdit" parent="."]
|
||||
margin_left = 112.0
|
||||
margin_right = 196.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
text = "<insert-id>"
|
||||
align = 1
|
||||
expand_to_text_length = true
|
||||
virtual_keyboard_enabled = false
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="."]
|
||||
margin_left = 200.0
|
||||
margin_right = 255.0
|
||||
margin_bottom = 24.0
|
||||
columns = 2
|
||||
|
||||
[node name="ConfirmButton" type="Button" parent="GridContainer"]
|
||||
margin_right = 31.0
|
||||
margin_bottom = 20.0
|
||||
text = "OK"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="EditButton" type="Button" parent="GridContainer"]
|
||||
visible = false
|
||||
margin_left = 35.0
|
||||
margin_right = 76.0
|
||||
margin_bottom = 20.0
|
||||
text = "EDIT"
|
||||
|
||||
[node name="RemoveButton" type="Button" parent="GridContainer"]
|
||||
margin_left = 35.0
|
||||
margin_right = 55.0
|
||||
margin_bottom = 20.0
|
||||
text = "X"
|
||||
|
||||
[node name="Alerts" type="Node" parent="."]
|
||||
|
||||
[node name="UniqueNameAcceptDialog" type="AcceptDialog" parent="Alerts"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -95.0
|
||||
margin_top = -29.0
|
||||
margin_right = 95.0
|
||||
margin_bottom = 29.0
|
||||
dialog_text = "The Name must be unique!"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="NameIdEmptyAcceptDialog" type="AcceptDialog" parent="Alerts"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -95.0
|
||||
margin_top = -29.0
|
||||
margin_right = 95.0
|
||||
margin_bottom = 29.0
|
||||
dialog_text = "The Name and Id must not be empty!"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="text_entered" from="Name" to="." method="_on_AdUnit_text_entered"]
|
||||
[connection signal="text_entered" from="Id" to="." method="_on_AdUnit_text_entered"]
|
||||
[connection signal="pressed" from="GridContainer/ConfirmButton" to="." method="_on_ConfirmButton_pressed"]
|
||||
[connection signal="pressed" from="GridContainer/EditButton" to="." method="_on_EditButton_pressed"]
|
||||
[connection signal="pressed" from="GridContainer/RemoveButton" to="." method="_on_RemoveButton_pressed"]
|
202
addons/admob/src/singletons/AdMobSingleton.gd
Normal file
@ -0,0 +1,202 @@
|
||||
extends Node
|
||||
|
||||
signal initialization_complete(status, adapter_name)
|
||||
|
||||
signal consent_form_dismissed()
|
||||
signal consent_status_changed(consent_status_message)
|
||||
signal consent_form_load_failure(error_code, error_message)
|
||||
signal consent_info_update_success(consent_status_message)
|
||||
signal consent_info_update_failure(error_code, error_message)
|
||||
|
||||
signal banner_loaded()
|
||||
signal banner_failed_to_load(error_code)
|
||||
signal banner_opened()
|
||||
signal banner_clicked()
|
||||
signal banner_closed()
|
||||
signal banner_recorded_impression()
|
||||
signal banner_destroyed()
|
||||
|
||||
signal interstitial_failed_to_load(error_code)
|
||||
signal interstitial_loaded()
|
||||
signal interstitial_failed_to_show(error_code)
|
||||
signal interstitial_opened()
|
||||
signal interstitial_clicked()
|
||||
signal interstitial_closed()
|
||||
signal interstitial_recorded_impression()
|
||||
|
||||
signal rewarded_ad_failed_to_load(error_code)
|
||||
signal rewarded_ad_loaded()
|
||||
signal rewarded_ad_failed_to_show(error_code)
|
||||
signal rewarded_ad_opened()
|
||||
signal rewarded_ad_clicked()
|
||||
signal rewarded_ad_closed()
|
||||
signal rewarded_ad_recorded_impression()
|
||||
|
||||
signal rewarded_interstitial_ad_failed_to_load(error_code)
|
||||
signal rewarded_interstitial_ad_loaded()
|
||||
signal rewarded_interstitial_ad_failed_to_show(error_code)
|
||||
signal rewarded_interstitial_ad_opened()
|
||||
signal rewarded_interstitial_ad_clicked()
|
||||
signal rewarded_interstitial_ad_closed()
|
||||
signal rewarded_interstitial_ad_recorded_impression()
|
||||
|
||||
signal user_earned_rewarded(currency, amount)
|
||||
|
||||
var AdMobSettings = preload("res://addons/admob/src/utils/AdMobSettings.gd").new()
|
||||
onready var config = AdMobSettings.config
|
||||
var _plugin : Object
|
||||
|
||||
func _ready() -> void:
|
||||
if config.general.is_enabled:
|
||||
if (Engine.has_singleton("AdMob")):
|
||||
_plugin = Engine.get_singleton("AdMob")
|
||||
initialize()
|
||||
_connect_signals()
|
||||
|
||||
func get_is_initialized() -> bool:
|
||||
if _plugin:
|
||||
return _plugin.get_is_initialized()
|
||||
return false
|
||||
|
||||
func initialize() -> void:
|
||||
if _plugin:
|
||||
var is_release : bool = OS.has_feature("release")
|
||||
|
||||
var is_debug_on_release : bool = config.debug.is_debug_on_release
|
||||
|
||||
var is_real : bool = false
|
||||
var is_test_europe_user_consent : bool = config.debug.is_test_europe_user_consent
|
||||
|
||||
if is_release:
|
||||
is_real = true
|
||||
is_test_europe_user_consent = false
|
||||
|
||||
if is_debug_on_release:
|
||||
is_real = config.debug.is_real
|
||||
is_test_europe_user_consent = config.debug.is_test_europe_user_consent
|
||||
|
||||
_plugin.initialize(config.general.is_for_child_directed_treatment, config.general.max_ad_content_rating, is_real, is_test_europe_user_consent)
|
||||
|
||||
|
||||
|
||||
|
||||
func _connect_signals() -> void:
|
||||
_plugin.connect("initialization_complete", self, "_on_AdMob_initialization_complete")
|
||||
|
||||
_plugin.connect("consent_form_dismissed", self, "_on_AdMob_consent_form_dismissed")
|
||||
_plugin.connect("consent_status_changed", self, "_on_AdMob_consent_status_changed")
|
||||
_plugin.connect("consent_form_load_failure", self, "_on_AdMob_consent_form_load_failure")
|
||||
_plugin.connect("consent_info_update_success", self, "_on_AdMob_consent_info_update_success")
|
||||
_plugin.connect("consent_info_update_failure", self, "_on_AdMob_consent_info_update_failure")
|
||||
|
||||
_plugin.connect("banner_loaded", self, "_on_AdMob_banner_loaded")
|
||||
_plugin.connect("banner_failed_to_load", self, "_on_AdMob_banner_failed_to_load")
|
||||
_plugin.connect("banner_opened", self, "_on_AdMob_banner_opened")
|
||||
_plugin.connect("banner_clicked", self, "_on_AdMob_banner_clicked")
|
||||
_plugin.connect("banner_closed", self, "_on_AdMob_banner_closed")
|
||||
_plugin.connect("banner_recorded_impression", self, "_on_AdMob_banner_recorded_impression")
|
||||
_plugin.connect("banner_destroyed", self, "_on_AdMob_banner_destroyed")
|
||||
|
||||
_plugin.connect("interstitial_failed_to_load", self, "_on_AdMob_interstitial_failed_to_load")
|
||||
_plugin.connect("interstitial_loaded", self, "_on_AdMob_interstitial_loaded")
|
||||
_plugin.connect("interstitial_failed_to_show", self, "_on_AdMob_interstitial_failed_to_show")
|
||||
_plugin.connect("interstitial_opened", self, "_on_AdMob_interstitial_opened")
|
||||
_plugin.connect("interstitial_clicked", self, "_on_AdMob_interstitial_clicked")
|
||||
_plugin.connect("interstitial_closed", self, "_on_AdMob_interstitial_closed")
|
||||
_plugin.connect("interstitial_recorded_impression", self, "_on_AdMob_interstitial_recorded_impression")
|
||||
|
||||
_plugin.connect("rewarded_ad_failed_to_load", self, "_on_AdMob_rewarded_ad_failed_to_load")
|
||||
_plugin.connect("rewarded_ad_loaded", self, "_on_AdMob_rewarded_ad_loaded")
|
||||
_plugin.connect("rewarded_ad_failed_to_show", self, "_on_AdMob_rewarded_ad_failed_to_show")
|
||||
_plugin.connect("rewarded_ad_opened", self, "_on_AdMob_rewarded_ad_opened")
|
||||
_plugin.connect("rewarded_ad_clicked", self, "_on_AdMob_rewarded_ad_clicked")
|
||||
_plugin.connect("rewarded_ad_closed", self, "_on_AdMob_rewarded_ad_closed")
|
||||
_plugin.connect("rewarded_ad_recorded_impression", self, "_on_AdMob_rewarded_ad_recorded_impression")
|
||||
|
||||
_plugin.connect("rewarded_interstitial_ad_failed_to_load", self, "_on_AdMob_rewarded_interstitial_ad_failed_to_load")
|
||||
_plugin.connect("rewarded_interstitial_ad_loaded", self, "_on_AdMob_rewarded_interstitial_ad_loaded")
|
||||
_plugin.connect("rewarded_interstitial_ad_failed_to_show", self, "_on_AdMob_rewarded_interstitial_ad_failed_to_show")
|
||||
_plugin.connect("rewarded_interstitial_ad_opened", self, "_on_AdMob_rewarded_interstitial_ad_opened")
|
||||
_plugin.connect("rewarded_interstitial_ad_clicked", self, "_on_AdMob_rewarded_interstitial_ad_clicked")
|
||||
_plugin.connect("rewarded_interstitial_ad_closed", self, "_on_AdMob_rewarded_interstitial_ad_closed")
|
||||
_plugin.connect("rewarded_interstitial_ad_recorded_impression", self, "_on_AdMob_rewarded_interstitial_ad_recorded_impression")
|
||||
|
||||
_plugin.connect("user_earned_rewarded", self, "_on_AdMob_user_earned_rewarded")
|
||||
|
||||
|
||||
func _on_AdMob_initialization_complete(status : int, adapter_name : String) -> void:
|
||||
emit_signal("initialization_complete", status, adapter_name)
|
||||
|
||||
func _on_AdMob_consent_form_dismissed() -> void:
|
||||
emit_signal("consent_form_dismissed")
|
||||
func _on_AdMob_consent_status_changed(consent_status_message : String) -> void:
|
||||
emit_signal("consent_status_changed", consent_status_message)
|
||||
func _on_AdMob_consent_form_load_failure(error_code : int, error_message: String) -> void:
|
||||
emit_signal("consent_form_load_failure", error_code, error_message)
|
||||
func _on_AdMob_consent_info_update_success(consent_status_message : String) -> void:
|
||||
emit_signal("consent_info_update_success", consent_status_message)
|
||||
func _on_AdMob_consent_info_update_failure(error_code : int, error_message : String) -> void:
|
||||
emit_signal("consent_info_update_failure", error_code, error_message)
|
||||
|
||||
func _on_AdMob_banner_loaded() -> void:
|
||||
emit_signal("banner_loaded")
|
||||
func _on_AdMob_banner_failed_to_load(error_code : int) -> void:
|
||||
emit_signal("banner_failed_to_load", error_code)
|
||||
func _on_AdMob_banner_opened() -> void:
|
||||
emit_signal("banner_loaded")
|
||||
func _on_AdMob_banner_clicked() -> void:
|
||||
emit_signal("banner_clicked")
|
||||
func _on_AdMob_banner_closed() -> void:
|
||||
emit_signal("banner_closed")
|
||||
func _on_AdMob_banner_recorded_impression() -> void:
|
||||
emit_signal("banner_recorded_impression")
|
||||
func _on_AdMob_banner_destroyed() -> void:
|
||||
emit_signal("banner_destroyed")
|
||||
|
||||
func _on_AdMob_interstitial_failed_to_load(error_code : int) -> void:
|
||||
emit_signal("interstitial_failed_to_load", error_code)
|
||||
func _on_AdMob_interstitial_loaded() -> void:
|
||||
emit_signal("interstitial_loaded")
|
||||
func _on_AdMob_interstitial_failed_to_show(error_code : int) -> void:
|
||||
emit_signal("interstitial_failed_to_show", error_code)
|
||||
func _on_AdMob_interstitial_opened() -> void:
|
||||
emit_signal("interstitial_opened")
|
||||
func _on_AdMob_interstitial_clicked() -> void:
|
||||
emit_signal("interstitial_clicked")
|
||||
func _on_AdMob_interstitial_closed() -> void:
|
||||
emit_signal("interstitial_closed")
|
||||
func _on_AdMob_interstitial_recorded_impression() -> void:
|
||||
emit_signal("interstitial_recorded_impression")
|
||||
|
||||
func _on_AdMob_rewarded_ad_failed_to_load(error_code : int) -> void:
|
||||
emit_signal("rewarded_ad_failed_to_load", error_code)
|
||||
func _on_AdMob_rewarded_ad_loaded() -> void:
|
||||
emit_signal("rewarded_ad_loaded")
|
||||
func _on_AdMob_rewarded_ad_failed_to_show(error_code : int) -> void:
|
||||
emit_signal("rewarded_ad_failed_to_show", error_code)
|
||||
func _on_AdMob_rewarded_ad_opened() -> void:
|
||||
emit_signal("rewarded_ad_opened")
|
||||
func _on_AdMob_rewarded_ad_clicked() -> void:
|
||||
emit_signal("rewarded_ad_clicked")
|
||||
func _on_AdMob_rewarded_ad_closed() -> void:
|
||||
emit_signal("rewarded_ad_closed")
|
||||
func _on_AdMob_rewarded_ad_recorded_impression() -> void:
|
||||
emit_signal("rewarded_ad_recorded_impression")
|
||||
|
||||
func _on_AdMob_rewarded_interstitial_ad_failed_to_load(error_code : int) -> void:
|
||||
emit_signal("rewarded_interstitial_ad_failed_to_load", error_code)
|
||||
func _on_AdMob_rewarded_interstitial_ad_loaded() -> void:
|
||||
emit_signal("rewarded_interstitial_ad_loaded")
|
||||
func _on_AdMob_rewarded_interstitial_ad_failed_to_show(error_code : int) -> void:
|
||||
emit_signal("rewarded_interstitial_ad_failed_to_show", error_code)
|
||||
func _on_AdMob_rewarded_interstitial_ad_opened() -> void:
|
||||
emit_signal("rewarded_interstitial_ad_opened")
|
||||
func _on_AdMob_rewarded_interstitial_ad_clicked() -> void:
|
||||
emit_signal("rewarded_interstitial_ad_clicked")
|
||||
func _on_AdMob_rewarded_interstitial_ad_closed() -> void:
|
||||
emit_signal("rewarded_interstitial_ad_closed")
|
||||
func _on_AdMob_rewarded_interstitial_ad_recorded_impression() -> void:
|
||||
emit_signal("rewarded_interstitial_ad_recorded_impression")
|
||||
|
||||
func _on_AdMob_user_earned_rewarded(currency : String, amount : int) -> void:
|
||||
emit_signal("user_earned_rewarded", currency, amount)
|
106
addons/admob/src/singletons/MobileAds.gd
Normal file
@ -0,0 +1,106 @@
|
||||
extends "res://addons/admob/src/singletons/AdMobSingleton.gd"
|
||||
|
||||
func _ready() -> void:
|
||||
# warning-ignore:return_value_discarded
|
||||
get_tree().connect("screen_resized", self, "_on_get_tree_resized")
|
||||
|
||||
|
||||
func load_banner(ad_unit_name : String = "standard") -> void:
|
||||
if _plugin:
|
||||
_plugin.load_banner(config.banner.unit_ids[OS.get_name()][ad_unit_name], config.banner.position, config.banner.size, config.banner.show_instantly, config.banner.respect_safe_area)
|
||||
|
||||
func load_interstitial(ad_unit_name : String = "standard") -> void:
|
||||
if _plugin:
|
||||
_plugin.load_interstitial(config.interstitial.unit_ids[OS.get_name()][ad_unit_name])
|
||||
|
||||
func load_rewarded(ad_unit_name : String = "standard") -> void:
|
||||
if _plugin:
|
||||
_plugin.load_rewarded(config.rewarded.unit_ids[OS.get_name()][ad_unit_name])
|
||||
|
||||
func load_rewarded_interstitial(ad_unit_name : String = "standard") -> void:
|
||||
if _plugin:
|
||||
_plugin.load_rewarded_interstitial(config.rewarded_interstitial.unit_ids[OS.get_name()][ad_unit_name])
|
||||
|
||||
func destroy_banner() -> void:
|
||||
if _plugin:
|
||||
_plugin.destroy_banner()
|
||||
|
||||
func show_banner() -> void:
|
||||
if _plugin:
|
||||
_plugin.show_banner()
|
||||
|
||||
func hide_banner() -> void:
|
||||
if _plugin:
|
||||
_plugin.hide_banner()
|
||||
|
||||
func show_interstitial() -> void:
|
||||
if _plugin:
|
||||
_plugin.show_interstitial()
|
||||
|
||||
func show_rewarded() -> void:
|
||||
if _plugin:
|
||||
_plugin.show_rewarded()
|
||||
|
||||
func show_rewarded_interstitial() -> void:
|
||||
if _plugin:
|
||||
_plugin.show_rewarded_interstitial()
|
||||
|
||||
func request_user_consent() -> void:
|
||||
if _plugin:
|
||||
_plugin.request_user_consent()
|
||||
|
||||
func reset_consent_state(will_request_user_consent := false) -> void:
|
||||
if _plugin:
|
||||
_plugin.reset_consent_state()
|
||||
|
||||
func get_banner_width() -> int:
|
||||
if _plugin:
|
||||
return _plugin.get_banner_width()
|
||||
return 0
|
||||
|
||||
func get_banner_width_in_pixels() -> int:
|
||||
if _plugin:
|
||||
return _plugin.get_banner_width_in_pixels()
|
||||
return 0
|
||||
|
||||
func get_banner_height() -> int:
|
||||
if _plugin:
|
||||
return _plugin.get_banner_height()
|
||||
return 0
|
||||
|
||||
func get_banner_height_in_pixels() -> int:
|
||||
if _plugin:
|
||||
return _plugin.get_banner_height_in_pixels()
|
||||
return 0
|
||||
|
||||
func get_is_banner_loaded() -> bool:
|
||||
if _plugin:
|
||||
return _plugin.get_is_banner_loaded()
|
||||
return false
|
||||
|
||||
func get_is_interstitial_loaded() -> bool:
|
||||
if _plugin:
|
||||
return _plugin.get_is_interstitial_loaded()
|
||||
return false
|
||||
|
||||
func get_is_rewarded_loaded() -> bool:
|
||||
if _plugin:
|
||||
return _plugin.get_is_rewarded_loaded()
|
||||
return false
|
||||
|
||||
func get_is_rewarded_interstitial_loaded() -> bool:
|
||||
if _plugin:
|
||||
return _plugin.get_is_rewarded_interstitial_loaded()
|
||||
return false
|
||||
|
||||
func _on_get_tree_resized() -> void:
|
||||
if _plugin:
|
||||
if get_is_banner_loaded() and config.banner.size == "SMART_BANNER":
|
||||
load_banner()
|
||||
if get_is_interstitial_loaded(): #verify if interstitial and rewarded is loaded because the only reason to load again now is to resize
|
||||
load_interstitial()
|
||||
if get_is_rewarded_loaded():
|
||||
load_rewarded()
|
||||
if get_is_rewarded_interstitial_loaded():
|
||||
load_rewarded_interstitial()
|
||||
|
8
addons/admob/src/utils/AdMobGlobals.gd
Normal file
@ -0,0 +1,8 @@
|
||||
const SAVE_ADMOB_GLOBALS_PATH := "user://admob_globals.tres"
|
||||
|
||||
|
||||
static func get_plugin_version() -> String:
|
||||
var plugin_config_file := ConfigFile.new()
|
||||
plugin_config_file.load("res://addons/admob/plugin.cfg")
|
||||
var version : String = plugin_config_file.get_value("plugin", "version")
|
||||
return version
|