/// <summary> /// Sets whether dragger is holding. /// </summary> public void SetHold(bool holding, float curTime) { if (this.isHolding == holding) { return; } // Show visual change only if there is currently a valid result for this hit object. if (!IsJudged) { return; } // Held down if (holding && !wasHolding) { isHolding = true; releaseAni.Stop(); holdAni.PlayFromStart(); } // Released else if (!holding && wasHolding) { isHolding = false; releaseTime = curTime; if (!draggerView.IsFullyJudged) { holdAni.Stop(); releaseAni.PlayFromStart(); } } wasHolding = isHolding; }
protected override void OnDisable() { base.OnDisable(); if (hitAni != null) { hitAni.Stop(); } }
protected override void OnDisable() { base.OnDisable(); Model.PreferUnicode.OnNewValue -= OnPreferUnicodeChange; Model.SelectedMap.OnNewValue -= OnMapChange; showAni.Stop(); hideAni.Stop(); }
/// <summary> /// Sets hit bar sprite's visual state for specified flag. /// </summary> public void SetHold(bool isHolding) { if (isHolding) { releaseAni.Stop(); holdAni.PlayFromStart(); } else { holdAni.Stop(); releaseAni.PlayFromStart(); } }
/// <summary> /// Event called when the triggered state is changed. /// </summary> private void OnTriggeredChange(bool isTriggered) { if (isTriggered) { hideAni.Stop(); showAni.PlayFromStart(); } else { showAni.Stop(); hideAni.PlayFromStart(); } }
/// <summary> /// Event called when the detailed information display mode is changed. /// </summary> private void OnDetailedModeChange(bool isDetailed) { if (isDetailed) { infoBriefAni.Stop(); infoDetailAni.PlayFromStart(); } else { infoDetailAni.Stop(); infoBriefAni.PlayFromStart(); } }
/// <summary> /// Adjusts display component positions based on menubar existence. /// </summary> private void AdjustForMenubar(bool hasMenubar) { menubarShowAni.Stop(); menubarHideAni.Stop(); if (hasMenubar) { menubarShowAni.PlayFromStart(); } else { menubarHideAni.PlayFromStart(); } }
/// <summary> /// Event called on songs list scrolled down. /// </summary> private void OnScrolledDown(bool isScrolledDown) { scrollButtonShowAni.Stop(); scrollButtonHideAni.Stop(); if (isScrolledDown) { scrollButtonShowAni.PlayFromStart(); } else { scrollButtonHideAni.PlayFromStart(); } }
private void Init() { titleLabel = CreateChild <Label>("title", 0); { titleLabel.FontSize = 22; titleLabel.IsBold = true; titleLabel.Alpha = 0; } artistLabel = CreateChild <Label>("artist", 1); { artistLabel.FontSize = 16; artistLabel.Alpha = 0; } versionLabel = CreateChild <Label>("version", 2); { versionLabel.FontSize = 20; versionLabel.Alpha = 0; } mapperLabel = CreateChild <Label>("mapper", 3); { mapperLabel.FontSize = 16; mapperLabel.Alpha = 0; } thumbDisplayer = CreateChild <ThumbDisplayer>("thumb", 4); { thumbDisplayer.Size = new Vector2(400f, 72f); thumbDisplayer.Alpha = 0; } showAni = new Anime(); AddShowAniFrame(titleLabel, 0.3f, new Vector2(0f, 112f)); AddShowAniFrame(artistLabel, 0.4f, new Vector2(0f, 88f)); AddShowAniFrame(thumbDisplayer, 0.5f, new Vector2(0f, 16f)); AddShowAniFrame(versionLabel, 0.6f, new Vector2(0f, -60f)); AddShowAniFrame(mapperLabel, 0.7f, new Vector2(0f, -86f)); hideAni = new Anime(); hideAni.AddEvent(0f, () => showAni.Stop()); AddHideAniFrame(titleLabel, 0f); AddHideAniFrame(artistLabel, 0.1f); AddHideAniFrame(thumbDisplayer, 0.2f); AddHideAniFrame(versionLabel, 0.3f); AddHideAniFrame(mapperLabel, 0.4f); OnEnableInited(); }
private void SwitchView(bool isLoggedIn, bool animate = true) { // No animation if (!animate) { if (isLoggedIn) { Height = LoggedInHeight; loggedInView.Alpha = 1f; loggedInView.Active = true; loggedOutView.Alpha = 0f; loggedOutView.Active = false; } else { Height = loggedOutView.DesiredHeight; loggedInView.Alpha = 0f; loggedInView.Active = false; loggedOutView.Alpha = 1f; loggedOutView.Active = true; } blocker.Active = false; } // Animate else { if (isLoggedIn) { if (!loggedInView.Active) { loggedOutAni.Stop(); loggedInAni.PlayFromStart(); } } else { if (!loggedOutView.Active) { loggedInAni.Stop(); loggedOutAni.PlayFromStart(); } } } }
public void ToggleDisplay(bool enable) { if ((enable && showAni.IsPlaying) || (!enable && hideAni.IsPlaying)) { return; } showAni.Stop(); hideAni.Stop(); if (enable) { showAni.PlayFromStart(); } else { hideAni.PlayFromStart(); } }
private void Init(IColorPreset colorPreset) { OnPointerDown += () => { isControlling = true; upAni.Stop(); downAni.PlayFromStart(); }; OnPointerUp += () => { isControlling = false; downAni.Stop(); upAni.PlayFromStart(); }; OnChange += (value) => { var audio = MusicController.Audio; if (isControlling && audio != null) { MusicController.Seek(value * audio.Duration); } }; background.Color = Color.black; foreground.Color = colorPreset.SecondaryFocus; thumb.Active = false; downAni = new Anime(); downAni.AnimateFloat(y => ScaleY = y) .AddTime(0f, () => ScaleY) .AddTime(0.25f, 2f) .Build(); upAni = new Anime(); upAni.AnimateFloat(y => ScaleY = y) .AddTime(0f, () => ScaleY) .AddTime(0.25f, 1f) .Build(); }
/// <summary> /// Sets folded state on the menu. /// </summary> public void SetFold(bool isFolded) { if (this.isFolded == isFolded) { return; } this.isFolded = isFolded; foldAni.Stop(); unfoldAni.Stop(); if (isFolded) { foldAni.PlayFromStart(); } else { unfoldAni.PlayFromStart(); } }
private void Init(IColorPreset colorPreset) { showAni = new Anime(); showAni.AnimateFloat(a => this.Alpha = a) .AddTime(1.5f, 0f, EaseType.QuadEaseOut) .AddTime(1.75f, 1f) .Build(); showAni.AnimateFloat(scale => Scale = new Vector3(scale, scale, 1f)) .AddTime(0f, 1f) .AddTime(1.5f, 2f, EaseType.QuadEaseOut) .AddTime(1.75f, 1f) .Build(); hideAni = new Anime(); hideAni.AddEvent(0f, () => showAni.Stop()); hideAni.AnimateFloat(a => this.Alpha = a) .AddTime(0f, 1f, EaseType.QuadEaseOut) .AddTime(0.5f, 0f) .Build(); Rotate = true; }
void IRecyclable.OnRecycleDestroy() { Active = false; anime.Stop(); }
private void Init() { darkSprite = CreateChild <UguiSprite>("dark", 0); { darkSprite.Anchor = AnchorType.Fill; darkSprite.Offset = new Offset(0f, MenuBarHeight, 0f, 0f); darkSprite.Color = new Color(0f, 0f, 0f, 0.5f); closeTrigger = darkSprite.CreateChild <UguiTrigger>("close", 0); { closeTrigger.Anchor = AnchorType.Fill; closeTrigger.RawSize = Vector2.zero; closeTrigger.OnPointerDown += () => { OverlayNavigator.Hide(this); }; } container = darkSprite.CreateChild <UguiTrigger>("container", 1); { container.OnPointerEnter += () => { outAni?.Stop(); hoverAni?.PlayFromStart(); }; container.OnPointerExit += () => { hoverAni?.Stop(); outAni?.PlayFromStart(); }; if (UseGlow) { glowSprite = container.CreateChild <UguiSprite>("glow", -1); { glowSprite.Anchor = AnchorType.Fill; glowSprite.Offset = new Offset(-15f); glowSprite.SpriteName = "glow-square-32"; glowSprite.ImageType = Image.Type.Sliced; glowSprite.Color = Color.black; } } } } if (UseGlow) { hoverAni = new Anime(); hoverAni.AnimateColor(color => glowSprite.Color = color) .AddTime(0f, () => glowSprite.Color) .AddTime(0.25f, Color.gray) .Build(); outAni = new Anime(); outAni.AnimateColor(color => glowSprite.Color = color) .AddTime(0f, () => glowSprite.Color) .AddTime(0.25f, Color.black) .Build(); } }
private void Init(IGameSession gameSession) { gameSession.OnSoftInit += () => { gameSession.ScoreProcessor.Combo.Bind(OnComboChanged); }; gameSession.OnSoftDispose += () => { comboAni.Stop(); hideAni.Stop(); effectComboLabel.Alpha = 0f; persistComboLabel.Alpha = 0f; }; effectComboLabel = CreateChild <Label>("effect"); { effectComboLabel.IsBold = true; effectComboLabel.FontSize = 48; effectComboLabel.Color = Color.black; effectComboLabel.AddEffect(new AdditiveShaderEffect()); } persistComboLabel = CreateChild <Label>("persisting"); { persistComboLabel.IsBold = true; persistComboLabel.FontSize = 48; persistComboLabel.Color = new Color(0.3f, 0.3f, 0.3f, 1f); persistComboLabel.AddEffect(new AdditiveShaderEffect()); } comboAni = new Anime(); comboAni.AnimateColor((color) => effectComboLabel.Color = color) .AddTime(0f, Color.black) .AddTime(0.05f, MaxEffectColor, EaseType.QuadEaseOut) .AddTime(0.25f, Color.black) .Build(); comboAni.AnimateVector3((scale) => effectComboLabel.Scale = scale) .AddTime(0f, MinEffectScale, EaseType.CubicEaseOut) .AddTime(0.25f, MaxEffectScale) .Build(); comboAni.AnimateColor((color) => persistComboLabel.Color = color) .AddTime(0f, () => persistComboLabel.Color) .AddTime(0.04f, MaxPersistColor, EaseType.QuadEaseIn) .AddTime(0.2f, MinPersistColor) .Build(); comboAni.AnimateVector3((scale) => persistComboLabel.Scale = scale) .AddTime(0f, Vector3.one, EaseType.QuadEaseOut) .AddTime(0.1f, MaxPersistScale, EaseType.QuadEaseIn) .AddTime(0.2f, Vector3.one) .Build(); hideAni = new Anime(); hideAni.AnimateColor((color) => effectComboLabel.Color = color) .AddTime(0f, () => effectComboLabel.Color) .AddTime(0.25f, Color.black) .Build(); hideAni.AnimateColor((color) => persistComboLabel.Color = color) .AddTime(0f, () => persistComboLabel.Color) .AddTime(0.25f, Color.black) .Build(); }
protected override void OnDisable() { base.OnDisable(); highlightAni?.Stop(); unhighlightAni?.Stop(); }
/// <summary> /// Event called when the game loading has failed. /// </summary> private void OnLoadFail() { componentShowAni.Stop(); componentHideAni.Stop(); }
/// <summary> /// Plays the initial logo animation. /// </summary> public void PlayStartup() { breatheAnime.Stop(); endAnime.Stop(); startupAnime.PlayFromStart(); }
/// <summary> /// Plays the looping animation on the logo. /// </summary> public void PlayBreathe() { startupAnime.Stop(); endAnime.Stop(); breatheAnime.PlayFromStart(); }
protected override void OnDisable() { base.OnDisable(); hoverInAni?.Stop(); hoverOutAni?.Stop(); }
protected override void OnDisable() { base.OnDisable(); showAni.Stop(); hideAni.Stop(); }