internal void RaiseToggleStatePropertyChangedEvent(DrawerState oldState, DrawerState newState) { this.RaisePropertyChangedEvent( TogglePatternIdentifiers.ToggleStateProperty, this.ConvertDrawerToToggleState(oldState), this.ConvertDrawerToToggleState(newState)); }
/// <summary> /// Present the property on the Editor GUI /// </summary> public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { PopulateRenderers(); EditorGUI.BeginProperty(position, label, property); Init(property); DrawerState state = _propertyStates[property.propertyPath]; EditorGUI.BeginChangeCheck(); #if Q_AFTER_OPAQUE_AND_SKY state.listAfterOpaqueAndSky.DoLayoutList(); #endif // #if Q_BEFORE_POST_PROCESS EditorGUILayout.Space(); state.listBeforePostProcess.DoLayoutList(); // #endif // #if Q_AFTER_POST_PROCESS EditorGUILayout.Space(); state.listAfterPostProcess.DoLayoutList(); // #endif if (EditorGUI.EndChangeCheck()) { property.serializedObject.ApplyModifiedProperties(); } EditorGUI.EndProperty(); EditorUtility.SetDirty(property.serializedObject.targetObject); }
internal void RaiseExpandCollapseAutomationEvent(DrawerState oldValue, DrawerState newValue) { var oldConvertedValue = this.ConvertDrawerToExpandCollapseState(oldValue); var newConvertedValue = this.ConvertDrawerToExpandCollapseState(newValue); this.RaisePropertyChangedEvent(ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty, oldConvertedValue.ToString(), newConvertedValue.ToString()); this.RaisePropertyChangedEvent(AutomationElementIdentifiers.ItemStatusProperty, oldConvertedValue.ToString(), newConvertedValue.ToString()); }
protected virtual void OpenDrawer() { trayBehaviour.parentContainer = null; trayTransform.SetPosition(TrayWorldPosition); EjectItems(); EjectPlayers(); SoundManager.PlayNetworkedAtPos("BinOpen", DrawerWorldPosition, Random.Range(0.8f, 1.2f), sourceObj: gameObject); drawerState = DrawerState.Open; // [SyncVar] will update sprites }
protected virtual void CloseDrawer() { trayBehaviour.parentContainer = drawerPushPull; trayBehaviour.VisibleState = false; GatherItems(); if (storePlayers) GatherPlayers(); SoundManager.PlayNetworkedAtPos("BinClose", DrawerWorldPosition, Random.Range(0.8f, 1.2f), sourceObj: gameObject); drawerState = DrawerState.Shut; // [SyncVar] will update sprites }
private ExpandCollapseState ConvertDrawerToExpandCollapseState(DrawerState drawerState) { if (drawerState == DrawerState.Opened) { return(ExpandCollapseState.Expanded); } else if (drawerState == DrawerState.Closed) { return(ExpandCollapseState.Collapsed); } return(ExpandCollapseState.PartiallyExpanded); }
/// <summary> /// Initialize a drawer state for the giver property if none already exists. /// </summary> /// <param name="property">The property that will be edited/displayed</param> private void Init(SerializedProperty property) { var path = property.propertyPath; if (!propertyStates.ContainsKey(path)) { var state = new DrawerState(); var feature = property.serializedObject.targetObject as CustomPostProcess; InitList(ref state.listAfterOpaqueAndSky, feature.settings.renderersAfterOpaqueAndSky, "After Opaque and Sky", CustomPostProcessInjectionPoint.AfterOpaqueAndSky, feature); InitList(ref state.listBeforePostProcess, feature.settings.renderersBeforePostProcess, "Before Post Process", CustomPostProcessInjectionPoint.BeforePostProcess, feature); InitList(ref state.listAfterPostProcess, feature.settings.renderersAfterPostProcess, "After Post Process", CustomPostProcessInjectionPoint.AfterPostProcess, feature); propertyStates.Add(path, state); } }
private ToggleState ConvertDrawerToToggleState(DrawerState drawerState) { if (drawerState == DrawerState.Opened) { return(ToggleState.On); } else if (drawerState == DrawerState.Closed) { return(ToggleState.Off); } else { return(ToggleState.Indeterminate); } }
public void CloseDrawers(bool animate = true) { if (animate) { SetAnimationTarget(0, outCurve, outTime); } else { swipeTransform.SetAnchoredHorizontalPosition(0); leftDrawer.gameObject.SetActive(false); rightDrawer.gameObject.SetActive(false); } DrawerState = DrawerState.None; }
/// <summary> /// Initialize a drawer state for the giver property if none already exists. /// </summary> /// <param name="property">The property that will be edited/displayed</param> private void Init(SerializedProperty property) { var path = property.propertyPath; if (!_propertyStates.ContainsKey(path)) { var state = new DrawerState(); var feature = property.serializedObject.targetObject as QuibliPostProcess; Debug.Assert(feature != null, nameof(feature) + " != null"); InitList(ref state.listAfterOpaqueAndSky, feature.settings.renderersAfterOpaqueAndSky, "After Opaque and Sky", InjectionPoint.AfterOpaqueAndSky, feature); InitList(ref state.listBeforePostProcess, feature.settings.renderersBeforePostProcess, "Before Post Process", InjectionPoint.BeforePostProcess, feature); // "Before Post Process" InitList(ref state.listAfterPostProcess, feature.settings.renderersAfterPostProcess, "Effects", InjectionPoint.AfterPostProcess, feature); // "After Post Process" _propertyStates.Add(path, state); } }
void ServerInit(MatrixInfo matrixInfo) { SpawnResult traySpawn = Spawn.ServerPrefab(trayPrefab, DrawerWorldPosition); if (!traySpawn.Successful) { throw new MissingReferenceException($"Failed to spawn tray! Is {name} prefab missing reference to tray prefab?"); } tray = traySpawn.GameObject; traySpriteHandler = tray.GetComponentInChildren<SpriteHandler>(); trayTransform = tray.GetComponent<CustomNetTransform>(); trayBehaviour = tray.GetComponent<ObjectBehaviour>(); trayBehaviour.parentContainer = drawerPushPull; trayBehaviour.VisibleState = false; // These two will sync drawer state/orientation and render appropriate sprite drawerState = DrawerState.Shut; drawerOrientation = directional.CurrentDirection; }
public void OpenRightDrawer(bool animate = true) { if (animate) { SetAnimationTarget(-maxSwipe, inCurve, inTime); } else { swipeTransform.SetAnchoredHorizontalPosition(-maxSwipe); leftDrawer.gameObject.SetActive(false); rightDrawer.gameObject.SetActive(true); } DrawerState = DrawerState.RightDrawerOut; if (DrawerOpened != null) { DrawerOpened(this); } }
public void OnBeginDrag(PointerEventData eventData) { dragStart = eventData.position; // prevent a single draw from jumping more than 1 state switch (DrawerState) { case DrawerState.RightDrawerOut: dragOffset = -maxSwipe; dragMin = -maxSwipe; dragMax = 0; break; case DrawerState.LeftDrawerOut: dragOffset = maxSwipe; dragMin = 0; dragMax = maxSwipe; break; default: dragOffset = 0; dragMin = -maxSwipe; dragMax = maxSwipe; break; } dragStartState = DrawerState; // activate both drawers for peeking leftDrawer.gameObject.SetActive(true); rightDrawer.gameObject.SetActive(true); if (DrawerPeeked != null) { DrawerPeeked(this); } }
private DrawerState InitializeStateFor(SerializedProperty property) { var key = property.propertyPath; stateMap.TryGetValue(key, out var state); // Ensure the cached SerializedProperty is synchronized. if (state is null || state.ReorderableList.serializedProperty.serializedObject != property.serializedObject) { if (state is null) { state = new DrawerState(); } state.PathProperty = property.FindPropertyRelative(nameof(ResourceLoaderConfiguration.PathPrefix)); var providerListProperty = property.FindPropertyRelative(nameof(ResourceLoaderConfiguration.ProviderTypes)); state.ReorderableList = new ReorderableList(property.serializedObject, providerListProperty, true, false, true, true); state.ReorderableList.headerHeight = 4; state.ReorderableList.drawElementCallback = DrawListElement; state.ReorderableList.onAddCallback = HandleListElementAdded; state.ReorderableList.onRemoveCallback = HandleListElementRemoved; state.ReorderableList.onSelectCallback = HandleListElementSelected; state.ReorderableList.onReorderCallback = HandleListElementReordered; stateMap[key] = state; } loaderProperty = property; reorderableList = state.ReorderableList; providerListProperty = state.ReorderableList.serializedProperty; pathProperty = state.PathProperty; lastSelectedIndex = state.LastSelectedIndex; reorderableList.index = lastSelectedIndex; return(state); }
/// <summary> /// Cycles through the toggle states of a control. /// </summary> public void Toggle() { DrawerState state = this.SideDrawerOwner.DrawerState; if (state == DrawerState.Opened) { this.SideDrawerOwner.HideDrawer(); } else if (state == DrawerState.Closed) { this.SideDrawerOwner.ShowDrawer(); } else { if (this.SideDrawerOwner.IsOpen) { this.SideDrawerOwner.HideDrawer(); } else { this.SideDrawerOwner.ShowDrawer(); } } }
/// <summary> /// Updates the drawer to the given state and sets the sprites accordingly. /// </summary> /// <param name="newState">The new state the drawer should be set to</param> protected void SetDrawerState(DrawerState newState) { drawerState = newState; UpdateSpriteState(); }
/// <summary> /// Called when drawerState [SyncVar] variable is altered or the client has just joined. /// </summary> /// <param name="oldState"></param> /// <param name="newState"></param> protected virtual void OnSyncDrawerState(DrawerState oldState, DrawerState newState) { drawerState = newState; drawerSpriteHandler.ChangeSprite((int)drawerState); }
public Form1() { InitializeComponent(); drawer = new DrawerState(pictureBox1); }
public void Handle(DrawerState message) { this.IsDrawerOpened = message == DrawerState.Opened; }
private void StartOpen() { StartCoroutine(AnimateDrawer(closePosition, openPosition)); state = DrawerState.Open; icon.SetTrigger("IsOpen"); }
private void StartClose() { StartCoroutine(AnimateDrawer(openPosition, closePosition)); state = DrawerState.Close; icon.SetTrigger("IsClose"); }