Пример #1
0
        IEnumerator OnInitSceneSucced(SceneRootEntry sceneRoot)
        {
            LoadingLogic.AddCustomProgress(5);
            if (m_SceneRootEntry != null)
            {
                m_SceneRootEntry.ShowLevel();
            }
            SetShadowQuality(sceneRoot);
            SetLayerMask(sceneRoot);
            sceneRoot.SetZonesTag();
            sceneRoot.SetMainLight();
            LoadingLogic.AddCustomProgress(15);
            PSPoolManager.Instance.LoadStandardMainlandFX();
            yield return(new WaitUntil(() =>
            {
                LoadingLogic.AddCustomProgress(1);
                return HudLoadManager.Completed;
            }));

            GlobalMenuManager.PopCaches();
            MainLandLogic.GetInstance().FreshMapName();
            MainLandLogic.GetInstance().OnSceneViewLoaded();
            MainLandLogic.GetInstance().RobDartFight();
            GameEngine.Instance.IsRunFromEnterGameBtn = false;
            LoadingLogic.AddCustomProgress(5);
        }
Пример #2
0
    /// <summary>
    /// 清除指定场景
    /// </summary>
    /// <param name="name">资源名称</param>
    /// <returns></returns>
    static bool DestroyLevel(string name)
    {
        EB.Debug.LogLoadLevel("<color=#ff0000>清除指定场景</color>_name:" + name);
        //
        SceneRootEntry entry = null;

        m_SceneRootDict.TryGetValue(name, out entry);
        if (entry != null)
        {
            if (name.Contains("MainLandView")) //|| name.Contains("CombatView"))
            {
                if (entry.m_SceneRoot != null)
                {
                    entry.m_SceneRoot.CustomSetActive(false);
                }
                return(true);
            }
            entry.DestroyLevel();
            return(true);
        }
        else
        {
            EB.Debug.LogError("[SceneLoadManager]DestroyLevel: There is no definition of level [{0}].  ", name);
        }
        return(false);
    }
Пример #3
0
    /// <summary>
    /// 异步加载指定的场景名称
    /// </summary>
    /// <param name="sceneFileName">场景资源名称(其实是路径带扩展名)</param>
    /// <param name="begin">开始加载事件</param>
    /// <param name="failed">失败事件</param>
    /// <param name="loading">进度事件</param>
    /// <param name="finish">完成事件</param>
    /// <returns></returns>
    static bool LoadOTALevelAsyncImpl(string sceneFileName, SceneRootEntry.Begin begin, SceneRootEntry.Failed failed, SceneRootEntry.Loading loading, SceneRootEntry.Finished finish)
    {
        EB.Debug.Log("LoadOTALevelAsyncImpl=====>");
        if (!m_SceneRootDict.ContainsKey(sceneFileName))
        {
            m_SceneRootDict.Add(sceneFileName, new SceneRootEntry(sceneFileName));
        }

        SceneRootEntry entry = null;

        m_SceneRootDict.TryGetValue(sceneFileName, out entry);
        if (entry != null)
        {
            int length = sceneFileName.IndexOf('.');
            length = (length >= 0 ? length : sceneFileName.Length);
            //场景名称
            string levelName = sceneFileName.Substring(0, length);
            string sceneUrl  = GameEngine.Instance.OtaServer + "/" + entry.m_Path;
            entry.LoadOTALevelAsync(levelName, sceneUrl, begin, failed, loading, finish);
            return(true);
        }

        EB.Debug.LogError("加载场景生成错误_[SceneLoadManager]LoadOTALevelAsync: There is no definition of level [{0}]. ", sceneFileName);
        return(false);
    }
Пример #4
0
        private EB.Collections.Queue <Vector3> FindTransferPath(string npc_id, bool allPath, out Vector3 startPoint)
        {
            startPoint = Vector3.zero;
            SceneRootEntry sceneRoot = SceneLoadManager.GetSceneRoot(SceneLoadManager.CurrentSceneName);

            if (sceneRoot == null)
            {
                EB.Debug.LogError("sceneRoot is null");
                return(null);
            }

            Transform pathRoot = sceneRoot.m_SceneRoot.transform.GetComponentInChildren <LevelHelper>().transform.Find("TransportPaths/" + npc_id);

            startPoint = new Vector3(pathRoot.GetChild(0).position.x, mDMono.transform.position.y, pathRoot.GetChild(0).position.z);
            EB.Collections.Queue <Vector3> posQue = new EB.Collections.Queue <Vector3>();

            int nextpointIndex = AlliancesManager.Instance.TransferDartInfo.NextTransferPoint;

            if (allPath)
            {
                nextpointIndex = pathRoot.childCount - 2;
            }
            //else nextpointIndex = nextpointIndex == 0 ? 0 : nextpointIndex-1;//没到第一个检查点强行设置为第一个
            float localPlayerY = mDMono.transform.position.y;

            for (int pointindex = pathRoot.childCount - nextpointIndex - 1; pointindex < pathRoot.childCount; ++pointindex)
            {
                Transform t   = pathRoot.GetChild(pointindex);
                Vector3   pos = new Vector3(t.position.x, localPlayerY, t.position.z);
                posQue.Enqueue(pos);
            }
            return(posQue);
        }
Пример #5
0
 protected virtual void SceneLoadFinished(SceneRootEntry sceneRoot)
 {
     if (sceneRoot != null)
     {
         sceneRoot.ShowLevel();
     }
     UIStack.Instance.HideLoadingScreen();
 }
Пример #6
0
 /// <summary>
 /// 已经加载过的场景,
 /// </summary>
 /// <param name="root"></param>
 static void BackLevelLoadFinished(SceneRootEntry root)
 {
     if (root == null)
     {
         return;
     }
     root.HideLevel();
 }
Пример #7
0
 protected override void SceneLoadFinished(SceneRootEntry sceneRoot)
 {
     LoadingLogic.AddCustomProgress(15);
     if (sceneRoot != null)
     {
         sceneRoot.ShowLevel();
     }
     SceneLogic.SceneState = SceneLogic.eSceneState.SceneLoop;
     //UIStack.Instance.HideLoadingScreen(false);
 }
Пример #8
0
        private void OnMainLandSceneLoaded(SceneRootEntry sceneRoot)
        {
            m_State = PlayState.PlayState_MainLand;
            if (!DataLookupsCache.Instance.SearchDataByID <string>("playstate.state", out m_State))
            {
                EB.Debug.LogWarning("DataLookupsCache ===> playstate.state can't find!");
            }
            string state = m_State;

            if (string.Compare(state, PlayState.PlayState_InitCombat) == 0) //初始(合服状态也会变为init,因此新增新手引导字段判断)
            {
                if (GuideNodeManager.isFirstCombatGuide())
                {
                    GuideNodeManager.GetInstance().GetGuideNodeCompleted(delegate(bool success)
                    {
                        if (success)
                        {
                            MainLandLogic.GetInstance().RequestFastCombatTransition(eBattleType.FastCampaignBattle, "1_1");
                        }
                        else
                        {
                            MainLandLogic.GetInstance().RequestTransfer(SceneManager.MainLandName, Vector3.zero, 0, SceneManager.MainLandName, SceneManager.HeroStart, 0);
                        }
                    });
                }
                else
                {
                    MainLandLogic.GetInstance().RequestTransfer(SceneManager.MainLandName, Vector3.zero, 0, SceneManager.MainLandName, SceneManager.HeroStart, 0);
                }
            }
            else if (string.Compare(state, PlayState.PlayState_MainLand) == 0) //主城
            {
                Hashtable mainland_session = null;
                DataLookupsCache.Instance.SearchDataByID <Hashtable>("mainlands", out mainland_session);
                if (mainland_session != null)
                {
                    MainLandLogic.GetInstance().OnSceneEnter(mainland_session);
                }
            }
            else if (string.Compare(state, PlayState.PlayState_LCCampaign) == 0)//副本
            {
                if (GameFlowControlManager.Instance != null)
                {
                    GameFlowControlManager.Instance.SendEvent("GoToInstanceView");
                }
            }
            else if (string.Compare(state, PlayState.PlayState_Combat) == 0)//战斗
            {
                if (GameFlowControlManager.Instance != null)
                {
                    GameFlowControlManager.Instance.SendEvent("GoToMainLandView");
                }
            }
        }
Пример #9
0
        protected override void SceneLoadFinished(SceneRootEntry sceneRoot)
        {
            if (sceneRoot != null && sceneRoot.IsLoaded())
            {
                var themeLoadManager = sceneRoot.GetComponentInChildren <ThemeLoadManager>();

                if (themeLoadManager != null)
                {
                    LoadingLogic.AddCustomProgress(2);
                    string levelName = SceneManager.MainLandName;
                    themeLoadManager.LoadOTALevelAsync(levelName, levelName + ".unity.json", null, OnMainLandSceneLoadFailed, null, OnMainLandSceneLoaded);
                }
            }
        }
Пример #10
0
    void HandleFinished(SceneRootEntry entry)
    {
        // may be destroyed, 如果进了if则会卡76%
        if (Equals(null))
        {
            EB.Debug.LogError("[ThemeLoadManager].HandleFinished===> Equals(null)");
            entry.DestroyLevel();
            return;
        }

        if (entry.IsLoaded())
        {
            entry.SetParent(gameObject);
            entry.ShowLevel();
        }

        m_OnFinished?.Invoke(entry);
    }
Пример #11
0
        IEnumerator FindPath(string[] strs)
        {
            bool           localplayeraction = false;
            SceneRootEntry sceneRoot         = MainLandLogic.GetInstance().ThemeLoadManager.GetSceneRoot();
            Transform      playersList       = sceneRoot.m_SceneRoot.transform.Find("PlayerList");

            if (playersList != null)
            {
                while (!localplayeraction)
                {
                    yield return(null);

                    if (playersList.gameObject.activeSelf)
                    {
                        localplayeraction = true;
                    }
                }
            }
            WorldMapPathManager.Instance.StartPathFindToNpcFly(MainLandLogic.GetInstance().CurrentSceneName, strs[0], strs[1]);
        }
Пример #12
0
        protected void SetLayerMask(SceneRootEntry sceneRoot)
        {
            int hiddenLayers = PerformanceManager.Instance.CurrentEnvironmentInfo.hiddenLayers;

            Camera[] cams = sceneRoot.m_SceneRoot.GetComponentsInChildren <Camera>(true);

            int particleFXLayer = LayerMask.NameToLayer("TransparentFX");

            float[] distances = new float[sizeof(int) * 8];
            distances[particleFXLayer] = 30.0f;

            for (int i = 0; i < cams.Length; ++i)
            {
                Camera cam = cams[i];
                cam.cullingMask &= ~hiddenLayers;

                cam.layerCullSpherical = true;
                cam.layerCullDistances = distances;
            }
        }
Пример #13
0
        protected override void SceneLoadFinished(SceneRootEntry sceneRoot)
        {
            EB.Debug.Log("MainLandViewAction.SceneLoadFinished=====>");
            LoadingLogic.AddCustomProgress(15);
            if (sceneRoot != null && sceneRoot.IsLoaded())
            {
                m_SceneRootEntry   = sceneRoot;
                m_ThemeLoadManager = sceneRoot.GetComponentInChildren <ThemeLoadManager>();

                sceneLoaded = true;
                LoadingLogic.AddCustomProgress(5);
                OnComplete();

                if (m_ThemeLoadManager != null && !string.IsNullOrEmpty(MainLandLogic.GetInstance().CurrentEnvironmentName))
                {
                    string levelName = MainLandLogic.GetInstance().CurrentEnvironmentName;
                    m_ThemeLoadManager.LoadOTALevelAsync(levelName, levelName + ".unity.json", null, OnInitSceneFailed, null, (SceneRootEntry entry) => { EB.Coroutines.Run(OnInitSceneSucced(entry)); });
                }
            }
            LoadingLogic.AddCustomProgress(5);
        }
Пример #14
0
        public void ShowMainLandLight(bool isShow)
        {
            if (!SceneLogicManager.isMainlands() ||
                MainLandLogic.GetInstance() == null ||
                MainLandLogic.GetInstance().ThemeLoadManager == null)
            {
                return;
            }

            SceneRootEntry sceneRoot = MainLandLogic.GetInstance().ThemeLoadManager.GetSceneRoot();

            if (sceneRoot != null && sceneRoot.m_SceneRoot != null)
            {
                var mainLight = sceneRoot.m_SceneRoot.GetComponentInChildren <Light>();

                if (mainLight != null)
                {
                    mainLight.enabled = isShow;
                }
            }
        }
Пример #15
0
    /// <summary>
    /// 异步加载场景
    /// </summary>
    /// <param name="levelName"></param>
    /// <param name="levelPath"></param>
    /// <param name="begin"></param>
    /// <param name="failed"></param>
    /// <param name="loading"></param>
    /// <param name="finish"></param>
    public void LoadOTALevelAsync(string levelName, string levelPath, SceneRootEntry.Begin begin, SceneRootEntry.Failed failed, SceneRootEntry.Loading loading, SceneRootEntry.Finished finish)
    {
        if (m_RootEntry != null && m_RootEntry.m_Path == levelPath)
        {
            m_CurrentLevelName = levelName;
            m_CurrentLevelPath = levelPath;
            m_OnFinished       = finish;
            HandleFinished(m_RootEntry);
        }
        else
        {
            InitLoad();

            m_CurrentLevelName = levelName;
            m_CurrentLevelPath = levelPath;
            m_OnFinished       = finish;
            m_RootEntry        = new SceneRootEntry(levelPath);
            string sceneUrl = GameEngine.Instance.OtaServer + "/" + m_RootEntry.m_Path;
            m_RootEntry.LoadOTALevelAsync(levelName, sceneUrl, begin, failed, loading, HandleFinished);
        }
    }
Пример #16
0
        public void ShowPoeple(bool isShow)
        {
            if (!SceneLogicManager.isMainlands())
            {
                return;
            }
            if (MainLandLogic.GetInstance() == null)
            {
                return;
            }
            if (!MainLandLogic.GetInstance().ThemeLoadManager)
            {
                return;
            }
            //var players = getPlayer(isShow);
            SceneRootEntry sceneRoot = MainLandLogic.GetInstance().ThemeLoadManager.GetSceneRoot();

            if (sceneRoot != null && sceneRoot.m_SceneRoot != null)
            {
                Transform playersList = sceneRoot.m_SceneRoot.transform.Find("PlayerList");
                if (playersList != null)
                {
                    //运镖的时候不能隐藏
                    if (!AllianceUtil.IsInTransferDart)
                    {
                        playersList.gameObject.CustomSetActive(isShow);
                    }
                    else
                    {
                        playersList.gameObject.CustomSetActive(true);
                    }
                }

                Transform enemysList = sceneRoot.m_SceneRoot.transform.Find("ObjectManager");
                if (enemysList != null)
                {
                    enemysList.gameObject.CustomSetActive(isShow);
                }
            }
        }
Пример #17
0
        protected void SetShadowQuality(SceneRootEntry sceneRoot)
        {
            if (sceneRoot == null || sceneRoot.m_SceneRoot == null)
            {
                return;
            }
            PerformanceInfo.eSHADOW_QUALITY shadowquality = PerformanceManager.Instance.CurrentEnvironmentInfo.shadowQuality;
            Light[] lights = sceneRoot.m_SceneRoot.GetComponentsInChildren <Light>(true);

            for (int i = 0; i < lights.Length; ++i)
            {
                Light shadowlight = lights[i];
                if (shadowquality == PerformanceInfo.eSHADOW_QUALITY.On)
                {
                    shadowlight.gameObject.CustomSetActive(true);
                }
                else
                {
                    shadowlight.gameObject.CustomSetActive(false);
                }
            }
        }
Пример #18
0
        protected override void SceneLoadFinished(SceneRootEntry sceneRoot)
        {
            LoadingLogic.AddCustomProgress(15);
            UIStack.Instance.ResetNextStackDepth();
            EB.Debug.Log("LoginProfile {0}", ((float)((System.DateTime.UtcNow.Ticks / 10000) % 100000) / 1000));
            if (sceneRoot != null && sceneRoot.IsLoaded())
            {
                m_SceneRootEntry   = sceneRoot;
                m_ThemeLoadManager = sceneRoot.GetComponentInChildren <ThemeLoadManager>();
                if (m_ThemeLoadManager != null)
                {
                    LoadingLogic.AddCustomProgress(5);
                    Combat_Scene_Name = GetCombatSceneName();
                    if (string.IsNullOrEmpty(Combat_Scene_Name))
                    {
                        Combat_Scene_Name = DEFAULT_COMBAT_NAME;
                    }
                    m_ThemeLoadManager.LoadOTALevelAsync(Combat_Scene_Name, Combat_Scene_Name + ".unity.json", null, InitializeSceneFailed, null, InitializeScene);
                }

                InteractableObjectManager.Instance.SetParent(sceneRoot.m_SceneRoot.transform);
            }
            LoadingLogic.AddCustomProgress(10);
        }
Пример #19
0
        IEnumerator InitializeSceneCoroutine(SceneRootEntry sceneRoot)
        {
            LoadingLogic.AddCustomProgress(10);
            EB.Debug.Log("LoginProfile {0}", ((float)((System.DateTime.UtcNow.Ticks / 10000) % 100000) / 1000));

            if (m_SceneRootEntry != null)
            {
                m_SceneRootEntry.ShowLevel();
            }

            while (!SceneLogic.MainHeroLoadComplete)
            {
                yield return(null);
            }
            LoadingLogic.AddCustomProgress(15);
            SetShadowQuality(sceneRoot);

            while (!HudLoadManager.Completed)
            {
                yield return(null);
            }

            UI3DLobby[] lobbys = GameObjectExtension.FindMonoILRObjectsOfType <UI3DLobby>("Hotfix_LT.UI.UI3DLobby", "Hotfix_LT.UI.UI3DVsLobby");

            if (lobbys != null)
            {
                if (lobbys != null && lobbys.Length > 0)
                {
                    for (var i = 0; i < lobbys.Length; i++)
                    {
                        var lobby = lobbys[i];

                        if (lobby != null)
                        {
                            EB.Debug.LogWarning("CombatViewAction: SceneLoadFinished Clean lobby = {0} ---> gameObject name: {1}", lobby, lobby.mDMono.name);
                            GameObject.Destroy(lobby.mDMono.gameObject);
                        }
                    }
                }
            }

            LTMainHudManager.Instance.SetsFromFirstBattleType(false);

            if (SceneLogic.BattleType == eBattleType.FirstBattle)
            {
                LTMainHudManager.Instance.SetsFromFirstBattleType(true);
                UIStack.Instance.HideLoadingScreenImmediately(false, false);
            }
            else if (SceneLogic.isPVP())
            {
                UIStack.Instance.WaitForOtherPlayer();
            }
            else
            {
                //UIStack.Instance.HideLoadingScreenImmediately(false, false);
            }


            GM.AssetManager.RecordLoadEnd("CombatViewAction", "HideLoadingScreen");

            LTCombatEventReceiver.Instance?.OnCombatViewLoaded();

            MainLandLogic.GetInstance().OnCombatViewLoaded();
            EB.Debug.Log("LoginProfile {0}", ((float)((System.DateTime.UtcNow.Ticks / 10000) % 100000) / 1000));
            EB.Debug.Log("To initialize scene.");
            LoadingLogic.AddCustomProgress(5);
        }
Пример #20
0
 /// <summary>
 /// 战斗场景加载完毕
 /// </summary>
 /// <param name="sceneRoot"></param>
 void InitializeScene(SceneRootEntry sceneRoot)
 {
     EB.Coroutines.Run(InitializeSceneCoroutine(sceneRoot));
 }
Пример #21
0
        /// <summary>
        /// from Class SceneLogic
        /// </summary>
        /// <param name="playerSpawnEntry"></param>
        /// <param name="themeLoadMgr"></param>
        /// <param name="pos"></param>
        /// <param name="rot"></param>
        /// <param name="userid"></param>
        public static void CreateOtherPlayer(SceneLogic.PlayerEntry playerSpawnEntry, ThemeLoadManager themeLoadMgr, Vector3 pos, Quaternion rot, long userid)
        {
            try
            {
                if (pos.Equals(Vector3.zero))                //传送都是这个点 都要换算为出生点
                {
                    pos = playerSpawnEntry.position;
                    rot = playerSpawnEntry.rotation;
                }

                //lzt 需要排查原因为什么会得到空
                string     modelName  = BuddyAttributesManager.GetModelClass(userid.ToString());
                float      scale_size = 1f;
                eDartState dartState  = eDartState.None;
                double     fDartState;
                if (!DataLookupsCache.Instance.SearchDataByID <double>(string.Format("mainlands.pl.{0}.state.TOR", userid), out fDartState))
                {
                    EB.Debug.LogError("when intact search data dartState state fail");
                }
                dartState = (eDartState)System.Convert.ToInt32(fDartState);
                if (AllianceEscortUtil.GetIsInTransferDart(dartState))
                {
                    string dartName = dartState.ToString();
                    modelName  = AllianceEscortUtil.GetTransportCartModel(AllianceEscortUtil.ToDartStateStr(dartState));
                    scale_size = (modelName.IndexOf("M1003") >= 0 || modelName.IndexOf("M1004") >= 0) ? 0.6f : 1;
                }
                if (string.IsNullOrEmpty(modelName))
                {
                    EB.Debug.Log("CreateOtherPlayer ModelClassIsNullOrEmpty for userid={0}", userid);
                    return;
                }

                #region Async Load OtherPlayer
                EB.Assets.LoadAsync(RES_OtherPlayer, typeof(GameObject), o =>
                {
                    if (!o)
                    {
                        return;
                    }

                    SceneRootEntry sceneRoot = themeLoadMgr.GetSceneRoot();
                    GameObject localObj      = Replication.Instantiate(o, pos, rot) as GameObject;
                    Transform PlayerList     = sceneRoot.m_SceneRoot.transform.Find("PlayerList");
                    if (PlayerList == null)
                    {
                        GameObject partner = new GameObject("PlayerList");
                        partner.transform.SetParent(sceneRoot.m_SceneRoot.transform);
                        PlayerList = partner.transform;
                    }
                    PlayerList.gameObject.CustomSetActive(true);
                    localObj.transform.SetParent(PlayerList);

                    PlayerController player_controller = localObj.GetComponent <PlayerController>();
                    player_controller.playerUid        = userid;
                    Player.PlayerHotfixController hotfix_controller = player_controller.transform.GetMonoILRComponent <Player.PlayerHotfixController>();
                    hotfix_controller.SetPlayerSpawnLocation(pos);
                    hotfix_controller.CreateOtherPlayer(modelName, userid, scale_size);//创建其他人
                    hotfix_controller.InitDataLookupSet();

                    OtherPlayerTidDataLookup OPTD = player_controller.transform.GetDataLookupILRComponent <OtherPlayerTidDataLookup>(false);
                    if (OPTD == null)
                    {
                        OPTD                = player_controller.gameObject.AddDataLookupILRComponent <OtherPlayerTidDataLookup>("Hotfix_LT.UI.OtherPlayerTidDataLookup");
                        string path         = string.Format("mainlands.pl.{0}.tid", userid);
                        string torStatePath = string.Format("mainlands.pl.{0}.state.TOR", userid);
                        DataLookupsCache.Instance.SearchDataByID <string>(path, out OPTD.ModelTid);
                        OPTD.DartState = dartState;
                        OPTD.mDL.RegisterDataID(path);
                        OPTD.mDL.RegisterDataID(torStatePath);
                        //OPTD.DefaultDataID= path;
                    }
                });
                #endregion
            }
            catch (System.Exception e)
            {
                EB.Debug.LogError("Message: {0}, Stack: {1}", e.Message, e.StackTrace);
                UnityEngine.Debug.LogException(e);
            }
        }