右上角游戏
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using AibisDream.Kit;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Random = UnityEngine.Random;
|
||||
@@ -17,19 +19,17 @@ namespace AibisDream.FixSystem
|
||||
[SerializeField] private Image target;
|
||||
[SerializeField] private Image slot;
|
||||
[SerializeField] private SliderEx slider;
|
||||
[SerializeField] private TMP_Text infoText;
|
||||
|
||||
#endregion
|
||||
|
||||
private float _normalizePosX;
|
||||
public event Action<bool> OnVerificationEnd;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
StartVerification();
|
||||
}
|
||||
|
||||
public void StartVerification()
|
||||
{
|
||||
infoText.text = "请将图片拖动至对应位置";
|
||||
gameObject.SetActive(true);
|
||||
_normalizePosX = Random.Range(0.4f, 0.9f);
|
||||
// 随机生成数据,包括Slot位置,有资源之后增加背景图
|
||||
var slotWidth = target.rectTransform.rect.width;
|
||||
@@ -56,11 +56,13 @@ namespace AibisDream.FixSystem
|
||||
// 如果失败就再来一次
|
||||
if (!isSuccess)
|
||||
{
|
||||
StartVerification();
|
||||
infoText.text = "失败";
|
||||
ActionKit.Delay(1f, StartVerification).Start(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
infoText.text = "成功";
|
||||
ActionKit.Delay(0.5f, () => gameObject.SetActive(false)).Start(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user