mirror of
https://github.com/FriendshipIsEpic/FiE-Game.git
synced 2024-11-24 14:37: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>
|
||||
<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 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>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Unity3D.SDK" version="2017.4.37.1" targetFramework="net20" />
|
||||
<package id="UnityEngine" version="1.0.0" targetFramework="net20" />
|
||||
<package id="Unity3D.SDK" version="2018.4.11.1" targetFramework="net20" />
|
||||
<package id="Unity3D.UnityEngine" version="2018.3.5.1" targetFramework="net20" />
|
||||
</packages>
|
|
@ -1,25 +1,20 @@
|
|||
using Photon;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Fie.Manager
|
||||
{
|
||||
namespace Fie.Manager {
|
||||
[FieManagerExists(FieManagerExistSceneFlag.ANYTIME_DESTROY)]
|
||||
public abstract class FieManagerBase : Photon.MonoBehaviour
|
||||
{
|
||||
public abstract class FieManagerBase : Photon.MonoBehaviour {
|
||||
private bool _isEndStartup;
|
||||
|
||||
private bool _isDestroyed;
|
||||
|
||||
public bool isDestroyed => _isDestroyed;
|
||||
|
||||
protected virtual void StartUpEntity()
|
||||
{
|
||||
protected virtual void StartUpEntity() {
|
||||
}
|
||||
|
||||
public void StartUp()
|
||||
{
|
||||
if (!_isEndStartup)
|
||||
{
|
||||
public void StartUp() {
|
||||
if (!_isEndStartup) {
|
||||
StartUpEntity();
|
||||
_isEndStartup = true;
|
||||
}
|
||||
|
|
|
@ -1,27 +1,21 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Fie.Manager
|
||||
{
|
||||
public class FieManagerBehaviour<T> : FieManagerBase where T : FieManagerBase
|
||||
{
|
||||
namespace Fie.Manager {
|
||||
public class FieManagerBehaviour<T> : FieManagerBase where T : FieManagerBase {
|
||||
[SerializeField]
|
||||
private bool _isAutoStartUp;
|
||||
|
||||
private static T instance;
|
||||
|
||||
public static T I
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((UnityEngine.Object)instance != (UnityEngine.Object)null && instance.isDestroyed)
|
||||
{
|
||||
instance = (T)null;
|
||||
public static T I {
|
||||
get {
|
||||
if (instance != null && instance.isDestroyed) {
|
||||
instance = null;
|
||||
}
|
||||
if ((UnityEngine.Object)instance == (UnityEngine.Object)null)
|
||||
if (instance == null)
|
||||
{
|
||||
instance = UnityEngine.Object.FindObjectOfType<T>();
|
||||
if ((UnityEngine.Object)instance == (UnityEngine.Object)null || instance.isDestroyed)
|
||||
{
|
||||
if (instance == null || instance.isDestroyed) {
|
||||
GameObject gameObject = new GameObject();
|
||||
UnityEngine.Object.DontDestroyOnLoad(gameObject);
|
||||
instance = gameObject.AddComponent<T>();
|
||||
|
@ -31,18 +25,14 @@ namespace Fie.Manager
|
|||
}
|
||||
return instance;
|
||||
}
|
||||
set
|
||||
{
|
||||
set {
|
||||
instance = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (_isAutoStartUp)
|
||||
{
|
||||
T i = I;
|
||||
i.StartUp();
|
||||
private void Start() {
|
||||
if (_isAutoStartUp) {
|
||||
I.StartUp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue