private void Awake() { _instance = this; peer = new PhotonPeer(this, protocol); peer.Connect(serverAddress, ApplicationName); DontDestroyOnLoad(this.gameObject); }
void Awake() { instance = this; peer = new PhotonPeer(this, protocol); peer.Connect(serverAddress, applicationName); //peer.Service(); }
private void Awake() { if (instance == null) { instance = this; } }
public void Start() { DontDestroyOnLoad(this); _instance = this; State = new Disconnected(_instance); Application.runInBackground = true; Initialize(); }
void Awake() { _instance = this;//该脚本是绑定在Unity游戏组件中,相当于unity实例化了该对象 peer = new PhotonPeer(this, protocol); peer.Connect(serverAddress, applicationName); role = new Role(); DontDestroyOnLoad(this); }
void Awake() { if (instance != null) { GameObject.Destroy(gameObject); return; } instance = this; }
void Awake() { _instance = this; peer = new PhotonPeer(this,protocol); //peer连接服务器 peer.Connect(serverAddress, applicationName); DontDestroyOnLoad(this.gameObject); }
void Awake() { //Dns.GetHostName(); IPAddress ipAddr = Dns.GetHostEntry("1462z254b3.iok.la").AddressList[0]; string ip = ipAddr.ToString();//"1462z254b3.iok.la";//ipAddr.ToString(); Debug.Log(ip); _instance = this; peer = new PhotonPeer(this, protocol); peer.Connect(ip+serverAddress, applicationName); DontDestroyOnLoad(this.gameObject); }
// Use this for initialization void Awake() { if (_instance == null) { _instance = this; DontDestroyOnLoad(this.gameObject); } else if (_instance != this) { Destroy(this.gameObject); } }
void Awake() { //Dns.GetHostName(); IPAddress ipAddr = Dns.GetHostEntry("1462z254b3.iok.la").AddressList[0]; string ip = ipAddr.ToString();//"1462z254b3.iok.la";//ipAddr.ToString(); Debug.Log(ip); _instance = this; peer = new PhotonPeer(this, protocol); peer.Connect(ip + serverAddress, applicationName); DontDestroyOnLoad(this.gameObject); }
void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else if (Instance != this) { Destroy(gameObject); } }
private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(this.gameObject); } else if (Instance != this) { Destroy(this.gameObject); return; } }
private void Awake() { if (PhotonEngine_INS == null) { PhotonEngine_INS = this; //当前对象不会随着场景的销毁而销毁 DontDestroyOnLoad(this.gameObject); Instantiate(MachingManager); } Application.targetFrameRate = 30; }
private Dictionary <OperationCode, RequestBase> RequestDict = new Dictionary <OperationCode, RequestBase>(); // 所有请求的字典,实现请求的处理分发 private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(this.gameObject); } else if (Instance != this) // 使游戏中只存在1个PhotonEngine游戏物体 { Destroy(this.gameObject); return; } }
private void Awake() { if (m_instance == null) { m_instance = this; DontDestroyOnLoad(this.gameObject); } else if (m_instance != this) { Destroy(this.gameObject); return; } m_requestDic = new Dictionary <OperationCode, Request>(); m_eventDic = new Dictionary <EventCode, BaseEvent>(); }
private void Awake() { //单例 场景一创建后初始化,从场景一到场景二需将场景一初始化的值删除 //保持场景中只有一个 PontonEngine if (Instance == null) { Instance = this; DontDestroyOnLoad(this.gameObject);//防止销毁当前游戏物体 } else if (Instance != this) { Destroy(this.gameObject); return;//销毁当前游戏物体 } }
void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { //Destroy object duplicate Destroy(gameObject); } DontDestroyOnLoad(gameObject); Initialize(); }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { // Destroy this object because it is a duplicate and we don't want to override the already existing version Destroy(gameObject); } DontDestroyOnLoad(gameObject); Initialize(); }
private void Awake() { //保持所有场景中只有一个PhotonEngine if (Instance == null) { Instance = this; //跳转场景等不销毁 DontDestroyOnLoad(gameObject); } else if (Instance != this) { Destroy(gameObject); return; } }
// Use this for initialization void Start() { Controller = new LoginController(this); PhotonEngine.UseExistingOrCreateNewPhotonEngine(ServerAddress, ApplicationName); // string[] arglist = new string[0]; // if (Application.srcValue.Split(new[] {"?"}, StringSplitOptions.RemoveEmptyEntries).Length > 1) // { // arglist = Application.srcValue.Split(new [] {"?"}, StringSplitOptions.RemoveEmptyEntries)[1].Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries) // ; // } // if (arglist.Length == 2) // { // _controller.SendLogin(arglist[0], arglist[1]); // //} }
public void Awake() { //Check if instance already exists if (_instance == null) //if not, set instance to this _instance = this; //If instance already exists and it's not this: else if (_instance != this) //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a PhotonEngine. Destroy(gameObject); }
private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(this.gameObject); } //跳转到第二个场景时,第一个场景的PhotonEngine Instance, //需要将其删除掉,场景中只保留一个PhotonEngine Instance //删除多余的PhotonEngine Instance else if (Instance != null) { Destroy(this.gameObject); return; } }
private void OnApplicationQuit() { Disconnect(); Instance = null; }
public WaitingForConnection(PhotonEngine engine) : base(engine) { }
public Disconnected(PhotonEngine engine) : base(engine) { }
public void Awake() { //should be when game starts this is called _instance = this; }
public Connected(PhotonEngine engine) : base(engine) { }
public void Awake() { _instance = this; State = new Disconnected(this); Initialize(); }
void OnDestroy() { instance = null; }
protected virtual void Start() { PhotonEngine.AddRequest(this); }
void Awake() { _instance = this; DontDestroyOnLoad(gameObject); //不自动销毁 }
public void Awake() { _instance = this; }
protected GameState(PhotonEngine engine) { _engine = engine; }
void OnDestroy() { PhotonEngine.RemoveRequest(this); }