public void AnimateRemoveUnit(UnitWindow removeUnit, System.Action endAnimEvent) { animDelete = new AnimFloat(0f); animDelete.target = 1f; animDelete.speed = 1.5f; animDelete.valueChanged.AddListener(Repaint); animDelete.valueChanged.AddListener( () => { removeUnit.visibleScale = animDelete.value; } ); someEvent.AddEvent( () => { return(animDelete.value > 0.95f); }, () => { if (endAnimEvent != null) { endAnimEvent(); } } ); }
internal static void BeginAdditionalPropertiesHighlight(AnimFloat animation) { var oldColor = GUI.color; GUI.color = Color.Lerp(CoreEditorStyles.backgroundColor, CoreEditorStyles.backgroundHighlightColor, animation.value); EditorGUILayout.BeginVertical(CoreEditorStyles.additionalPropertiesHighlightStyle); GUI.color = oldColor; }
public GUITimer(UnityAction update, float value, float target) { this.af = new AnimFloat(0F, update); this.af.speed = 1F; this.af.target = target; this.value = value; this.target = target; }
// ---------------------------------------------------------------------------------------------------------------- #region system private void Awake() { tr = GetComponent <Transform>(); camPivot = new AnimVector3(Vector3.zero, focusSmoothing); camDistance = new AnimFloat(defaultZoom, zoomSmoothing); camRotator = new AnimQuaternion(Quaternion.Euler(defaultRotation), focusSmoothing, UpdateCameraRotation); Focus(null, true, true); }
protected void DrawClipboardBox() { if (currentBehaviour != null && currentBehaviour.behaviour != null && currentBehaviour.behaviour.clipboard != null) { if (!animClipboard.isAnimating && animClipboard.value <= -40f) { animClipboard = new AnimFloat(-40f, Repaint); animClipboard.target = 15f; animClipboard.speed = 2.5f; } } UnityEngine.GUI.Box(new Rect(new Vector2(10f, animClipboard.value), Vector2.one * 20f), imgClipboard); }
private static void OnGUIInputs() { ConsoleSettings settings = HQ.Settings.Get <ConsoleSettings>(); for (int n = 0, i = 0; i < settings.inputsManager.groups.Count; ++i, ++n) { if (GUILayout.Toggle(i == ConsoleSettingsEditor.selectedInputsGroup, LC.G("InputGroup_" + settings.inputsManager.groups[i].name), ConsoleSettingsEditor.menuButtonStyle) == true) { ConsoleSettingsEditor.selectedInputsGroup = i; } } if (ConsoleSettingsEditor.selectedInputsGroup < settings.inputsManager.groups.Count) { ConsoleSettingsEditor.inputScrollPosition = EditorGUILayout.BeginScrollView(ConsoleSettingsEditor.inputScrollPosition); { for (int n = 0, j = 0; j < settings.inputsManager.groups[ConsoleSettingsEditor.selectedInputsGroup].commands.Count; ++j, ++n) { while (n >= ConsoleSettingsEditor.testInputAnimationFeedback.Count) { var af = new AnimFloat(0F, EditorWindow.focusedWindow.Repaint); af.speed = 1F; af.target = 0F; ConsoleSettingsEditor.testInputAnimationFeedback.Add(new GUITimer(EditorWindow.focusedWindow.Repaint, Constants.CheckFadeoutCooldown, 0F)); } if (settings.inputsManager.groups[ConsoleSettingsEditor.selectedInputsGroup].commands[j].Check() == true) { ConsoleSettingsEditor.testInputAnimationFeedback[n].Start(); ConsoleSettingsEditor.testInputAnimationFeedback[n].af.valueChanged.RemoveAllListeners(); ConsoleSettingsEditor.testInputAnimationFeedback[n].af.valueChanged.AddListener(EditorWindow.focusedWindow.Repaint); } if (ConsoleSettingsEditor.testInputAnimationFeedback[n].Value > 0F) { using (ColorContentRestorer.Get(Color.Lerp(GUI.contentColor, ConsoleSettingsEditor.HighlightInput, ConsoleSettingsEditor.testInputAnimationFeedback[n].Value))) ConsoleSettingsEditor.DrawInputCommand(settings.inputsManager.groups[ConsoleSettingsEditor.selectedInputsGroup].commands[j]); } else { ConsoleSettingsEditor.DrawInputCommand(settings.inputsManager.groups[ConsoleSettingsEditor.selectedInputsGroup].commands[j]); } } GUILayout.Space(10F); } EditorGUILayout.EndScrollView(); } }
public void Init(Rect rect, ITreeViewDataSource data, ITreeViewGUI gui, ITreeViewDragging dragging) { this.data = data; this.gui = gui; this.dragging = dragging; this.m_TotalRect = rect; data.OnInitialize(); gui.OnInitialize(); if (dragging != null) { dragging.OnInitialize(); } this.expandedStateChanged = (Action)Delegate.Combine(this.expandedStateChanged, new Action(this.ExpandedStateHasChanged)); this.m_FramingAnimFloat = new AnimFloat(this.state.scrollPos.y, new UnityAction(this.AnimatedScrollChanged)); }
public void Init(Rect rect, ITreeViewDataSource data, ITreeViewGUI gui, ITreeViewDragging dragging) { this.data = data; this.gui = gui; this.dragging = dragging; m_TotalRect = rect; data.OnInitialize(); gui.OnInitialize(); if (dragging != null) { dragging.OnInitialize(); } expandedStateChanged += ExpandedStateHasChanged; m_FramingAnimFloat = new AnimFloat(state.scrollPos.y, AnimatedScrollChanged); }
public void FadeOffUnits(float time = 0f) { fadeOffUnitsWaitTime = Time.realtimeSinceStartup + time; someEvent.AddEvent( () => { return(Time.realtimeSinceStartup > fadeOffUnitsWaitTime); }, () => { animAllHide = new AnimFloat(0.3f, Repaint); animAllHide.target = 2.5f; animAllHide.speed = 0.35f; } ); }
private void HandleCameraScrollWheel(CameraState cameraState) { float y = Event.current.delta.y; float num2 = (Mathf.Abs(cameraState.viewSize.value) * y) * 0.015f; if ((num2 > 0f) && (num2 < 0.3f)) { num2 = 0.3f; } else if ((num2 < 0f) && (num2 > -0.3f)) { num2 = -0.3f; } AnimFloat viewSize = cameraState.viewSize; viewSize.value += num2; Event.current.Use(); }
public void AnimButtonsAdds(float size, System.Action <float> refresh) { animShowAddButtons = new AnimFloat(0f); animShowAddButtons.target = size; animShowAddButtons.speed = 3.5f; animShowAddButtons.valueChanged.AddListener(Repaint); animShowAddButtons.valueChanged.AddListener( () => { if (refresh != null) { refresh(animShowAddButtons.value); } } ); FadeOnUnits(); }
// INITIALIZE: ------------------------------------------------------------------------------------------------- private void OnEnable() { if (target == null || serializedObject == null) { return; } this.animPagesIndex = new AnimFloat(0.0f, () => { this.Repaint(); }); this.pages = new PageData[] { new PageData(this.OnPaintWelcome, "welcome.png"), new PageData(this.OnPaintTutorials, "tutorials.png"), new PageData(this.OnPaintDocumentation, "documentation.png"), new PageData(this.OnPaintExamples, "examples.png"), new PageData(this.OnPaintModules, "modules.png"), new PageData(this.OnPaintStore, "hub.png"), new PageData(this.OnPaintDiscord, "discord.png"), }; }
/// <summary> /// Update the height of the editor. /// </summary> /// <param name="height">The new height.</param> /// <param name="allowAnimation">Should animation be allowed? Sometimes animation is not /// desired if a sub-item is animation. If this item animations when a sub-item is /// animating, then there will be visible UX jerk.</param> /// <returns>If true, then a transition is occurring and the animation is rendering.</returns> public bool UpdateHeight(float height) { if (_animator == null) { _animator = new AnimFloat(height); return false; } if (_animator.target != height) { if (fiSettings.EnableAnimation) { _animator.target = height; } else { _animator = new AnimFloat(height); } return true; } return false; }
private void OnEnable() { onNamespaceNameChanged += OnNamespaceNameChanged; onClassNameChanged += OnClassNameChanged; onBaseClassNameChanged += OnBaseClassNameChanged; onInterfaceListChanged += OnInterfaceListChanged; showClassNameError = new AnimFloat(0); showClassNameError.valueChanged.AddListener(Repaint); showBaseClassError = new AnimFloat(0); showBaseClassError.valueChanged.AddListener(Repaint); showBaseClass = new AnimFloat(1); showBaseClass.valueChanged.AddListener(Repaint); showBaseClassSuggestion = new AnimFloat(0); showBaseClassSuggestion.valueChanged.AddListener(Repaint); showNamespaceSuggestion = new AnimFloat(0); showNamespaceSuggestion.valueChanged.AddListener(Repaint); baseClassSuggestion = new List <Type>(); showInterfaceSuggestion = new AnimFloat(0); showInterfaceSuggestion.valueChanged.AddListener(Repaint); showInterfaceError = new AnimFloat(0); showInterfaceError.valueChanged.AddListener(Repaint); showInterfaces = new AnimFloat(0); showInterfaces.valueChanged.AddListener(Repaint); implementedInterfaces = new List <Type>(); interfaceSuggesstion = new List <Type>(); showStaticAbstractSealed = new AnimFloat(0); showStaticAbstractSealed.valueChanged.AddListener(Repaint); showMenuPath = new AnimFloat(0); showMenuPath.valueChanged.AddListener(Repaint); GetCurrentlySelectedFolder(); InitTypes(); LoadSettings(); ClassName = string.Empty; wantsMouseMove = true; //give it a nicer look when hovering over suggestion entries }
/// <summary> /// Update the height of the editor. /// </summary> /// <param name="height">The new height.</param> /// <param name="allowAnimation"> /// Should animation be allowed? Sometimes animation is not desired if a /// sub-item is animation. If this item animations when a sub-item is /// animating, then there will be visible UX jerk. /// </param> /// <returns> /// If true, then a transition is occurring and the animation is /// rendering. /// </returns> public bool UpdateHeight(float height) { if (_animator == null) { _animator = new AnimFloat(height); return(false); } if (_animator.target != height) { if (fiSettings.EnableAnimation) { _animator.target = height; } else { _animator = new AnimFloat(height); } return(true); } return(false); }
protected void SetAnimFloat(AnimFloat param, float value) { Animator.SetFloat(param.ToString(), value); }
void OnEnable() { m_ShowInfo = new AnimFloat(0); m_ShowInfo.valueChanged.AddListener(Repaint); m_ShowInfo.speed = 0.5f; }
public void FadeOnUnits() { animAllHide = new AnimFloat(1f, Repaint); animAllHide.target = 0.3f; animAllHide.speed = 1f; }
public ConditionalDrawerWithAdditionalPropertiesInternal(Enabler enabler = null, AnimFloat anim = null, params ActionDrawer[] actionDrawers) { m_ActionDrawers = actionDrawers; m_Enabler = enabler; m_Anim = anim; }
internal static IDrawer ConditionalWithAdditionalProperties(Enabler enabler, AnimFloat animation, params ActionDrawer[] contentDrawers) { return(new ConditionalDrawerWithAdditionalPropertiesInternal(enabler, animation, contentDrawers)); }
public void OnEnable() { progressBar = new AnimFloat(0, Repaint); progressBar.speed = 2; white = (Texture2D)EditorGUIUtility.Load("Rogo Digital/Shared/white.png"); }
public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) { instance = new AnimFloat((float)data.AsDouble); return(fsResult.Success); }
public void Init(Rect rect, ITreeViewDataSource data, ITreeViewGUI gui, ITreeViewDragging dragging) { this.data = data; this.gui = gui; this.dragging = dragging; this.m_TotalRect = rect; data.OnInitialize(); gui.OnInitialize(); if (dragging != null) dragging.OnInitialize(); this.expandedStateChanged += new System.Action(this.ExpandedStateHasChanged); this.m_FramingAnimFloat = new AnimFloat(this.state.scrollPos.y, new UnityAction(this.AnimatedScrollChanged)); }
public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) { instance = new AnimFloat((float)data.AsDouble); return fsResult.Success; }
public static bool Switch(Rect position, string label, bool value) { AnimFloat af = null; int id = EditorGUIUtility.GetControlID("NGEditorGUILayout.Switch".GetHashCode(), FocusType.Keyboard, position); bool mouseIn = position.Contains(Event.current.mousePosition); float switchWidth = position.height * 2F; if (switchWidth < position.width) { Rect r2 = position; r2.xMin += switchWidth; Utility.content.text = label; EditorGUI.PrefixLabel(r2, id, Utility.content); position.width = switchWidth; } if (mouseIn == true) { EditorGUIUtility.AddCursorRect(position, MouseCursor.Link); } if (Event.current.type == EventType.MouseMove) { // Need to check, in rare case, a MouseMove can be triggered without any mouseOverWindow. if (EditorWindow.mouseOverWindow != null) { EditorWindow.mouseOverWindow.Repaint(); } } else if (Event.current.type == EventType.MouseDown) { if (mouseIn == true) { value = !value; GUI.changed = true; if (switchAnimations.TryGetValue(id, out af) == true) { if (value == true) { af.target = 1F; } else { af.target = 0F; } } else { af = new AnimFloat(0F, EditorWindow.mouseOverWindow.Repaint); af.speed = NGEditorGUILayout.SwitchAnimationSpeed; switchAnimations.Add(id, af); if (value == true) { af.value = 0F; af.target = 1F; } else { af.value = 1F; af.target = 0F; } } Event.current.Use(); } } float radius = position.height * .5F - 1F; if (radius < 3F) { radius = 3F; } position.xMin += radius + 1F + 4F; position.xMax -= radius + 1F; position.y += radius + 1F; Color color; float xOffset; if (af == null && switchAnimations.TryGetValue(id, out af) == true) { if (af.isAnimating == false) { if (value == false) { color = NGEditorGUILayout.FalseColor; xOffset = 0F; } else { color = NGEditorGUILayout.TrueColor; xOffset = position.width; } switchAnimations.Remove(id); } else { color = Color.Lerp(NGEditorGUILayout.FalseColor, NGEditorGUILayout.TrueColor, af.value); xOffset = Mathf.Lerp(0F, position.width, af.value); } } else { if (value == false) { color = NGEditorGUILayout.FalseColor; xOffset = 0F; } else { color = NGEditorGUILayout.TrueColor; xOffset = position.width; } } using (HandlesColorRestorer.Get(color)) { Handles.BeginGUI(); Handles.DrawSolidDisc(new Vector3(position.x + xOffset, position.y, 0F), new Vector3(0F, 0F, 1F), radius - 2F); Handles.DrawWireArc(new Vector3(position.x, position.y), Vector3.forward, Vector3.up, 180F, radius); Handles.DrawWireArc(new Vector3(position.x + position.width, position.y), Vector3.forward, Vector3.down, 180F, radius); Handles.DrawLine(new Vector3(position.x, position.y + radius), new Vector3(position.x + position.width, position.y + radius)); Handles.DrawLine(new Vector3(position.x, position.y - radius + 1F), new Vector3(position.x + position.width, position.y - radius + 1F)); Handles.EndGUI(); } return(value); }