Exemplo n.º 1
0
    //玩家状态改变之后全局变量清理工作,为玩家重新上线做准备
    //适用范围包括玩家掉线,切换角色,切换帐号
    public void PlayerStateChange()
    {
        //清理PlayerDataPool
        GameManager.gameManager.PlayerDataPool.CleanUp();
        GameManager.gameManager.PlayerDataPool.Init();
        //Clean Damage Board
        DamageBoardManager.ClearDamageDictionary();
        //清理邮件缓存
        MailData.CleanMailData();

        PushNotification.ClearPushNotificationInfo();

        GameManager.gameManager.SoundManager.ChangeSoundState();
    }
Exemplo n.º 2
0
    private void OnDestroy()
    {
#if !UNITY_EDITOR
        try
        {
#endif
        Instance = null;
        EventDispatcher.Instance.RemoveEventListener(IsShowMainUIEvent.EVENT_TYPE, IsShowMainUIEventCallBack);
#if !UNITY_EDITOR
    }
    catch (Exception ex)
    {
        Logger.Error(ex.ToString());
    }
#endif
    }
Exemplo n.º 3
0
 public void RelaseActiveSceneData()
 {
     m_nCurSceneServerID = GlobeVar.INVALID_ID;
     m_UIRoot            = null;
     NameBoardRoot       = null;
     //m_TerrainData = null;
     m_MovingCircle       = null;
     m_SelectCircle       = null;
     m_GuideDirSign       = null;
     m_Teleport           = null;
     m_TeleportCopyScene  = null;
     m_QingGongPointList  = null;
     m_NameBoardPool      = null;
     m_DamageBoardRoot    = null;
     m_DamageBoardManager = null;
     m_SceneAudioSources  = null;
 }
Exemplo n.º 4
0
    void Awake()
    {
#if !UNITY_EDITOR
        try
        {
#endif

        Instance  = this;
        IsWorking = false;

#if !UNITY_EDITOR
    }
    catch (Exception ex)
    {
        Logger.Error(ex.ToString());
    }
#endif
    }
Exemplo n.º 5
0
    private void Start()
    {
#if !UNITY_EDITOR
        try
        {
#endif


        Instance          = this;
        MyPlayerCenterPos = new Vector2(Screen.width / 2.0f, Screen.height / 2.0f);
        panel             = transform.GetComponent <UIPanel>();
#if !UNITY_EDITOR
    }
    catch (Exception ex)
    {
        Logger.Error(ex.ToString());
    }
#endif
    }
Exemplo n.º 6
0
    IEnumerator LoadScene()
    {
        //m_ClipSlider.SetNextProgress(0.9f);
        LabelLoadingProgressNum1.text = "90%";
        LabelLoadingProgressNum2.text = "90%";
        SliderLoading1.value          = 0.9f;


        BundleManager.ReleaseSingleBundle();
        BundleManager.CleanBundleLoadQueue();
        BundleManager.ReleaseUIRefBundle();
        BundleManager.DoUnloadUnuseBundle();
        Obj_Character.s_hasPlayedBornEffectObjIdList.Clear();

        if (null != m_lastSceneBundle)
        {
            m_lastSceneBundle.Unload(false);
            m_lastSceneBundle = null;
        }
        ResourcesManager.Instance.UnLoadAll();
        BundleManager.ReleaseUIGroupBundle();
        if (nextSceneID != (int)Games.GlobeDefine.GameDefine_Globe.SCENE_DEFINE.SCENE_LOGIN)
        {
            BundleManager.ReleaseLoginBundle();
            LogModule.ErrorLog("Resources.UnloadUnusedAssets");
            yield return(Resources.UnloadUnusedAssets());

            System.GC.Collect();
            yield return(StartCoroutine(BundleManager.LoadMainUI()));

            yield return(StartCoroutine(BundleManager.LoadUI(UIInfo.JoyStickRoot, null, null, null)));

            DamageBoardManager.PreloadDamageBoard();
        }
        else
        {
            BundleManager.ReleaseGroupBundle();
            LogModule.ErrorLog("Resources.UnloadUnusedAssets");
            yield return(Resources.UnloadUnusedAssets());

            System.GC.Collect();
            yield return(StartCoroutine(BundleManager.LoadLoginUI()));
        }

        yield return(StartCoroutine(BundleManager.LoadCommonShader()));

        if (nextSceneID == (int)Games.GlobeDefine.GameDefine_Globe.SCENE_DEFINE.SCENE_LOGIN)
        {
            GameManager.gameManager.RunningScene = (int)LoadingWindow.nextSceneID;
            AsyncOperation curAsync = Application.LoadLevelAsync((int)LoadingWindow.nextSceneID);
            while (!curAsync.isDone)
            {
                //SetProgress(curAsync.progress);

                //m_ClipSlider.SetNextProgress(0.9f + 0.1f * curAsync.progress);
                StringBuilder sb = new StringBuilder("");
                sb.AppendFormat("{0}%", (int)(curAsync.progress * 100));
                LabelLoadingProgressNum1.text = sb.ToString();
                LabelLoadingProgressNum2.text = sb.ToString();
                SliderLoading1.sliderValue    = curAsync.progress;
                //loadingSlider.value = curAsync.progress;
                yield return(null);
            }
            //m_ClipSlider.SetProgress(1f);
            LabelLoadingProgressNum1.text = "100%";
            LabelLoadingProgressNum2.text = "100%";
            SliderLoading1.sliderValue    = 1.0f;
            //loadingSlider.value = 1;
        }
        else
        {
            m_ClipSlider.SetNextProgress(1f);
            SliderLoading1.sliderValue    = 0.95f;
            LabelLoadingProgressNum2.text = "95%";
            // 这个地方改为读表,不读GlobeDefine的静态字符串
            Tab_SceneClass sceneClass = TableManager.GetSceneClassByID((int)LoadingWindow.nextSceneID, 0);
            if (sceneClass == null)
            {
                LogModule.ErrorLog("Cant load scene id: {0}", (int)LoadingWindow.nextSceneID);
                yield return(null);
            }
            else
            {
                yield return(StartCoroutine(BundleManager.LoadScene(sceneClass.ResName, LoadSceneFinish)));
            }
        }
    }
Exemplo n.º 7
0
        /// <summary>
        /// 场景初始化
        /// </summary>
        private void SceneInit()
        {
            NameBoardRoot = GameObject.Find("CharacterRoot");
            if (NameBoardRoot == null)
            {
                NameBoardRoot = ResourceManager.InstantiateResource("Prefab/HeadInfo/NameBoardRoot") as GameObject;
            }

            FakeObjRoot = GameObject.Find("FakeObjRoot");
            if (FakeObjRoot == null)
            {
                FakeObjRoot = ResourceManager.InstantiateResource("Prefab/HeadInfo/FakeObjRoot") as GameObject;
                FakeObjRoot.SetActive(false);
            }

            DropItemBoardRoot = GameObject.Find("DropItemBoardRoot");
            if (DropItemBoardRoot == null)
            {
                DropItemBoardRoot = ResourceManager.InstantiateResource("Prefab/HeadInfo/DropItemBoardRoot") as GameObject;
            }


            //初始化特效
            m_MovingCircle = GameObject.Find("cb_dituzhizhen_02");
            if (null == m_MovingCircle)
            {
                m_MovingCircle = ResourceManager.InstantiateResource("Prefab/Effect/cb_dituzhizhen_02") as GameObject;
                if (null != m_MovingCircle)
                {
                    m_MovingCircle.transform.position = Vector3.zero;
                    m_MovingCircle.transform.rotation = Quaternion.Euler(Vector3.zero);
                    m_MovingCircle.SetActive(false);
                }
            }

            m_SelectCircle = GameObject.Find("SelectCircle");
            if (null == m_SelectCircle)
            {
                m_SelectCircle = ResourceManager.InstantiateResource("Prefab/Effect/SelectCircle") as GameObject;
                if (null != m_SelectCircle)
                {
                    m_SelectCircle.transform.position = Vector3.zero;
                    m_SelectCircle.transform.rotation = Quaternion.Euler(Vector3.zero);
                    m_SelectCircle.SetActive(false);
                }
            }

            // 方向指引
            GameObject guideDirSignObj = GameObject.Find("cb_dituzhizhen_01");

            if (null == guideDirSignObj)
            {
                guideDirSignObj = ResourceManager.InstantiateResource("Prefab/Effect/cb_dituzhizhen_01") as GameObject;
                m_GuideDirSign  = guideDirSignObj.AddComponent <GuideDirectionSign>();
                if (null != m_GuideDirSign)
                {
                    m_GuideDirSign.m_circleTrans          = guideDirSignObj.transform;
                    m_GuideDirSign.m_circleTrans.position = Vector3.zero;
                    m_GuideDirSign.m_circleTrans.rotation = Quaternion.Euler(Vector3.zero);
                    guideDirSignObj.SetActive(false);
                }
            }
            else
            {
                m_GuideDirSign = guideDirSignObj.GetComponent <GuideDirectionSign>();
            }

            if (m_GuideDirSign != null)
            {
                m_GuideDirSign.Init();
                m_GuideDirSign.SetGuideEffectScale(m_curMainPlayerCircleScale);
            }
            m_Teleport = GameObject.Find("Teleport");
            if (m_Teleport != null)
            {
                if (IsCopyScene())
                {
                    m_Teleport.SetActive(false);
                }
            }
            m_TeleportCopyScene = GameObject.Find("TeleportCopyScene");
            if (m_TeleportCopyScene)
            {
                if (IsCopyScene())
                {
                    m_TeleportCopyScene.SetActive(false);
                }
            }
            if (null == m_DamageBoardRoot)
            {
                m_DamageBoardRoot = new GameObject("DamageBoard Root");
                if (null != m_DamageBoardRoot)
                {
                    UIPanel panel = m_DamageBoardRoot.AddComponent <UIPanel>();
                    if (null != panel)
                    {
                        panel.depth = 20;
                    }
                    m_DamageBoardRoot.transform.localScale = new Vector3(0.015f, 0.015f, 0.015f);

                    m_DamageBoardManager = m_DamageBoardRoot.AddComponent <DamageBoardManager>();
                }
            }

            m_QingGongPointList = GameObject.FindGameObjectsWithTag("QingGongPoint");
            for (int i = 0; i < m_QingGongPointList.Length; ++i)
            {
                if (IsCopyScene() && m_QingGongPointList[i] != null)
                {
                    m_QingGongPointList[i].SetActive(false);
                }
            }

            //声音资源
            m_SceneAudioSources = GameObject.FindGameObjectsWithTag("SceneSoundEffect");
            for (int i = 0; i < m_SceneAudioSources.Length; ++i)
            {
                if (m_SceneAudioSources[i] != null && PlayerPreferenceData.SystemSoundEffect == 0)
                {
                    m_SceneAudioSources[i].SetActive(false);
                }
            }

            //初始化Terrain数据
            if (GameManager.gameManager != null)
            {
                GameManager.gameManager.m_loadErrorNum = 0;
            }

            //初始化名字版池子
            if (null == m_NameBoardPool)
            {
                m_NameBoardPool = new GameObjectPool("HeadInfo", 128);
            }

            if (null != m_NameBoardPool)
            {
                m_NameBoardPool.ClearAllPool();
            }

            if (m_MainCamera == null)
            {
                m_MainCamera = GameObject.Find("Main Camera");
            }
        }