update samples
parent
f31e5e0d22
commit
f6f326119c
|
@ -121,6 +121,49 @@ NavMeshSettings:
|
|||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &1096367106
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1096367108}
|
||||
- component: {fileID: 1096367107}
|
||||
m_Layer: 0
|
||||
m_Name: Application
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1096367107
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1096367106}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3cbcea01819f3d94ba5162624ad9c75f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!4 &1096367108
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1096367106}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -0.8017086, y: 0, z: 16.699955}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1281760859
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -150,7 +193,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 41fef9a778e4e254b939e9dc3e553bf0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
PlayMode: 1
|
||||
PlayMode: 2
|
||||
--- !u!4 &1281760861
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -163,7 +206,7 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &6920458660802423023
|
||||
GameObject:
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
|
||||
public class BhvApplicationQuit : MonoBehaviour
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
DontDestroyOnLoad(this.gameObject);
|
||||
}
|
||||
private void OnApplicationQuit()
|
||||
{
|
||||
YooAssets.Destroy();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3cbcea01819f3d94ba5162624ad9c75f
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -17,8 +17,6 @@ internal class FsmSceneBattle : IStateNode
|
|||
}
|
||||
void IStateNode.OnEnter()
|
||||
{
|
||||
UniWindow.OpenWindowSync<UILoadingWindow>("UILoading");
|
||||
|
||||
UniModule.StartCoroutine(Prepare());
|
||||
}
|
||||
void IStateNode.OnUpdate()
|
||||
|
@ -37,6 +35,7 @@ internal class FsmSceneBattle : IStateNode
|
|||
|
||||
private IEnumerator Prepare()
|
||||
{
|
||||
yield return UniWindow.OpenWindowAsync<UILoadingWindow>("UILoading");
|
||||
yield return YooAssets.LoadSceneAsync("scene_battle");
|
||||
|
||||
_battleRoom = new BattleRoom();
|
||||
|
|
|
@ -16,9 +16,6 @@ internal class FsmSceneHome : IStateNode
|
|||
}
|
||||
void IStateNode.OnEnter()
|
||||
{
|
||||
if (_machine.PreviousNode != typeof(FsmInitGame).FullName)
|
||||
UniWindow.OpenWindowSync<UILoadingWindow>("UILoading");
|
||||
|
||||
UniModule.StartCoroutine(Prepare());
|
||||
}
|
||||
void IStateNode.OnUpdate()
|
||||
|
@ -31,6 +28,9 @@ internal class FsmSceneHome : IStateNode
|
|||
|
||||
private IEnumerator Prepare()
|
||||
{
|
||||
if (_machine.PreviousNode != typeof(FsmInitGame).FullName)
|
||||
yield return UniWindow.OpenWindowAsync<UILoadingWindow>("UILoading");
|
||||
|
||||
yield return YooAssets.LoadSceneAsync("scene_home");
|
||||
yield return UniWindow.OpenWindowAsync<UIHomeWindow>("UIHome");
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
|
|
|
@ -39,12 +39,13 @@ public class FsmCreateDownloader : IStateNode
|
|||
|
||||
if (downloader.TotalDownloadCount == 0)
|
||||
{
|
||||
Debug.Log("没有发现需要下载的资源!");
|
||||
Debug.Log("Not found any download files !");
|
||||
_machine.ChangeState<FsmDownloadOver>();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"一共发现了{downloader.TotalDownloadCount}个资源需要更新下载!");
|
||||
//A total of 10 files were found that need to be downloaded
|
||||
Debug.Log($"Found total {downloader.TotalDownloadCount} files that need download !");
|
||||
|
||||
// 发现新更新文件后,挂起流程系统
|
||||
// 注意:开发者需要在下载前检测磁盘空间不足
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace UniFramework.Event
|
|||
}
|
||||
|
||||
private static bool _isInitialize = false;
|
||||
private static GameObject _driver = null;
|
||||
private static readonly Dictionary<int, LinkedList<Action<IEventMessage>>> _listeners = new Dictionary<int, LinkedList<Action<IEventMessage>>>(1000);
|
||||
private static readonly List<PostWrapper> _postingList = new List<PostWrapper>(1000);
|
||||
|
||||
|
@ -37,9 +38,26 @@ namespace UniFramework.Event
|
|||
{
|
||||
// 创建驱动器
|
||||
_isInitialize = true;
|
||||
GameObject driver = new UnityEngine.GameObject($"[{nameof(UniEvent)}]");
|
||||
driver.AddComponent<UniEventDriver>();
|
||||
UnityEngine.Object.DontDestroyOnLoad(driver);
|
||||
_driver = new UnityEngine.GameObject($"[{nameof(UniEvent)}]");
|
||||
_driver.AddComponent<UniEventDriver>();
|
||||
UnityEngine.Object.DontDestroyOnLoad(_driver);
|
||||
UniLogger.Log($"{nameof(UniEvent)} initalize !");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁事件系统
|
||||
/// </summary>
|
||||
public static void Destroy()
|
||||
{
|
||||
if (_isInitialize)
|
||||
{
|
||||
ClearAll();
|
||||
|
||||
_isInitialize = false;
|
||||
if (_driver != null)
|
||||
GameObject.Destroy(_driver);
|
||||
UniLogger.Log($"{nameof(UniEvent)} destroy all !");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,21 +77,6 @@ namespace UniFramework.Event
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁事件系统
|
||||
/// </summary>
|
||||
internal static void Destroy()
|
||||
{
|
||||
if (_isInitialize)
|
||||
{
|
||||
_isInitialize = false;
|
||||
ClearAll();
|
||||
|
||||
UniLogger.Log($"{nameof(UniEvent)} destroy all !");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 清空所有监听
|
||||
/// </summary>
|
||||
|
|
|
@ -8,10 +8,5 @@ namespace UniFramework.Event
|
|||
{
|
||||
UniEvent.Update();
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
UniEvent.Destroy();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
# UniFramework.Event
|
||||
# UniFramework.Machine
|
||||
|
||||
一个轻量级的状态机。
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 19d466eecc32f6a478d64f6a78748b23
|
||||
guid: 40fe73297598be84fb8dadedd4dd17e6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5999045dd15678e4bbaca21f460ea0e6
|
||||
guid: bcbf86a86eb115a41b6aa61fb0945d43
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace UniFramework.Module
|
|||
}
|
||||
|
||||
private static bool _isInitialize = false;
|
||||
private static GameObject _driver = null;
|
||||
private static readonly List<Wrapper> _wrappers = new List<Wrapper>(100);
|
||||
private static MonoBehaviour _behaviour;
|
||||
private static bool _isDirty = false;
|
||||
|
@ -36,9 +37,26 @@ namespace UniFramework.Module
|
|||
{
|
||||
// 创建驱动器
|
||||
_isInitialize = true;
|
||||
GameObject driver = new UnityEngine.GameObject($"[{nameof(UniModule)}]");
|
||||
_behaviour = driver.AddComponent<UniModuleDriver>();
|
||||
UnityEngine.Object.DontDestroyOnLoad(driver);
|
||||
_driver = new UnityEngine.GameObject($"[{nameof(UniModule)}]");
|
||||
_behaviour = _driver.AddComponent<UniModuleDriver>();
|
||||
UnityEngine.Object.DontDestroyOnLoad(_driver);
|
||||
UniLogger.Log($"{nameof(UniModule)} initalize !");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁模块系统
|
||||
/// </summary>
|
||||
public static void Destroy()
|
||||
{
|
||||
if (_isInitialize)
|
||||
{
|
||||
DestroyAll();
|
||||
|
||||
_isInitialize = false;
|
||||
if (_driver != null)
|
||||
GameObject.Destroy(_driver);
|
||||
UniLogger.Log($"{nameof(UniModule)} destroy all !");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,20 +87,6 @@ namespace UniFramework.Module
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁模块系统
|
||||
/// </summary>
|
||||
internal static void Destroy()
|
||||
{
|
||||
if (_isInitialize)
|
||||
{
|
||||
_isInitialize = false;
|
||||
DestroyAll();
|
||||
|
||||
UniLogger.Log($"{nameof(UniModule)} destroy all !");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取模块
|
||||
/// </summary>
|
||||
|
|
|
@ -8,10 +8,5 @@ namespace UniFramework.Module
|
|||
{
|
||||
UniModule.Update();
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
UniModule.Destroy();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,8 +12,8 @@ namespace UniFramework.Pooling
|
|||
public static class UniPooling
|
||||
{
|
||||
private static bool _isInitialize = false;
|
||||
private static GameObject _driver = null;
|
||||
private static readonly List<Spawner> _spawners = new List<Spawner>();
|
||||
private static GameObject _poolingRoot;
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
@ -28,9 +28,30 @@ namespace UniFramework.Pooling
|
|||
{
|
||||
// 创建驱动器
|
||||
_isInitialize = true;
|
||||
_poolingRoot = new UnityEngine.GameObject($"[{nameof(UniPooling)}]");
|
||||
_poolingRoot.AddComponent<UniPoolingDriver>();
|
||||
UnityEngine.Object.DontDestroyOnLoad(_poolingRoot);
|
||||
_driver = new UnityEngine.GameObject($"[{nameof(UniPooling)}]");
|
||||
_driver.AddComponent<UniPoolingDriver>();
|
||||
UnityEngine.Object.DontDestroyOnLoad(_driver);
|
||||
UniLogger.Log($"{nameof(UniPooling)} initalize !");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁游戏对象池系统
|
||||
/// </summary>
|
||||
public static void Destroy()
|
||||
{
|
||||
if (_isInitialize)
|
||||
{
|
||||
foreach (var spawner in _spawners)
|
||||
{
|
||||
spawner.Destroy();
|
||||
}
|
||||
_spawners.Clear();
|
||||
|
||||
_isInitialize = false;
|
||||
if (_driver != null)
|
||||
GameObject.Destroy(_driver);
|
||||
UniLogger.Log($"{nameof(UniPooling)} destroy all !");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,25 +69,6 @@ namespace UniFramework.Pooling
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁游戏对象池系统
|
||||
/// </summary>
|
||||
internal static void Destroy()
|
||||
{
|
||||
if (_isInitialize)
|
||||
{
|
||||
foreach (var spawner in _spawners)
|
||||
{
|
||||
spawner.Destroy();
|
||||
}
|
||||
|
||||
_spawners.Clear();
|
||||
_isInitialize = false;
|
||||
UniLogger.Log($"{nameof(UniPooling)} destroy all !");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建游戏对象生成器
|
||||
/// </summary>
|
||||
|
@ -87,7 +89,7 @@ namespace UniFramework.Pooling
|
|||
if (HasSpawner(packageName))
|
||||
return GetSpawner(packageName);
|
||||
|
||||
Spawner spawner = new Spawner(_poolingRoot, assetPackage);
|
||||
Spawner spawner = new Spawner(_driver, assetPackage);
|
||||
_spawners.Add(spawner);
|
||||
return spawner;
|
||||
}
|
||||
|
|
|
@ -8,10 +8,5 @@ namespace UniFramework.Pooling
|
|||
{
|
||||
UniPooling.Update();
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
UniPooling.Destroy();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@ namespace UniFramework.Window
|
|||
}
|
||||
|
||||
private static bool _isInitialize = false;
|
||||
private static GameObject _driver = null;
|
||||
private static readonly List<UIWindow> _stack = new List<UIWindow>(100);
|
||||
internal static GameObject Desktop { private set; get; }
|
||||
|
||||
|
@ -35,14 +36,31 @@ namespace UniFramework.Window
|
|||
{
|
||||
// 创建驱动器
|
||||
_isInitialize = true;
|
||||
GameObject driver = new UnityEngine.GameObject($"[{nameof(UniWindow)}]");
|
||||
driver.AddComponent<UniWindowDriver>();
|
||||
UnityEngine.Object.DontDestroyOnLoad(driver);
|
||||
_driver = new UnityEngine.GameObject($"[{nameof(UniWindow)}]");
|
||||
_driver.AddComponent<UniWindowDriver>();
|
||||
UnityEngine.Object.DontDestroyOnLoad(_driver);
|
||||
UniLogger.Log($"{nameof(UniWindow)} initalize !");
|
||||
|
||||
Desktop = desktop;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁界面系统
|
||||
/// </summary>
|
||||
public static void Destroy()
|
||||
{
|
||||
if (_isInitialize)
|
||||
{
|
||||
CloseAll();
|
||||
|
||||
_isInitialize = false;
|
||||
if (_driver != null)
|
||||
GameObject.Destroy(_driver);
|
||||
UniLogger.Log($"{nameof(UniWindow)} destroy all !");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新界面系统
|
||||
/// </summary>
|
||||
|
@ -61,20 +79,6 @@ namespace UniFramework.Window
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁界面系统
|
||||
/// </summary>
|
||||
internal static void Destroy()
|
||||
{
|
||||
if (_isInitialize)
|
||||
{
|
||||
_isInitialize = false;
|
||||
CloseAll();
|
||||
UniLogger.Log($"{nameof(UniWindow)} destroy all !");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置屏幕安全区域(异形屏支持)
|
||||
/// </summary>
|
||||
|
|
|
@ -8,10 +8,5 @@ namespace UniFramework.Window
|
|||
{
|
||||
UniWindow.Update();
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
UniWindow.Destroy();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue