You've already forked taptap2024_GJ_chidouren
updat core
This commit is contained in:
156
Assets/Scripts/Views/SuccessPanel.cs
Normal file
156
Assets/Scripts/Views/SuccessPanel.cs
Normal file
@@ -0,0 +1,156 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Coffee.UIEffects;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Framework.Timer;
|
||||
using Game;
|
||||
using Game.Component;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using IcecreamView;
|
||||
using MintAnimation.Core;
|
||||
|
||||
namespace Views{
|
||||
|
||||
public class SuccessPanel : IcecreamView.IC_AbstractModule
|
||||
{
|
||||
|
||||
public UIDissolve[] TopFragments;
|
||||
public UIDissolve[] LeftFragments;
|
||||
public UIDissolve[] RightFragments;
|
||||
|
||||
public GameObject redPoint;
|
||||
public GameObject greenPoint;
|
||||
public GameObject bluePoint;
|
||||
|
||||
public GameObject lastFragment;
|
||||
|
||||
public ObjectShake Shake;
|
||||
|
||||
|
||||
public override void OnOpenView(IC_ViewData parameters)
|
||||
{
|
||||
var index = parameters.GetValue<int> ();
|
||||
this.lastFragment.SetActive (false);
|
||||
this.redPoint.SetActive (false);
|
||||
this.greenPoint.SetActive (false);
|
||||
this.bluePoint.SetActive (false);
|
||||
foreach (var topFragment in this.TopFragments)
|
||||
{
|
||||
topFragment.effectFactor = 1;
|
||||
}
|
||||
foreach (var leftFragment in this.LeftFragments)
|
||||
{
|
||||
leftFragment.effectFactor = 1;
|
||||
}
|
||||
foreach (var rightFragment in this.RightFragments)
|
||||
{
|
||||
rightFragment.effectFactor = 1;
|
||||
}
|
||||
UpdateAnim (index);
|
||||
}
|
||||
|
||||
public override void OnCloseView()
|
||||
{
|
||||
|
||||
}
|
||||
// #if UNITY_EDITOR
|
||||
// private bool tempLock;
|
||||
// private async void Update ()
|
||||
// {
|
||||
// if (this.tempLock)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (Input.GetKeyDown (KeyCode.A))
|
||||
// {
|
||||
// this.tempLock = true;
|
||||
// UpdateAnim (1);
|
||||
// await UniTask.Delay (5000);
|
||||
// this.tempLock = false;
|
||||
// }
|
||||
// if (Input.GetKeyDown (KeyCode.S))
|
||||
// {
|
||||
// this.tempLock = true;
|
||||
// UpdateAnim (2);
|
||||
// await UniTask.Delay (5000);
|
||||
// this.tempLock = false;
|
||||
// }
|
||||
// if (Input.GetKeyDown (KeyCode.D))
|
||||
// {
|
||||
// this.tempLock = true;
|
||||
// UpdateAnim (3);
|
||||
// await UniTask.Delay (5000);
|
||||
// this.tempLock = false;
|
||||
// }
|
||||
// }
|
||||
// #endif
|
||||
|
||||
|
||||
public async void UpdateAnim (int index)
|
||||
{
|
||||
lastFragment.SetActive (false);
|
||||
foreach (var topFragment in this.TopFragments)
|
||||
{
|
||||
topFragment.effectFactor = index > 1 ? 0 : 1;
|
||||
}
|
||||
foreach (var leftFragment in this.LeftFragments)
|
||||
{
|
||||
leftFragment.effectFactor = index > 2 ? 0 : 1;
|
||||
}
|
||||
|
||||
foreach (var rightFragment in this.RightFragments)
|
||||
{
|
||||
rightFragment.effectFactor = index > 3 ? 0 : 1;
|
||||
}
|
||||
|
||||
this.redPoint.SetActive (index > 1);
|
||||
this.greenPoint.SetActive (index > 2);
|
||||
this.bluePoint.SetActive (index > 3);
|
||||
|
||||
UIDissolve[] effects = index switch
|
||||
{
|
||||
1 => this.TopFragments,
|
||||
2 => this.LeftFragments,
|
||||
3 => this.RightFragments,
|
||||
_ => null
|
||||
};
|
||||
GameObject point = index switch
|
||||
{
|
||||
1 => this.redPoint,
|
||||
2 => this.greenPoint,
|
||||
3 => this.bluePoint,
|
||||
_ => null
|
||||
};
|
||||
await AnimOpen (effects , point);
|
||||
if (index >= 3)
|
||||
{
|
||||
this.lastFragment.SetActive (true);
|
||||
Shake.ShakeFor (0.25f , 0.75f);
|
||||
CameraImpulseUtils.Instance.UniformImpulseCamera (0.5f , 4);
|
||||
GameManager.Instance.Vibrator (VibratorScale.Normal);
|
||||
}
|
||||
}
|
||||
|
||||
private async UniTask AnimOpen (UIDissolve[] effects , GameObject point)
|
||||
{
|
||||
var taskTracker = GameUpdateMgr.Instance.CreateTask ();
|
||||
GameUpdateMgr.Instance.CreateTimer (0.75f , taskTracker.ListenerAction , progress =>
|
||||
{
|
||||
var f = MintEaseAction.InQuart (0 , 1 ,progress);
|
||||
foreach (var uiEffect in effects)
|
||||
{
|
||||
uiEffect.effectFactor = 1 - f;
|
||||
}
|
||||
});
|
||||
await taskTracker.Task;
|
||||
Shake.ShakeFor (0.15f , 0.35f);
|
||||
GameManager.Instance.Vibrator (VibratorScale.Small);
|
||||
CameraImpulseUtils.Instance.UniformImpulseCamera (0.5f , 2);
|
||||
point.SetActive (true);
|
||||
point.transform.GetChild (0).gameObject.SetActive (true);
|
||||
await UniTask.Delay (2000);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user