From 67574bf759bb7184eaf67abfcfb2677cb015edc4 Mon Sep 17 00:00:00 2001 From: hevinci Date: Sat, 26 Nov 2022 11:29:53 +0800 Subject: [PATCH] update samples --- .../Runtime/{GameLogic/Room.meta => BattleLogic.meta} | 2 +- .../{GameLogic/Room => BattleLogic}/BattleRoom.cs | 4 +++- .../{GameLogic/Room => BattleLogic}/BattleRoom.cs.meta | 0 .../Runtime/{GameLogic => BattleLogic}/Entity.meta | 0 .../{GameLogic => BattleLogic}/Entity/EntityAsteroid.cs | 0 .../Entity/EntityAsteroid.cs.meta | 0 .../{GameLogic => BattleLogic}/Entity/EntityBullet.cs | 0 .../Entity/EntityBullet.cs.meta | 0 .../{GameLogic => BattleLogic}/Entity/EntityEffect.cs | 0 .../Entity/EntityEffect.cs.meta | 0 .../{GameLogic => BattleLogic}/Entity/EntityEnemy.cs | 0 .../Entity/EntityEnemy.cs.meta | 0 .../{GameLogic => BattleLogic}/Entity/EntityPlayer.cs | 0 .../Entity/EntityPlayer.cs.meta | 0 .../GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs | 1 + .../GameScript/Runtime/UIWindow/UILoadingWindow.cs | 9 ++++----- 16 files changed, 9 insertions(+), 7 deletions(-) rename Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/{GameLogic/Room.meta => BattleLogic.meta} (77%) rename Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/{GameLogic/Room => BattleLogic}/BattleRoom.cs (98%) rename Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/{GameLogic/Room => BattleLogic}/BattleRoom.cs.meta (100%) rename Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/{GameLogic => BattleLogic}/Entity.meta (100%) rename Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/{GameLogic => BattleLogic}/Entity/EntityAsteroid.cs (100%) rename Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/{GameLogic => BattleLogic}/Entity/EntityAsteroid.cs.meta (100%) rename Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/{GameLogic => BattleLogic}/Entity/EntityBullet.cs (100%) rename Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/{GameLogic => BattleLogic}/Entity/EntityBullet.cs.meta (100%) rename Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/{GameLogic => BattleLogic}/Entity/EntityEffect.cs (100%) rename Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/{GameLogic => BattleLogic}/Entity/EntityEffect.cs.meta (100%) rename Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/{GameLogic => BattleLogic}/Entity/EntityEnemy.cs (100%) rename Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/{GameLogic => BattleLogic}/Entity/EntityEnemy.cs.meta (100%) rename Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/{GameLogic => BattleLogic}/Entity/EntityPlayer.cs (100%) rename Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/{GameLogic => BattleLogic}/Entity/EntityPlayer.cs.meta (100%) diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Room.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic.meta similarity index 77% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Room.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic.meta index 9536a61..af9dc50 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Room.meta +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7866629ff257c6d4d84cd9dab5d0b000 +guid: 358519dfd46c3c84d9300408c743ebf7 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Room/BattleRoom.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/BattleRoom.cs similarity index 98% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Room/BattleRoom.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/BattleRoom.cs index 863a26c..c572240 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Room/BattleRoom.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/BattleRoom.cs @@ -59,6 +59,8 @@ public class BattleRoom /// public void DestroyRoom() { + Debug.LogWarning("DestroyRoom"); + if (_musicHandle != null) _musicHandle.Release(); @@ -176,7 +178,7 @@ public class BattleRoom 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(); entity.InitEntity(handle); diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Room/BattleRoom.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/BattleRoom.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Room/BattleRoom.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/BattleRoom.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityAsteroid.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityAsteroid.cs similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityAsteroid.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityAsteroid.cs diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityAsteroid.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityAsteroid.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityAsteroid.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityAsteroid.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityBullet.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityBullet.cs similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityBullet.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityBullet.cs diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityBullet.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityBullet.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityBullet.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityBullet.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityEffect.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEffect.cs similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityEffect.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEffect.cs diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityEffect.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEffect.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityEffect.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEffect.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityEnemy.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEnemy.cs similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityEnemy.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEnemy.cs diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityEnemy.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEnemy.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityEnemy.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityEnemy.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityPlayer.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityPlayer.cs similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityPlayer.cs rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityPlayer.cs diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityPlayer.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityPlayer.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/Entity/EntityPlayer.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/BattleLogic/Entity/EntityPlayer.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs index 3260bef..cbdea4e 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs @@ -31,6 +31,7 @@ internal class FsmSceneHome : IStateNode private IEnumerator Prepare() { + Debug.LogWarning("LoadScene Home"); yield return YooAssets.LoadSceneAsync("scene_home"); yield return UniWindow.OpenWindowAsync("UIHome"); yield return new WaitForSeconds(0.5f); diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/UIWindow/UILoadingWindow.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/UIWindow/UILoadingWindow.cs index 4162840..2e92328 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/UIWindow/UILoadingWindow.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/UIWindow/UILoadingWindow.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UniFramework.Window; +using UniFramework.Utility; [WindowAttribute(1000, true)] public class UILoadingWindow : UIWindow { private Text _info; - private float _timer; private int _countdown; + private UniTimer _timer = UniTimer.CreatePepeatTimer(0, 0.2f); public override void OnCreate() { @@ -21,15 +22,13 @@ public class UILoadingWindow : UIWindow public override void OnRefresh() { _info.text = "Loading"; - _timer = 0; + _timer.Reset(); _countdown = 0; } public override void OnUpdate() { - _timer += Time.deltaTime; - if (_timer>= 0.1f) + if(_timer.Update(Time.deltaTime)) { - _timer = 0f; _countdown++; if (_countdown > 6) _countdown = 0;