mirror of
https://github.com/FriendshipIsEpic/FiE-Game.git
synced 2024-11-24 22:47:59 +01:00
Chip away at this some more
This commit is contained in:
parent
1d2f20bc23
commit
703218b53b
4 changed files with 21 additions and 36 deletions
|
@ -4797,10 +4797,10 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="UnityEditor, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="UnityEditor, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Unity3D.SDK.2017.4.37.1\lib\UnityEditor.dll</HintPath>
|
<HintPath>packages\Unity3D.SDK.2018.4.11.1\lib\UnityEditor.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Unity3D.SDK.2017.4.37.1\lib\UnityEngine.dll</HintPath>
|
<HintPath>packages\Unity3D.UnityEngine.2018.3.5.1\lib\UnityEngine.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Unity3D.SDK" version="2017.4.37.1" targetFramework="net20" />
|
<package id="Unity3D.SDK" version="2018.4.11.1" targetFramework="net20" />
|
||||||
<package id="UnityEngine" version="1.0.0" targetFramework="net20" />
|
<package id="Unity3D.UnityEngine" version="2018.3.5.1" targetFramework="net20" />
|
||||||
</packages>
|
</packages>
|
|
@ -1,25 +1,20 @@
|
||||||
using Photon;
|
using Photon;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Fie.Manager
|
namespace Fie.Manager {
|
||||||
{
|
|
||||||
[FieManagerExists(FieManagerExistSceneFlag.ANYTIME_DESTROY)]
|
[FieManagerExists(FieManagerExistSceneFlag.ANYTIME_DESTROY)]
|
||||||
public abstract class FieManagerBase : Photon.MonoBehaviour
|
public abstract class FieManagerBase : Photon.MonoBehaviour {
|
||||||
{
|
|
||||||
private bool _isEndStartup;
|
private bool _isEndStartup;
|
||||||
|
|
||||||
private bool _isDestroyed;
|
private bool _isDestroyed;
|
||||||
|
|
||||||
public bool isDestroyed => _isDestroyed;
|
public bool isDestroyed => _isDestroyed;
|
||||||
|
|
||||||
protected virtual void StartUpEntity()
|
protected virtual void StartUpEntity() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartUp()
|
public void StartUp() {
|
||||||
{
|
if (!_isEndStartup) {
|
||||||
if (!_isEndStartup)
|
|
||||||
{
|
|
||||||
StartUpEntity();
|
StartUpEntity();
|
||||||
_isEndStartup = true;
|
_isEndStartup = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,21 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Fie.Manager
|
namespace Fie.Manager {
|
||||||
{
|
public class FieManagerBehaviour<T> : FieManagerBase where T : FieManagerBase {
|
||||||
public class FieManagerBehaviour<T> : FieManagerBase where T : FieManagerBase
|
|
||||||
{
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private bool _isAutoStartUp;
|
private bool _isAutoStartUp;
|
||||||
|
|
||||||
private static T instance;
|
private static T instance;
|
||||||
|
|
||||||
public static T I
|
public static T I {
|
||||||
{
|
get {
|
||||||
get
|
if (instance != null && instance.isDestroyed) {
|
||||||
{
|
instance = null;
|
||||||
if ((UnityEngine.Object)instance != (UnityEngine.Object)null && instance.isDestroyed)
|
|
||||||
{
|
|
||||||
instance = (T)null;
|
|
||||||
}
|
}
|
||||||
if ((UnityEngine.Object)instance == (UnityEngine.Object)null)
|
if (instance == null)
|
||||||
{
|
{
|
||||||
instance = UnityEngine.Object.FindObjectOfType<T>();
|
instance = UnityEngine.Object.FindObjectOfType<T>();
|
||||||
if ((UnityEngine.Object)instance == (UnityEngine.Object)null || instance.isDestroyed)
|
if (instance == null || instance.isDestroyed) {
|
||||||
{
|
|
||||||
GameObject gameObject = new GameObject();
|
GameObject gameObject = new GameObject();
|
||||||
UnityEngine.Object.DontDestroyOnLoad(gameObject);
|
UnityEngine.Object.DontDestroyOnLoad(gameObject);
|
||||||
instance = gameObject.AddComponent<T>();
|
instance = gameObject.AddComponent<T>();
|
||||||
|
@ -31,18 +25,14 @@ namespace Fie.Manager
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
set
|
set {
|
||||||
{
|
|
||||||
instance = value;
|
instance = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start() {
|
||||||
{
|
if (_isAutoStartUp) {
|
||||||
if (_isAutoStartUp)
|
I.StartUp();
|
||||||
{
|
|
||||||
T i = I;
|
|
||||||
i.StartUp();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue