Class LogUIHandler
Namespace: AS2.UI
Assembly: .dll
Syntax
public class LogUIHandler : MonoBehaviour
Fields
color_debug
Declaration
Field Value
color_error
Declaration
Field Value
color_log
Declaration
Field Value
color_warning
Declaration
public Color color_warning
Field Value
go_elementParent
Declaration
public GameObject go_elementParent
Field Value
Type |
Description |
GameObject |
|
go_expand
Declaration
public GameObject go_expand
Field Value
Type |
Description |
GameObject |
|
go_log
Declaration
Field Value
Type |
Description |
GameObject |
|
instance
Declaration
public static LogUIHandler instance
Field Value
keepVisible
Declaration
Field Value
logElementList
Declaration
public List<GameObject> logElementList
Field Value
Type |
Description |
List<GameObject> |
|
logEntryID
Declaration
Field Value
maxLogEntries
Declaration
private int maxLogEntries
Field Value
Declaration
public Scrollbar scrollBar
Field Value
Type |
Description |
Scrollbar |
|
Declaration
public ScrollRect scrollRect
Field Value
Type |
Description |
ScrollRect |
|
Declaration
private int scrollToBottomInAmountOfFrames
Field Value
timeVisible
Declaration
private float timeVisible
Field Value
timeVisibleInitial
Declaration
private float timeVisibleInitial
Field Value
timestampLastInteraction
Declaration
private float timestampLastInteraction
Field Value
Methods
AddLogEntry(string, EntryType)
Adds a log entry to the log.
Declaration
public void AddLogEntry(string text, LogUIHandler.EntryType type)
Parameters
AddLogEntry(string, EntryType, bool, bool)
Adds a log entry to the log.
Declaration
protected void AddLogEntry(string text, LogUIHandler.EntryType type, bool showNumberOfEntry, bool useOldPrefab = false)
Parameters
Type |
Name |
Description |
string |
text |
The text to log.
|
LogUIHandler.EntryType |
type |
The type of the log entry.
|
bool |
showNumberOfEntry |
True if the number of the entry should be shown.
|
bool |
useOldPrefab |
True if the old prefab which does not support multiline should be used. Recommendation: Keep this at false.
|
AddWelcomeMessage()
Adds the log entries making up the welcome message so that the log is not empty.
Declaration
private void AddWelcomeMessage()
The user pressed the clear log button. Delete all log entries.
Declaration
public void ButtonPressed_ClearLog()
The user pressed the collapse log button. Hide the log panel.
Declaration
public void ButtonPressed_CollapseLog()
The user pressed the expand log button. Show the log panel.
Declaration
public void ButtonPressed_ExpandLog()
GetLogElementTMPHeader(GameObject)
Returns the TMP UGUI for the header.
Declaration
private TextMeshProUGUI GetLogElementTMPHeader(GameObject logElement)
Parameters
Type |
Name |
Description |
GameObject |
logElement |
|
Returns
Type |
Description |
TextMeshProUGUI |
|
GetLogElementTMPText(GameObject)
Returns the TMP UGUI for the text.
Declaration
private TextMeshProUGUI GetLogElementTMPText(GameObject logElement)
Parameters
Type |
Name |
Description |
GameObject |
logElement |
|
Returns
Type |
Description |
TextMeshProUGUI |
|
GetLogElementTextMeshProUGUI(GameObject, int)
Returns the first/second/third/etc... found TMP UGUI in the child elements of the log element. Index starting at 1.
Declaration
private TextMeshProUGUI GetLogElementTextMeshProUGUI(GameObject logElement, int firstSecondEtc)
Parameters
Type |
Name |
Description |
GameObject |
logElement |
|
int |
firstSecondEtc |
|
Returns
Type |
Description |
TextMeshProUGUI |
|
Hide()
Declaration
InitLog()
Initializes the log and writes some welcome message.
Declaration
Scrolls to the bottom of the log.
We call this method after some very small number of frames because Unity needs to update some internal UI stuff before the sizes of the UI elements are in the system.
Declaration
public void ScrollToBottom()
Show(bool, bool)
Declaration
public void Show(bool scrollDown, bool keepVisible)
Parameters
Type |
Name |
Description |
bool |
scrollDown |
True if the log should scroll down.
|
bool |
keepVisible |
True if the log should be kept visible, false if it should disappear automatically after some time.
|
Start()
Declaration
Update()
Update loop for the log UI, called each frame.
Declaration