Skip to content
This repository has been archived by the owner on Apr 28, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
merging with pc
  • Loading branch information
superRaptor911 committed Nov 3, 2020
2 parents 9ce970a + e88702a commit 328e060
Show file tree
Hide file tree
Showing 16 changed files with 258 additions and 313 deletions.
2 changes: 0 additions & 2 deletions Menus/MainMenu/MainMenu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func goToNextScene():

func _on_back_pressed():
if MenuManager.admob._is_interstitial_loaded:
MenuManager.admob._pause_ads = true
MenuManager.admob.show_banner()
MenuManager.admob.show_interstitial()
#yield(MenuManager.admob, "interstitial_closed")
Expand Down Expand Up @@ -94,4 +93,3 @@ func _on_yes_pressed():

func _on_no_pressed():
$quitPanel.hide()
MenuManager.admob._pause_ads = false
8 changes: 5 additions & 3 deletions Menus/MainMenu/NewGame.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,23 @@ __meta__ = {
}

[node name="Join_online" type="Button" parent="Panel/VBoxContainer"]
margin_right = 307.0
margin_right = 329.0
margin_bottom = 100.0
rect_min_size = Vector2( 307, 100 )
custom_styles/hover = ExtResource( 2 )
custom_styles/pressed = ExtResource( 2 )
custom_styles/focus = ExtResource( 2 )
custom_styles/normal = ExtResource( 2 )
custom_fonts/font = SubResource( 2 )
disabled = true
text = "Join Online"
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Button2" type="Button" parent="Panel/VBoxContainer"]
margin_top = 150.0
margin_right = 307.0
margin_right = 329.0
margin_bottom = 250.0
rect_min_size = Vector2( 307, 100 )
custom_styles/hover = ExtResource( 2 )
Expand All @@ -91,14 +92,15 @@ __meta__ = {

[node name="Button" type="Button" parent="Panel/VBoxContainer"]
margin_top = 300.0
margin_right = 307.0
margin_right = 329.0
margin_bottom = 400.0
rect_min_size = Vector2( 307, 100 )
custom_styles/hover = ExtResource( 2 )
custom_styles/pressed = ExtResource( 2 )
custom_styles/focus = ExtResource( 2 )
custom_styles/normal = ExtResource( 2 )
custom_fonts/font = SubResource( 2 )
disabled = true
text = "Join Lan"
__meta__ = {
"_edit_use_anchors_": false
Expand Down
15 changes: 15 additions & 0 deletions Menus/MainMenu/joinOnline.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ func _ready():
network.connect("join_fail", self, "_on_join_fail")
network.connect("join_success", self, "on_server_joined")
game_server.connect("synced_serverInfo", self, "_join_game")
var notice = Notice.new()
notice.showNotice(self, "Warning !",
"This is an experimental feature. Work is in progress.\nGame may crash",
Color.red)
MenuManager.connect("back_pressed", self, "on_back_pressed")


# Called every frame. 'delta' is the elapsed time since the previous frame.
Expand Down Expand Up @@ -49,3 +54,13 @@ func _join_game():
Logger.LogError("_join_game", "Map %s does not have game mode %s" % [current_server.map, current_server.game_mode])
return
get_tree().change_scene(l_path)


func _on_join_s2_pressed():
network.join_server("35.240.187.237",6969)
$Label.text = "Connecting . . ."
$Label.show()


func on_back_pressed():
MenuManager.changeScene("newGame")
103 changes: 102 additions & 1 deletion Menus/MainMenu/joinOnline.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ margin_top = -14.08
margin_right = 0.379883
margin_bottom = -0.320007
custom_styles/panel = SubResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="s1" type="Panel" parent="Panel"]
anchor_left = 0.053
Expand Down Expand Up @@ -108,6 +111,7 @@ __meta__ = {
}

[node name="players" type="Label" parent="Panel/s1"]
visible = false
anchor_left = 0.71
anchor_top = 0.138
anchor_right = 0.71
Expand All @@ -133,7 +137,7 @@ margin_top = -0.00400066
margin_right = 194.5
margin_bottom = 40.996
custom_fonts/font = ExtResource( 2 )
text = "DUST2"
text = "AIM-MAP"
clip_text = true
__meta__ = {
"_edit_use_anchors_": false
Expand All @@ -155,6 +159,102 @@ __meta__ = {
"_edit_use_anchors_": false
}

[node name="s2" type="Panel" parent="Panel"]
anchor_left = 0.053
anchor_top = 0.331
anchor_right = 0.947
anchor_bottom = 0.43
margin_left = 0.144989
margin_top = -0.00836182
margin_right = -0.14502
margin_bottom = 0.175644
custom_styles/panel = SubResource( 2 )
__meta__ = {
"_edit_group_": true,
"_edit_use_anchors_": false
}

[node name="s_name" type="Label" parent="Panel/s2"]
anchor_left = 0.028
anchor_top = 0.138
anchor_right = 0.028
anchor_bottom = 0.138
margin_left = 0.100002
margin_top = -0.00399971
margin_right = 231.1
margin_bottom = 40.996
custom_fonts/font = ExtResource( 2 )
text = "Server 2 [Asia]"
clip_text = true
__meta__ = {
"_edit_use_anchors_": false
}

[node name="gmode" type="Label" parent="Panel/s2"]
anchor_left = 0.323
anchor_top = 0.138
anchor_right = 0.323
anchor_bottom = 0.138
margin_left = 0.224976
margin_top = -0.00400066
margin_right = 167.225
margin_bottom = 40.996
custom_fonts/font = ExtResource( 2 )
text = "Zombie"
clip_text = true
__meta__ = {
"_edit_use_anchors_": false
}

[node name="players" type="Label" parent="Panel/s2"]
visible = false
anchor_left = 0.71
anchor_top = 0.138
anchor_right = 0.71
anchor_bottom = 0.138
margin_left = 0.249939
margin_top = -0.00400066
margin_right = 93.2499
margin_bottom = 40.996
custom_fonts/font = ExtResource( 2 )
text = "2/16"
clip_text = true
__meta__ = {
"_edit_use_anchors_": false
}

[node name="map" type="Label" parent="Panel/s2"]
anchor_left = 0.5
anchor_top = 0.138
anchor_right = 0.5
anchor_bottom = 0.138
margin_left = 3.5
margin_top = -0.00400066
margin_right = 194.5
margin_bottom = 40.996
custom_fonts/font = ExtResource( 2 )
text = "AIM-MAP"
clip_text = true
__meta__ = {
"_edit_use_anchors_": false
}

[node name="join_s2" type="Button" parent="Panel/s2"]
anchor_left = 0.856
anchor_top = 0.172
anchor_right = 0.856
anchor_bottom = 0.172
margin_left = 0.199951
margin_top = 0.0239992
margin_right = 115.2
margin_bottom = 38.024
custom_styles/normal = SubResource( 3 )
custom_fonts/font = ExtResource( 2 )
text = "Join"
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Label" type="Label" parent="."]
visible = false
anchor_left = 0.5
Expand All @@ -171,3 +271,4 @@ text = "Connecting . . . "
align = 1
valign = 1
[connection signal="pressed" from="Panel/s1/join_s1" to="." method="_on_join_s1_pressed"]
[connection signal="pressed" from="Panel/s2/join_s2" to="." method="_on_join_s2_pressed"]
10 changes: 4 additions & 6 deletions Menus/Settings/Settings.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ extends CanvasLayer


func _ready():
#$TabContainer/Basic/VBoxContainer/music/music.pressed = game_states.game_settings.music_enabled
#$TabContainer/Basic/VBoxContainer/particles/particles.pressed = game_states.game_settings.particle_effects
#$TabContainer/Basic/VBoxContainer/camera/camera.pressed = game_states.game_settings.dynamic_camera
#$TabContainer/Basic/VBoxContainer/shadows/shadows.pressed = game_states.game_settings.shadows
#$TabContainer/Advanced/container/fps/fps.pressed = game_states.game_settings.show_fps
#$TabContainer/Advanced/container/log/log.pressed = game_states.game_settings.enable_logging

#$Admob.load_banner()
#UiAnim.animLeftToRight([$TabContainer])
Expand Down Expand Up @@ -35,3 +29,7 @@ func _on_sound_pressed():
func _on_contols_pressed():
MusicMan.click()
MenuManager.changeScene("settings/control")


func _on_view_logs_pressed():
MenuManager.changeScene("settings/viewLogs")
15 changes: 15 additions & 0 deletions Menus/Settings/Settings.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,22 @@ rect_min_size = Vector2( 0, 50 )
custom_styles/normal = SubResource( 2 )
custom_fonts/font = ExtResource( 7 )
text = "Contol"

[node name="view_logs" type="Button" parent="."]
anchor_left = 0.927
anchor_top = 0.062
anchor_right = 0.927
anchor_bottom = 0.062
margin_left = -43.5601
margin_top = -19.64
margin_right = 42.4399
margin_bottom = 19.36
text = "View logs"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="Button" to="." method="_on_Button_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/display" to="." method="_on_display_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/sound" to="." method="_on_sound_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/contols" to="." method="_on_contols_pressed"]
[connection signal="pressed" from="view_logs" to="." method="_on_view_logs_pressed"]
12 changes: 12 additions & 0 deletions Menus/Settings/viewLogs.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extends Control


func _ready():
MenuManager.connect("back_pressed", self,"on_back_pressed")
for i in Logger.logs:
$Label.text += i + "\n"



func on_back_pressed():
MenuManager.changeScene("settings")
21 changes: 21 additions & 0 deletions Menus/Settings/viewLogs.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://Menus/Settings/viewLogs.gd" type="Script" id=1]

[node name="viewLogs" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Label" type="Label" parent="."]
anchor_left = 0.031
anchor_top = 0.053
anchor_right = 0.969
anchor_bottom = 0.947
margin_left = -0.18
margin_top = -0.160004
margin_right = 0.179932
margin_bottom = 0.159973
37 changes: 20 additions & 17 deletions Menus/menuManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var prev_menu = null
var cur_menu = null

# Admob instance
var admob : AdMob = null
var admob = null
# Number of times to load ads if loading fails
var _admob_max_load_fails = 1
# Counter for each ad types [banner, intestitial, video]
Expand Down Expand Up @@ -70,6 +70,7 @@ func loadMenus():
# Sub menu of settings
addMenu("settings/display", "res://Menus/Settings/DisplaySettings.tscn")
addMenu("settings/control", "res://Menus/Settings/JoySettings.tscn")
addMenu("settings/viewLogs", "res://Menus/Settings/viewLogs.tscn")


func changeScene(new_scene):
Expand Down Expand Up @@ -106,31 +107,26 @@ func setupAds():
var banners = [
"ca-app-pub-9443221640471166/9049742329",
"ca-app-pub-9443221640471166/6136808642",
"ca-app-pub-9443221640471166/1591918779"
"ca-app-pub-9443221640471166/1591918779",
"ca-app-pub-9443221640471166/9860952690"
]
var interstitials = [
"ca-app-pub-9443221640471166/1781147462",
"ca-app-pub-9443221640471166/1978071782",
"ca-app-pub-9443221640471166/7774183742"
]
var videos = [
"ca-app-pub-9443221640471166/2680609241"
"ca-app-pub-9443221640471166/7774183742",
"ca-app-pub-9443221640471166/1591918779",
"ca-app-pub-9443221640471166/1591918779"
]

if admob:
admob.queue_free()

admob = AdMob.new()
admob = load("res://admob-lib/admob.gd").new()
admob.is_real = true
admob.max_ad_content_rate = "T"
admob.banner_id = banners[randi() % banners.size()]
admob.interstitial_id = interstitials[randi() % interstitials.size()]
admob.rewarded_id = videos[randi() % videos.size()]
add_child(admob)
admob.load_banner()
admob.load_interstitial()
#admob.load_rewarded_video()
admob.hide_banner()

admob.connect("banner_loaded", self, "on_banner_loaded")
admob.connect("interstitial_loaded", self, "on_interstitial_loaded")
Expand All @@ -140,33 +136,40 @@ func setupAds():
admob.connect("interstitial_failed_to_load", self , "on_interstitial_failed")
admob.connect("rewarded_video_failed_to_load", self, "on_video_failed")

admob.connect("interstitial_requested", self, "on_interstitial_requested")
admob.load_banner()
admob.load_interstitial()
#admob.load_rewarded_video()
#admob.hide_banner()


func on_banner_loaded():
_admob_load_fail_count[0] = 0
Logger.Log("Banner ad loaded")

func on_interstitial_loaded():
_admob_load_fail_count[1] = 0
Logger.Log("interstitial ad loaded")

func on_video_loaded():
_admob_load_fail_count[2] = 0

func on_banner_failed(_code):
Logger.Log("Banner ad failed to load error code : %d" % [_code])
_admob_load_fail_count[0] += 1
if _admob_load_fail_count[0] < _admob_max_load_fails:
admob.load_banner()
Logger.Log("Reloading banner ads")


func on_interstitial_failed(_code):
_admob_load_fail_count[1] += 1
Logger.Log("Interstitial ad failed to load error code : %d" % [_code])
if _admob_load_fail_count[1] < _admob_max_load_fails:
admob.load_interstitial()
Logger.Log("Reloading interstitial ads")


func on_video_failed(_code):
_admob_load_fail_count[2] += 1
if _admob_load_fail_count[2] < _admob_max_load_fails:
admob.load_rewarded_video()

func on_interstitial_requested():
admob.load_interstitial()

Loading

0 comments on commit 328e060

Please sign in to comment.