protected override IGameSession CreateSession(IGraphicObject container, IDependencyContainer dependency) { var session = new BeatsStandardSession(container); dependency.Inject(session); return(session); }
public PersonalityRenderer(List <IGraphicObject> objects, SpriteBatch sbatch) { _sbatch = sbatch; string[] toggleButtons = new string[] { "ToggleButton1", "ToggleButton2", "ToggleButton3", "ToggleButton4" }; _objects = new List <IGraphicObject>(); _buttons = new List <IGraphicObject>(); foreach (IGraphicObject object1 in objects) { if (object1.IsCalled("Overlay")) { _overlay = object1; } else { for (int i = 0; i < toggleButtons.Length; i++) { if (object1.IsCalled(toggleButtons[i])) { _buttons.Add(object1); break; } else { _objects.Add(object1); } } } } }
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); }
/// <summary> /// Adjusts offsets of graphic object. /// </summary> /// <param name="graphicObject">Graphic object to process</param> /// <param name="dx">Displacement along the x-axis</param> /// <param name="dy">Displacement along the y-axis</param> /// <param name="resDx">Resulting displacement along the x-axis</param> /// <param name="resDy">Resulting displacement along the y-axis</param> public void AdjustOffsets(IGraphicObject graphicObject, int dx, int dy, out int resDx, out int resDy) { if (graphicObject == null) { throw new ArgumentNullException(nameof(graphicObject)); } var boundRect = graphicObject.GetBoundRectangle(); boundRect.Offset(dx, dy); if (dx < 0) { resDx = boundRect.Left < 0 ? dx - boundRect.Left : dx; } else { resDx = boundRect.Right > Width ? dx - (boundRect.Right - Width) : dx; } if (dy < 0) { resDy = boundRect.Top < 0 ? dy - boundRect.Top : dy; } else { resDy = boundRect.Bottom > Height ? dy - (boundRect.Bottom - Height) : dy; } }
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(); }
public IGameSession GetSession(IGraphicObject container, IDependencyContainer dependency) { if (cachedSession == null) { cachedSession = CreateSession(container, dependency); } return(cachedSession); }
protected GameSession(IGraphicObject container) { if (container == null) { throw new ArgumentNullException(nameof(container)); } containerObject = container; }
public Navigator(IGraphicObject root) { if (root == null) { throw new ArgumentNullException(nameof(root)); } this.root = root; }
/// <summary> /// Returns the Graphic component from the specified objct. /// </summary> protected Graphic GetGraphic(IGraphicObject obj) { var graphic = obj.RawObject.GetComponent <Graphic>(); if (graphic == null) { Logger.LogWarning("BaseShaderEffect.GetGraphic - Graphic component not found for object: " + obj.Name); } return(graphic); }
/// <summary> /// Event called when the effect needs to be applied to the host object. /// </summary> protected virtual bool OnApply(IGraphicObject obj) { if (GetGraphic(obj) == null) { return(false); } Component = obj.RawObject.AddComponent <T>(); return(true); }
void IEffect.Revert(IGraphicObject obj) { var graphic = GetGraphic(obj); if (graphic == null) { return; } graphic.material = graphic.defaultMaterial; }
bool IEffect.Apply(IGraphicObject obj) { var graphic = GetGraphic(obj); if (graphic == null) { return(false); } graphic.material = Material; return(true); }
public IAnime GetSubMenuOverlayPopupShow(INavigationView overlay, Func <IGraphicObject> getContainer) { IGraphicObject container = null; var anime = GetSubMenuOverlayShow(overlay); anime.AnimateFloat(y => { if (container == null) { container = getContainer(); } container.Y = y; }) .AddTime(0f, -36f, EaseType.CubicEaseOut) .AddTime(anime.Duration, -16f) .Build(); return(anime); }
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); }
public void CopyGraphics(ICollection <Frame> collection) { IGraphicObject g = _nodeObject as IGraphicObject; if (g != null) { collection.Add(this); } else { FrameComponentColletion c = _nodeObject as FrameComponentColletion; if (c != null) { collection.Add(this); } } if (_nodes != null) { foreach (var item in _nodes) { item.CopyGraphics(collection); } } }
public OverlayNavigator(IGraphicObject root) : base(root) { }
/// <summary> /// Selects graphic objects at point (x;y) /// </summary> /// <param name="x">X-coordinate</param> /// <param name="y">Y-coordinate</param> /// <returns>Returns true if object has been selected otherwise - false</returns> public bool SelectObjectAtCoordinates(int x, int y) { lock (_selectedObjectLock) { _selectedGraphicObject = GetObjectByCoordinate(x, y); return _selectedGraphicObject != null; } }
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; }); }
/// <summary> /// Unselects last selected graphic object /// </summary> public void ClearSelection() { lock (_selectedObjectLock) { _selectedGraphicObject = null; } }
/// <summary> /// Some sort of optimization. Checks if current graphic object is covered by selected one. /// </summary> /// <param name="graphicObject">Object for check</param> /// <returns>Return true if current graphic object is covered by selected on otherwise - false</returns> private bool IsCoverBySelectedObject(IGraphicObject graphicObject) { lock (_selectedObjectLock) { if (_selectedGraphicObject == null || graphicObject == _selectedGraphicObject) { return false; } var selectedBoundRect = _selectedGraphicObject.GetBoundRectangle(); var boundRect = graphicObject.GetBoundRectangle(); var union = Rectangle.Union(selectedBoundRect, boundRect); if (union == selectedBoundRect) { return true; } return false; } }
void IEffect.Revert(IGraphicObject obj) => OnRevert();
protected override void HandleSelection(IGraphicObject graphicObject) { }
public void RemoveObject(IGraphicObject go) { graobjs.Remove(go); }
public BeatsStandardSession(IGraphicObject container) : base(container) { replayInputRecycler = new ManagedRecycler <ReplayableInput>(CreateReplayInput); replayFrameRecycler = new ManagedRecycler <ReplayFrame>(CreateReplayFrame); }
internal System.Windows.Forms.AccessibleObject GetAccessibleChildObject(IGraphicObject graphicObject) { return(iFLGAccessibleObject.GetAccessibleChildObject(graphicObject)); }
public ScreenNavigator(IGraphicObject root) : base(root) { }
public IEnumerator Test() { var dependencies = new DependencyContainer(); dependencies.CacheAs <IDependencyContainer>(dependencies); dependencies.CacheAs <IAtlas <Sprite> >(new ResourceSpriteAtlas()); var env = GraphicTestEnvironment.Create(); var root = env.CreateRoot(dependencies); font = env.ArialFont.ToFont(); var listView = root.CreateChild <UguiListView>("listview"); listViewContainer = listView.Container; listView.Background.Color = new Color(); // Setup properties listView.Limit = 0; Assert.AreEqual(1, listView.Limit); listView.CellSize = new Vector2(150f, 30f); listView.Size = new Vector2(600f, 600f); listView.Initialize(OnCreateItem, OnUpdateItem); while (env.IsRunning) { if (Input.GetKeyDown(KeyCode.Equals)) { listView.TotalItems += 5; } else if (Input.GetKeyDown(KeyCode.Minus)) { listView.TotalItems -= 5; } if (Input.GetKeyDown(KeyCode.Q)) { listView.ForceUpdate(); } if (Input.GetKeyDown(KeyCode.W)) { listView.Recalibrate(); } if (Input.GetKeyDown(KeyCode.A)) { listView.CellWidth += 10; } else if (Input.GetKeyDown(KeyCode.S)) { listView.CellWidth -= 10; } if (Input.GetKeyDown(KeyCode.D)) { listView.CellHeight += 10; } else if (Input.GetKeyDown(KeyCode.F)) { listView.CellHeight -= 10; } if (Input.GetKeyDown(KeyCode.Z)) { listView.Corner = GridLayoutGroup.Corner.UpperLeft; } if (Input.GetKeyDown(KeyCode.X)) { listView.Corner = GridLayoutGroup.Corner.UpperRight; } if (Input.GetKeyDown(KeyCode.C)) { listView.Corner = GridLayoutGroup.Corner.LowerLeft; } if (Input.GetKeyDown(KeyCode.V)) { listView.Corner = GridLayoutGroup.Corner.LowerRight; } if (Input.GetKeyDown(KeyCode.B)) { listView.Axis = GridLayoutGroup.Axis.Horizontal; } if (Input.GetKeyDown(KeyCode.N)) { listView.Axis = GridLayoutGroup.Axis.Vertical; } if (Input.GetKeyDown(KeyCode.O)) { listView.Limit++; } if (Input.GetKeyDown(KeyCode.P)) { listView.Limit--; } if (Input.GetKeyDown(KeyCode.K)) { Debug.Log("Container start pos: " + listView.ContainerStartPos); } if (Input.GetKeyDown(KeyCode.L)) { Debug.Log("Container end pos: " + listView.ContainerEndPos); } yield return(null); } }
public new IFLGEditField EditObject(IGraphicObject objectToEdit, EditObjectActivationMode activationMode) { return(null); }
protected override DragImage CreateAndSetDragImage(IGraphicObject graphicObject, List <Element> data, IDataObject dataObject) { return(null); }
// TODO: protected override IGameSession CreateSession(IGraphicObject container, IDependencyContainer dependency) { return(null); }
protected override Rulesets.UI.GameGui CreateGameGui(IGraphicObject container, IDependencyContainer dependencies) { return(container.CreateChild <GameGui>("beats-standard-gui", dependencies: dependencies)); }
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 void Add(IGraphicObject g) { objList.Add(g); }
/// <summary> /// Creates a new instance of the game gui under the specified container object. /// </summary> protected abstract GameGui CreateGameGui(IGraphicObject container, IDependencyContainer dependencies);
protected override void HandleHover(IGraphicObject graphicObject) { }