Skip to content

Commit d575412

Browse files
committed
Impls new component 3d bubble hint.
1 parent ecfbd78 commit d575412

File tree

5 files changed

+261
-33
lines changed

5 files changed

+261
-33
lines changed

Assets/JCSUnity/Scenes/Demo/3D/JCS_Demo3D.unity

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,7 @@ GameObject:
958958
- component: {fileID: 515040522}
959959
- component: {fileID: 515040521}
960960
- component: {fileID: 515040520}
961+
- component: {fileID: 515040523}
961962
m_Layer: 0
962963
m_Name: Text (TMP)
963964
m_TagString: Untagged
@@ -1002,7 +1003,7 @@ MonoBehaviour:
10021003
m_OnCullStateChanged:
10031004
m_PersistentCalls:
10041005
m_Calls: []
1005-
m_text: Sample text
1006+
m_text: Hint here!!
10061007
m_isRightToLeft: 0
10071008
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
10081009
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
@@ -1011,8 +1012,8 @@ MonoBehaviour:
10111012
m_fontMaterials: []
10121013
m_fontColor32:
10131014
serializedVersion: 2
1014-
rgba: 4294967295
1015-
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
1015+
rgba: 16777215
1016+
m_fontColor: {r: 1, g: 1, b: 1, a: 0}
10161017
m_enableVertexGradient: 0
10171018
m_colorMode: 3
10181019
m_fontColorGradient:
@@ -1161,6 +1162,7 @@ MonoBehaviour:
11611162
m_Script: {fileID: 11500000, guid: de994b17122351641ad7dce1fba0922c, type: 3}
11621163
m_Name:
11631164
m_EditorClassIdentifier:
1165+
mTestWithKey: 1
11641166
mActiveKey: 97
11651167
mDeactiveKey: 115
11661168
mTweenerHandler: {fileID: 0}
@@ -1177,7 +1179,7 @@ MonoBehaviour:
11771179
m_Script: {fileID: 11500000, guid: 45615b6dd23b56f459d954b52ad1fdbf, type: 3}
11781180
m_Name:
11791181
m_EditorClassIdentifier:
1180-
mObjectType: 0
1182+
mObjectType: 4
11811183
mTestWithKey: 0
11821184
mFadeInKey: 109
11831185
mFadeOutKey: 110
@@ -1200,7 +1202,47 @@ MonoBehaviour:
12001202
m_Name:
12011203
m_EditorClassIdentifier:
12021204
mPanelRoot: {fileID: 0}
1203-
mTweenInfos: []
1205+
mTweenInfos:
1206+
- startingValue: {x: 0, y: 0, z: 0}
1207+
transformTweener: {fileID: 515040523}
1208+
targetValue: {x: 0, y: 2, z: 0}
1209+
--- !u!114 &515040523
1210+
MonoBehaviour:
1211+
m_ObjectHideFlags: 0
1212+
m_CorrespondingSourceObject: {fileID: 0}
1213+
m_PrefabInstance: {fileID: 0}
1214+
m_PrefabAsset: {fileID: 0}
1215+
m_GameObject: {fileID: 515040514}
1216+
m_Enabled: 1
1217+
m_EditorHideFlags: 0
1218+
m_Script: {fileID: 11500000, guid: 5952853e70b094f44b68c8597013bde6, type: 3}
1219+
m_Name:
1220+
m_EditorClassIdentifier:
1221+
mObjectType: 4
1222+
mTestWithKey: 0
1223+
mTweenToAKey: 97
1224+
mTweenToA: {x: 0, y: 0, z: 0}
1225+
mTweenToBKey: 98
1226+
mTweenToB: {x: 5, y: 5, z: 5}
1227+
mContinueKeyTween: 99
1228+
mContinueTween: 0
1229+
mTargetTransform: {fileID: 0}
1230+
mIsDoneTweening: 0
1231+
mTween: 1
1232+
mValueOffset: {x: 0, y: 0, z: 0}
1233+
mDurationX: 1
1234+
mDurationY: 1
1235+
mDurationZ: 1
1236+
mDestroyWhenDoneTweening: 0
1237+
mDestroyDoneTweeningCount: 1
1238+
mRandomizeDuration: 0
1239+
mTweenType: 0
1240+
mTrackAsLocalSelf: 1
1241+
mTrackAsLocalTarget: 1
1242+
mEasingX: 0
1243+
mEasingY: 0
1244+
mEasingZ: 0
1245+
mStopTweenDistance: 1
12041246
--- !u!1 &594004494
12051247
GameObject:
12061248
m_ObjectHideFlags: 0

Assets/JCSUnity/Scripts/Effects/Tweener/JCS_ColorTweener.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ [SerializeField] [Range(0.01f, 1000.0f)]
151151
[SerializeField]
152152
private UnityEvent mUnityCallback = null;
153153

154-
155154
/* Setter & Getter */
156155

157156
public bool Animating { get { return (mEasingR || mEasingG || mEasingB || mEasingA); } }
@@ -212,7 +211,6 @@ public void SetCallback(CallBackDelegate func)
212211
this.mColorCallback = func;
213212
}
214213

215-
216214
/* Functions */
217215

218216
protected override void Awake()

Assets/JCSUnity/Scripts/Enums/JCS_UnityObjectType.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
* $Notice: See LICENSE.txt for modification and distribution information
77
* Copyright (c) 2016 by Shen, Jen-Chieh $
88
*/
9+
/* NOTE: If you are using `TextMesh Pro` uncomment this line.
10+
*/
11+
#define TMP_PRO
12+
913
using UnityEngine;
1014
using System.Collections;
1115

@@ -19,6 +23,9 @@ public enum JCS_UnityObjectType
1923
GAME_OBJECT,
2024
UI,
2125
SPRITE,
22-
TEXT
26+
TEXT,
27+
#if TMP_PRO
28+
TMP, // Text Mesh Pro
29+
#endif
2330
}
2431
}

Assets/JCSUnity/Scripts/GameObject/3D/JCS_3DHintBubble.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public class JCS_3DHintBubble
3737
#if UNITY_EDITOR
3838
[Header("** Helper Variables (JCS_3DHintBubble) **")]
3939

40+
[Tooltip("Test this component with these keys.")]
41+
[SerializeField]
42+
private bool mTestWithKey = false;
43+
4044
[Tooltip("Key to active hint bubble.")]
4145
[SerializeField]
4246
private KeyCode mActiveKey = KeyCode.A;
@@ -49,7 +53,7 @@ public class JCS_3DHintBubble
4953

5054
[Header("** Check Variables (JCS_3DHintBubble) **")]
5155

52-
[Tooltip("Tweeener handler.")]
56+
[Tooltip("Tweener handler to do tween to the bubble hint.")]
5357
[SerializeField]
5458
private JCS_TweenerHandler mTweenerHandler = null;
5559

@@ -75,26 +79,47 @@ private void Awake()
7579
#if UNITY_EDITOR
7680
private void Update()
7781
{
82+
Test();
83+
}
84+
85+
private void Test()
86+
{
87+
if (!mTestWithKey)
88+
return;
89+
7890
if (JCS_Input.GetKeyDown(mActiveKey))
7991
Active();
8092
else if (JCS_Input.GetKeyDown(mDeactiveKey))
8193
Deactive();
8294
}
8395
#endif
8496

97+
/// <summary>
98+
/// Set the text and active.
99+
/// </summary>
100+
/// <param name="msg"></param>
85101
public void SendText(string msg)
86102
{
87103
mTextMesh.text = msg;
104+
Active();
88105
}
89106

107+
/// <summary>
108+
/// Active this bubble hint.
109+
/// </summary>
90110
public void Active()
91111
{
92112
TweenerHandler.DoAllTweenToTargetValue();
113+
mFadeObject.FadeIn();
93114
}
94115

116+
/// <summary>
117+
/// Deactive this bubble hint.
118+
/// </summary>
95119
public void Deactive()
96120
{
97121
TweenerHandler.DoAllTweenToStartValue();
122+
mFadeObject.FadeOut();
98123
}
99124
}
100125
}

0 commit comments

Comments
 (0)