C# Class UIScreen, Unity-UI-Framework

UIScreen contains dictionaries which keeps references to all Text, Slider, Image.
Inheritance: MonoBehaviour
Datei anzeigen Open project: psuong/Unity-UI-Framework Class Usage Examples

Protected Properties

Property Type Description
imageDict Image>.Dictionary
sliderDict Slider>.Dictionary
textDict Text>.Dictionary

Public Methods

Method Description
CloseThisScreen ( ) : void

Deactivates the instance of a gameObject that UI_Screen is attached to.

GetImage ( string imageName ) : Image

Returns an instance of an image.

GetSlider ( string sliderName ) : Slider,

Returns an instance of a slider.

GetText ( string textName ) : Text

Returns an instance of a Text gameObject.

OpenThisScreen ( ) : void

Activates the instance of a gameObject that UI_Screen is attached to.

SetImageColor ( string imageName, Color setColor ) : void

Takes in a Unity's Color component and sets the Image Component to that that color.

SetImageColor ( string imageName, float r, float g, float b, float a = 1 ) : void

Takes in Unity's Color RGBA values as a float between 0 and 1 and sets the ImageComponent to that color.

SetImageFill ( string imageName, float fillValue ) : void
SetSliderFill ( string sliderName, float sliderValue ) : void

Sets the slider's fill value to the desired amount.

SetSliderFill ( string sliderName, int sliderValue ) : void

Overloads the SetSliderFill method to take in whole numbers (integers) and set the value of the slider to that value.

SetText ( string textName, string screenText ) : void

Sets the text variable in the Text gameObject to a custom string.

SetUp ( ) : void

Populates the dictionaries with references to all Text, Image, and Slider components within the scene.

TextProgression ( string textName, string rollingText, KeyCode, interruptKey ) : System.Collections.IEnumerator

Sets text to progress one letter at a time

Protected Methods

Method Description
Start ( ) : void

Unity's Start() method; this checks to see if the dictionaries are built up, if not then it builds up the dictionaries.

Private Methods

Method Description
SetUpImageDict ( Image imageList ) : void

Builds the imageDict with keys as a unique Image Component's name and value as the associated Image's object.

SetUpSliderDict ( Slider, sliderList ) : void

Builds the sliderDict with keys as a unique Slider Component's name and value as the associated Slider's object.

SetUpTextDict ( Text textList ) : void

Builds the textDict with keys as a unique Text Component's name and the value as the associated Text's object.

Method Details

CloseThisScreen() public method

Deactivates the instance of a gameObject that UI_Screen is attached to.
public CloseThisScreen ( ) : void
return void

GetImage() public method

Returns an instance of an image.
public GetImage ( string imageName ) : Image
imageName string Name of the image gameObject
return Image

GetSlider() public method

Returns an instance of a slider.
public GetSlider ( string sliderName ) : Slider,
sliderName string Name of the slider gameObject
return Slider,

GetText() public method

Returns an instance of a Text gameObject.
public GetText ( string textName ) : Text
textName string Name of the text gameObject.
return Text

OpenThisScreen() public method

Activates the instance of a gameObject that UI_Screen is attached to.
public OpenThisScreen ( ) : void
return void

SetImageColor() public method

Takes in a Unity's Color component and sets the Image Component to that that color.
public SetImageColor ( string imageName, Color setColor ) : void
imageName string Name of the Image Component
setColor Color Color value
return void

SetImageColor() public method

Takes in Unity's Color RGBA values as a float between 0 and 1 and sets the ImageComponent to that color.
public SetImageColor ( string imageName, float r, float g, float b, float a = 1 ) : void
imageName string Name of the Image Component
r float Float value between 0 and 1 for the red component
g float Float value between 0 and 1 for the green component
b float Float value between 0 and 1 for the blue component
a float Float value between 0 and 1 for the alpha component
return void

SetImageFill() public method

public SetImageFill ( string imageName, float fillValue ) : void
imageName string
fillValue float
return void

SetSliderFill() public method

Sets the slider's fill value to the desired amount.
public SetSliderFill ( string sliderName, float sliderValue ) : void
sliderName string Name of the slider component
sliderValue float Float value between the min and the max values.
return void

SetSliderFill() public method

Overloads the SetSliderFill method to take in whole numbers (integers) and set the value of the slider to that value.
public SetSliderFill ( string sliderName, int sliderValue ) : void
sliderName string Name of the slider component (string)
sliderValue int Integer value of the slider's value between the min and max values.
return void

SetText() public method

Sets the text variable in the Text gameObject to a custom string.
public SetText ( string textName, string screenText ) : void
textName string Name of the Text Component
screenText string The string to display
return void

SetUp() public method

Populates the dictionaries with references to all Text, Image, and Slider components within the scene.
public SetUp ( ) : void
return void

Start() protected method

Unity's Start() method; this checks to see if the dictionaries are built up, if not then it builds up the dictionaries.
protected Start ( ) : void
return void

TextProgression() public method

Sets text to progress one letter at a time
public TextProgression ( string textName, string rollingText, KeyCode, interruptKey ) : System.Collections.IEnumerator
textName string Name of the Text Component
rollingText string The text to be displayed progressively
interruptKey KeyCode, Set key to interrupt the coroutine and display the entire text
return System.Collections.IEnumerator

Property Details

imageDict protected_oe property

protected Dictionary imageDict
return Image>.Dictionary

sliderDict protected_oe property

protected Dictionary sliderDict
return Slider>.Dictionary

textDict protected_oe property

protected Dictionary textDict
return Text>.Dictionary