Beispiel #1
0
 public void RemoveSwitchData(TsSceneSwitcher.ESceneType eSceneType, TsSceneSwitcher.SwitchData switchData)
 {
     TsSceneSwitcher._SwitchDataList switchDataList = this._GetSwitchData_List(eSceneType);
     if (switchDataList == null)
     {
         return;
     }
     switchDataList.Remove(switchData);
 }
Beispiel #2
0
    private void _Collect(GameObject go, GameObject rootGO, TsSceneSwitcher.ESceneType eSceneType, bool isActive)
    {
        if (go == null || rootGO == null)
        {
            TsLog.LogError("Cannot be null~!!!!! ", new object[0]);
            return;
        }
        TsSceneSwitcherMark tsSceneSwitcherMark = go.GetComponent <TsSceneSwitcherMark>();

        if (tsSceneSwitcherMark == null)
        {
            tsSceneSwitcherMark = this._AddOrGetComponent(go, eSceneType);
            if (tsSceneSwitcherMark == null)
            {
                TsLog.LogError("Must Added~! Check logic~!", new object[0]);
                return;
            }
        }
        if (tsSceneSwitcherMark.IsCollected)
        {
            return;
        }
        if (go.transform.parent == null)
        {
            go.transform.parent = rootGO.transform;
        }
        TsSceneSwitcher._SwitchDataList switchDataList = this._GetSwitchData_List(eSceneType);
        if (switchDataList == null)
        {
            TsLog.LogError("Cannot found~! key= " + rootGO.name, new object[0]);
            return;
        }
        TsSceneSwitcher.SwitchData switchData = this._MakeSwitchData(tsSceneSwitcherMark, rootGO.name);
        if (switchData != null)
        {
            tsSceneSwitcherMark.RootGOName    = rootGO.name;
            tsSceneSwitcherMark.IsCollected   = true;
            tsSceneSwitcherMark.RefSwitchData = switchData;
            switchDataList.Add(switchData);
        }
        Light[] componentsInChildren = go.GetComponentsInChildren <Light>();
        if (componentsInChildren != null)
        {
            Light[] array = componentsInChildren;
            for (int i = 0; i < array.Length; i++)
            {
                Light       light     = array[i];
                TsLayerMask layerMask = new TsLayerMask((uint)light.cullingMask);
                light.cullingMask = layerMask - TsLayer.GUI;
            }
        }
        go.SetActive(isActive);
    }
Beispiel #3
0
    private GameObject _MakeRootSceneGO(TsSceneSwitcher.ESceneType eSceneType)
    {
        GameObject gameObject = this._GetSwitchData_RootSceneGO(eSceneType);

        if (gameObject == null)
        {
            gameObject = new GameObject(eSceneType.ToString());
            TsSceneSwitcherMark tsSceneSwitcherMark = this._AddOrGetComponent(gameObject, eSceneType);
            tsSceneSwitcherMark.RootGOName  = eSceneType.ToString();
            tsSceneSwitcherMark.IsCollected = true;
            TsSceneSwitcher._SwitchDataList value = new TsSceneSwitcher._SwitchDataList();
            this._switchDataDic.Add(gameObject, value);
            gameObject.transform.parent = TsSceneSwitcher.Instance.gameObject.transform;
            UnityEngine.Object.DontDestroyOnLoad(gameObject);
        }
        return(gameObject);
    }
Beispiel #4
0
    public void DeleteScene(TsSceneSwitcher.ESceneType eSceneType)
    {
        GameObject gameObject = this._GetSwitchData_RootSceneGO(eSceneType);

        if (gameObject != null)
        {
            TsSceneSwitcher._SwitchDataList switchDataList = this._GetSwitchData_List(eSceneType);
            if (switchDataList == null)
            {
                TsLog.LogError("Cannot found~! key= " + eSceneType, new object[0]);
                return;
            }
            switchDataList.Clear();
            for (int i = 0; i < gameObject.transform.childCount; i++)
            {
                Transform child = gameObject.transform.GetChild(i);
                UnityEngine.Object.Destroy(child.gameObject);
            }
        }
    }