Skip to content

Commit

Permalink
Load Async Works
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos2380 committed May 14, 2018
1 parent d679679 commit ede1bd2
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 122 deletions.
10 changes: 10 additions & 0 deletions ShowPT/Assets/Graphical Resources/Images.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 87 additions & 0 deletions ShowPT/Assets/Graphical Resources/Images/loadingCircle.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

126 changes: 18 additions & 108 deletions ShowPT/Assets/Scenes/Menu Test.unity
Original file line number Diff line number Diff line change
Expand Up @@ -2580,6 +2580,7 @@ GameObject:
m_Component:
- component: {fileID: 807021168}
- component: {fileID: 807021167}
- component: {fileID: 807021169}
m_Layer: 5
m_Name: loadBarSlider
m_TagString: loadBarSlider
Expand Down Expand Up @@ -2623,7 +2624,7 @@ MonoBehaviour:
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 0}
m_FillRect: {fileID: 1859966966}
m_FillRect: {fileID: 0}
m_HandleRect: {fileID: 0}
m_Direction: 0
m_MinValue: 0
Expand All @@ -2646,15 +2647,26 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1561522356}
- {fileID: 2009734345}
m_Father: {fileID: 324646969}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -38.005615}
m_SizeDelta: {x: 160, y: 48.28}
m_AnchoredPosition: {x: -6, y: -54}
m_SizeDelta: {x: 148.3, y: 165.4}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &807021169
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 807021166}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3a877c57884eadb4897427aa654dc131, type: 3}
m_Name:
m_EditorClassIdentifier:
speed: 200
--- !u!1 &881519352
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -4487,8 +4499,8 @@ MonoBehaviour:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_Sprite: {fileID: 21300000, guid: b37d32031c2184248a434915752ee127, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
Expand Down Expand Up @@ -5569,74 +5581,6 @@ Prefab:
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 73a811b71265ef7458f52f7b08de4e89, type: 2}
m_IsPrefabParent: 0
--- !u!1 &1859966965
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1859966966}
- component: {fileID: 1859966968}
- component: {fileID: 1859966967}
m_Layer: 5
m_Name: Fill
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1859966966
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1859966965}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2009734345}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 10, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1859966967
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1859966965}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.24705884, g: 0.6627451, b: 0.9607844, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1859966968
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1859966965}
--- !u!1 &1868135951
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -6124,40 +6068,6 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1980223486}
--- !u!1 &2009734344
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 2009734345}
m_Layer: 5
m_Name: Fill Area
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2009734345
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2009734344}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1859966966}
m_Father: {fileID: 807021168}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.25}
m_AnchorMax: {x: 1, y: 0.75}
m_AnchoredPosition: {x: -0, y: 0}
m_SizeDelta: {x: -10.01, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &2022870255
GameObject:
m_ObjectHideFlags: 0
Expand Down
15 changes: 15 additions & 0 deletions ShowPT/Assets/Scripts/AutoRotationUI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AutoRotationUI : MonoBehaviour
{

public float speed = 20f;

// Update is called once per frame
void Update () {

gameObject.transform.Rotate(Vector3.back, speed*Time.deltaTime);
}
}
13 changes: 13 additions & 0 deletions ShowPT/Assets/Scripts/AutoRotationUI.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 19 additions & 13 deletions ShowPT/Assets/Scripts/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class Main : MonoBehaviour
{
public static Main instance = null;
public Slider loadBar;
AsyncOperation async;

private void Awake()
{
Expand All @@ -18,30 +19,35 @@ private void Awake()
}

// Use this for initialization
private void Start() {}

private void Update() {}

public void playGame(string name)
private void Start()
{
StartCoroutine(loadLevel(name));
StartCoroutine(loadLevel(1));
}

public void loadSceneByName(string name)
private void Update()
{
SceneManager.LoadSceneAsync(name);
if (async != null && async.isDone)
{
Debug.Log("done loading");
}
}

IEnumerator loadLevel(string name)
public void playGame(string name)
{
AsyncOperation operation = SceneManager.LoadSceneAsync(name);
while (!operation.isDone)
if (async != null)
{
loadBar.value = operation.progress;
yield return null;
async.allowSceneActivation = true;
}
}

IEnumerator loadLevel(int numScene)
{
async = SceneManager.LoadSceneAsync(numScene);
loadBar.value = async.progress;
async.allowSceneActivation = false;
yield return async;
}

public void quitGame()
{
Application.Quit();
Expand Down
2 changes: 1 addition & 1 deletion ShowPT/ProjectSettings/EditorBuildSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes:
- enabled: 0
- enabled: 1
path: Assets/Scenes/Menu Test.unity
guid: 70e5d543f85ce384eb4eafc4024dd735
- enabled: 1
Expand Down

0 comments on commit ede1bd2

Please sign in to comment.