Exemple #1
0
        private void Init()
        {
            mapTagRecycler = new ManagedRecycler <MapMetaTag>(CreateMapTag);

            OnTriggered += () =>
            {
                if (Active && Mapset != null)
                {
                    if (Model.SelectedMapset.Value != Mapset)
                    {
                        Model.SelectMapset(Mapset);
                    }
                    else
                    {
                        Model.NavigateToPrepare();
                    }
                }
            };

            container = CreateChild <UguiObject>("container");
            {
                container.Anchor = AnchorType.CenterStretch;
                container.SetOffsetVertical(5f);
                container.Width = UnfocusedWidth;

                highlight = container.CreateChild <UguiSprite>("highlight");
                {
                    highlight.Size       = new Vector2(1920f, 144f);
                    highlight.SpriteName = "glow-128";
                    highlight.Alpha      = UnfocusedHighlightAlpha;

                    highlight.IsRaycastTarget = false;

                    highlight.AddEffect(new AdditiveShaderEffect());
                }
                glow = container.CreateChild <UguiSprite>("glow");
                {
                    glow.Anchor     = AnchorType.Fill;
                    glow.RawSize    = new Vector2(30f, 30f);
                    glow.SpriteName = "glow-circle-32";
                    glow.ImageType  = Image.Type.Sliced;
                    glow.Color      = UnfocusedGlowColor;
                }
                thumbContainer = container.CreateChild <UguiSprite>("thumb");
                {
                    thumbContainer.Anchor     = AnchorType.Fill;
                    thumbContainer.RawSize    = Vector2.zero;
                    thumbContainer.SpriteName = "circle-32";
                    thumbContainer.ImageType  = Image.Type.Sliced;
                    thumbContainer.Color      = Color.black;

                    thumbContainer.AddEffect(new MaskEffect());

                    thumbImage = thumbContainer.CreateChild <UguiTexture>("image");
                    {
                        thumbImage.Anchor  = AnchorType.Fill;
                        thumbImage.RawSize = Vector2.zero;
                        thumbImage.Color   = UnfocusedThumbColor;
                    }
                }
                titleLabel = container.CreateChild <Label>("title");
                {
                    titleLabel.Anchor = AnchorType.TopStretch;
                    titleLabel.Pivot  = PivotType.Top;
                    titleLabel.Y      = -8f;
                    titleLabel.Height = 32f;
                    titleLabel.SetOffsetHorizontal(20f);
                    titleLabel.IsItalic  = true;
                    titleLabel.IsBold    = true;
                    titleLabel.WrapText  = true;
                    titleLabel.Alignment = TextAnchor.MiddleLeft;
                    titleLabel.FontSize  = 22;

                    titleShadow             = titleLabel.AddEffect(new ShadowEffect()).Component;
                    titleShadow.style       = ShadowStyle.Shadow;
                    titleShadow.effectColor = Color.black;
                    titleShadow.enabled     = false;
                }
                artistLabel = container.CreateChild <Label>("artist");
                {
                    artistLabel.Anchor = AnchorType.BottomStretch;
                    artistLabel.Pivot  = PivotType.Bottom;
                    artistLabel.Y      = 8f;
                    artistLabel.Height = 24f;
                    artistLabel.SetOffsetHorizontal(20f);
                    artistLabel.WrapText  = true;
                    artistLabel.Alignment = TextAnchor.MiddleLeft;
                    artistLabel.FontSize  = 18;

                    artistShadow             = artistLabel.AddEffect(new ShadowEffect()).Component;
                    artistShadow.style       = ShadowStyle.Shadow;
                    artistShadow.effectColor = Color.black;
                    artistShadow.enabled     = false;
                }
                creatorLabel = container.CreateChild <Label>("creator");
                {
                    creatorLabel.Anchor = AnchorType.BottomStretch;
                    creatorLabel.Pivot  = PivotType.Bottom;
                    creatorLabel.Y      = 8f;
                    creatorLabel.Height = 24f;
                    creatorLabel.SetOffsetHorizontal(20f);
                    creatorLabel.WrapText  = true;
                    creatorLabel.Alignment = TextAnchor.MiddleRight;
                    creatorLabel.FontSize  = 18;

                    creatorShadow             = creatorLabel.AddEffect(new ShadowEffect()).Component;
                    creatorShadow.style       = ShadowStyle.Shadow;
                    creatorShadow.effectColor = Color.black;
                    creatorShadow.enabled     = false;
                }
                mapTagGrid = container.CreateChild <UguiGrid>("map-tag-grid");
                {
                    mapTagGrid.Anchor = AnchorType.TopStretch;
                    mapTagGrid.Pivot  = PivotType.Top;
                    mapTagGrid.Y      = -8f;
                    mapTagGrid.Height = MapTagCellSize.y;
                    mapTagGrid.SetOffsetHorizontal(20f);
                    mapTagGrid.Alignment  = TextAnchor.MiddleRight;
                    mapTagGrid.Axis       = GridLayoutGroup.Axis.Horizontal;
                    mapTagGrid.SpaceWidth = 8f;
                    mapTagGrid.CellSize   = MapTagCellSize;
                    mapTagGrid.Limit      = 0;
                }
            }

            backgroundAgent = new CacherAgent <IMap, IMapBackground>(BackgroundCacher)
            {
                UseDelayedRemove = true,
                RemoveDelay      = 2f
            };
            backgroundAgent.OnFinished += OnBackgroundLoaded;

            OnEnableInited();
        }
        private void Init()
        {
            container = CreateChild <UguiSprite>("container", 0);
            {
                container.Anchor     = AnchorType.Fill;
                container.Offset     = new Offset(8f);
                container.SpriteName = "circle-32";
                container.ImageType  = Image.Type.Sliced;
                container.Color      = new Color(1f, 1f, 1f, 0.25f);
                container.AddEffect(new MaskEffect());

                coverImage = container.CreateChild <CoverImage>("cover", 0);
                {
                    coverImage.Anchor = AnchorType.Fill;
                    coverImage.Offset = Offset.Zero;
                }
                shadow = container.CreateChild <UguiSprite>("shadow", 1);
                {
                    shadow.Anchor     = AnchorType.Fill;
                    shadow.Offset     = Offset.Zero;
                    shadow.Color      = new Color(0f, 0f, 0f, 0.5f);
                    shadow.SpriteName = "gradation-bottom";
                }
                titleLabel = container.CreateChild <Label>("title", 2);
                {
                    titleLabel.Anchor = AnchorType.BottomStretch;
                    titleLabel.Pivot  = PivotType.Bottom;
                    titleLabel.SetOffsetHorizontal(8f);
                    titleLabel.Y         = 74f;
                    titleLabel.Height    = 50f;
                    titleLabel.IsBold    = true;
                    titleLabel.FontSize  = 18;
                    titleLabel.WrapText  = true;
                    titleLabel.Alignment = TextAnchor.LowerLeft;

                    titleLabel.AddEffect(new ShadowEffect()).Component.effectColor = Color.black;
                }
                artistLabel = container.CreateChild <Label>("artist", 3);
                {
                    artistLabel.Anchor = AnchorType.BottomStretch;
                    artistLabel.Pivot  = PivotType.Bottom;
                    artistLabel.SetOffsetHorizontal(8f);
                    artistLabel.Y         = 58f;
                    artistLabel.Height    = 20f;
                    artistLabel.IsBold    = true;
                    artistLabel.FontSize  = 16;
                    artistLabel.WrapText  = true;
                    artistLabel.Alignment = TextAnchor.LowerLeft;

                    artistLabel.AddEffect(new ShadowEffect()).Component.effectColor = Color.black;
                }
                mapperLabel = container.CreateChild <Label>("mapper", 4);
                {
                    mapperLabel.Anchor = AnchorType.BottomStretch;
                    mapperLabel.Pivot  = PivotType.Bottom;
                    mapperLabel.SetOffsetHorizontal(8f);
                    mapperLabel.Y         = 42f;
                    mapperLabel.Height    = 20f;
                    mapperLabel.IsBold    = true;
                    mapperLabel.FontSize  = 16;
                    mapperLabel.WrapText  = true;
                    mapperLabel.Alignment = TextAnchor.LowerLeft;

                    mapperLabel.AddEffect(new ShadowEffect()).Component.effectColor = Color.black;
                }
                previewBar = container.CreateChild <PreviewBar>("preview", 5);
                {
                    previewBar.Anchor = AnchorType.BottomStretch;
                    previewBar.Pivot  = PivotType.Bottom;
                    previewBar.SetOffsetHorizontal(0f);
                    previewBar.Y      = 36f;
                    previewBar.Height = 2f;
                }
                metaDisplayer = container.CreateChild <MetaDisplayer>("meta", 6);
                {
                    metaDisplayer.Anchor = AnchorType.TopStretch;
                    metaDisplayer.Pivot  = PivotType.Top;
                    metaDisplayer.SetOffsetHorizontal(8f);
                    metaDisplayer.Y      = -8f;
                    metaDisplayer.Height = 24f;
                }
                actionBar = container.CreateChild <ActionBar>("actions", 7);
                {
                    actionBar.Anchor = AnchorType.BottomStretch;
                    actionBar.Pivot  = PivotType.Bottom;
                    actionBar.SetOffsetHorizontal(0f);
                    actionBar.Y      = 0f;
                    actionBar.Height = 36f;
                }
            }
        }
Exemple #3
0
        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();
        }
        private void Init()
        {
            hoverSprite.Depth      = 1;
            hoverSprite.Anchor     = AnchorType.Fill;
            hoverSprite.RawSize    = new Vector2(28f, 30f);
            hoverSprite.Color      = Color.black;
            hoverSprite.SpriteName = "glow-parallel-64";
            hoverSprite.ImageType  = Image.Type.Sliced;
            hoverSprite.AddEffect(new FlipEffect()).Component.horizontal = true;

            mask = CreateChild <UguiSprite>("mask", 0);
            {
                mask.Anchor     = AnchorType.Fill;
                mask.RawSize    = Vector2.zero;
                mask.Color      = HexColor.Create("2A313A");
                mask.SpriteName = "parallel-64";
                mask.ImageType  = Image.Type.Sliced;

                mask.AddEffect(new MaskEffect());
                mask.AddEffect(new FlipEffect()).Component.horizontal = true;

                imageDisplay = mask.CreateChild <MapImageDisplay>("imageDisplay", 0);
                {
                    imageDisplay.Anchor  = AnchorType.Fill;
                    imageDisplay.RawSize = Vector2.zero;

                    imageGradient = imageDisplay.CreateChild <UguiSprite>("gradient", 100);
                    {
                        imageGradient.Anchor     = AnchorType.Fill;
                        imageGradient.RawSize    = Vector2.zero;
                        imageGradient.SpriteName = "gradation-left";
                        imageGradient.Color      = new Color(0f, 0f, 0f, 0.5f);
                    }
                }
                progressBar = mask.CreateChild <UguiProgressBar>("progress", 1);
                {
                    progressBar.Anchor = AnchorType.BottomStretch;
                    progressBar.Pivot  = PivotType.Bottom;
                    progressBar.SetOffsetHorizontal(22f, 0f);
                    progressBar.Height = 6f;
                    progressBar.Y      = 0f;

                    progressBar.Background.Color = new Color(0f, 0f, 0f, 0.5f);
                    progressBar.Foreground.SetOffsetTop(2f);
                }
                titleLabel = mask.CreateChild <Label>("title", 2);
                {
                    titleLabel.Anchor = AnchorType.TopStretch;
                    titleLabel.Pivot  = PivotType.Top;
                    titleLabel.SetOffsetHorizontal(20f, 32f);
                    titleLabel.Y         = -8f;
                    titleLabel.Height    = 30f;
                    titleLabel.IsBold    = true;
                    titleLabel.FontSize  = 22;
                    titleLabel.Alignment = TextAnchor.UpperLeft;
                    titleLabel.WrapText  = true;

                    var shadow = titleLabel.AddEffect(new ShadowEffect()).Component;
                    shadow.style          = ShadowStyle.Outline;
                    shadow.effectDistance = Vector2.one;
                    shadow.effectColor    = new Color(0f, 0f, 0f, 0.5f);
                }
                artistLabel = mask.CreateChild <Label>("artist", 3);
                {
                    artistLabel.Anchor = AnchorType.BottomStretch;
                    artistLabel.Pivot  = PivotType.Bottom;
                    artistLabel.SetOffsetHorizontal(32f, 20f);
                    artistLabel.Y         = 8f;
                    artistLabel.Height    = 30f;
                    artistLabel.Alignment = TextAnchor.LowerLeft;
                    artistLabel.WrapText  = true;

                    var shadow = artistLabel.AddEffect(new ShadowEffect()).Component;
                    shadow.style          = ShadowStyle.Outline;
                    shadow.effectDistance = Vector2.one;
                    shadow.effectColor    = new Color(0f, 0f, 0f, 0.5f);
                }
            }

            hoverInAni = new Anime();
            hoverInAni.AnimateColor(color => hoverSprite.Color = color)
            .AddTime(0f, () => hoverSprite.Color)
            .AddTime(0.25f, () => MapSelection.Background.Value.Highlight)
            .Build();
            hoverInAni.AnimateFloat(alpha => imageGradient.Alpha = alpha)
            .AddTime(0f, () => imageGradient.Alpha)
            .AddTime(0.25f, 0f)
            .Build();

            hoverOutAni = new Anime();
            hoverOutAni.AnimateColor(color => hoverSprite.Color = color)
            .AddTime(0f, () => hoverSprite.Color)
            .AddTime(0.25f, Color.black)
            .Build();
            hoverOutAni.AnimateFloat(alpha => imageGradient.Alpha = alpha)
            .AddTime(0f, () => imageGradient.Alpha)
            .AddTime(0.25f, 0.5f)
            .Build();

            OnEnableInited();
        }