Exemple #1
0
    public override void Exit(params object[] objs)
    {
        if (null != m_mono)
        {
            m_lastUsedIp   = m_mono.ip;
            m_lastUsedPort = m_mono.port;
            GameObject.Destroy(m_mono.gameObject);
        }

        m_mono = null;
        App.my.gameNetwork.openCb  -= this.OnConnected;
        App.my.gameNetwork.closeCb -= this.OnDisConnect;
    }
Exemple #2
0
 public override void Enter(params object[] objs)
 {
     m_mono = App.my.uiRoot.GetComponentInChildren <UIConnectServer>();
     if (null == m_mono)
     {
         Object     prefab = Resources.Load("Art/UI/Prefabs/UIConnectServer");
         GameObject go     = GameObject.Instantiate(prefab) as GameObject;
         m_mono = go.GetComponent <UIConnectServer>();
         m_mono.transform.SetParent(App.my.uiRoot);
         m_mono.transform.localPosition = Vector3.zero;
         m_mono.transform.localScale    = Vector3.one;
     }
     m_mono.ip   = m_lastUsedIp;
     m_mono.port = m_lastUsedPort;
     App.my.gameNetwork.openCb  += this.OnConnected;
     App.my.gameNetwork.closeCb += this.OnDisConnect;
 }