Add splash screen and fix issues with loader

This commit is contained in:
Hamcha 2019-06-12 01:50:33 +02:00
parent 173dd420d1
commit a55ff3d895
Signed by: hamcha
GPG Key ID: A40413D21021EAEE
9 changed files with 69 additions and 8 deletions

BIN
AssetSrc/splash.afphoto Normal file

Binary file not shown.

View File

@ -13,7 +13,7 @@ func _ready():
set_process(false)
func load_scene(path: String):
current_scene = root.get_child(root.get_child_count() -1)
current_scene = get_tree().current_scene
loading.fade_in()
load_next = path
@ -21,11 +21,12 @@ var delay := 0.1
var cur_delay := 0.0
func set_new_scene(scene):
current_scene.queue_free()
var instance = scene.instance()
instance.connect("loaded", self, "_fade_out")
root.add_child(instance)
root.move_child(instance, 0)
get_tree().current_scene = instance
current_scene.queue_free()
func _process(delta):
if loader == null:

6
Scenes/Lobby.gd Normal file
View File

@ -0,0 +1,6 @@
extends Control
signal loaded()
func _ready():
emit_signal("loaded")

View File

@ -1,14 +1,16 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=3 format=2]
[ext_resource path="res://MLPAssets/Background/menubg.webp" type="Texture" id=1]
[ext_resource path="res://Scenes/Lobby.gd" type="Script" id=1]
[ext_resource path="res://MLPAssets/Background/menubg.webp" type="Texture" id=2]
[node name="Lobby" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
[node name="TextureRect" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 1 )
texture = ExtResource( 2 )
expand = true
stretch_mode = 7

View File

@ -1,5 +1,14 @@
extends Control
var timeout = 1.0
func _ready():
#TODO Splash screen
Loader.load_scene("res://Scenes/Board.tscn")
# Stupid hack for seamless transition
get_tree().get_root().call_deferred("move_child", self, 0)
func _process(delta):
timeout -= delta
if timeout <= 0:
Loader.load_scene("res://Scenes/Lobby.tscn")
set_process(false)

View File

@ -1,8 +1,16 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Scenes/Scripts/SplashScreen.gd" type="Script" id=1]
[ext_resource path="res://UIAssets/splash.png" type="Texture" id=2]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
[node name="TextureRect" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 2 )
expand = true
stretch_mode = 6

BIN
UIAssets/splash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/splash.png-e50ae66ed178dbf3b831a31cf16b4033.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://UIAssets/splash.png"
dest_files=[ "res://.import/splash.png-e50ae66ed178dbf3b831a31cf16b4033.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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -47,6 +47,7 @@ _global_script_class_icons={
config/name="MLP CARD GAME"
run/main_scene="res://Scenes/SplashScreen.tscn"
run/low_processor_mode=true
boot_splash/image="res://UIAssets/splash.png"
boot_splash/bg_color=Color( 0.156863, 0.156863, 0.156863, 1 )
config/icon="res://icon.png"