Skip to content

Commit 39a5d15

Browse files
committed
chore: update JCSUnity
1 parent 5335d14 commit 39a5d15

File tree

6 files changed

+49
-19
lines changed

6 files changed

+49
-19
lines changed

Assets/JCSUnity/Scripts/Effects/JCS_FadeObject.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,6 @@ private void FadeEffect(JCS_FadeType type, float time)
231231
/// </summary>
232232
private void DoFade()
233233
{
234-
if (GetObjectType() == JCS_UnityObjectType.GAME_OBJECT &&
235-
JCS_GameManager.FirstInstance().gamePaused)
236-
return;
237-
238234
if (!mEffect)
239235
return;
240236

Assets/JCSUnity/Scripts/UI/JCS_Canvas.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ public enum ShowMethod
3838
public Action doHide = null;
3939

4040
// Execution when canvas is shown.
41-
public Action<JCS_Canvas> onShow = null;
41+
public Action<bool> onShow = null;
4242
// Execution when canvas is hidden.
43-
public Action<JCS_Canvas> onHide = null;
43+
public Action<bool> onHide = null;
4444

4545
// Execution when canvas is shown by fading.
46-
public Action<JCS_Canvas> onShowFade = null;
46+
public Action onShowFade = null;
4747
// Execution when canvas is hidden by fading.
48-
public Action<JCS_Canvas> onHideFade = null;
48+
public Action onHideFade = null;
4949

5050
private RectTransform mAppRect = null; // Application Rect (Window)
5151

@@ -329,7 +329,7 @@ public void Show(bool mute = false)
329329

330330
doShow?.Invoke();
331331

332-
onShow?.Invoke(this);
332+
onShow?.Invoke(mute);
333333
}
334334

335335
#region Show
@@ -373,7 +373,7 @@ public void Hide(bool mute = false)
373373

374374
doHide?.Invoke();
375375

376-
onHide?.Invoke(this);
376+
onHide?.Invoke(mute);
377377
}
378378

379379
#region Hide
@@ -496,7 +496,7 @@ private void DoFading()
496496
{
497497
mCanvasGroup.alpha = mFadeInAmount;
498498

499-
onShowFade?.Invoke(this);
499+
onShowFade?.Invoke();
500500
}
501501
break;
502502
case JCS_FadeType.OUT:
@@ -505,7 +505,7 @@ private void DoFading()
505505

506506
mCanvas.enabled = false;
507507

508-
onHideFade?.Invoke(this);
508+
onHideFade?.Invoke();
509509
}
510510
break;
511511
}

Assets/JCSUnity/Scripts/UI/JCS_CanvasComp.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,22 @@ public Action doHide
3737
get => mCanvas.doHide;
3838
set => mCanvas.doHide = value;
3939
}
40-
public Action<JCS_Canvas> onShow
40+
public Action<bool> onShow
4141
{
4242
get => mCanvas.onShow;
4343
set => mCanvas.onShow = value;
4444
}
45-
public Action<JCS_Canvas> onHide
45+
public Action<bool> onHide
4646
{
4747
get => mCanvas.onHide;
4848
set => mCanvas.onHide = value;
4949
}
50-
public Action<JCS_Canvas> onShowFade
50+
public Action onShowFade
5151
{
5252
get => mCanvas.onShowFade;
5353
set => mCanvas.onShowFade = value;
5454
}
55-
public Action<JCS_Canvas> onHideFade
55+
public Action onHideFade
5656
{
5757
get => mCanvas.onHideFade;
5858
set => mCanvas.onHideFade = value;

Assets/JCSUnity/Scripts/Util/JCS_Animator.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ public static bool HasLayer(Animator animator, int index)
5555
/// Like `Animator.HasState` but make second paramter
5656
/// accepts the string.
5757
/// </summary>
58+
public static bool HasState(Animator animator, int layer, int name)
59+
{
60+
// First check if the layer exists.
61+
if (!HasLayer(animator, layer))
62+
return false;
63+
64+
// Then do the check.
65+
return animator.HasState(layer, name);
66+
}
5867
public static bool HasState(Animator animator, int layer, string name)
5968
{
6069
// First check if the layer exists.

Assets/JCSUnity/Scripts/Util/JCS_Path.cs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
* $Notice: See LICENSE.txt for modification and distribution information
77
* Copyright © 2021 by Shen, Jen-Chieh $
88
*/
9+
using System.IO;
10+
using UnityEngine;
911

1012
namespace JCSUnity
1113
{
1214
/// <summary>
13-
/// Wrapper for .NET module `Path`.
15+
/// The utility module for handling path issues.
1416
/// </summary>
1517
public static class JCS_Path
1618
{
@@ -20,6 +22,16 @@ public static class JCS_Path
2022

2123
/* Functions */
2224

25+
/// <summary>
26+
/// Return the normalized path.
27+
/// </summary>
28+
public static string Normalize(string path)
29+
{
30+
return path.Replace(
31+
Path.DirectorySeparatorChar,
32+
Path.AltDirectorySeparatorChar);
33+
}
34+
2335
/// <summary>
2436
/// Safe way to combine multiple path to one path with slash.
2537
/// </summary>
@@ -28,14 +40,27 @@ public static class JCS_Path
2840
public static string Combine(params string[] list)
2941
{
3042
string result = list[0];
43+
3144
for (int index = 1; index < list.Length; ++index)
3245
{
3346
string path = list[index];
3447
result += "/" + path;
3548
}
36-
result = result.Replace("\\", "/");
49+
50+
result = Normalize(result);
3751
result = result.Replace("//", "/");
52+
3853
return result;
3954
}
55+
56+
/// <summary>
57+
/// Convert a path to asset compatible path.
58+
///
59+
/// The returned string should start with `Assets/`.
60+
/// </summary>
61+
public static string ToAsset(string path)
62+
{
63+
return path.Replace(Application.dataPath, "Assets");
64+
}
4065
}
4166
}

Assets/MyBox/Types/StateOnAwake.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)