update samples

pull/51/head
hevinci 2022-11-26 11:29:53 +08:00
parent e94923c3c6
commit 67574bf759
16 changed files with 9 additions and 7 deletions

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 7866629ff257c6d4d84cd9dab5d0b000 guid: 358519dfd46c3c84d9300408c743ebf7
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -59,6 +59,8 @@ public class BattleRoom
/// </summary> /// </summary>
public void DestroyRoom() public void DestroyRoom()
{ {
Debug.LogWarning("DestroyRoom");
if (_musicHandle != null) if (_musicHandle != null)
_musicHandle.Release(); _musicHandle.Release();
@ -176,7 +178,7 @@ public class BattleRoom
yield return _entitySpawner.CreateGameObjectPoolAsync("explosion_player"); yield return _entitySpawner.CreateGameObjectPoolAsync("explosion_player");
// 创建玩家实体对象 // 创建玩家实体对象
var handle = _entitySpawner.SpawnSync("player_ship"); var handle = _entitySpawner.SpawnSync("player_ship", _roomRoot.transform);
var entity = handle.GameObj.GetComponent<EntityPlayer>(); var entity = handle.GameObj.GetComponent<EntityPlayer>();
entity.InitEntity(handle); entity.InitEntity(handle);

View File

@ -31,6 +31,7 @@ internal class FsmSceneHome : IStateNode
private IEnumerator Prepare() private IEnumerator Prepare()
{ {
Debug.LogWarning("LoadScene Home");
yield return YooAssets.LoadSceneAsync("scene_home"); yield return YooAssets.LoadSceneAsync("scene_home");
yield return UniWindow.OpenWindowAsync<UIHomeWindow>("UIHome"); yield return UniWindow.OpenWindowAsync<UIHomeWindow>("UIHome");
yield return new WaitForSeconds(0.5f); yield return new WaitForSeconds(0.5f);

View File

@ -3,13 +3,14 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using UniFramework.Window; using UniFramework.Window;
using UniFramework.Utility;
[WindowAttribute(1000, true)] [WindowAttribute(1000, true)]
public class UILoadingWindow : UIWindow public class UILoadingWindow : UIWindow
{ {
private Text _info; private Text _info;
private float _timer;
private int _countdown; private int _countdown;
private UniTimer _timer = UniTimer.CreatePepeatTimer(0, 0.2f);
public override void OnCreate() public override void OnCreate()
{ {
@ -21,15 +22,13 @@ public class UILoadingWindow : UIWindow
public override void OnRefresh() public override void OnRefresh()
{ {
_info.text = "Loading"; _info.text = "Loading";
_timer = 0; _timer.Reset();
_countdown = 0; _countdown = 0;
} }
public override void OnUpdate() public override void OnUpdate()
{ {
_timer += Time.deltaTime; if(_timer.Update(Time.deltaTime))
if (_timer>= 0.1f)
{ {
_timer = 0f;
_countdown++; _countdown++;
if (_countdown > 6) if (_countdown > 6)
_countdown = 0; _countdown = 0;