Exemple #1
0
 /// <summary>
 /// 类型:方法
 /// 名称:Awake
 /// 作者:taixihuase
 /// 作用:创建单例
 /// 编写日期:2015/7/17
 /// </summary>
 void Awake()
 {
     // 若当前不存在单例,则创建单例并实例化客户端服务进程
     if (_instance == null)
     {
         _instance = this;
         Service   = new PhotonService();
         DontDestroyOnLoad(this);
     }
     else
     {
         // 若已存在一个单例,则销毁该单例所挂载的对象
         if (this != _instance)
         {
             Destroy(gameObject);
         }
     }
 }
 /// <summary>
 /// 类型:方法
 /// 名称:Awake
 /// 作者:taixihuase
 /// 作用:创建单例
 /// 编写日期:2015/7/17
 /// </summary>
 void Awake()
 {
     // 若当前不存在单例,则创建单例并实例化客户端服务进程
     if (_instance == null)
     {
         _instance = this;
         Service = new PhotonService();
         DontDestroyOnLoad(this);
     }
     else
     {
         // 若已存在一个单例,则销毁该单例所挂载的对象
         if (this != _instance)
         {
             Destroy(gameObject);
         }
     }
 }