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

49 lines
1.7 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MonoBehaviourSingletonTemplate<T> : MonoBehaviour where T : MonoBehaviour
{
public static T Ins;
public GameObject go_Camera;
protected virtual 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); }
}
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;
protected override void Awake() { Ins = this as T; }
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); }
}