Example #1
0
 private void _SetSwitchData(GameObject go, TsSceneSwitcher.SwitchData switchData)
 {
     switchData.TargetGO = go;
     if (go.renderer != null)
     {
         switchData.EnableRender = ((!go.renderer.enabled) ? TsSceneSwitcher.SwitchData.ERender.Disable : TsSceneSwitcher.SwitchData.ERender.Enable);
     }
     if (go.audio != null)
     {
         TsAudioAdapter component = switchData.TargetGO.GetComponent <TsAudioAdapter>();
         if (component != null)
         {
             switchData.IsPlayingAudio = ((!component.GetAudioEx().PlayOnDownload) ? TsSceneSwitcher.SwitchData.EAudio.Stop : TsSceneSwitcher.SwitchData.EAudio.Playing);
             component.GetAudioEx().Stop();
         }
     }
     if (go.animation != null)
     {
         Animation animation = switchData.TargetGO.animation;
         if (animation != null)
         {
             switchData.IsPlayingAnimation = ((!animation.playAutomatically || !(animation.clip != null)) ? TsSceneSwitcher.SwitchData.EAnimation.Stop : TsSceneSwitcher.SwitchData.EAnimation.Playing);
             animation.Stop();
         }
     }
 }
Example #2
0
 public void RemoveSwitchData(TsSceneSwitcher.ESceneType eSceneType, TsSceneSwitcher.SwitchData switchData)
 {
     TsSceneSwitcher._SwitchDataList switchDataList = this._GetSwitchData_List(eSceneType);
     if (switchDataList == null)
     {
         return;
     }
     switchDataList.Remove(switchData);
 }
Example #3
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);
    }
Example #4
0
 private TsSceneSwitcher.SwitchData _MakeSwitchData(TsSceneSwitcherMark mark, string rootSceneGOName)
 {
     TsSceneSwitcher.SwitchData switchData = new TsSceneSwitcher.SwitchData();
     this._SetSwitchData(mark.gameObject, switchData);
     return(switchData);
 }