IV API Demo

Infinite Value Public API

🠔 Tables of content

Demo

namespace: IV_Demo
Here you can check every scripts used for the demo.

Scriptable Objects

ADisplayedScriptableObject Abstract class that will be inherited by both Upgrade and Income.
public class ADisplayedScriptableObject : ScriptableObject

Abstract class that will be inherited by both Upgrade and Income.
This will create a readable name from the file name and define an image and description to use when displaying the object in game.
Income Represent incomes that will be loaded by the DataBase manager.
public class Income : ADisplayedScriptableObject

Represent incomes that will be loaded by the DataBase manager.
Define the income power and price.
Upgrade Represent upgrades that will be loaded by the DataBase manager.
public class Upgrade : ADisplayedScriptableObject

Represent upgrades that will be loaded by the DataBase manager.
Define the upgrade target, power and price.

Managers

AManager Base abstract class for managers.
public class AManager<T> : MonoBehaviour where T: AManager<T>

Base abstract class for managers.
A manager instance can be accessed from a static context by a child class with the instance property.
Audio A simple Audio manager.
public class Audio : AManager<Audio>

A simple Audio manager.
It will play a single music on loop and sounds on multiples audio sources generated automatically.
You can add sounds by editing the Sound enum (+ the soundsCount const).
DataBase Game data loader.
public class DataBase : AManager<DataBase>

Game data loader.
This manager will load incomes, upgrades and text files using the Resources class.
It will then parse the text files to generate multiples small texts to type in the play zone.
Those can then be accessed from other objects.
GlobalModifier Apply global modifications to every scene Objects.
public class GlobalModifier : AManager<GlobalModifier>

Apply global modifications to every scene Objects.
This Manager is useful for making global changes to the scene before building the game.
Thing that apply to a lot of objects or that you could forget to toggle when working on the scene.
Inventory Store the player current state.
public class Inventory : AManager<Inventory>

Store the player current state.
This manager stores the player score, money, incomes and upgrades.
It also define the player current statistics.
SaveAndLoad A simple save and load system featuring an autosave and import/export functionality.
public class SaveAndLoad : AManager<SaveAndLoad>

A simple save and load system featuring an autosave and import/export functionality.
The data will be stored in a text file using readable JSON.

It features a cheat key system, this way the player can freely modify the JSON representation of the saved data but the game will know about it and mark the game as cheated.

UI Components

General
ButtonSound Component that will play a sound when a button is clicked.
public class ButtonSound : MonoBehaviour, IPointerClickHandler

Component that will play a sound when a button is clicked.
The sound is different if the button is interactable or not. No sound will be played if the button is disabled.
CopyRectTransformSize Copy another RectTransform size.
public class CopyRectTransformSize : MonoBehaviour

Copy another RectTransform size.
This will work in edit mode.
GraphicEffect Apply effects to a UI.Graphic component.
public class GraphicEffect : MonoBehaviour

Apply effects to a UI.Graphic component.
The effects are made using the CrossFadeColor method.
They can be a simple color change, a singular flash, or repeating flashes (blink).
Their will be a smooth transition between effects.
HoldableButton Make a button holdeable.
public class HoldableButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IPointerExitHandler

Make a button holdeable.
You can change how often OnClick event will be generated when holding a button.
SplitChilds Split 2 or 3 childs of an object automatically.
public class SplitChilds : MonoBehaviour

Split 2 or 3 childs of an object automatically.
It is to be used on the parent of UI objects set to full stretch.
It is similar to a LayoutGroup but doesn’t consider the content of the objects.
This will work in edit mode.
ToolTip Add a tooltip to an UI Object.
public class ToolTip : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler

Add a tooltip to an UI Object.
This Component is used by the TooltipWindow to create tooltips appearing when hovering over the Object.
Main
CenterPanelChooser Component used by the left and right panels to show two sub-panels.
public class CenterPanelChooser : MonoBehaviour

Component used by the left and right panels to show two sub-panels.
PlayZone Main menu where the user can type to create games.
public class PlayZone : MonoBehaviour

Main menu where the user can type to create games.
IncomesDisplay Incomes shop.
public class IncomesDisplay : MonoBehaviour

Incomes shop.
UpgradesDisplay Upgrades shop.
public class UpgradesDisplay : MonoBehaviour

Upgrades shop.
CheatZone Menu where the player can cheat.
public class CheatZone : MonoBehaviour

Menu where the player can cheat.
If used, it will mark the game as cheated forever.
ScoreDisplay Display the current score (number of games created).
public class ScoreDisplay : MonoBehaviour

Display the current score (number of games created).
MoneyDisplay Display the current money the player have.
public class MoneyDisplay : MonoBehaviour

Display the current money the player have.
Options Options menu.
public class Options : MonoBehaviour

Options menu.
Includes audio volume change, a link to the Juste Tools website and buttons for opening the save menus.
Stats Display the current statistics of the player.
public class Stats : MonoBehaviour

Display the current statistics of the player.
Other
Borders Simple Component that will move the center border to the correct position.
public class Borders : MonoBehaviour

Simple Component that will move the center border to the correct position.
SaveWindows Import and export save menus.
public class SaveWindows : MonoBehaviour

Import and export save menus.
This Component will call the SaveAndLoad manager.
StartWindow Screen displayed at the start of the game.
public class StartWindow : MonoBehaviour

Screen displayed at the start of the game.
If the game is launched for the first time, it will display a tutorial. Otherwise it display how many games were generated while the demo was closed.
TooltipWindow Show a tooltip when hovering over an object.
public class TooltipWindow : MonoBehaviour

Show a tooltip when hovering over an object.
This script is called by Tooltip components to display a window with a text.

Utilities

Inspector Attributes Attributes used in the demo to easily customize the inspector.
GitHub source

public class ButtonParameterAttribute : PropertyAttribute

This attribute will create a button next to a field in the inspector that will call a given method with the field as it’s parameter.
You can use the type “InspectorTrigger” if your method doesn’t take any parameters. You can also input a button text as an argument (default is to use the method name).

public class ConditionalHideAttribute : PropertyAttribute

This attribute allow you to hide a field in the inspector depending on a condition.

public class PreviewSpriteAttribute : PropertyAttribute

This attribute allow you to preview a sprite in the inspector, use it with a Sprite field.
You can specify the preview sprite height as an argument.

public class ReadOnlyAttribute : PropertyAttribute

This attribute will show a field as readonly in the inspector.
MinMax Structure defining a range.
public struct MinMax

Structure defining a range between a min and a max.
CustomRandom Class defining a ponderated random method.
public static class CustomRandom

Class defining a ponderated random method.
Ponderated means each possible outcomes won’t have the same chance of being returned.
OnValidateUtility Class useful for creating an array of parameters for each enum values.
public static class OnValidateUtility

Class useful for creating an array of parameters for each enum values.
This should be used in OnValidate.
WebGLCopyAndPaste Class that provides support for copy and paste when building for WebGL.
GitHub source

Class that provides support for copy and paste when building for WebGL.