/// <summary> /// Gotos the one sence. /// 跳转去一个场景; /// 先去跳转到loaidngSence,然后等到loadingsence 跳转; /// </summary> /// <param name="type">Type.</param> public void GotoOneSence(SenceType type, object param = null) { if (curSence != null) { preSence = curSence; } isLoading = true; isSceneReady = false; isCtrlReady = false; curSence = type; if (curSence == SenceType.mainSence && (preSence == SenceType.startSence || preSence == null)) { //第一次的话 ; // loadingUI = AddLoadingUI <GameUpdataManager>(EndDealOp_ScenePreCtrl); } else //暂时没有区分战斗还是主界面的前置; { if (curSence == SenceType.mainSence) { // loadingUI = AddLoadingUI<PreCtrlMainScene>(EndDealOp_ScenePreCtrl); } else { // loadingUI = AddLoadingUI<PreCtrlWarScene>(EndDealOp_ScenePreCtrl,mapID); } } GTWindowManage.Instance().SenceWillChangeed(); GTSenceManage.Instance().SenceWillChangeed(); AsyncOperation loadSence = Application.LoadLevelAsync("LoadingScene"); }
public override void CloseUI() { GTWindowManage.Instance().RemoveOneUI(this); gameObject.SetActive(false); transform.parent = null; Destroy(gameObject); }
/// <summary> /// Ends the loading after in sence. /// 进场景后删除loading /// /// </summary> public void EndLoadingAfterInSence() { GTWindowManage.Instance().SenceChangeed(); GTSenceManage.Instance().SenceChangeed(); if (loadingUI != null) { loadingUI.CloseUI(); } }
public static GTWindowManage Instance() { if (null == _instance) { Transform MangerBase = GTUIManager.Instance().GetManagerBaseRoot(); m_gameObject = new GameObject("GTWindowManage"); m_gameObject.transform.parent = MangerBase; _instance = m_gameObject.AddComponent <GTWindowManage>(); } return(_instance); }
IEnumerator loadData(string url, byte[] data) { m_bIsBeginRequest = true; m_bIsDone = false; m_www = new WWW(url, data); yield return(m_www); getDataCount++; //等爆头; if (m_www.bytes.Length < NetPacket.PACK_HEAD_SIZE) { Debuger.LogError(" --- 包头 不够" + m_msgID); byte[] dataSend = m_packet.getBuffer(); StartCoroutine(loadData(url, dataSend)); yield return(m_www); } else if (m_www.bytes.Length >= NetPacket.PACK_HEAD_SIZE) { //等包身; Byte[] msgIDData = new Byte[NetPacket.PACK_HEAD_SIZE]; Array.Copy(m_www.bytes, 0, msgIDData, 0, msgIDData.Length); int len = BitConverter.ToInt32(msgIDData, NetPacket.PACK_LENGTH_OFFSET); if (m_www.bytes.Length < len) { Debuger.LogError(" --- body 不够" + m_msgID); yield return(m_www); } byte[] backStr = null; if (m_www.error != null) { Debuger.Log("error " + m_www.error); } else { backStr = m_www.bytes; } if (null != m_CallFun) { int msgID = BitConverter.ToInt32(msgIDData, NetPacket.PACK_MESSSAGEID_OFFSET); Debuger.Log(" --- 够 了 " + m_msgID); int msgReal = msgID & 0x0ffffff0; if (msgReal != (int)m_msgID) { if (getDataCount >= 3) { GTWindowManage.Instance().OpenDialog_Tip("网络环境异常,请检查网络后重新启动游戏."); yield return(m_www); } else { Debuger.LogError(" --- 发包是 " + m_msgID + " " + (int)m_msgID + " 回包 " + msgReal); byte[] dataSend = m_packet.getBuffer(); StartCoroutine(loadData(url, dataSend)); yield return(m_www); } } else { m_CallFun(this, backStr); } } m_bIsDone = true; m_bIsBeginRequest = false; } }
void BtnClick_OpenCardList() { GTWindowManage.Instance().OpenPanel_CardList(); }