Skip to content

Commit 98e043d

Browse files
committed
refactor: Improve IG log APIs
1 parent 1eed92d commit 98e043d

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

Assets/JCSUnity/Scripts/UI/Logging/JCS_IGLogSystem.cs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace JCSUnity
1616
/// </summary>
1717
[RequireComponent(typeof(RectTransform))]
1818
[RequireComponent(typeof(JCS_GUITextPool))]
19+
[DisallowMultipleComponent]
1920
public class JCS_IGLogSystem : JCS_UnityObject
2021
{
2122
/* Variables */
@@ -82,33 +83,27 @@ private void Test()
8283
return;
8384

8485
if (JCS_Input.GetKeyDown(sendTextAKey))
85-
SendLogMessage(textA);
86+
Send(textA);
8687
if (JCS_Input.GetKeyDown(sendTextBKey))
87-
SendLogMessage(textB);
88+
Send(textB);
8889
if (JCS_Input.GetKeyDown(sendRandomTextArrayKey))
8990
{
90-
SendLogMessages(textArray);
91+
Send(textArray);
9192
}
9293
}
9394
#endif
9495

9596
/// <summary>
96-
/// Make multiple log messages on the screen.
97+
/// Make log message(s) on the screen.
9798
/// </summary>
98-
/// <param name="messages"></param>
99-
public void SendLogMessages(string[] messages)
99+
public void Send(params string[] msgs)
100100
{
101-
foreach (string msg in messages)
101+
foreach (string msg in msgs)
102102
{
103-
SendLogMessage(msg);
103+
Send(msg);
104104
}
105105
}
106-
107-
/// <summary>
108-
/// Make single log message on the screen.
109-
/// </summary>
110-
/// <param name="message"></param>
111-
public void SendLogMessage(string message)
106+
public void Send(string msg)
112107
{
113108
// get one log text from the pool
114109
JCS_LogText logText = mLogTextPool.ExecuteOneFromPool();
@@ -132,7 +127,7 @@ public void SendLogMessage(string message)
132127

133128
// this will set the log text active,
134129
// so it wont be reuse until is fade out.
135-
logText.Execute(message);
130+
logText.Execute(msg);
136131
}
137132

138133
/// <summary>

Assets/JCSUnity/Scripts/UI/Logging/JCS_LogText.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace JCSUnity
1717
[RequireComponent(typeof(JCS_FadeObject))]
1818
[RequireComponent(typeof(JCS_SimpleTrackAction))]
1919
[RequireComponent(typeof(JCS_SlideEffect))]
20+
[DisallowMultipleComponent]
2021
public class JCS_LogText : JCS_TextObject
2122
{
2223
/* Variables */
@@ -31,7 +32,7 @@ public class JCS_LogText : JCS_TextObject
3132
[SerializeField]
3233
private JCS_IGLogSystem mIGLogSystem = null;
3334

34-
[Tooltip("Is the log text active?")]
35+
[Tooltip("True when the log text is active.")]
3536
[SerializeField]
3637
private bool mActive = false;
3738

Assets/_BossFight/Scripts/BF_LiveObject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public override void Die()
100100
{
101101
string expMsg = BF_MessageSettings.FirstInstance().EXP_BASE + exp.ToString();
102102

103-
igls.SendLogMessage(expMsg);
103+
igls.Send(expMsg);
104104
}
105105

106106
base.Die();

docs/ScriptReference/UI/Logging/JCS_IGLogSystem.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ In game log system.
1212

1313
| Name | Description |
1414
|:--------------------|:-------------------------------------------------|
15-
| SendLogMessage | Make single log message on the screen. |
16-
| SendLogMessages | Make multiple log messages on the screen. |
15+
| Send | Make log message(s) on the screen. |
1716
| RemoveFromRenderVec | Remove the log message that are outdated. |
1817
| UpdateSpace | Update all current active log messages' spacing. |
1918

0 commit comments

Comments
 (0)