private void Init()
        {
            Alpha = 0.0625f;

            loaderIcon = CreateChild <LoaderIcon>("loader");
            {
                loaderIcon.Position = Vector3.zero;
                loaderIcon.Size     = new Vector2(32f, 32f);
            }
            tabDisplay = CreateChild <RankingTabDisplay>("tab");
            {
                tabDisplay.Anchor   = AnchorType.TopStretch;
                tabDisplay.Pivot    = PivotType.Top;
                tabDisplay.RawWidth = 0f;
                tabDisplay.Height   = 0f;
                tabDisplay.Y        = 0f;
            }
            column = CreateChild <RankingColumn>("column");
            {
                column.Anchor = AnchorType.TopStretch;
                column.Pivot  = PivotType.Top;
                column.Height = 36f;
                column.Y      = -52f;

                column.SetOffsetHorizontal(0f);
            }
            rankingList = CreateChild <RankingList>("list");
            {
                rankingList.Anchor = AnchorType.Fill;
                rankingList.Offset = new Offset(0f, 88f, 0f, 0f);
                rankingList.Column = column;
            }

            loadShowAni = new Anime();
            loadShowAni.AnimateFloat((alpha) => loaderIcon.Alpha = alpha)
            .AddTime(0f, () => loaderIcon.Alpha)
            .AddTime(0.35f, 1f)
            .Build();
            loadShowAni.AnimateFloat((alpha) => rankingList.Alpha = alpha)
            .AddTime(0f, () => rankingList.Alpha)
            .AddTime(0.35f, 0f)
            .Build();

            loadHideAni = new Anime();
            loadHideAni.AnimateFloat((alpha) => loaderIcon.Alpha = alpha)
            .AddTime(0f, () => loaderIcon.Alpha)
            .AddTime(0.35f, 0f)
            .Build();
            loadHideAni.AnimateFloat((alpha) => rankingList.Alpha = alpha)
            .AddTime(0f, () => rankingList.Alpha)
            .AddTime(0.35f, 1f)
            .Build();

            OnEnableInited();
        }
        private void Init()
        {
            glowSprite = CreateChild <UguiSprite>("glow");
            {
                glowSprite.Size            = new Vector2(BaseSize + GlowSizeOffset, BaseSize + GlowSizeOffset);
                glowSprite.SpriteName      = "glow-square-32";
                glowSprite.ImageType       = Image.Type.Sliced;
                glowSprite.Color           = ColorPreset.SecondaryFocus;
                glowSprite.RotationZ       = 45f;
                glowSprite.IsRaycastTarget = false;
            }
            fillSprite = CreateChild <UguiSprite>("fill");
            {
                fillSprite.Anchor          = AnchorType.Fill;
                fillSprite.Offset          = Offset.Zero;
                fillSprite.Color           = ColorPreset.SecondaryFocus;
                fillSprite.RotationZ       = 45f;
                fillSprite.IsRaycastTarget = false;

                fillSprite.AddEffect(new AdditiveShaderEffect());
            }

            showAni = new Anime();
            showAni.AnimateFloat((alpha) => glowSprite.Alpha = alpha)
            .AddTime(0f, 0f)
            .AddTime(0.05f, 0f, EaseType.QuadEaseOut)
            .AddTime(0.15f, 1f)
            .Build();
            showAni.AnimateFloat((alpha) => fillSprite.Alpha = alpha)
            .AddTime(0f, 0.85f, EaseType.QuadEaseOut)
            .AddTime(0.15f, 0.25f)
            .Build();
            showAni.AnimateVector2((size) => fillSprite.Size = size)
            .AddTime(0f, new Vector2(BaseSize + ShowShrinkSize, BaseSize + ShowShrinkSize), EaseType.CubicEaseOut)
            .AddTime(0.15f, new Vector2(BaseSize, BaseSize))
            .Build();
            showAni.AddEvent(showAni.Duration, () => repeatAni.PlayFromStart());

            hideAni = new Anime();
            hideAni.AddEvent(0f, () => repeatAni.Pause());
            hideAni.AnimateFloat((alpha) => glowSprite.Alpha = alpha)
            .AddTime(0f, () => glowSprite.Alpha)
            .AddTime(0.25f, 0f)
            .Build();
            hideAni.AnimateFloat((alpha) => fillSprite.Alpha = alpha)
            .AddTime(0f, () => fillSprite.Alpha)
            .AddTime(0.25f, 0f)
            .Build();
            hideAni.AddEvent(hideAni.Duration, () => Recycler.Return(this));

            repeatAni = new Anime()
            {
                WrapMode = WrapModeType.Loop,
            };
            repeatAni.AnimateFloat((alpha) => fillSprite.Alpha = alpha)
            .AddTime(0f, 0.25f, EaseType.QuadEaseOut)
            .AddTime(0.4f, 0.75f, EaseType.QuadEaseIn)
            .AddTime(0.8f, 0.25f)
            .Build();
        }
示例#3
0
        private void Init()
        {
            canvasGroup = RawObject.AddComponent <CanvasGroup>();

            notificationList = CreateChild <NotificationList>("notification-list");
            {
                notificationList.Anchor = AnchorType.Fill;
                notificationList.Offset = Offset.Zero;
                notificationList.Scope  = NotificationScope.Temporary;

                notificationList.OnDismiss += OnDismissed;
            }

            showAni = new Anime();
            showAni.AddEvent(0f, () => Active           = true);
            showAni.AnimateFloat(a => canvasGroup.alpha = a)
            .AddTime(0f, () => canvasGroup.alpha)
            .AddTime(0.25f, 1f)
            .Build();

            hideAni = new Anime();
            hideAni.AnimateFloat(a => canvasGroup.alpha = a)
            .AddTime(0f, () => canvasGroup.alpha)
            .AddTime(0.25f, 1f)
            .Build();
            hideAni.AddEvent(hideAni.Duration, () => Active = false);

            OnEnableInited();
        }
        private void Init()
        {
            this.Alpha = 0f;

            effectRecycler = new ManagedRecycler <JudgementEffect>(CreateEffect);

            effectHolder = CreateChild("effect-holder", 0);
            {
                effectHolder.Size = Vector2.zero;

                effectRecycler.Precook(6);
            }
            hitBarSprite = CreateChild <UguiSprite>("bar", 1);
            {
                hitBarSprite.Anchor = AnchorType.MiddleStretch;
                hitBarSprite.SetOffsetHorizontal(0f);
                hitBarSprite.SpriteName = "glow-bar";
                hitBarSprite.Y          = 0f;
                hitBarSprite.ImageType  = Image.Type.Sliced;
                hitBarSprite.Alpha      = 0.5f;
            }

            holdAni = new Anime();
            holdAni.AnimateFloat(a => hitBarSprite.Alpha = a)
            .AddTime(0f, () => hitBarSprite.Alpha)
            .AddTime(0.1f, 1f)
            .Build();

            releaseAni = new Anime();
            releaseAni.AnimateFloat(a => hitBarSprite.Alpha = a)
            .AddTime(0f, () => hitBarSprite.Alpha)
            .AddTime(0.1f, 0.5f)
            .Build();
        }
示例#5
0
        private void Init()
        {
            fpsDisplayer = CreateChild <FpsDisplayer>("fps-displayer", 100);
            {
                fpsDisplayer.Anchor   = AnchorType.BottomRight;
                fpsDisplayer.Pivot    = PivotType.BottomRight;
                fpsDisplayer.Position = new Vector3(-DisplayerPadding, DisplayerPadding);
                fpsDisplayer.Size     = new Vector2(170f, 30f);
            }
            messageDisplayer = CreateChild <NotificationDisplayer>("message-displayer", 1);
            {
                messageDisplayer.Anchor   = AnchorType.TopRight;
                messageDisplayer.Pivot    = PivotType.Right;
                messageDisplayer.Position = new Vector3(-DisplayerPadding, -DisplayerPadding);
                messageDisplayer.Size     = new Vector2(320f, 0f);
            }

            menubarShowAni = new Anime();
            menubarShowAni.AnimateFloat(y => messageDisplayer.Y = y)
            .AddTime(0f, () => messageDisplayer.Y)
            .AddTime(0.25f, () => - DisplayerPadding - MenuBarHeight)
            .Build();

            menubarHideAni = new Anime();
            menubarHideAni.AnimateFloat(y => messageDisplayer.Y = y)
            .AddTime(0f, () => messageDisplayer.Y)
            .AddTime(0.25f, () => - DisplayerPadding)
            .Build();

            OnEnableInited();
        }
        private void Init(IRootMain rootMain)
        {
            Dependencies.Cache(this);

            infoContainer = CreateChild <InfoContainer>("info", 0);
            {
                infoContainer.Anchor   = AnchorType.BottomStretch;
                infoContainer.Pivot    = PivotType.Top;
                infoContainer.RawWidth = 0f;
                infoContainer.Height   = Mathf.Min(infoContainer.FullDetailHeight, rootMain.Resolution.y - InfoDetailedYDiff);
                infoContainer.Y        = InfoBriefY;
            }
            versionContainer = CreateChild <VersionContainer>("version", 1);
            {
                versionContainer.Anchor   = AnchorType.TopStretch;
                versionContainer.Pivot    = PivotType.Top;
                versionContainer.RawWidth = 0;
                versionContainer.Y        = 0f;
                versionContainer.Height   = 160f;
            }

            infoDetailAni = new Anime();
            infoDetailAni.AnimateFloat(y => infoContainer.Y = y)
            .AddTime(0f, () => infoContainer.Y)
            .AddTime(0.25f, infoContainer.Height)
            .Build();

            infoBriefAni = new Anime();
            infoBriefAni.AnimateFloat(y => infoContainer.Y = y)
            .AddTime(0f, () => infoContainer.Y)
            .AddTime(0.25f, InfoBriefY)
            .Build();

            OnEnableInited();
        }
示例#7
0
        private void Init()
        {
            var blur = CreateChild <BlurDisplay>("blur", 0);

            {
                blur.Anchor = AnchorType.Fill;
                blur.Offset = Offset.Zero;

                var dark = blur.CreateChild <UguiSprite>("dark", 0);
                {
                    dark.Anchor = AnchorType.Fill;
                    dark.Offset = Offset.Zero;
                    dark.Color  = new Color(0f, 0f, 0f, 0.75f);
                }
            }
            infoDisplayer = CreateChild <InfoDisplayer>("info", 1);
            {
            }
            loadIndicator = CreateChild <LoadIndicator>("load", 2);
            {
                loadIndicator.Position = new Vector3(0f, -260f);
                loadIndicator.Size     = new Vector2(88f, 88f);
            }

            float showDur = Mathf.Max(infoDisplayer.ShowAniDuration, loadIndicator.ShowAniDuration);

            componentShowAni = new Anime();
            componentShowAni.AddEvent(0f, () =>
            {
                infoDisplayer.Show();
                loadIndicator.Show();
            });
            componentShowAni.AddEvent(showDur + model.MinimumLoadTime, OnShowAniEnd);

            float hideDur = Mathf.Max(infoDisplayer.HideAniDuration, loadIndicator.HideAniDuration);

            componentHideAni = new Anime();
            componentHideAni.AddEvent(0f, () =>
            {
                infoDisplayer.Hide();
                loadIndicator.Hide();
            });
            componentHideAni.AnimateFloat(v => model.MusicController.SetFade(v))
            .AddTime(0f, 0.5f, EaseType.QuadEaseOut)
            .AddTime(hideDur, 0f)
            .Build();
            componentHideAni.AddEvent(hideDur, () =>
            {
                model.MusicController.SetFade(1f);
                OnHideAniEnd();
            });

            OnEnableInited();
        }
 /// <summary>
 /// Adds common hide animation effect.
 /// </summary>
 private void AddHideAniFrame <T>(T component, float targetTime)
     where T : IHasTransform, IHasAlpha
 {
     hideAni.AnimateFloat(a => component.Alpha = a)
     .AddTime(targetTime, 1f, EaseType.QuadEaseOut)
     .AddTime(targetTime + 0.25f, 0f)
     .Build();
     hideAni.AnimateVector2(scale => component.Scale = scale)
     .AddTime(targetTime, Vector2.one, EaseType.QuadEaseOut)
     .AddTime(targetTime + 0.25f, new Vector2(1.25f, 1.25f))
     .Build();
 }
示例#9
0
        /// <summary>
        /// Creates default highlighting animation.
        /// </summary>
        public void UseDefaultHighlightAni()
        {
            // Create highlight animation
            highlightAni = new Anime();
            highlightAni.AnimateFloat(a => highlightSprite.Alpha = a)
            .AddTime(0f, () => highlightSprite.Alpha)
            .AddTime(0.25f, 1f)
            .Build();
            // Highlight sprite sizing animation.
            ISection <float> highlightSection = null;

            if (IsHighlightSpriteVertical)
            {
                highlightSection = highlightAni.AnimateFloat(size => highlightSprite.Height = size).AddTime(0f, () => highlightSprite.Height);
            }
            else
            {
                highlightSection = highlightAni.AnimateFloat(size => highlightSprite.Width = size).AddTime(0f, () => highlightSprite.Width);
            }
            highlightSection.AddTime(0.25f, () => HighlightedSize).Build();

            // Create unhighlight animation.
            unhighlightAni = new Anime();
            unhighlightAni.AnimateFloat(a => highlightSprite.Alpha = a)
            .AddTime(0f, () => highlightSprite.Alpha)
            .AddTime(0.25f, 0f)
            .Build();
            // Highlight sprite sizing animation.
            ISection <float> unhighlightSection = null;

            if (IsHighlightSpriteVertical)
            {
                unhighlightSection = unhighlightAni.AnimateFloat(size => highlightSprite.Height = size).AddTime(0f, () => highlightSprite.Height);
            }
            else
            {
                unhighlightSection = unhighlightAni.AnimateFloat(size => highlightSprite.Width = size).AddTime(0f, () => highlightSprite.Width);
            }
            unhighlightSection.AddTime(0.25f, 0f).Build();
        }
 /// <summary>
 /// Adds common show animation effect.
 /// </summary>
 private void AddShowAniFrame <T>(T component, float targetTime, Vector2 targetPos)
     where T : IHasTransform, IHasAlpha
 {
     showAni.AnimateFloat(a => component.Alpha = a)
     .AddTime(targetTime, 0f, EaseType.QuadEaseOut)
     .AddTime(targetTime + 0.25f, 1f)
     .Build();
     showAni.AnimateVector2(pos => component.Position = pos)
     .AddTime(0f, targetPos)
     .AddTime(targetTime, targetPos.GetTranslated(0f, -20f), EaseType.QuadEaseOut)
     .AddTime(targetTime + 0.25f, targetPos)
     .Build();
 }
示例#11
0
        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;
        }
        /// <summary>
        /// Creates default hover in/out animations.
        /// </summary>
        public virtual void UseDefaultHoverAni()
        {
            hoverInAni = new Anime();
            hoverInAni.AnimateFloat(a => hoverSprite.Alpha = a)
            .AddTime(0, () => hoverSprite.Alpha)
            .AddTime(0.25f, 0.25f)
            .Build();

            hoverOutAni = new Anime();
            hoverOutAni.AnimateFloat(a => hoverSprite.Alpha = a)
            .AddTime(0, () => hoverSprite.Alpha)
            .AddTime(0.25f, 0f)
            .Build();
        }
示例#13
0
        private void Init()
        {
            gradient = CreateChild <UguiSprite>("gradient", 0);
            {
                gradient.Anchor     = AnchorType.Fill;
                gradient.RawSize    = Vector2.zero;
                gradient.SpriteName = "gradation-bottom";
                gradient.Color      = Color.black;
            }
            title = CreateChild <Label>("title", 1);
            {
                title.Anchor    = AnchorType.BottomStretch;
                title.RawWidth  = -84f;
                title.Y         = 56f;
                title.IsBold    = true;
                title.Alignment = TextAnchor.MiddleLeft;
                title.FontSize  = 26;
            }
            artist = CreateChild <Label>("artist", 2);
            {
                artist.Anchor = AnchorType.BottomStretch;
                artist.Pivot  = PivotType.BottomLeft;
                artist.SetOffsetHorizontal(42f, 402f);
                artist.Y         = 12f;
                artist.Height    = 34f;
                artist.FontSize  = 22;
                artist.Alignment = TextAnchor.MiddleLeft;
            }
            creator = CreateChild <Label>("creator", 3);
            {
                creator.Anchor    = AnchorType.BottomStretch;
                creator.Pivot     = PivotType.BottomRight;
                creator.Alignment = TextAnchor.MiddleRight;
                creator.FontSize  = 22;
                creator.Position  = new Vector2(-42f, 12f);
                creator.Size      = new Vector2(360f, 34f);
            }

            fadeAni = new Anime();
            fadeAni.AnimateFloat(alpha => title.Alpha = artist.Alpha = alpha)
            .AddTime(0f, 0f, EaseType.SineEaseOut)
            .AddTime(0.25f, 1f)
            .Build();

            OnEnableInited();
        }
        private void Init(IGameSession session)
        {
            session.OnSoftInit += () =>
            {
                session.ScoreProcessor.OnNewJudgement += OnNewJudgement;
            };

            SpriteName = "glow-in-square-32";
            Color      = ColorPreset.GetHitResultColor(HitResultType.Miss).Alpha(0f);

            showAni = new Anime();
            showAni.AnimateFloat((alpha) => Alpha = alpha)
            .AddTime(0f, () => Alpha)
            .AddTime(0.05f, 0.125f, EaseType.QuadEaseOut)
            .AddTime(0.35f, 0f)
            .Build();
        }
        private void Init()
        {
            SpriteName = "glow-in-square-32";
            ImageType  = Image.Type.Sliced;
            RotationZ  = 45f;

            AddEffect(new AdditiveShaderEffect());

            anime = new Anime();
            anime.AnimateFloat((alpha) => this.Alpha = alpha)
            .AddTime(0f, 0f, EaseType.QuadEaseOut)
            .AddTime(0.1f, 1f, EaseType.QuadEaseIn)
            .AddTime(0.25f, 0f)
            .Build();
            anime.AnimateVector2((size) => this.Size = size)
            .AddTime(0f, new Vector2(PulseStartSize, PulseStartSize), EaseType.CubicEaseOut)
            .AddTime(0.25f, new Vector2(PulseFullSize, PulseFullSize))
            .Build();
            anime.AddEvent(anime.Duration, () => Recycler.Return(this));
        }
        private void Init()
        {
            tickSprite = CreateChild <UguiSprite>("tick", 0);
            {
                tickSprite.Anchor     = AnchorType.Fill;
                tickSprite.Offset     = Offset.Zero;
                tickSprite.SpriteName = "circle-32";
            }

            hitAni = new Anime();
            hitAni.AnimateFloat(a => this.Alpha = a)
            .AddTime(0f, 1f, EaseType.QuadEaseOut)
            .AddTime(0.5f, 0f)
            .Build();
            hitAni.AnimateVector3(s => this.Scale = s)
            .AddTime(0f, Vector3.one, EaseType.CubicEaseOut)
            .AddTime(0.5f, new Vector3(2.5f, 2.5f, 1f))
            .Build();
            hitAni.AddEvent(hitAni.Duration, () => Active = false);
        }
示例#17
0
        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();
        }
示例#18
0
        private void Init()
        {
            holdSprite = CreateChild <UguiSprite>("hold", 4);
            {
                holdSprite.Anchor     = AnchorType.Fill;
                holdSprite.Offset     = Offset.Zero;
                holdSprite.SpriteName = "circle-320";
                holdSprite.Alpha      = 0f;
            }

            holdAni = new Anime();
            holdAni.AnimateFloat(a => holdSprite.Alpha = a)
            .AddTime(0f, () => holdSprite.Alpha)
            .AddTime(0.35f, 0.25f)
            .Build();
            holdAni.AnimateVector3(s => holdSprite.Scale = s)
            .AddTime(0f, () => holdSprite.Scale)
            .AddTime(0.35f, new Vector3(2f, 2f, 2f))
            .Build();

            releaseAni = new Anime();
            releaseAni.AnimateFloat(a => holdSprite.Alpha = a)
            .AddTime(0f, () => holdSprite.Alpha)
            .AddTime(0.35f, 0f)
            .Build();
            releaseAni.AnimateVector3(s => holdSprite.Scale = s)
            .AddTime(0f, () => holdSprite.Scale)
            .AddTime(0.35f, Vector3.one)
            .Build();

            hitAni.AddEvent(hitAni.Duration, () =>
            {
                if (draggerView != null)
                {
                    draggerView.Active = false;
                }
            });
        }
示例#19
0
        private void Init()
        {
            background = CreateChild <UguiSprite>("background", 1);
            {
                background.Anchor = AnchorType.Fill;
                background.Offset = Offset.Zero;
                background.Color  = ColorPreset.Background;
            }
            mask = CreateChild <UguiSprite>("mask", 3);
            {
                mask.Anchor     = AnchorType.Fill;
                mask.RawSize    = Vector2.zero;
                mask.Position   = Vector2.zero;
                mask.SpriteName = "box";

                var maskEffect = mask.AddEffect(new MaskEffect());
                maskEffect.Component.showMaskGraphic = false;

                loggedInView = mask.CreateChild <LoggedInView>("logged-in", 0);
                {
                    loggedInView.Anchor = AnchorType.Fill;
                    loggedInView.Offset = Offset.Zero;
                }
                loggedOutView = mask.CreateChild <LoggedOutView>("logged-out", 0);
                {
                    loggedOutView.Anchor = AnchorType.Fill;
                    loggedOutView.Offset = Offset.Zero;

                    loggedOutView.CurLoginView.OnNewValue += OnLoginProviderViewChange;
                }
            }
            blocker = CreateChild <Blocker>("blocker", 4);

            loggedInAni = new Anime();
            loggedInAni.AnimateFloat(alpha => loggedInView.Alpha = alpha)
            .AddTime(0f, () => loggedInView.Alpha)
            .AddTime(0.25f, 1f)
            .Build();
            loggedInAni.AnimateFloat(alpha => loggedOutView.Alpha = alpha)
            .AddTime(0f, () => loggedOutView.Alpha)
            .AddTime(0.25f, 0f)
            .Build();
            loggedInAni.AnimateFloat(height => this.Height = height)
            .AddTime(0f, () => this.Height)
            .AddTime(0.25f, LoggedInHeight)
            .Build();
            loggedInAni.AddEvent(0f, () => loggedInView.Active = blocker.Active = true);
            loggedInAni.AddEvent(loggedInAni.Duration, () => loggedOutView.Active = blocker.Active = false);

            loggedOutAni = new Anime();
            loggedOutAni.AnimateFloat(alpha => loggedInView.Alpha = alpha)
            .AddTime(0f, () => loggedInView.Alpha)
            .AddTime(0.25f, 0f)
            .Build();
            loggedOutAni.AnimateFloat(alpha => loggedOutView.Alpha = alpha)
            .AddTime(0f, () => loggedOutView.Alpha)
            .AddTime(0.25f, 1f)
            .Build();
            loggedOutAni.AnimateFloat(height => this.Height = height)
            .AddTime(0f, () => this.Height)
            .AddTime(0.25f, () => loggedOutView.DesiredHeight)
            .Build();
            loggedOutAni.AddEvent(0f, () => loggedOutView.Active = blocker.Active = true);
            loggedOutAni.AddEvent(loggedInAni.Duration, () => loggedInView.Active = blocker.Active = false);

            OnEnableInited();
        }
示例#20
0
        private void Init()
        {
            // Make the menu fit within the parent's object.
            Anchor = AnchorType.Fill;
            Offset = Offset.Zero;

            var blocker = CreateChild <Blocker>("blocker", 0);

            {
                blocker.OnTriggered += CloseMenu;
            }
            holder = CreateChild("holder", 1);
            {
                holder.Size = new Vector2(ContainerWidth, 0f);

                aniHolder = holder.CreateChild("ani-holder", 0);
                {
                    aniHolder.Anchor = AnchorType.Fill;
                    aniHolder.Offset = Offset.Zero;

                    canvasGroup       = aniHolder.RawObject.AddComponent <CanvasGroup>();
                    canvasGroup.alpha = 0f;

                    shadow = aniHolder.CreateChild <UguiSprite>("shadow", 0);
                    {
                        shadow.Anchor     = AnchorType.Fill;
                        shadow.Offset     = new Offset(-7f);
                        shadow.SpriteName = "glow-circle-16";
                        shadow.ImageType  = Image.Type.Sliced;
                        shadow.Color      = Color.black;
                    }
                    listContainer = aniHolder.CreateChild <UguiListView>("list", 1);
                    {
                        listContainer.Anchor = AnchorType.Fill;
                        listContainer.Offset = Offset.Zero;
                        listContainer.Background.SpriteName = "circle-16";
                        listContainer.Background.ImageType  = Image.Type.Sliced;
                        listContainer.Background.Color      = new Color(0f, 0f, 0f, 0.75f);

                        listContainer.Initialize(OnCreateMenuItem, OnUpdateMenuItem);
                        listContainer.CellSize = ItemSize;
                        listContainer.Corner   = GridLayoutGroup.Corner.UpperLeft;
                        listContainer.Axis     = GridLayoutGroup.Axis.Vertical;
                    }
                }
            }

            showAni = new Anime();
            showAni.AddEvent(0f, () => Active           = true);
            showAni.AnimateFloat(a => canvasGroup.alpha = a)
            .AddTime(0f, () => canvasGroup.alpha)
            .AddTime(0.25f, 1f)
            .Build();
            showAni.AnimateFloat(y => aniHolder.Y = y)
            .AddTime(0f, MoveAniAmount, EaseType.QuadEaseOut)
            .AddTime(0.25f, 0f)
            .Build();

            hideAni = new Anime();
            hideAni.AnimateFloat(a => canvasGroup.alpha = a)
            .AddTime(0f, () => canvasGroup.alpha)
            .AddTime(0.25f, 0f)
            .Build();
            hideAni.AnimateFloat(y => aniHolder.Y = y)
            .AddTime(0f, 0f, EaseType.QuadEaseOut)
            .AddTime(0.25f, MoveAniAmount)
            .Build();
            hideAni.AddEvent(hideAni.Duration, () =>
            {
                OnHidden?.Invoke(this);
                Active = false;
            });
        }
示例#21
0
        private void Init()
        {
            container = CreateChild <UguiObject>("container", 0);
            {
                container.Anchor = AnchorType.TopStretch;
                container.Pivot  = PivotType.Top;
                container.Y      = 0f;
                container.SetOffsetHorizontal(0f);
                container.Height = FoldedHeight;

                providerContainer = container.CreateChild <ProviderContainer>("provider", 1);
                {
                    providerContainer.Anchor = AnchorType.TopStretch;
                    providerContainer.Pivot  = PivotType.Top;
                    providerContainer.SetOffsetHorizontal(0f);
                    providerContainer.Y      = 0f;
                    providerContainer.Height = ProviderControllerHeight;
                }
                bannerContainer = container.CreateChild <BannerContainer>("banner", 0);
                {
                    bannerContainer.Anchor         = AnchorType.Fill;
                    bannerContainer.Offset         = new Offset(0f, 54f, 0f, 96f);
                    bannerContainer.IsInteractible = false;
                }
                searchBarContainer = container.CreateChild <SearchBarContainer>("search-bar", 2);
                {
                    searchBarContainer.Anchor = AnchorType.BottomStretch;
                    searchBarContainer.Pivot  = PivotType.Bottom;
                    searchBarContainer.SetOffsetHorizontal(0f);
                    searchBarContainer.Y      = 0f;
                    searchBarContainer.Height = SearchBarHeight;

                    searchBarContainer.AdvancedButton.OnTriggered += OnAdvancedButton;
                }
            }
            shadowButton = CreateChild <ShadowButton>("shadow", 1);
            {
                shadowButton.Anchor = AnchorType.Fill;
                shadowButton.Offset = new Offset(0f, FoldedHeight, 0f, 0f);
                shadowButton.Active = false;
                shadowButton.Alpha  = 0f;

                shadowButton.OnTriggered += OnShadowButton;
            }
            scrollTopButton = CreateChild <ScrollTopButton>("scroll-button", 2);
            {
                scrollTopButton.Anchor = AnchorType.Bottom;
                scrollTopButton.Y      = -28f;
                scrollTopButton.Size   = new Vector2(120f, 24f);
                scrollTopButton.Active = false;

                scrollTopButton.OnTriggered += OnScrollTopButton;
            }

            foldAni = new Anime();
            foldAni.AddEvent(0f, () => bannerContainer.IsInteractible = false);
            foldAni.AnimateFloat(h =>
            {
                container.Height = h;
                shadowButton.SetOffsetTop(h);
                bannerContainer.AdjustBannerTexture();
            })
            .AddTime(0f, () => container.Height)
            .AddTime(0.25f, FoldedHeight)
            .Build();
            foldAni.AnimateFloat(a => shadowButton.Alpha = a)
            .AddTime(0f, () => shadowButton.Alpha)
            .AddTime(0.25f, 0f)
            .Build();
            foldAni.AddEvent(0f, () => shadowButton.Active = false);

            unfoldAni = new Anime();
            unfoldAni.AddEvent(0f, () => shadowButton.Active = true);
            unfoldAni.AnimateFloat(h =>
            {
                container.Height = h;
                shadowButton.SetOffsetTop(h);
                bannerContainer.AdjustBannerTexture();
            })
            .AddTime(0f, () => container.Height)
            .AddTime(0.25f, UnfoldedHeight)
            .Build();
            unfoldAni.AnimateFloat(a => shadowButton.Alpha = a)
            .AddTime(0f, () => shadowButton.Alpha)
            .AddTime(0.25f, 0.5f)
            .Build();
            unfoldAni.AddEvent(unfoldAni.Duration, () => bannerContainer.IsInteractible = true);

            scrollButtonShowAni = new Anime();
            scrollButtonShowAni.AddEvent(0f, () => scrollTopButton.Active = true);
            scrollButtonShowAni.AnimateFloat((i) =>
            {
                scrollTopButton.Alpha = Easing.Linear(i, 0f, 1f, 0f);
                scrollTopButton.Y     = Easing.Linear(i, 0f, 28f, 0f);
            }).AddTime(0f, 0f, EaseType.BackEaseOut)
            .AddTime(0.25f, 1f)
            .Build();

            scrollButtonHideAni = new Anime();
            scrollButtonHideAni.AnimateFloat((i) =>
            {
                scrollTopButton.Alpha = Easing.Linear(i, 1f, -1f, 0f);
                scrollTopButton.Y     = Easing.Linear(i, 28f, -28f, 0f);
            }).AddTime(0f, 0f, EaseType.SineEaseOut)
            .AddTime(0.25f, 1f)
            .Build();
            scrollButtonHideAni.AddEvent(scrollButtonHideAni.Duration, () => scrollTopButton.Active = false);

            OnEnableInited();
        }
        private void Init(IGameSession gameSession)
        {
            gameSession.OnSoftInit += () =>
            {
                scoreProcessor = gameSession.ScoreProcessor;
                scoreProcessor.Health.BindAndTrigger(OnHealthChange);
                SetFailingForce(false);
            };
            gameSession.OnSoftDispose += () =>
            {
                ProgressBar.Value = 0f;
            };

            ProgressBar = CreateChild <UguiProgressBar>("progress", 0);
            {
                fgSprite       = ProgressBar.Foreground;
                fgSprite.Color = ColorPreset.PrimaryFocus.Base;

                thumbSprite            = ProgressBar.Thumb;
                thumbSprite.Active     = true;
                thumbSprite.SpriteName = "glow-128";
                thumbSprite.Color      = ColorPreset.PrimaryFocus.Alpha(0f);
                thumbSprite.Size       = new Vector2(36f, 88f);

                pinEffectSprite = thumbSprite.CreateChild <UguiSprite>("effect");
                {
                    pinEffectSprite.Color      = ColorPreset.PrimaryFocus.Alpha(0f);
                    pinEffectSprite.SpriteName = "glow-128";
                    pinEffectSprite.Size       = thumbSprite.Size * 6.5f;

                    pinEffectSprite.AddEffect(new AdditiveShaderEffect());
                }
            }
            Indicator = CreateChild <UguiSprite>("indicator", 1);
            {
                Indicator.Color = ColorPreset.PrimaryFocus.Base;
            }

            changeAni = new Anime();
            changeAni.AnimateFloat((progress) => ProgressBar.Value = progress)
            .AddTime(0f, () => ProgressBar.Value)
            .AddTime(0.2f, () => curHealth)
            .Build();
            changeAni.AnimateColor((tint) => fgSprite.Tint = tint)
            .AddTime(0f, () => barTintFromColor)
            .AddTime(0.35f, () => barTintToColor)
            .Build();

            pinAni = new Anime();
            // Thumb sprite fade and scale
            pinAni.AnimateFloat((alpha) => thumbSprite.Alpha = alpha)
            .AddTime(0f, 0f)
            .AddTime(0.05f, 1f, EaseType.QuadEaseIn)
            .AddTime(0.25f, 0f)
            .Build();
            pinAni.AnimateVector3((scale) => thumbSprite.Scale = scale)
            .AddTime(0f, new Vector3(1.1f, 1.1f), EaseType.QuadEaseIn)
            .AddTime(0.25f, Vector3.one)
            .Build();
            // Pin effect fade and scale
            pinAni.AnimateFloat((alpha) => pinEffectSprite.Alpha = alpha)
            .AddTime(0f, 1f, EaseType.QuadEaseOut)
            .AddTime(0.25f, 0f)
            .Build();
            pinAni.AnimateVector3((scale) => pinEffectSprite.Scale = scale)
            .AddTime(0f, Vector3.zero, EaseType.CubicEaseOut)
            .AddTime(0.25f, Vector3.one)
            .Build();
        }
示例#23
0
        private void Init()
        {
            Width = 0f;

            isTriggered.Bind(OnTriggeredChange);

            buttonTrigger = CreateChild <BasicTrigger>("trigger");
            {
                buttonTrigger.IsClickToTrigger = false;
                buttonTrigger.Anchor           = AnchorType.CenterStretch;
                buttonTrigger.Width            = 36f;
                buttonTrigger.SetOffsetVertical(0f);

                buttonTrigger.OnPointerDown += () => isTriggered.Value = true;
                buttonTrigger.OnPointerUp   += () => isTriggered.Value = false;

                var bg = buttonTrigger.CreateChild <UguiSprite>("bg");
                {
                    bg.Anchor = AnchorType.CenterStretch;
                    bg.SetOffsetVertical(0f);
                    bg.Width      = 8f;
                    bg.Color      = new Color(1f, 1f, 1f, 0.25f);
                    bg.SpriteName = "circle-8";
                    bg.ImageType  = Image.Type.Sliced;
                }
            }
            indicatorContainer = CreateChild <UguiObject>("container");
            {
                indicatorContainer.Anchor = AnchorType.CenterStretch;
                indicatorContainer.Width  = 0;
                indicatorContainer.SetOffsetVertical(0f);

                indicatorCanvas       = indicatorContainer.RawObject.AddComponent <CanvasGroup>();
                indicatorCanvas.alpha = 0f;

                shadowSprite = indicatorContainer.CreateChild <UguiSprite>("shadow");
                {
                    shadowSprite.Anchor     = AnchorType.Fill;
                    shadowSprite.Offset     = new Offset(0f, 9f, 0f, -9f);
                    shadowSprite.Color      = ColorPreset.Passive.Darken(0.5f);
                    shadowSprite.SpriteName = "parallel-64";
                    shadowSprite.ImageType  = Image.Type.Sliced;

                    shadowFlipEffect = shadowSprite.AddEffect(new FlipEffect());
                }
                bgSprite = indicatorContainer.CreateChild <UguiSprite>("bg");
                {
                    bgSprite.Anchor     = AnchorType.Fill;
                    bgSprite.Offset     = Offset.Zero;
                    bgSprite.Color      = ColorPreset.Passive;
                    bgSprite.SpriteName = "parallel-64";
                    bgSprite.ImageType  = Image.Type.Sliced;

                    bgFlipEffect = bgSprite.AddEffect(new FlipEffect());
                }
                iconSprite = indicatorContainer.CreateChild <UguiSprite>("icon");
                {
                    iconSprite.Y          = 0f;
                    iconSprite.Size       = new Vector2(24f, 24f);
                    iconSprite.SpriteName = "icon-pause";
                    iconSprite.Color      = ColorPreset.PrimaryFocus;
                }

                indicatorContainer.Active = false;
            }

            showAni = new Anime();
            showAni.AddEvent(0f, () => indicatorContainer.Active     = true);
            showAni.AnimateFloat((width) => indicatorContainer.Width = width)
            .AddTime(0f, 0, EaseType.BackEaseOut)
            .AddTime(0.25f, 196f)
            .Build();
            showAni.AnimateFloat((alpha) => indicatorCanvas.alpha = alpha)
            .AddTime(0f, () => indicatorCanvas.alpha)
            .AddTime(0.25f, 1f)
            .Build();

            hideAni = new Anime();
            hideAni.AnimateFloat((width) => indicatorContainer.Width = width)
            .AddTime(0f, 196f, EaseType.CubicEaseIn)
            .AddTime(0.25f, 0f)
            .Build();
            hideAni.AnimateFloat((alpha) => indicatorCanvas.alpha = alpha)
            .AddTime(0f, () => indicatorCanvas.alpha)
            .AddTime(0.25f, 0f)
            .Build();
            hideAni.AddEvent(hideAni.Duration, () => indicatorContainer.Active = false);
        }