public virtual void Setup(WindowComponent component, Layout.Component activatorInstance) { this.activatorInstance = activatorInstance; this.component = component; if (this.component != null) this.component.Setup(this); }
public void Load(WindowComponent component) { this.activatorInstance.component = component; component.SetComponentState(WindowObjectState.NotInitialized); this.activatorInstance.Create(this.GetWindow(), this as WindowLayoutElement); }
public void Load(WindowComponent component) { this.activatorInstance.component = component; var instance = this.activatorInstance.Create(this.GetWindow(), this as WindowLayoutElement); if (instance != null) instance.OnInit(); }
public override void OnInspectorGUI() { var offset = 2f; //this.DrawDefaultInspector(); base.OnInspectorGUI(); var newComponent = this.prefab.objectReferenceValue as WindowComponent; if (this.oldComponent != newComponent) { this.prefabParameters.objectReferenceValue = Layout.AddParametersFor((this.target as Component).gameObject, newComponent); this.prefabParameters.serializedObject.ApplyModifiedPropertiesWithoutUndo(); this.editor = null; } this.serializedObject.Update(); if (this.prefab.objectReferenceValue != null) { if (this.editor == null) { this.editor = Editor.CreateEditor(this.prefabParameters.objectReferenceValue) as IParametersEditor; } if (this.editor != null) { CustomGUI.Splitter(); var title = "Parameters"; ++EditorGUI.indentLevel; this.foldout = EditorGUILayout.Foldout(this.foldout, new GUIContent(title)); var rect = GUILayoutUtility.GetLastRect(); --EditorGUI.indentLevel; if (this.foldout == true) { rect.y += rect.height; rect.height = this.editor.GetHeight(); GUILayout.Space(rect.height); var height = 16f; rect.height = height - offset; ++EditorGUI.indentLevel; this.editor.OnParametersGUI(rect); --EditorGUI.indentLevel; } } } this.serializedObject.ApplyModifiedProperties(); this.oldComponent = newComponent; }
public void OnEnable() { this.prefab = this.serializedObject.FindProperty("prefab"); this.prefabParameters = this.serializedObject.FindProperty("prefabParameters"); this.oldComponent = this.prefab.objectReferenceValue as WindowComponent; }
private void DrawComponent(WindowComponent comp, string name, Rect r, GUIStyle background) { if (comp == null) return; if (Event.current.type != EventType.Layout) { comp.OnPreviewGUI(r, background); } }
public override void OnNewItem(WindowComponent instance) { base.OnNewItem(instance); var carouselItem = (instance as ICarouselItem); if (carouselItem != null) { var index = this.GetIndexOf(instance); carouselItem.OnSelect(index, this.MoveTo); } this.ArrangeItems(); }
/// <summary> /// Registers the sub component. /// If you want to instantiate new component manualy but wants the window events - register this component here. /// </summary> /// <param name="subComponent">Sub component.</param> public void RegisterSubComponent(WindowComponent subComponent) { if (this.GetWindow() != null) { switch (this.GetWindow().GetState()) { case WindowObjectState.Initializing: // after OnInit subComponent.OnInit(); break; case WindowObjectState.Showing: // after OnShowBegin subComponent.OnInit(); subComponent.OnShowBegin(null); break; case WindowObjectState.Shown: // after OnShowEnd subComponent.OnInit(); subComponent.OnShowBegin(() => { subComponent.OnShowEnd(); }); break; } subComponent.Setup(this.GetWindow()); subComponent.Setup(this.GetLayoutRoot()); } if (this.subComponents.Contains(subComponent) == false) this.subComponents.Add(subComponent); }
/// <summary> /// Unregisters the sub component. /// </summary> /// <param name="subComponent">Sub component.</param> public void UnregisterSubComponent(WindowComponent subComponent) { if (this.GetWindow() != null) { switch (this.GetWindow().GetState()) { case WindowObjectState.Shown: // after OnShowEnd subComponent.OnHideBegin(() => { subComponent.OnHideEnd(); subComponent.OnDeinit(); }); break; case WindowObjectState.Hiding: // after OnHideBegin subComponent.OnHideBegin(null); break; case WindowObjectState.Hidden: // after OnHideEnd subComponent.OnHideBegin(() => { subComponent.OnHideEnd(); subComponent.OnDeinit(); }); break; } } this.subComponents.Remove(subComponent); }
public void RegisterOnView(WindowComponent container) { container.RegisterSubComponent(this); }
public WindowComponent Load(WindowComponent component) { this.activatorInstance.SetComponent(component); component.SetComponentState(WindowObjectState.NotInitialized); return(this.activatorInstance.Create(this.GetWindow(), this as WindowLayoutElement) as WindowComponent); }
public void SetLoadedComponent(int tag, WindowComponent instance) { this.loadedComponents.Add(tag, instance); }
public Item(WindowComponent component) { this.mainComponent = component; this.components = new WindowComponent[1] { component }; }