备份CatanBuilding瘦身独立工程
This commit is contained in:
41
Assets/Scripts/EventBingo/EventBingoAct.cs
Normal file
41
Assets/Scripts/EventBingo/EventBingoAct.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using asap.core;
|
||||
using GameCore;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
public class EventBingoAct : AGameAct
|
||||
{
|
||||
public static IEventAggregator EventAggregator = new EventAggregator();
|
||||
public readonly static string ActAddressable = "EventBingoAct";
|
||||
private CanvasScaler _canvasScaler;
|
||||
private readonly float normalScale = 0.75f, actScale = 1.0f, duration = 0.75f;
|
||||
private readonly Vector2 targetResolution = new Vector2(1080, 2340);
|
||||
private Vector2 originalResolution;
|
||||
public override async Task<bool> StartAsync()
|
||||
{
|
||||
GContext.container.Resolve<IDeferredRewardStashService>().Reset();
|
||||
_canvasScaler = UIManager.Instance.GetComponent<CanvasScaler>();
|
||||
// DOTween.To(() => _canvasScaler.matchWidthOrHeight, v => _canvasScaler.matchWidthOrHeight = v, actScale, duration).SetEase(Ease.OutQuad);
|
||||
originalResolution = _canvasScaler.referenceResolution;
|
||||
DOTween.To(() => _canvasScaler.referenceResolution, v => _canvasScaler.referenceResolution = v, targetResolution, duration).SetEase(Ease.OutQuad);
|
||||
var panelGo = await UIManager.Instance.ShowUILoad(UITypes.EventBingoPanel);
|
||||
var panel = panelGo.GetComponent<EventBingoPanel>();
|
||||
panel.Init();
|
||||
var bingoModel = GContext.container.Resolve<EventBingoModel>();
|
||||
if (bingoModel is { IsFirstTime: true })
|
||||
{
|
||||
await UIManager.Instance.ShowUINotLoading(UITypes.EventBingoInfoPanel);
|
||||
bingoModel.SetFirstTimeFlag();
|
||||
}
|
||||
return await base.StartAsync();
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
// DOTween.To(() => _canvasScaler.matchWidthOrHeight, v => _canvasScaler.matchWidthOrHeight = v, normalScale, duration).SetEase(Ease.OutQuad);
|
||||
DOTween.To(() => _canvasScaler.referenceResolution, v => _canvasScaler.referenceResolution = v, originalResolution, duration).SetEase(Ease.OutQuad);
|
||||
UIManager.Instance.DestroyUI(UITypes.EventBingoPanel);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user