Project_WL/Assets/Script/Util/MonoBehaviourSingletonTempl...

48 lines
1.6 KiB
C#
Raw Permalink Normal View History

2024-12-15 01:39:39 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MonoBehaviourSingletonTemplate<T> : MonoBehaviour where T : MonoBehaviour
{
public static T Ins;
2025-02-11 23:22:40 +00:00
public static bool isIns;
2024-12-15 01:39:39 +00:00
2025-02-11 23:22:40 +00:00
protected virtual void Awake() { Ins = this as T; isIns = true; }
2024-12-15 01:39:39 +00:00
protected void DontDestroy() { DontDestroyOnLoad(gameObject); }
}
public class MonoBehaviourSingletonScrollViewMgr<T> : ScrollViewMgr where T : MonoBehaviour
{
public static T Ins;
protected override void Awake() { Ins = this as T; }
protected void DontDestroy() { DontDestroyOnLoad(gameObject); }
}
public class MonoBehaviourSingletonuScrollViewMgr<T> : uScrollViewMgr where T : MonoBehaviour
{
public static T Ins;
protected override void Awake() { Ins = this as T; }
protected void DontDestroy() { DontDestroyOnLoad(gameObject); }
}
public class MonoBehaviourSingletonuScrollViewArrMgr<T> : uScrollViewArrMgr where T : MonoBehaviour
{
public static T Ins;
2025-02-11 23:22:40 +00:00
public static bool isIns;
2024-12-15 01:39:39 +00:00
2025-02-11 23:22:40 +00:00
protected override void Awake() { Ins = this as T; isIns = true; }
2024-12-15 01:39:39 +00:00
protected void DontDestroy() { DontDestroyOnLoad(gameObject); }
}
public class MonoBehaviourSingletonTemplateBackKeyAdd<T> : BackKeyAdd where T : MonoBehaviour
{
public static T Ins;
public GameObject go_Camera;
protected override void Awake() { Ins = this as T; }
protected void DontDestroy() { DontDestroyOnLoad(gameObject); }
public void Camera_On() { if (go_Camera) go_Camera.SetActive(true); }
public void Camera_Off() { if (go_Camera) go_Camera.SetActive(false); }
}