Splash screen now displays properly and loads MainMenu when it's done.
This commit is contained in:
parent
cfd8448087
commit
e4909d9d81
4 changed files with 64 additions and 4 deletions
|
@ -264,8 +264,9 @@ GameObject:
|
||||||
- component: {fileID: 854366558}
|
- component: {fileID: 854366558}
|
||||||
- component: {fileID: 854366560}
|
- component: {fileID: 854366560}
|
||||||
- component: {fileID: 854366559}
|
- component: {fileID: 854366559}
|
||||||
|
- component: {fileID: 854366561}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: Image (1)
|
m_Name: SplashText
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
|
@ -322,6 +323,17 @@ CanvasRenderer:
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 854366557}
|
m_GameObject: {fileID: 854366557}
|
||||||
|
--- !u!114 &854366561
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 854366557}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 96b46a3ec497e3640a9ecf1b5067a5a2, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &1108133782
|
--- !u!1 &1108133782
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -404,7 +416,7 @@ RectTransform:
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1108133782}
|
m_GameObject: {fileID: 1108133782}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 485, y: 267.5, z: 0}
|
m_LocalPosition: {x: 512, y: 384, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 1531749743}
|
- {fileID: 1531749743}
|
||||||
|
@ -493,7 +505,7 @@ GameObject:
|
||||||
- component: {fileID: 1531749745}
|
- component: {fileID: 1531749745}
|
||||||
- component: {fileID: 1531749744}
|
- component: {fileID: 1531749744}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: Image
|
m_Name: SplashBackground
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class LobbyManager : Photon.PunBehaviour {
|
||||||
|
|
||||||
public override void OnLeftRoom()
|
public override void OnLeftRoom()
|
||||||
{
|
{
|
||||||
SceneManager.LoadScene(0);
|
SceneManager.LoadScene("MainMenu");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LeaveRoom()
|
public void LeaveRoom()
|
||||||
|
|
35
Project Undercover/Assets/Scripts/UI/SplashController.cs
Normal file
35
Project Undercover/Assets/Scripts/UI/SplashController.cs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
|
public class SplashController : MonoBehaviour {
|
||||||
|
private Image splashText;
|
||||||
|
private float timer;
|
||||||
|
|
||||||
|
void Start () {
|
||||||
|
splashText = GetComponent<Image> ();
|
||||||
|
Color tempcolor = Color.white;
|
||||||
|
tempcolor.a = 0;
|
||||||
|
splashText.color = tempcolor;
|
||||||
|
timer = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update () {
|
||||||
|
Color setalpha = Color.white;
|
||||||
|
timer -= Time.deltaTime;
|
||||||
|
|
||||||
|
if(timer >= 2.5 && timer < 3.5) {
|
||||||
|
setalpha.a = 1 - (timer - 2.5f);
|
||||||
|
splashText.color = setalpha;
|
||||||
|
}
|
||||||
|
if(timer >= 0.5 && timer < 1.5) {
|
||||||
|
setalpha.a = (timer - 0.5f);
|
||||||
|
splashText.color = setalpha;
|
||||||
|
}
|
||||||
|
if(timer <= 0) {
|
||||||
|
SceneManager.LoadScene ("MainMenu");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 96b46a3ec497e3640a9ecf1b5067a5a2
|
||||||
|
timeCreated: 1512026200
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Reference in a new issue