Example #1
0
 private void Awake()
 {
     _instance = this;
     peer      = new PhotonPeer(this, protocol);
     peer.Connect(serverAddress, ApplicationName);
     DontDestroyOnLoad(this.gameObject);
 }
Example #2
0
 void Awake()
 {
     instance = this;
     peer     = new PhotonPeer(this, protocol);
     peer.Connect(serverAddress, applicationName);
     //peer.Service();
 }
Example #3
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #4
0
 public void Start()
 {
     DontDestroyOnLoad(this);
     _instance = this;
     State = new Disconnected(_instance);
     Application.runInBackground = true;
     Initialize();
 }
Example #5
0
 void Awake()
 {
     _instance = this;//该脚本是绑定在Unity游戏组件中,相当于unity实例化了该对象
     peer      = new PhotonPeer(this, protocol);
     peer.Connect(serverAddress, applicationName);
     role = new Role();
     DontDestroyOnLoad(this);
 }
Example #6
0
 void Awake()
 {
     if (instance != null)
     {
         GameObject.Destroy(gameObject);
         return;
     }
     instance = this;
 }
Example #7
0
    void Awake()
    {
        _instance = this;
        peer = new PhotonPeer(this,protocol);
        //peer连接服务器
        peer.Connect(serverAddress, applicationName);
        DontDestroyOnLoad(this.gameObject);

    }
Example #8
0
 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);
 }
Example #9
0
 // Use this for initialization
 void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else if (_instance != this)
     {
         Destroy(this.gameObject);
     }
 }
Example #10
0
    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);
     }
 }
Example #12
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else if (Instance != this)
     {
         Destroy(this.gameObject); return;
     }
 }
Example #13
0
    private void Awake()
    {
        if (PhotonEngine_INS == null)
        {
            PhotonEngine_INS = this;
            //当前对象不会随着场景的销毁而销毁
            DontDestroyOnLoad(this.gameObject);
            Instantiate(MachingManager);
        }

        Application.targetFrameRate = 30;
    }
Example #14
0
    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;
        }
    }
Example #15
0
 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>();
 }
Example #16
0
 private void Awake()
 {
     //单例  场景一创建后初始化,从场景一到场景二需将场景一初始化的值删除
     //保持场景中只有一个  PontonEngine
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(this.gameObject);//防止销毁当前游戏物体
     }
     else if (Instance != this)
     {
         Destroy(this.gameObject); return;//销毁当前游戏物体
     }
 }
Example #17
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            //Destroy object duplicate
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
        Initialize();
    }
Example #18
0
    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();
    }
Example #19
0
 private void Awake()
 {
     //保持所有场景中只有一个PhotonEngine
     if (Instance == null)
     {
         Instance = this;
         //跳转场景等不销毁
         DontDestroyOnLoad(gameObject);
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
         return;
     }
 }
Example #20
0
// 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]);
        //
        //}
    }
Example #21
0
    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);
        
        
    }
Example #22
0
 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;
 }
Example #24
0
 public WaitingForConnection(PhotonEngine engine) : base(engine)
 {
 }
Example #25
0
 public Disconnected(PhotonEngine engine) : base(engine)
 {
 }
Example #26
0
 public void Awake()
 {
     //should be when game starts this is called
     _instance = this;
 }
Example #27
0
 public Connected(PhotonEngine engine) : base(engine)
 {
 }
    public WaitingForConnection(PhotonEngine engine) : base(engine)
    {

    }
Example #29
0
 public void Awake()
 {
     _instance = this;
     State     = new Disconnected(this);
     Initialize();
 }
Example #30
0
 void OnDestroy()
 {
     instance = null;
 }
Example #31
0
 protected virtual void Start()
 {
     PhotonEngine.AddRequest(this);
 }
 void Awake()
 {
     _instance = this;
     DontDestroyOnLoad(gameObject);  //不自动销毁
 }
Example #33
0
 public void Awake()
 {
     _instance = this;
 }
Example #34
0
 public void Awake()
 {
     //should be when game starts this is called
     _instance = this;
 }
 public void Awake()
 {
     _instance = this;
     State = new Disconnected(this);
     Initialize();
 }
Example #36
0
 protected GameState(PhotonEngine engine)
 {
     _engine = engine;
 }
Example #37
0
 protected GameState(PhotonEngine engine)
 {
     _engine = engine;
 }
Example #38
0
 public void Awake()
 {
     _instance = this;
 }
Example #39
0
 void OnDestroy()
 {
     PhotonEngine.RemoveRequest(this);
 }