Example #1
0
    /// <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");
    }
Example #2
0
 /// <summary>
 /// Ends the loading after in sence.
 /// 进场景后删除loading
 ///
 /// </summary>
 public void EndLoadingAfterInSence()
 {
     GTWindowManage.Instance().SenceChangeed();
     GTSenceManage.Instance().SenceChangeed();
     if (loadingUI != null)
     {
         loadingUI.CloseUI();
     }
 }
Example #3
0
    /// <summary>
    /// 这里去主界面应该通过资源检测  GameUpdataManagerCp;
    /// 资源更新后打开登陆界面;
    /// 点击登陆后才进入GamePreCtrl;
    /// </summary>
    void GotoMain()
    {
        GTSenceManage.Instance().AddLoadingUIToSence <GameUpdataManagerCp>(true, EndDealOp_ScenePreCtrl, EndAddLoadingUI);
        //添加loading
//        GamePreCtrl preCtrl = GTSenceManage.Instance().AddLoadingUIToSence<GamePreCtrl>(EndDealOp_ScenePreCtrl);
//		LoadingController.GetInstance ().GotoOneSence (SenceType.mainSence);

//		LoadingController.GetInstance ().LoadSenceAsyncDone(); = "main";
//		Application.LoadLevelAsync("loading");
        //		Application.LoadLevelAdditiveAsync ("yourScene"); //不删除原场景 情况下  慎用.
    }
Example #4
0
    /// <summary>
    /// Sends the message.
    /// 用消息ID 获取信息;
    /// </summary>
    /// <param name="msgID">Message I.</param>
    /// <param name="URL">UR.</param>
    public void SendMsg(GameMessage msgID, string URL, bool isNeedTipWaite = false)
    {
        bool isNeed = MsgSet.IsNeedTipByMsgID((int)msgID);

        if (isNeedTipWaite || isNeed)
        {
            GTSenceManage.Instance().StartLoadData();
        }

        NetPacket pack = new NetPacket((int)msgID, 0);

        GameObject  oneObj  = new GameObject("http_" + msgID);
        HttpDataCmp httpCmp = oneObj.AddComponent <HttpDataCmp> ();

        httpCmp.isNeedTipWaite   = isNeedTipWaite;
        httpCmp.transform.parent = transform;

        httpCmp.GET(msgID, URL, GetDataCallFun, pack);
    }
Example #5
0
    void GetDataCallFun(HttpDataCmp cmp, byte[] text)
    {
        Debuger.LogWarning("get back http " + cmp.m_msgID + "  ");
        bool isNeed = MsgSet.IsNeedTipByMsgID((int)cmp.m_msgID);

        if (cmp.isNeedTipWaite || isNeed)
        {
            GTSenceManage.Instance().EndLoadData();
        }
        if (text != null)
        {
            NetPacket packet = null;

            int bodySize = text.Length - NetPacket.PACK_HEAD_SIZE;
            if (bodySize < 0)
            {
                bodySize = 0;
                Debuger.LogError("服务器返回的字节 不够包头 " + cmp.m_msgID.ToString());
                packet = new NetPacket((int)cmp.m_msgID, 0);
            }
            else
            {
                //读取包身数据;
                Byte[] data = new Byte[bodySize];
                Array.Copy(text, NetPacket.PACK_HEAD_SIZE, data, 0, data.Length);
                //读取包头数据;
                Byte[] msgIDData = new Byte[NetPacket.PACK_HEAD_SIZE];
                Array.Copy(text, 0, msgIDData, 0, msgIDData.Length);
                packet = new NetPacket((int)cmp.m_msgID, data.Length);
                packet.setPackHead(msgIDData);
                packet.setData(data);
            }


            MessageRecieveHandle.Instance().OnRecvMessage(cmp.m_msgID, packet);
        }
        else
        {
            Debug.Log("call back  error");
        }
        MonoBehaviour.Destroy(cmp.gameObject);
    }
Example #6
0
    /// <summary>
    /// Sends the message.
    /// 带参数l
    /// </summary>
    /// <param name="msgID">Message I.</param>
    /// <param name="URL">UR.</param>
    /// <param name="values">Values.</param>
    public void SendMsgJson(GameMessage msgID, string URL, bool isNeedTipWaite, params HttpPbj[] values)
    {
        bool isNeed = MsgSet.IsNeedTipByMsgID((int)msgID);

        if (isNeedTipWaite || isNeed)
        {
            GTSenceManage.Instance().StartLoadData();
        }
        //		if(catchePool.countInactive > 0)
        //		{
        //
        //		}
        //		catchePool
        //		catchePool.Get ();
        GameObject  oneObj  = new GameObject("http_" + msgID);
        HttpDataCmp httpCmp = oneObj.AddComponent <HttpDataCmp> ();

        httpCmp.isNeedTipWaite   = isNeedTipWaite;
        httpCmp.transform.parent = transform;
        httpCmp.GET(msgID, URL, GetDataCallFun, values);
    }
Example #7
0
    IEnumerator LoadMainiFast()
    {
        Debug.LogError("----zys----  start load mainfalst");
        yield return(StartCoroutine(Initialize()));

        Debug.LogError("----zys----  back to laod");

        yield return(StartCoroutine(LoadRootUI()));

        yield return(StartCoroutine(LoadRootUI1()));

        AssetBundleManager.UnloadAssetBundle("baseui.unity3d");
        AssetBundleManager.UnloadAssetBundle("baseui.unity3d");

        GTUIManager.Instance().SetInitRootUI(staticCanvas, effCanvas);
        yield return(StartCoroutine(LoadLoadingUI()));

        yield return(StartCoroutine(GTSenceManage.Instance().AddStartSence()));

//        yield return StartCoroutine(LoadStartSenceUI());
    }
Example #8
0
    /// <summary>
    /// Sends the message.
    /// 发送结构体过去;
    /// </summary>
    /// <param name="msgID">Message I.</param>
    /// <param name="URL">UR.</param>
    /// <param name="protoSt">Proto st.</param>
    /// <typeparam name="T">The 1st type parameter.</typeparam>
    public void SendMsg <T> (GameMessage msgID, string URL, T protoSt, bool isNeedTipWaite = false) where T : class, ProtoBuf.IExtensible
    {
        Debuger.LogWarning("向服务器发送 http " + msgID + "  ");
        using (MemoryStream ms = new MemoryStream()) {
            bool isNeed = MsgSet.IsNeedTipByMsgID((int)msgID);
            if (isNeedTipWaite || isNeed)
            {
                GTSenceManage.Instance().StartLoadData();
            }
            new PBMessageSerializer().Serialize(ms, protoSt);
            byte[] bytes = ms.ToArray();

            NetPacket pack = new NetPacket((int)msgID, bytes.Length);
            pack.setData(bytes);

            GameObject  oneObj  = new GameObject("http_" + msgID);
            HttpDataCmp httpCmp = oneObj.AddComponent <HttpDataCmp> ();
            httpCmp.isNeedTipWaite   = isNeedTipWaite;
            httpCmp.transform.parent = transform;

            httpCmp.GET(msgID, URL, GetDataCallFun, pack);
        }
    }
Example #9
0
 /// <summary>
 /// 直接进入游戏不用登陆;
 /// </summary>
 public void LogonGame()
 {
     GTSenceManage.Instance().GotoMainUiSenceFromLogon();
 }
Example #10
0
    void EndDealOp_ScenePreCtrl()
    {
        Debuger.Log("zys -----  资源更新检测结束");

        GTSenceManage.Instance().GotoLogonSence();
    }