void OnEnable() { var root = rootVisualElement; root.styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>(MainStylePath)); root.AddToClassList(EditorGUIUtility.isProSkin ? UiConstants.ussDark : UiConstants.ussLight); AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(k_LayoutPath).CloneTree(root); m_Provider = new Collab(); m_Provider.UpdatedProjectStatus += OnUpdatedProjectStatus; m_ViewContainer = root.Q <VisualElement>(className: ContainerUssClassName); // Get the views and configure them. m_MainView = new MainPageView(); m_MainView.Presenter = new MainPresenter(m_MainView, new MainModel(m_Provider)); m_StartView = new StartPageView(); m_StartView.Presenter = new StartPresenter(m_StartView, new StartModel(m_Provider)); m_ErrorPageView = new ErrorPageView(); // Add floating dialogue so it can be displayed anywhere in the window. root.Add(FloatingDialogue.Instance); OnUpdatedProjectStatus(m_Provider.GetProjectStatus()); }
void CreateGUI() { EditorApplication.playModeStateChanged += OnPlayModeStateChanged; AssemblyReloadEvents.beforeAssemblyReload += OnBeforeAssemblyReload; AssemblyReloadEvents.afterAssemblyReload += OnAfterAssemblyReload; var root = rootVisualElement; root.styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>(MainStylePath)); root.AddToClassList(EditorGUIUtility.isProSkin ? UiConstants.ussDark : UiConstants.ussLight); AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(k_LayoutPath).CloneTree(root); m_Provider = new Collab(); m_Provider.UpdatedProjectStatus += OnUpdatedProjectStatus; m_ViewContainer = root.Q <VisualElement>(className: ContainerUssClassName); // Create models and configure them. var mainModel = new MainModel(m_Provider); var startModel = new StartModel(m_Provider); m_Models = new List <IModel> { mainModel, startModel }; m_Models.ForEach(m => m.OnStart()); // Get the views and configure them. m_MainView = new MainPageView(); m_MainView.Presenter = new MainPresenter(m_MainView, mainModel); m_StartView = new StartPageView(); m_StartView.Presenter = new StartPresenter(m_StartView, startModel); m_ErrorPageView = new ErrorPageView(); // Add floating dialogue so it can be displayed anywhere in the window. root.Add(FloatingDialogue.Instance); OnUpdatedProjectStatus(m_Provider.GetProjectStatus()); }