private void Init(IGameSession gameSession) { secondaryContainer = CreateChild("secondary"); { secondaryContainer.Size = Vector2.zero; } primaryContainer = CreateChild("primary"); { primaryContainer.Size = Vector2.zero; } pulseContainer = CreateChild("pulse"); { pulseContainer.Size = Vector2.zero; } gameSession.OnSoftDispose += () => { DestroyAllEffects(); }; pulseRecycler = new ManagedRecycler <TouchPulseEffect>(CreatePulseEffect); pulseRecycler.Precook(5); primaryRecycler = new ManagedRecycler <PrimaryTouchEffects>(CreatePrimaryEffect); primaryRecycler.Precook(4); secondaryRecycler = new ManagedRecycler <SecondaryTouchEffects>(CreateSecondaryEffect); secondaryRecycler.Precook(20); }
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(); }
private void Init() { rankTag = CreateChild <RankMetaTag>("rank", 0); { rankTag.Anchor = AnchorType.TopLeft; rankTag.Pivot = PivotType.TopLeft; rankTag.Position = Vector2.zero; rankTag.Size = new Vector2(100f, TagHeight); } playCountTag = CreateChild <StatMetaTag>("stat", 1); { playCountTag.Anchor = AnchorType.TopRight; playCountTag.Pivot = PivotType.TopRight; playCountTag.Position = Vector2.zero; playCountTag.Height = TagHeight; } favoriteCountTag = CreateChild <StatMetaTag>("favorite", 2); { favoriteCountTag.Anchor = AnchorType.TopRight; favoriteCountTag.Pivot = PivotType.TopRight; favoriteCountTag.Position = new Vector2(0f, -28); favoriteCountTag.Height = TagHeight; } mapTagRecycler = new ManagedRecycler <MapMetaTag>(CreateMetaTag); }
public DropdownProvider(IRootMain rootMain) { if (rootMain == null) { throw new ArgumentNullException(nameof(rootMain)); } this.rootMain = rootMain; recycler = new ManagedRecycler <DropdownMenu>(CreateMenu); }
private void Init() { tickRecycler = new ManagedRecycler <MetronomeTick>(CreateTick); CellSize = new Vector2(24f, 24f); Axis = GridLayoutGroup.Axis.Horizontal; Alignment = TextAnchor.MiddleCenter; OnEnableInited(); }
protected BaseInputter(HitBarDisplay hitBar, HitObjectHolder hitObjectHolder) { this.hitBar = hitBar; this.hitObjectHolder = hitObjectHolder; hitBarCursor = CreateCursor(); hitBar.LinkCursor(hitBarCursor); keyRecycler = new ManagedRecycler <BeatsKey>(CreateKey); keyRecycler.Precook(3); }
private void Init() { buttonRecycler = new ManagedRecycler <SelectionButton>(CreateButton); Height = 0f; bgSprite = CreateChild <UguiSprite>("bg", -1); { bgSprite.Anchor = AnchorType.Fill; bgSprite.RawSize = Vector2.zero; bgSprite.Color = new Color(0f, 0f, 0f, 0.5f); } OnEnableInited(); }
/// <summary> /// Event called on game session hard disposal. /// </summary> protected virtual void OnHardDispose() { GameSession.OnSoftInit -= OnSoftInit; GameSession.OnSoftDispose -= OnSoftDispose; GameSession.OnHardDispose -= OnHardDispose; hitBar.UnlinkCursor(); hitBar = null; hitObjectHolder = null; hitBarCursor = null; keyRecycler = null; pointerEvent = null; raycastResults = null; }
private void Init(IDependencyContainer dependencies) { this.Dependencies = dependencies.Clone(); this.Dependencies.CacheAs <IGameSession <T> >(this); this.Dependencies.CacheAs <IGameSession>(this); replayJudgementsRecycler = new ManagedRecycler <ReplayableJudgement>(CreateReplayJudgement); this.Dependencies.CacheAs <IRecycler <ReplayableJudgement> >(replayJudgementsRecycler); // Create game gui. GameGui = CreateGameGui(containerObject, this.Dependencies); { GameGui.Anchor = AnchorType.Fill; GameGui.Offset = Offset.Zero; } }
private void Init() { Dependencies.Cache(this); if (GameSession != null) { GameSession.OnHardInit += OnHardInit; GameSession.OnSoftInit += OnSoftInit; GameSession.OnSoftDispose += OnSoftDispose; GameSession.OnHardDispose += OnHardDispose; } hitCircleRecycler = new ManagedRecycler <HitCircleView>(CreateHitCircle); draggerCircleRecycler = new ManagedRecycler <DraggerCircleView>(CreateDraggerCircle); tickRecycler = new ManagedRecycler <DraggerTickView>(CreateTick); draggerRecycler = new ManagedRecycler <DraggerView>(CreateDragger); hitObjectViews = new RangedList <HitObjectView>(400); // Add tick and drag circle as dependencies for dragger view to draw its nested objects. Dependencies.CacheAs <IRecycler <DraggerCircleView> >(draggerCircleRecycler); Dependencies.CacheAs <IRecycler <DraggerTickView> >(tickRecycler); }
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(); }
public BeatsStandardSession(IGraphicObject container) : base(container) { replayInputRecycler = new ManagedRecycler <ReplayableInput>(CreateReplayInput); replayFrameRecycler = new ManagedRecycler <ReplayFrame>(CreateReplayFrame); }
private void Init() { cellRecycler = new ManagedRecycler <NotificationCell>(CreateCell); canvasGroup = RawObject.AddComponent <CanvasGroup>(); }