public void Load()
        {
            FabricManager fabricAudioManager = GetFabricManagerInEditor();

            if (!fabricAudioManager)
            {
                GameObject prefabGO = Resources.Load(_fabricManagerPrefabPath, typeof(GameObject)) as GameObject;

                if (prefabGO)
                {
#if UNITY_EDITOR
                    if (!EditorApplication.isPlayingOrWillChangePlaymode && Application.isEditor)
                    {
                        //GameObject fabricAudioManagerGO = PrefabUtility.InstantiatePrefab(prefabGO) as GameObject;
                        //GameObjectUtils.SetHideFlagsRecursive(fabricAudioManagerGO, HideFlags.DontSave, true);
                        //GameObjectUtils.SetSavableRecursive(fabricAudioManagerGO, false);
                        //Debug.Log("Creating");
                    }
                    else
#endif
                    {
                        GameObject.Instantiate(prefabGO);
                        //Debug.Log("Creating");
                    }
                }
            }
        }
        private void Start()
        {
            FabricManager instance = FabricManager.Instance;

            if (instance != null)
            {
                FabricManager.Instance._audioListener = base.gameObject.AddComponent <AudioListener>();
            }
        }
 public static FabricManager Instance()
 {
     if (fabricManager != null)
     {
         return(fabricManager);
     }
     if (FabricManager.Instance != null)
     {
         fabricManager = FabricManager.Instance;
     }
     else
     {
         fabricManager = (FabricManager)Object.FindObjectOfType(typeof(FabricManager));
     }
     return(fabricManager);
 }
Example #4
0
        private void DrawComponents()
        {
            if (!FabricManager.IsInitialised())
            {
                return;
            }
            float value = slotHeight + 500f;

            scrollPosition = GUI.BeginScrollView(new Rect(0f, 0f, 700f, GetActualSize(value) + 20f), scrollPosition, new Rect(0f, 0f, width, GetActualSize(value)));
            Component[] componentsInChildren = FabricManager.Instance.gameObject.GetComponentsInChildren <GroupComponent>();
            float       y = 20f;
            float       x = 20f;

            foreach (Component component in componentsInChildren)
            {
                if (component != null)
                {
                    DrawComponent(component, ref x, y);
                }
            }
            width = x;
            GUI.EndScrollView();
        }
Example #5
0
 public static FabricManager GetManagerInstance()
 {
     if (FabricManager.Instance != null)
     {
         return(FabricManager.Instance);
     }
     if (Selection.activeGameObject != null)
     {
         FabricManager fabricManager    = null;
         GameObject    activeGameObject = Selection.activeGameObject;
         PrefabType    prefabType       = PrefabUtility.GetPrefabType(activeGameObject);
         if (prefabType == PrefabType.Prefab)
         {
             GameObject gameObject = activeGameObject.transform.root.gameObject;
             if (gameObject != null)
             {
                 fabricManager          = gameObject.GetComponent <FabricManager>();
                 FabricManager.Instance = fabricManager;
             }
         }
         return(fabricManager);
     }
     return(null);
 }
Example #6
0
 public void Awake()
 {
     if (_isInitialised)
     {
         return;
     }
     _instance = this;
     if (_VRAudioManager.HasVRSolutions())
     {
         FabricAudioListener fabricAudioListener = (FabricAudioListener)UnityEngine.Object.FindObjectOfType(typeof(FabricAudioListener));
         if (fabricAudioListener != null)
         {
             GameObject audioListener = _VRAudioManager.GetAudioListener();
             if (audioListener != null)
             {
                 audioListener.transform.parent = fabricAudioListener.gameObject.transform;
             }
         }
         if (_audioSourcePool == 0)
         {
             _audioSourcePool = 100;
         }
     }
     if (_audioSourcePool > 0)
     {
         if (_audioSourcePoolManager == null)
         {
             _audioSourcePoolManager = base.gameObject.GetComponentInChildren <AudioSourcePool>();
             if (_audioSourcePoolManager == null)
             {
                 _audioSourcePoolManager = AudioSourcePool.Create();
             }
             _audioSourcePoolManager.Initialise(_audioSourcePool, _audioSourcePoolFadeInTime, _audioSourcePoolFadeOutTime);
         }
         if (_audioSourcePoolManager != null)
         {
             _audioSourcePoolManager.Refresh();
         }
     }
     InitialiseComponents();
     RefreshComponents();
     if (_dontDestroyOnLoad)
     {
         if (Application.isPlaying)
         {
             UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
         }
         DebugLog.Print("FabricManager initialised (DontDestroyOnLoad flag enabled)");
     }
     else
     {
         DebugLog.Print("FabricManager initialised (DontDestroyOnLoad flag disabled)");
     }
     if (Application.isEditor)
     {
         CodeProfiler.enabled = true;
         FabricManager[] array = UnityEngine.Object.FindObjectsOfType(typeof(FabricManager)) as FabricManager[];
         if (array.Length > 1)
         {
             DebugLog.Print("More than two FabricManager instances available!!!", DebugLevel.Error);
         }
     }
     for (int i = 0; i < _musicTimeSignatures.Count; i++)
     {
         _musicTimeSignatures[i].Init();
     }
     _isInitialised = true;
 }
Example #7
0
 public void OnDestroy()
 {
     _instance = null;
 }
Example #8
0
 private void OnEnable()
 {
     this.fabricManager = (base.target as FabricManager);
     this.undoManager   = new EditorUndoManager(this.fabricManager, this.fabricManager.name);
 }