コード例 #1
0
        private void Init()
        {
            blurSprite = CreateChild <UguiSprite>("blur", 0);
            {
                blurSprite.Anchor     = AnchorType.Fill;
                blurSprite.Offset     = Offset.Zero;
                blurSprite.SpriteName = "null";
                blurSprite.AddEffect(new BlurShaderEffect());
            }
            fallbackSprite = CreateChild <UguiSprite>("fallback", 1);
            {
                fallbackSprite.Anchor = AnchorType.Fill;
                fallbackSprite.Offset = Offset.Zero;
                fallbackSprite.Color  = new Color(0f, 0f, 0f, 0.4f);
            }

            OnEnableInited();
        }
コード例 #2
0
        private void Init(IColorPreset colorPreset)
        {
            bgSprite = CreateChild <UguiSprite>("bg", -1);
            {
                bgSprite.Anchor = AnchorType.Fill;
                bgSprite.Offset = Offset.Zero;

                var gradient = bgSprite.AddEffect(new GradientEffect());
                gradient.Component.direction = UIGradient.Direction.Vertical;
                gradient.Component.color1    = colorPreset.Passive;
                gradient.Component.color2    = colorPreset.DarkBackground;
            }
            searchMenu = CreateChild <SearchMenu>("search-menu", 1);
            {
                searchMenu.Anchor = AnchorType.Fill;
                searchMenu.Pivot  = PivotType.Top;
                searchMenu.Offset = new Offset(0f, MenuBarHeight, 0f, 0f);
            }
            resultArea = CreateChild <UguiObject>("result-area", 1);
            {
                resultArea.Anchor = AnchorType.Fill;
                resultArea.Offset = new Offset(0f, searchMenu.FoldedHeight + MenuBarHeight, 0f, 0f);

                resultList = resultArea.CreateChild <ResultList>("list", 0);
                {
                    resultList.Anchor = AnchorType.Fill;
                    resultList.Offset = new Offset(8f, 0f);
                }
                resultLoader = resultArea.CreateChild <ResultLoader>("loader", 1);
                {
                    resultLoader.Anchor = AnchorType.Fill;
                    resultLoader.Offset = Offset.Zero;
                }
            }

            model.MapsetsRequest.OnNewValue += OnRequestChange;
        }
コード例 #3
0
        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;
                }
            }
        }
コード例 #4
0
        private void Init()
        {
            var bg = CreateChild <UguiSprite>("bg");

            {
                bg.Anchor     = AnchorType.Fill;
                bg.SpriteName = "circle-320";
                bg.Color      = ColorPreset.DarkBackground;
                bg.Offset     = Offset.Zero;
            }
            meterSprite = CreateChild <UguiSprite>("meter");
            {
                meterSprite.Anchor     = AnchorType.Fill;
                meterSprite.Offset     = Offset.Zero;
                meterSprite.SpriteName = "circle-320";
                meterSprite.ImageType  = Image.Type.Filled;
                meterSprite.SetRadial360Fill(Image.Origin360.Top);

                meterGradient = meterSprite.AddEffect(new GradientEffect());
                meterGradient.Component.direction = UIGradient.Direction.Vertical;
                meterGradient.Component.color1    = Color.white;
                meterGradient.Component.color2    = HexColor.Create("A0A0A0");
                meterGradient.Component.offset    = 0.75f;
            }
            rangeDisplay = CreateChild <RankCircleRange>("ranges");
            {
                rangeDisplay.Anchor = AnchorType.Fill;
                rangeDisplay.Offset = new Offset(18f);
            }
            var mask = CreateChild <UguiSprite>("mask");

            {
                mask.Anchor     = AnchorType.Fill;
                mask.Offset     = new Offset(28f);
                mask.Color      = ColorPreset.DarkBackground;
                mask.SpriteName = "circle-320";
                mask.AddEffect(new MaskEffect());

                mapThumb = mask.CreateChild <MapImageDisplay>("thumb");
                {
                    mapThumb.Anchor = AnchorType.Fill;
                    mapThumb.Offset = Offset.Zero;
                    mapThumb.Color  = new Color(1f, 1f, 1f, 0.25f);
                }
            }
            rankGlowSprite = CreateChild <UguiSprite>("rank-glow");
            {
                rankGlowSprite.Size       = new Vector2(256f, 256f);
                rankGlowSprite.SpriteName = "glow-128";
                rankGlowSprite.Alpha      = 0.625f;
            }
            rankLabel = CreateChild <Label>("rank");
            {
                rankLabel.IsBold   = true;
                rankLabel.FontSize = 128;

                rankShadowEffect = rankLabel.AddEffect(new ShadowEffect());
                rankShadowEffect.Component.style = ShadowStyle.Outline8;
            }
            var accBg = CreateChild <UguiSprite>("acc-bg");

            {
                accBg.Position   = new Vector3(0f, -84f);
                accBg.Size       = new Vector2(280f, 64f);
                accBg.SpriteName = "glow-128";
                accBg.Color      = Color.black;
            }
            accuracyLabel = CreateChild <Label>("accuracy");
            {
                accuracyLabel.Position = accBg.Position;
                accuracyLabel.FontSize = 22;
            }

            OnEnableInited();
        }
コード例 #5
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);
        }