using UnityEngine;
/*by Alexander*/
public enum UserState
{
Online,
Chatting,
Pushing,
Offline
}
public class StateController : MonoBehaviour
{
private object m_mutex = new object();
private bool m_initialized = false;
private static StateController stateController = null;
// Singleton in thread-safe-mode
public StateController Instance
{
get
{
if (!this.m_initialized)
{
lock (this.m_mutex)
{
if (stateController == null)
{
stateController = new StateController();
m_initialized = true;
}
}
}
return stateController;
}
}
private UserState m_state;
public UserState State
{
get
{
return m_state;
}
set
{
lock (m_mutex)
{
m_state = value;
}
}
}
}
作者:艾孜尔江