/// <summary> /// Internally handles view creation process. /// </summary> protected virtual T CreateInternal <T>() where T : MonoBehaviour, INavigationView { var view = root.CreateChild <T>(typeof(T).Name); var viewEvent = view as INavigationEvent; // Hook events to animations. var showAni = view.ShowAnime; var hideAni = view.HideAnime; if (showAni != null) { showAni.AddEvent(showAni.Duration, () => { if (viewEvent != null) { viewEvent.OnPostShow(); } }); } if (hideAni != null) { hideAni.AddEvent(hideAni.Duration, () => { if (view != null) { DisposeInternal(view); } }); } return(view); }
/// <summary> /// Creates a new secondary touch effect. /// </summary> private SecondaryTouchEffects CreateSecondaryEffect() { var effect = secondaryContainer.CreateChild <SecondaryTouchEffects>(); effect.PulseRecycler = pulseRecycler; return(effect); }
/// <summary> /// Creates a new primary touch effect. /// </summary> private PrimaryTouchEffects CreatePrimaryEffect() { var effect = primaryContainer.CreateChild <PrimaryTouchEffects>(); effect.PulseRecycler = pulseRecycler; return(effect); }
private void Init(PrepareScreen prepareScreen) { gradient = CreateChild <UguiSprite>("gradient", 0); { gradient.Anchor = AnchorType.Fill; gradient.RawSize = Vector2.zero; gradient.SpriteName = "gradation-top"; gradient.Color = new Color(0f, 0f, 0f, 0.75f); } listContainer = CreateChild <UguiObject>("list-container", 1); { listContainer.Anchor = AnchorType.TopStretch; listContainer.Pivot = PivotType.Top; listContainer.RawWidth = 0f; listContainer.Height = 64f; listContainer.Y = -prepareScreen.MenuBarHeight; versionList = listContainer.CreateChild <UguiListView>("version-list", 0); { versionList.Anchor = AnchorType.Fill; versionList.RawSize = new Vector2(-64f, 0f); versionList.SetOffsetVertical(0f); versionList.Background.Alpha = 0f; versionList.UseMask = false; versionList.IsVertical = false; versionList.Initialize(CreateVersionCell, SetupVersionCell); versionList.Axis = GridLayoutGroup.Axis.Horizontal; versionList.CellSize = new Vector2(64f, 64f); } } // Call after a frame due to unity ui limitations. InvokeAfterFrames(1, OnEnableInited); }
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() { // 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; }); }
protected override Rulesets.UI.GameGui CreateGameGui(IGraphicObject container, IDependencyContainer dependencies) { return(container.CreateChild <GameGui>("beats-standard-gui", dependencies: dependencies)); }
/// <summary> /// Creates a new touch pulse effect. /// </summary> private TouchPulseEffect CreatePulseEffect() { return(pulseContainer.CreateChild <TouchPulseEffect>()); }
/// <summary> /// Creates a new judgement effect object. /// </summary> private JudgementEffect CreateEffect() => effectHolder.CreateChild <JudgementEffect>(depth: effectRecycler.TotalCount);