Initial commit: Unity WordConnect project
This commit is contained in:
@ -0,0 +1,105 @@
|
||||
// // ©2015 - 2025 Candy Smith
|
||||
// // All rights reserved
|
||||
// // Redistribution of this software is strictly not allowed.
|
||||
// // Copy of this software can be obtained from unity asset store only.
|
||||
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// // THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using WordsToolkit.Scripts.Gameplay.Pool;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace WordsToolkit.Scripts.GUI.Labels
|
||||
{
|
||||
public class CurrencyLabelAnimation : LabelAnim, ILabelAnimation
|
||||
{
|
||||
public void Animate(GameObject sourceObject, Vector3 startPosition, string rewardDataCount, AudioClip sound, Action callback)
|
||||
{
|
||||
var count = 0;
|
||||
var animateCount = 4;
|
||||
var targetPosition = targetTransform.transform.position;
|
||||
// if (coinsTextPrefab != null)
|
||||
// {
|
||||
// PopupText(startPosition, rewardDataCount);
|
||||
// }
|
||||
if (targetTransform)
|
||||
{
|
||||
for (var i = 0; i < animateCount; i++)
|
||||
{
|
||||
var item = GetAnimatedObjectSource(sourceObject);
|
||||
var random = .5f;
|
||||
item.transform.position = startPosition + new Vector3(Random.Range(-random, random), Random.Range(-random, random));
|
||||
var randomStartDelay = i==0? 0 : Random.Range(0f, 0.5f);
|
||||
StartAnim(item.transform, targetPosition, randomStartDelay, () =>
|
||||
{
|
||||
animatedObjectSource.ReleaseObject(item);
|
||||
if (doPunchScale == null || !doPunchScale.IsPlaying())
|
||||
{
|
||||
var punchScale = transform.DOPunchScale(Vector3.one * 0.2f, 0.2f);
|
||||
punchScale.OnComplete(() => { doPunchScale = null; });
|
||||
doPunchScale = punchScale;
|
||||
}
|
||||
|
||||
if (fxPrefab != null)
|
||||
{
|
||||
var fx = PoolObject.GetObject(fxPrefab, targetPosition);
|
||||
fx.transform.localScale = Vector3.one;
|
||||
fx.transform.position = targetPosition;
|
||||
DOVirtual.DelayedCall(1f, () => { PoolObject.Return(fx); });
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
_audioService.PlaySound(sound);
|
||||
}
|
||||
|
||||
count++;
|
||||
if (count == animateCount)
|
||||
{
|
||||
transform.localScale = Vector3.one;
|
||||
callback?.Invoke();
|
||||
DOVirtual.DelayedCall(.5f, () => { DOTween.Kill(gameObject); });
|
||||
}
|
||||
|
||||
PoolObject.Return(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void StartAnim(Transform targetTransform, Vector3 targetPos, float randomStartDelay, Action callback = null)
|
||||
{
|
||||
var sequence = DOTween.Sequence();
|
||||
|
||||
targetTransform.localScale = Vector3.zero;
|
||||
var _scaleTween = targetTransform.DOScale(Vector3.one * 1f, .5f)
|
||||
.SetEase(Ease.OutBack)
|
||||
.SetDelay(randomStartDelay);
|
||||
|
||||
sequence.Append(_scaleTween);
|
||||
var _rotationTween = targetTransform.DORotate(new Vector3(0, 0, Random.Range(0, 360)), .3f)
|
||||
.SetEase(Ease.Linear)
|
||||
.SetLoops(1, LoopType.Incremental);
|
||||
|
||||
sequence.Join(_rotationTween);
|
||||
|
||||
var _movementTween = targetTransform.DOMove(targetPos, .3f)
|
||||
.SetEase(Ease.Linear)
|
||||
.OnComplete(() =>
|
||||
{
|
||||
callback?.Invoke();
|
||||
targetTransform.gameObject.SetActive(false);
|
||||
});
|
||||
|
||||
sequence.Join(_movementTween);
|
||||
sequence.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70fae662836044c79412a304f4a5d3f3
|
||||
timeCreated: 1748447122
|
||||
@ -0,0 +1,104 @@
|
||||
// // ©2015 - 2025 Candy Smith
|
||||
// // All rights reserved
|
||||
// // Redistribution of this software is strictly not allowed.
|
||||
// // Copy of this software can be obtained from unity asset store only.
|
||||
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// // THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using WordsToolkit.Scripts.Gameplay.Pool;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace WordsToolkit.Scripts.GUI.Labels
|
||||
{
|
||||
public class GemsLabelAnimation : LabelAnim, ILabelAnimation
|
||||
{
|
||||
public void Animate(GameObject sourceObject, Vector3 startPosition, string rewardDataCount, AudioClip sound, Action callback)
|
||||
{
|
||||
var count = 0;
|
||||
var animateCount = 4;
|
||||
var targetPosition = targetTransform.transform.position;
|
||||
// if (coinsTextPrefab != null)
|
||||
// {
|
||||
// PopupText(startPosition, rewardDataCount);
|
||||
// }
|
||||
if (targetTransform)
|
||||
{
|
||||
for (var i = 0; i < animateCount; i++)
|
||||
{
|
||||
var item = GetAnimatedObjectSource(sourceObject);
|
||||
var random = .5f;
|
||||
item.transform.position = startPosition + new Vector3(Random.Range(-random, random), Random.Range(-random, random));
|
||||
var randomStartDelay = i==0? 0 : Random.Range(0f, 0.5f);
|
||||
if (count == 0)
|
||||
{
|
||||
_audioService.PlayDelayed(sound, 1.0f);
|
||||
}
|
||||
StartAnim(item.transform, targetPosition, randomStartDelay, () =>
|
||||
{
|
||||
animatedObjectSource.ReleaseObject(item);
|
||||
if (doPunchScale == null || !doPunchScale.IsPlaying())
|
||||
{
|
||||
var punchScale = transform.DOPunchScale(Vector3.one * 0.2f, 0.2f);
|
||||
punchScale.OnComplete(() => { doPunchScale = null; });
|
||||
doPunchScale = punchScale;
|
||||
}
|
||||
|
||||
if (fxPrefab != null)
|
||||
{
|
||||
var fx = PoolObject.GetObject(fxPrefab, targetPosition);
|
||||
fx.transform.localScale = Vector3.one;
|
||||
fx.transform.position = targetPosition;
|
||||
DOVirtual.DelayedCall(1f, () => { PoolObject.Return(fx); });
|
||||
}
|
||||
|
||||
count++;
|
||||
if (count == animateCount)
|
||||
{
|
||||
transform.localScale = Vector3.one;
|
||||
callback?.Invoke();
|
||||
DOVirtual.DelayedCall(.5f, () => { DOTween.Kill(gameObject); });
|
||||
}
|
||||
|
||||
PoolObject.Return(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void StartAnim(Transform targetTransform, Vector3 targetPos, float randomStartDelay, Action callback = null)
|
||||
{
|
||||
var sequence = DOTween.Sequence();
|
||||
|
||||
targetTransform.localScale = Vector3.zero;
|
||||
var _scaleTween = targetTransform.DOScale(Vector3.one * 1f, .5f)
|
||||
.SetEase(Ease.OutBack)
|
||||
.SetDelay(randomStartDelay);
|
||||
|
||||
sequence.Append(_scaleTween);
|
||||
var _rotationTween = targetTransform.DORotate(new Vector3(0, 0, Random.Range(0, 360)), .3f)
|
||||
.SetEase(Ease.Linear)
|
||||
.SetLoops(1, LoopType.Incremental);
|
||||
|
||||
sequence.Join(_rotationTween);
|
||||
|
||||
var _movementTween = targetTransform.DOMove(targetPos, 0.5f)
|
||||
.SetEase(Ease.Linear)
|
||||
.OnComplete(() =>
|
||||
{
|
||||
callback?.Invoke();
|
||||
targetTransform.gameObject.SetActive(false);
|
||||
});
|
||||
|
||||
sequence.Append(_movementTween);
|
||||
sequence.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5011c5819a984dbeac491d82a8128433
|
||||
timeCreated: 1749031939
|
||||
@ -0,0 +1,18 @@
|
||||
// // ©2015 - 2025 Candy Smith
|
||||
// // All rights reserved
|
||||
// // Redistribution of this software is strictly not allowed.
|
||||
// // Copy of this software can be obtained from unity asset store only.
|
||||
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// // THE SOFTWARE.
|
||||
|
||||
namespace WordsToolkit.Scripts.GUI.Labels
|
||||
{
|
||||
public class HammerLabelAnimation : IconLabel
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 339d208ff02448daae7bbd7af2000c48
|
||||
timeCreated: 1748439618
|
||||
@ -0,0 +1,68 @@
|
||||
// // ©2015 - 2025 Candy Smith
|
||||
// // All rights reserved
|
||||
// // Redistribution of this software is strictly not allowed.
|
||||
// // Copy of this software can be obtained from unity asset store only.
|
||||
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// // THE SOFTWARE.
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.Pool;
|
||||
|
||||
namespace WordsToolkit.Scripts.GUI.Labels
|
||||
{
|
||||
public interface IAnimationSource
|
||||
{
|
||||
GameObject GetAnimatedObject();
|
||||
void ReleaseObject(GameObject animatedObject);
|
||||
}
|
||||
|
||||
public class PooledAnimationSource : IAnimationSource
|
||||
{
|
||||
private readonly ObjectPool<GameObject> _pool;
|
||||
|
||||
public PooledAnimationSource(GameObject prefab, Transform transform)
|
||||
{
|
||||
_pool = new ObjectPool<GameObject>(
|
||||
() => Object.Instantiate(prefab, transform),
|
||||
animatedObject => animatedObject.SetActive(true),
|
||||
animatedObject => animatedObject.SetActive(false),
|
||||
Object.Destroy
|
||||
);
|
||||
}
|
||||
|
||||
public GameObject GetAnimatedObject()
|
||||
{
|
||||
return _pool.Get();
|
||||
}
|
||||
|
||||
public void ReleaseObject(GameObject animatedObject)
|
||||
{
|
||||
_pool.Release(animatedObject);
|
||||
}
|
||||
}
|
||||
|
||||
public class SingleObjectAnimationSource : IAnimationSource
|
||||
{
|
||||
private readonly GameObject _animatedObject;
|
||||
|
||||
public SingleObjectAnimationSource(GameObject animatedObject)
|
||||
{
|
||||
_animatedObject = animatedObject;
|
||||
}
|
||||
|
||||
public GameObject GetAnimatedObject()
|
||||
{
|
||||
return _animatedObject;
|
||||
}
|
||||
|
||||
public void ReleaseObject(GameObject animatedObject)
|
||||
{
|
||||
animatedObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad866880d5bd4e2a8c3bfe3bfb298d9c
|
||||
timeCreated: 1748509775
|
||||
@ -0,0 +1,23 @@
|
||||
// // ©2015 - 2025 Candy Smith
|
||||
// // All rights reserved
|
||||
// // Redistribution of this software is strictly not allowed.
|
||||
// // Copy of this software can be obtained from unity asset store only.
|
||||
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// // THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using WordsToolkit.Scripts.Popups.RewardsGift;
|
||||
|
||||
namespace WordsToolkit.Scripts.GUI.Labels
|
||||
{
|
||||
public interface ILabelAnimation
|
||||
{
|
||||
void Animate(GameObject sourceObject, Vector3 startPosition, string rewardDataCount, AudioClip sound, Action callback);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7324cbdb7e04d8784e7b074ce95de5f
|
||||
timeCreated: 1748447755
|
||||
@ -0,0 +1,60 @@
|
||||
// // ©2015 - 2025 Candy Smith
|
||||
// // All rights reserved
|
||||
// // Redistribution of this software is strictly not allowed.
|
||||
// // Copy of this software can be obtained from unity asset store only.
|
||||
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// // THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using WordsToolkit.Scripts.Gameplay.Pool;
|
||||
using WordsToolkit.Scripts.Popups.RewardsGift;
|
||||
|
||||
namespace WordsToolkit.Scripts.GUI.Labels
|
||||
{
|
||||
public class IconLabel : LabelAnim, ILabelAnimation
|
||||
{
|
||||
public void Animate(GameObject sourceObject, Vector3 startPosition, string rewardDataCount, AudioClip sound, Action callback)
|
||||
{
|
||||
sourceObject.GetComponent<GiftBase>().HideText();
|
||||
var animatedObject = GetAnimatedObjectSource(sourceObject);
|
||||
Vector3 targetPos = targetTransform.position;
|
||||
animatedObject.transform.position = startPosition;
|
||||
var sequence = DOTween.Sequence();
|
||||
var _decreaseScaleTween = animatedObject.transform.DOScale(Vector3.one * 0.1f, .3f)
|
||||
.SetEase(Ease.Linear);
|
||||
sequence.Join(_decreaseScaleTween);
|
||||
var _movementTween = animatedObject.transform.DOMove(targetPos, .3f)
|
||||
.SetEase(Ease.Linear);
|
||||
|
||||
sequence.Join(_movementTween);
|
||||
|
||||
// bounce after movement
|
||||
var _bounceTween = animatedObject.transform.DOScale(Vector3.one * .3f, .4f)
|
||||
.SetEase(Ease.OutBack)
|
||||
.OnComplete(() =>
|
||||
{
|
||||
_audioService.PlaySoundExclusive(sound);
|
||||
// play fx
|
||||
if (fxPrefab != null)
|
||||
{
|
||||
var fx = PoolObject.GetObject(fxPrefab, targetPos);
|
||||
fx.transform.position = targetPos;
|
||||
DOVirtual.DelayedCall(1f, () => { PoolObject.Return(fx); });
|
||||
}
|
||||
Release(animatedObject);
|
||||
callback?.Invoke();
|
||||
OnAnimationComplete?.Invoke();
|
||||
});
|
||||
sequence.Append(_bounceTween);
|
||||
|
||||
sequence.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf51bcfa784c4a1ba25080cb5268d346
|
||||
timeCreated: 1748519904
|
||||
@ -0,0 +1,69 @@
|
||||
// // ©2015 - 2025 Candy Smith
|
||||
// // All rights reserved
|
||||
// // Redistribution of this software is strictly not allowed.
|
||||
// // Copy of this software can be obtained from unity asset store only.
|
||||
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// // THE SOFTWARE.
|
||||
|
||||
using DG.Tweening;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using VContainer;
|
||||
using WordsToolkit.Scripts.Audio;
|
||||
using WordsToolkit.Scripts.Data;
|
||||
using WordsToolkit.Scripts.Gameplay.Pool;
|
||||
|
||||
namespace WordsToolkit.Scripts.GUI.Labels
|
||||
{
|
||||
public class LabelAnim : MonoBehaviour
|
||||
{
|
||||
public GameObject prefab;
|
||||
public Transform targetTransform;
|
||||
public ResourceObject associatedResource;
|
||||
|
||||
[SerializeField]
|
||||
protected GameObject fxPrefab;
|
||||
|
||||
[SerializeField]
|
||||
protected TextMeshProUGUI coinsTextPrefab;
|
||||
|
||||
protected Tweener doPunchScale;
|
||||
|
||||
[Inject]
|
||||
protected IAudioService _audioService;
|
||||
|
||||
protected IAnimationSource animatedObjectSource;
|
||||
|
||||
[SerializeField]
|
||||
protected UnityEvent OnAnimationComplete;
|
||||
protected GameObject GetAnimatedObjectSource(GameObject o)
|
||||
{
|
||||
animatedObjectSource ??= new PooledAnimationSource(o??prefab, transform);
|
||||
return animatedObjectSource.GetAnimatedObject();
|
||||
}
|
||||
|
||||
protected void Release(GameObject o)
|
||||
{
|
||||
animatedObjectSource?.ReleaseObject(o);
|
||||
}
|
||||
|
||||
protected void PopupText(Vector3 transformPosition, string rewardDataCount)
|
||||
{
|
||||
var coinsText = PoolObject.GetObject(coinsTextPrefab.gameObject, transformPosition).GetComponent<TextMeshProUGUI>();
|
||||
coinsText.transform.position = transformPosition;
|
||||
coinsText.text = rewardDataCount;
|
||||
coinsText.alpha = 0;
|
||||
|
||||
var sequence = DOTween.Sequence();
|
||||
sequence.Append(coinsText.DOFade(1, 0.2f));
|
||||
sequence.Join(coinsText.transform.DOMoveY(coinsText.transform.position.y + .5f, .5f)).OnComplete(() => { PoolObject.Return(coinsText.gameObject); });
|
||||
sequence.Append(coinsText.DOFade(0, 0.2f));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a33679f003442d482254fce1279dc4e
|
||||
timeCreated: 1722963833
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63234c9046ed647049b7a71f9237f61d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,50 @@
|
||||
// // ©2015 - 2025 Candy Smith
|
||||
// // All rights reserved
|
||||
// // Redistribution of this software is strictly not allowed.
|
||||
// // Copy of this software can be obtained from unity asset store only.
|
||||
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// // THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using WordsToolkit.Scripts.Data;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace WordsToolkit.Scripts.GUI.Labels
|
||||
{
|
||||
public static class ResourceAnimationController
|
||||
{
|
||||
public static void AnimateForResource(ResourceObject resourceObject, GameObject animatedObject, Vector3 startPosition, string rewardDataCount, AudioClip sound,
|
||||
Action callback)
|
||||
{
|
||||
var label = FindLabelForResource(resourceObject);
|
||||
if (label != null)
|
||||
{
|
||||
label.Animate(animatedObject, startPosition, rewardDataCount, sound, callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
callback?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private static ILabelAnimation FindLabelForResource(ResourceObject resourceObject)
|
||||
{
|
||||
var allLabels = Object.FindObjectsOfType<LabelAnim>();
|
||||
foreach (var label in allLabels)
|
||||
{
|
||||
if (label.associatedResource == resourceObject)
|
||||
{
|
||||
return label as ILabelAnimation;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a27ac2d882a446c38e9418f664e5238e
|
||||
timeCreated: 1748412719
|
||||
@ -0,0 +1,42 @@
|
||||
// // ©2015 - 2025 Candy Smith
|
||||
// // All rights reserved
|
||||
// // Redistribution of this software is strictly not allowed.
|
||||
// // Copy of this software can be obtained from unity asset store only.
|
||||
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// // THE SOFTWARE.
|
||||
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using WordsToolkit.Scripts.Data;
|
||||
|
||||
namespace WordsToolkit.Scripts.GUI.Labels
|
||||
{
|
||||
public class ResourceLabel : MonoBehaviour
|
||||
{
|
||||
public ResourceObject resourceObject;
|
||||
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI text;
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
resourceObject.OnResourceUpdate += UpdateValue;
|
||||
UpdateValue(resourceObject.GetValue());
|
||||
}
|
||||
|
||||
protected virtual void OnDisable()
|
||||
{
|
||||
resourceObject.OnResourceUpdate -= UpdateValue;
|
||||
}
|
||||
|
||||
protected virtual void UpdateValue(int count)
|
||||
{
|
||||
text.text = count.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c79bf792c0d841e59f4e9ce0e4f13cc8
|
||||
timeCreated: 1716450501
|
||||
@ -0,0 +1,18 @@
|
||||
// // ©2015 - 2025 Candy Smith
|
||||
// // All rights reserved
|
||||
// // Redistribution of this software is strictly not allowed.
|
||||
// // Copy of this software can be obtained from unity asset store only.
|
||||
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// // THE SOFTWARE.
|
||||
|
||||
namespace WordsToolkit.Scripts.GUI.Labels
|
||||
{
|
||||
public class TipLabelAnimation : IconLabel
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 996433fa960e41578e8420db55d6317f
|
||||
timeCreated: 1748439593
|
||||
Reference in New Issue
Block a user