-
Notifications
You must be signed in to change notification settings - Fork 2
UDBase.UI.Common
Base class for buttons which perform specific action
public abstract class UDBase.UI.Common.ActionButton
: MonoBehaviourMethods
| Type | Name | Summary |
|---|---|---|
void |
Init() | Must be called in Start callback to set callback and initialy update state |
Boolean |
IsInteractable() | Is should button currently be interactable? |
Boolean |
IsVisible() | Is should button currently visible? |
void |
OnClick() | Concrete action to perform on click |
void |
UpdateState() | Update button visibility and interactable state |
public class UDBase.UI.Common.CustomOverlayFactory
: IFactory<GameObject, UIOverlay>, IFactoryMethods
| Type | Name | Summary |
|---|---|---|
UIOverlay |
Create(GameObject prefab) |
UI elemenent animation clearing is required when animation has state and it needs to be reset when stopping
public interface UDBase.UI.Common.IClearAnimationMethods
| Type | Name | Summary |
|---|---|---|
void |
Clear() | Clear animation state |
Animation when element hiding
public interface UDBase.UI.Common.IHideAnimationMethods
| Type | Name | Summary |
|---|---|---|
void |
Hide(UIElement element, Action action) |
Hide the specified element with callback |
void |
SetHidden() | Set element hide |
Animation, when element showing
public interface UDBase.UI.Common.IShowAnimationMethods
| Type | Name | Summary |
|---|---|---|
void |
SetShown() | Set state to shown |
void |
Show(UIElement element, Action action) |
Show the specified element with action |
public class UDBase.UI.Common.OverlayFactory
: Factory<GameObject, UIOverlay>, IPlaceholderFactory, IValidatable, IFactory<GameObject, UIOverlay>, IFactoryEvent which fired when element is hidden
public struct UDBase.UI.Common.UI_ElementHiddenProperties
| Type | Name | Summary |
|---|---|---|
UIElement |
Element |
Event which fired when element is shown
public struct UDBase.UI.Common.UI_ElementShownProperties
| Type | Name | Summary |
|---|---|---|
UIElement |
Element |
Controller to play animation combinations on UI element
public class UDBase.UI.Common.UIAnimationController
: MonoBehaviour, IShowAnimation, IHideAnimation, IClearAnimationFields
| Type | Name | Summary |
|---|---|---|
List<UIShowHideAnimation> |
HideSteps | All hide animations |
List<UIShowHideAnimation> |
ShowSteps | All show animations |
Boolean |
StepByStep | Shoud animations played step by step? |
Methods
| Type | Name | Summary |
|---|---|---|
void |
Clear() | |
void |
Hide(UIElement element, Action action) |
|
void |
SetHidden() | |
void |
SetShown() | |
void |
Show(UIElement element, Action action) |
Canvas to show overlays
public class UDBase.UI.Common.UICanvas
: MonoBehaviourUIElement is a set of canvas elements with ability to show/hide. If your element contains buttons or other interactable element, CanvasGroup is required.
public class UDBase.UI.Common.UIElement
: MonoBehaviourFields
| Type | Name | Summary |
|---|---|---|
Boolean |
AutoShow | Needs to show element when it is instantiated? |
Boolean |
CacheAnimation | If set, animation retrieved only at first time (usuful if you don't change it at runtime) |
List<UIElement> |
Childs | Child elements |
Boolean |
DisableOnHide | Needs to disable element when it is hidden? |
String |
Group | Optional, you can set it to get ability to interact with all elements with given group |
Boolean |
InitialActive | Needs to set element interactable when it is firstly presented? |
Boolean |
Ordered | If checked, Childs will start to show after parent element is shown and all Childs will be hidden before parent element start to hide |
Properties
| Type | Name | Summary |
|---|---|---|
Boolean |
HasChilds | Has al least one child? |
Boolean |
HasParent | Has a parent element? |
Boolean |
IsInteractable | Gets or sets a value indicating whether this element is interactable |
UIElementState |
State | Current lifetime state |
Methods
| Type | Name | Summary |
|---|---|---|
void |
Activate() | Enable interactions with this element |
void |
Deactivate() | Disable interactions with this element |
void |
Hide() | Hide element with assigned animations |
void |
Init(IEvent events) |
Init with dependencies |
void |
Show() | Show element with assigned animations |
void |
Switch() | Shows element, if it is hidden and opposite |
Static Fields
| Type | Name | Summary |
|---|---|---|
HashSet<UIElement> |
Instances |
Set element visibility from transparent to solid when shown
public class UDBase.UI.Common.UIFadeAnimation
: UIShowHideAnimation, IShowAnimation, IHideAnimation, IClearAnimationFields
| Type | Name | Summary |
|---|---|---|
Single |
Duration | Duration of both animations |
Methods
| Type | Name | Summary |
|---|---|---|
void |
Clear() | |
void |
Hide(UIElement element, Action action) |
|
void |
SetHidden() | |
void |
SetShown() | |
void |
Show(UIElement element, Action action) |
UI system is based on Unity UI and provides you methods of interacting with grouped interface elements which can contain animations. With UIManager you can show overlays and dialogs and also switch elements visibility: all or by its group. You can specify key command to Show/Hide elements using ShowHideToggle field. UIManager is created by request if it is not exist on scene before. To show overlay/dialog you need to add UICanvas component to your canvas, that will show that elements, or assign it directly.
public class UDBase.UI.Common.UIManager
: MonoBehaviourProperties
| Type | Name | Summary |
|---|---|---|
Int32 |
OverlayDepth | How many overlays is shown? |
Methods
| Type | Name | Summary |
|---|---|---|
void |
CallOverlayCallback(Boolean result) |
|
void |
FreeOverlay(Boolean result) |
|
void |
Hide(String group) |
Hide UI elements of the specified group |
void |
HideAll() | Hide all UI elements |
void |
Init(Settings settings, OverlayFactory overlayFactory, List<IContent> loaders, ILog log) |
Init with dependencies |
void |
Show(String group) |
Show UI elements of the specified group |
void |
ShowAll() | Shows all UI elements |
void |
ShowDialog(ContentId content, Action onOk, Action onCancel, Action<GameObject> init = null) |
Shows the dialog with positive and negative callbacks |
void |
ShowDialog(ContentId content, Action<Boolean> callback, Action<GameObject> init = null) |
Shows the dialog with positive and negative callbacks |
void |
ShowDialog(GameObject prefab, Action onOk, Action onCancel, Action<GameObject> init = null) |
Shows the dialog with positive and negative callbacks |
void |
ShowDialog(GameObject prefab, Action<Boolean> callback, Action<GameObject> init = null) |
Shows the dialog with positive and negative callbacks |
void |
ShowOverlay(ContentId content, Action callback, Action<GameObject> init = null) |
Shows the overlay with closing callback |
void |
ShowOverlay(GameObject prefab, Action callback, Action<GameObject> init = null) |
Shows the overlay with closing callback |
Move element with given offset when shown
public class UDBase.UI.Common.UIMoveAnimation
: UIShowHideAnimation, IShowAnimation, IHideAnimation, IClearAnimationFields
| Type | Name | Summary |
|---|---|---|
Single |
Duration | Duration of both animations |
Vector3 |
Offset | Offset to move |
Methods
| Type | Name | Summary |
|---|---|---|
void |
Clear() | |
void |
Hide(UIElement element, Action action) |
|
void |
SetHidden() | |
void |
SetShown() | |
void |
Show(UIElement element, Action action) |
UIOverlay is a component which shows overlays and dialogs to user: it can be closed with boolean argument and you can pass callback which would be executed when wanted result is happen. When overlay is shown, all background elements become non-interactable and made interactable back after overlay is hidden. Overlay can be shown over another overlay.
public class UDBase.UI.Common.UIOverlay
: MonoBehaviourFields
| Type | Name | Summary |
|---|---|---|
OverlayHideMode |
HideMode | How overlay needs to closed? |
Methods
| Type | Name | Summary |
|---|---|---|
void |
Close() | Close this overlay with negative decision |
void |
Close(Boolean result) |
Close this overlay with negative decision |
void |
Init(IEvent events, UIManager manager) |
Init with dependencies |
void |
Show() | Show this overlay |
Scale element from zero to original when shown
public class UDBase.UI.Common.UIScaleAnimation
: UIShowHideAnimation, IShowAnimation, IHideAnimation, IClearAnimationFields
| Type | Name | Summary |
|---|---|---|
Single |
Duration | Duration of both animations |
Methods
| Type | Name | Summary |
|---|---|---|
void |
Clear() | |
void |
Hide(UIElement element, Action action) |
|
void |
SetHidden() | |
void |
SetShown() | |
void |
Show(UIElement element, Action action) |
Base class for full-cycle animations
public abstract class UDBase.UI.Common.UIShowHideAnimation
: MonoBehaviour, IShowAnimation, IHideAnimation, IClearAnimationFields
| Type | Name | Summary |
|---|---|---|
AnimationDirection |
Direction | Desired animation direction |
Properties
| Type | Name | Summary |
|---|---|---|
Boolean |
HasHideAnimation | Heeds to hide animation? |
Boolean |
HasShowAnimation | Needs to show animation? |
Methods
| Type | Name | Summary |
|---|---|---|
void |
Clear() | |
void |
Hide(UIElement element, Action action) |
|
void |
SetHidden() | |
void |
SetShown() | |
void |
Show(UIElement element, Action action) |
Button to simply change state of UI element
public class UDBase.UI.Common.UIStateButton
: ActionButtonFields
| Type | Name | Summary |
|---|---|---|
UIElement |
Element | Element, which state is controlled |
Methods
| Type | Name | Summary |
|---|---|---|
Boolean |
IsInteractable() | |
Boolean |
IsVisible() | |
void |
OnClick() |