1255 lines
44 KiB
C#
1255 lines
44 KiB
C#
// - 新的Blocks UI
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Threading.Tasks;
|
||
using asap.core;
|
||
using cfg;
|
||
using DG.Tweening;
|
||
using EventCubeMelt;
|
||
using EventCubeMelt.Data;
|
||
using EventCubeMelt.UI;
|
||
using game;
|
||
using Game;
|
||
using GameCore;
|
||
using TMPro;
|
||
using UniRx;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
namespace EventBlocks.UI
|
||
{
|
||
public class EventBlockPanel : BasePanel
|
||
{
|
||
//
|
||
private EventCubeMeltManager _thisEventManager;
|
||
|
||
private EventCubeMeltData _thisEventData;
|
||
//
|
||
private readonly PlayerItemData _playerItemData = GContext.container.Resolve<PlayerItemData>();
|
||
|
||
// 显示奖励数量
|
||
private int _showRewardCount = 4;
|
||
|
||
private IDisposable _robotAddScoreSubscription;
|
||
|
||
private Button _btnClose;
|
||
private Button _btnQuestionmark;
|
||
private Button _btnAdd;
|
||
|
||
private Transform root;
|
||
|
||
private TMP_Text icon_ticket;
|
||
|
||
private TMP_Text _textTitle;
|
||
private TMP_Text _txtTime;
|
||
private TMP_Text _txtNum;
|
||
private Image _imgTicket; //- 图标
|
||
|
||
// private Transform _stageComplete;
|
||
// private Transform _nextStageTip;
|
||
// private TMP_Text _textStage;
|
||
|
||
private Animation _showAnimation; // 处理显示的Animation
|
||
private CanvasGroup _canvasGroup;
|
||
|
||
private Image _weaponImage;
|
||
|
||
//- 视频解码器
|
||
// private Transform _videoPlayer;
|
||
|
||
private EventBlockVideoPlayer _blockVideoPlayer;
|
||
|
||
|
||
//- 引导
|
||
private Transform _guide01;
|
||
private Button _guideBtnSkip;
|
||
private Transform _guide01Region;
|
||
|
||
|
||
|
||
private Button _btnJump;
|
||
// 获取奖励逻辑
|
||
private bool _isStageRewardLogic = false;
|
||
|
||
|
||
private TaskCompletionSource<bool> _waitStageRewardTcs;
|
||
|
||
private bool _isFinalRewardLogic = false;
|
||
// 最终奖励
|
||
private RewardItemNew _rewardFinal;
|
||
// Level 复用一下
|
||
private SandDigLevel[] _levels;
|
||
|
||
private RewardItemNew _rewardItem1;
|
||
private RewardItemNew _rewardItem2;
|
||
|
||
private Transform _normalReward;
|
||
private RewardItemNew _rewardItemFinal;
|
||
// 提出来放到脚本中
|
||
private CubeMeltCollectItems[] _collectItems;
|
||
// 定时器
|
||
private IDisposable _timer;
|
||
|
||
// 增光特效
|
||
private Transform _fxUIEventCubemeltFireIncrease;
|
||
|
||
|
||
#region 组件引用
|
||
|
||
[Header("组件引用")] [SerializeField] private BoardRenderer boardRenderer;
|
||
[SerializeField] private PieceRenderer[] pieceRendererArray;
|
||
|
||
#endregion
|
||
|
||
[Header("动画名")]
|
||
[SerializeField] private string aniEventBlockFinishName = "EventBlockFinish";
|
||
[SerializeField] private string anmEventBlockFinishRecover = "EventBlockFinishRecover";
|
||
[SerializeField] private string aniEventBlockShow = "EventBlockShow";
|
||
[SerializeField] private string aniEventBlockSwithShow = "EventBlockSwithShow";
|
||
|
||
|
||
#region 数值设定
|
||
|
||
// [Header("面板宽度")] public int boardWidth = 8;
|
||
// [Header("面板高度")] public int boardHeight = 8;
|
||
|
||
// [Header("下方单元数量")]
|
||
// public int pieceNumber = 3;
|
||
|
||
[Header("下方单元宽")] public int pieceWidth = 5;
|
||
[Header("下方单元高")] public int pieceHeight = 5;
|
||
|
||
[Header("视觉效果")]
|
||
[Tooltip("点击的偏移")]
|
||
public int pieceOffsetY = 320;
|
||
[Tooltip("拖动对象的的缩放")]
|
||
public float pieceScaleFactor = 100F / 40;
|
||
[Tooltip("拖动对象目标大小,影响计算位置")]
|
||
public float pieceTargetSize = 100F;
|
||
|
||
[Tooltip("滑动比例")]
|
||
public float pieceDistanceFactor = 0.2F;
|
||
|
||
#endregion
|
||
|
||
// GUide
|
||
private Transform moveNode;
|
||
private Vector3 moveNodeOriginPos;
|
||
private Vector3 moveFinalPos;
|
||
private bool _isUpdatingCollect;
|
||
|
||
[Header("新手引导")]
|
||
[Tooltip("手指演示开始后,超时则结束新手引导(秒);拖错重播手指不重置该计时")]
|
||
[SerializeField] private float guideFingerDemoTimeoutSeconds = 30f;
|
||
[SerializeField] private int guideIndex = 2;
|
||
[SerializeField] private float moveDuration = 1f;
|
||
[SerializeField] private float pauseDuration = 0.5f;
|
||
[SerializeField] private float guideScaleFactor = 2.3f;
|
||
[SerializeField] private Transform guideFinalTrans;
|
||
|
||
|
||
private IDisposable _guideFingerTimeoutDisposable;
|
||
|
||
|
||
#region 周期函数
|
||
|
||
private void Awake()
|
||
{
|
||
ELog("Awake");
|
||
|
||
|
||
_thisEventManager = GContext.container.Resolve<EventCubeMeltManager>();
|
||
_thisEventData = _thisEventManager.EventData;
|
||
|
||
root = transform.Find("root");
|
||
//_textTitle = transform.Find("root/title/Txt_titleName").GetComponent<TMP_Text>();
|
||
_levels = transform.Find("root/title/level").GetComponentsInChildren<SandDigLevel>(true);
|
||
|
||
_txtTime = transform.Find("root/title/level/Txt_time").GetComponent<TMP_Text>();
|
||
_rewardFinal = transform.Find("root/title/level/reward").GetComponent<RewardItemNew>();
|
||
|
||
_showAnimation = GetComponent<Animation>();
|
||
_canvasGroup = GetComponent<CanvasGroup>();
|
||
|
||
_collectItems = transform.Find("root/TargetObject/CollectObject/CollectList")
|
||
.GetComponentsInChildren<CubeMeltCollectItems>(true);
|
||
//
|
||
_normalReward = transform.Find("root/TargetObject/RewardObject/reward");
|
||
|
||
_rewardItem1 = transform.Find("root/TargetObject/RewardObject/reward/reward1")
|
||
.GetComponent<RewardItemNew>();
|
||
_rewardItem2 = transform.Find("root/TargetObject/RewardObject/reward/reward2")
|
||
.GetComponent<RewardItemNew>();
|
||
|
||
_rewardItemFinal = transform.Find("root/TargetObject/RewardObject/rewardFinal")
|
||
.GetComponent<RewardItemNew>();
|
||
|
||
// _stageComplete = transform.Find("root/StageComplete");
|
||
// _nextStageTip = transform.Find("root/NextStageTip");
|
||
// _textStage = transform.Find("root/NextStageTip/txt_stage").GetComponent<TMP_Text>();
|
||
_btnClose = transform.Find("root/p_panel_btn_close").GetComponent<Button>();
|
||
_btnQuestionmark = transform.Find("root/title/Btn_questionmark").GetComponent<Button>();
|
||
_btnAdd = transform.Find("root/icon_ticket").GetComponent<Button>();
|
||
_txtNum = transform.Find("root/icon_ticket/txt_num").GetComponent<TMP_Text>();
|
||
_imgTicket = transform.Find("root/icon_ticket/Img_ticket").GetComponent<Image>();
|
||
|
||
_guide01 = transform.Find("root/guide_01");
|
||
_guideBtnSkip = transform.Find("root/guide_btn_skip").GetComponent<Button>();
|
||
|
||
_btnJump = transform.Find("root/btn_jump").GetComponent<Button>();
|
||
//var finalPos = transform.Find("root/EventCubeMeltTablePanel/Guidance/final_pos");
|
||
_guide01Region = boardRenderer.transform.Find("Guidance/Guide_01_region");
|
||
// var finalPos = transform.Find("root/GuidePanel/final_pos");
|
||
moveNode = _guide01.Find("node");
|
||
// moveNodeOriginPos = moveNode.position;
|
||
// moveFinalPos = finalPos.position;
|
||
|
||
// moveFinalPos = moveFinalPos
|
||
|
||
_fxUIEventCubemeltFireIncrease = transform.Find("root/Bg_melt/fx_ui_event_cubemelt_fire_increase");
|
||
_weaponImage = transform.Find("root/Bg_melt/weapon").GetComponent<Image>();
|
||
|
||
// _videoPlayer = transform.Find("root/EventBlockVideoPlayer");
|
||
// _videoPlayer.gameObject.SetActive(false);
|
||
|
||
_blockVideoPlayer = transform.Find("root/EventBlockVideoPlayer").GetComponent<EventBlockVideoPlayer>();
|
||
_blockVideoPlayer.gameObject.SetActive(false);
|
||
|
||
_showRewardCount = _levels.Length;
|
||
_btnClose.onClick.AddListener(OnClose);
|
||
|
||
_btnQuestionmark.onClick.AddListener(() =>
|
||
{
|
||
var infoPanel = _thisEventManager.EventCubeMeltMainData.InfoPanel;
|
||
_ = UIManager.Instance.ShowUI(new UIType(infoPanel));
|
||
});
|
||
_btnAdd.onClick.AddListener(OnBtnAdd);
|
||
|
||
|
||
_guideBtnSkip.onClick.AddListener(OnSkipGuide);
|
||
// _btnJump.onClick.AddListener(() =>
|
||
// {
|
||
// _thisEventManager.JumpToStage(11);
|
||
// });
|
||
// 绑定事件
|
||
GContext.OnEvent<EventForUpdateCollect>().Subscribe(evtData => { _ = UpdateCollectAsync(); }).AddTo(disposables);
|
||
GContext.OnEvent<EventForRefreshCubeMeltPanel>().Subscribe(_ => RefreshUI()).AddTo(disposables);
|
||
GContext.OnEvent<EventCubeMeltUpdateTicketCount>().Subscribe(_ => UpdateTickCount()).AddTo(disposables);
|
||
GContext.OnEvent<EventCubeMeltShowNeoNormalPack>().Subscribe(_ => ShowNeoPackPanel()).AddTo(disposables);
|
||
GContext.OnEvent<EventBlockGetReward>().Subscribe(_ => OnGetReward()).AddTo(disposables);
|
||
GContext.OnEvent<EventCubeMeltForNextStage>().Subscribe(evtData => { _ = ShowNextStageAsync(); }).AddTo(disposables);
|
||
GContext.OnEvent<FishingChallengeContinueEvent>().Subscribe( _ => OnStageLogicContinue()).AddTo(disposables);
|
||
GContext.OnEvent<EventCubeMeltWeaponExhibitFinished>().Subscribe(_ => OnWeaponExhibitFinish()) .AddTo(disposables);
|
||
// GContext.OnEvent<EventCubeMeltWeaponProgress>().Subscribe((evt ) => UpdateWeaponProgress()).AddTo(disposables);
|
||
GContext.OnEvent<EventCubeMeltStageFinish>().Subscribe(_ => OnFinishStage()).AddTo(disposables);
|
||
GContext.OnEvent<EventCubeMeltGuideFingerHide>().Subscribe(_ => StopGuideMove()).AddTo(disposables);
|
||
GContext.OnEvent<EventNewGuideFingerStart>().Subscribe(_ => StartGuideMove()).AddTo(disposables);
|
||
GContext.OnEvent<EventNewGuideFingerFinish>().Subscribe(_ => OnNewGuideFingerFinish()).AddTo(disposables);
|
||
GContext.OnEvent<EventCubemeltExitAct>().Subscribe(_ => OnClose()).AddTo(disposables);
|
||
// GContext.OnEvent<EventBlockLoadingFinished>().Subscribe(_ => OnLoadingFinished()).AddTo(disposables);
|
||
// GContext.OnEvent<OnTransitioned>().Subscribe(_ => OnLoadingFinished()).AddTo(disposables);
|
||
|
||
}
|
||
|
||
private void OnFinishStage()
|
||
{
|
||
ELog("OnFinishStage()");
|
||
_canvasGroup.blocksRaycasts = false;
|
||
foreach (var pieceRenderer in pieceRendererArray)
|
||
{
|
||
pieceRenderer.RestorePiece();
|
||
}
|
||
}
|
||
|
||
private void OnClose()
|
||
{
|
||
GContext.Publish(new UnloadActToNextAct());
|
||
}
|
||
|
||
private async Task ShowNextStageAsync()
|
||
{
|
||
ELog("ShowNextStage");
|
||
await Awaiters.NextFrame;
|
||
_ = ShowCurrentStage();
|
||
_showAnimation?.Play(aniEventBlockSwithShow);
|
||
UpdateTopInfo();
|
||
UpdateTargetInfo();
|
||
UpdateTickCount();
|
||
_canvasGroup.blocksRaycasts = true;
|
||
}
|
||
|
||
private void OnStageLogicContinue()
|
||
{
|
||
ELog($"OnStageLogicContinue isStageRewardLogic={_isStageRewardLogic} isFinalRewardLogic={_isFinalRewardLogic}");
|
||
|
||
if (_isStageRewardLogic)
|
||
{
|
||
_isStageRewardLogic = false;
|
||
}
|
||
else if (_isFinalRewardLogic)
|
||
{
|
||
_isFinalRewardLogic = false;
|
||
}
|
||
|
||
_waitStageRewardTcs?.TrySetResult(true);
|
||
}
|
||
|
||
private async void OnWeaponExhibitFinish()
|
||
{
|
||
ELog("OnWeaponExhibitFinish");
|
||
ClearBoardAndPieces();
|
||
_blockVideoPlayer.StopPlayVideo();
|
||
_blockVideoPlayer.gameObject.SetActive(false);
|
||
|
||
if (_thisEventData.CurrentStagetId < _thisEventManager.StageCount - 1)
|
||
{
|
||
await RunFinishRecoverAnim();
|
||
}
|
||
|
||
var bRet = _waitExhibitTcs?.TrySetResult(true) ?? false;
|
||
if (!bRet)
|
||
{
|
||
LogWarning("WaitExhibitTrySetResultIgnored reason=AlreadyCompleted");
|
||
}
|
||
}
|
||
|
||
private async Task RunFinishRecoverAnim()
|
||
{
|
||
var rootAni = root.GetComponent<Animation>();
|
||
rootAni?.Play(anmEventBlockFinishRecover);
|
||
await Awaiters.Seconds(0.2f);
|
||
}
|
||
|
||
// public void
|
||
|
||
protected override void Start()
|
||
{
|
||
base.Start();
|
||
_canvasGroup.blocksRaycasts = false;
|
||
Initialize();
|
||
UpdateTopInfo();
|
||
UpdateTargetInfo();
|
||
UpdateTickCount();
|
||
SetIcon();
|
||
_ = ShowCurrentStage();
|
||
_timer = Observable.Interval(TimeSpan.FromSeconds(1)).Subscribe(UpdateTimer).AddTo(this);
|
||
|
||
_blockVideoPlayer.gameObject.SetActive(false);
|
||
}
|
||
|
||
|
||
private void GuideListener(AddIndexEvent addIndexEvent)
|
||
{
|
||
ELog($"GuideListener -> {addIndexEvent.guideSubIndex} {addIndexEvent.CompleteGuide}");
|
||
if (addIndexEvent.CompleteGuide)
|
||
{
|
||
if (!this)
|
||
{
|
||
return;
|
||
}
|
||
if (_canvasGroup)
|
||
{
|
||
_canvasGroup.blocksRaycasts = true;
|
||
}
|
||
RunGuide01Anim();
|
||
}
|
||
}
|
||
|
||
// public async void OnLoadingFinished()
|
||
// {
|
||
// ELog("OnLoadingFinished()");
|
||
// //-
|
||
// // await Awaiters.Seconds(0.5f);
|
||
// //
|
||
// var anim = _showAnimation ? _showAnimation : GetComponent<Animation>();
|
||
// if (!anim || string.IsNullOrEmpty(aniEventBlockShow))
|
||
// return;
|
||
//
|
||
// // Rewind() 对单条 clip 不可靠;显式把目标 AnimationState 时间归零后再 Play,避免从上次结束帧/中间帧接着播
|
||
// anim.Stop();
|
||
// var state = anim[aniEventBlockShow];
|
||
// if (state != null)
|
||
// {
|
||
// state.enabled = true;
|
||
// state.weight = 1f;
|
||
// state.normalizedTime = 0f;
|
||
// state.time = 0f;
|
||
// state.speed = 1f;
|
||
// }
|
||
//
|
||
// anim.Play(aniEventBlockShow, PlayMode.StopAll);
|
||
// anim.Sample();
|
||
// }
|
||
|
||
|
||
private async void RunGuide01Anim()
|
||
{
|
||
ELog("RunGuide01Anim");
|
||
await Awaiters.NextFrame;
|
||
if (!_guide01)
|
||
return;
|
||
|
||
DisposeGuideFingerDemoTimeout();
|
||
|
||
_thisEventManager.SetIsInGuideAnim(true);
|
||
_guide01.gameObject.SetActive(true);
|
||
|
||
var renderer1 = pieceRendererArray[guideIndex];
|
||
// var trans = _guide01.Find("node/p/CubeGroup_02");
|
||
var rootP = _guide01.Find("node/p");
|
||
var trans = Instantiate(renderer1.gameObject, rootP);
|
||
_thisEventManager.GuideIndex = guideIndex;
|
||
renderer1.GetComponent<Animation>().Play("EventBlockGuideCubeAnim");
|
||
|
||
// var pieceRender = trans.GetComponent<PieceRenderer>();
|
||
// if (!pieceRender)
|
||
// pieceRender = trans.gameObject.AddComponent<PieceRenderer>();
|
||
|
||
moveNodeOriginPos = renderer1.transform.position + new Vector3(-122,0,0);
|
||
|
||
rootP.transform.localScale = Vector3.one * guideScaleFactor;
|
||
StartGuideMove();
|
||
StartGuideFingerDemoTimeoutOnce();
|
||
}
|
||
|
||
private Sequence moveToTarget;
|
||
private void StartGuideMove()
|
||
{
|
||
// StopGuideMove();
|
||
_guide01?.gameObject.SetActive(true);
|
||
ELog($"StartGuideMove-> ");
|
||
var transformNode = moveNode;
|
||
// 创建移动动画到目标位置
|
||
// transformNode.DOKill();
|
||
transformNode.position = moveNodeOriginPos;
|
||
moveToTarget?.Kill();
|
||
|
||
moveFinalPos = guideFinalTrans.position;
|
||
moveToTarget = DOTween.Sequence();
|
||
moveToTarget.Append(transformNode.DOMove(moveNodeOriginPos, 0));
|
||
moveToTarget.Append(transformNode.DOMove(moveFinalPos, moveDuration));
|
||
moveToTarget.AppendInterval(pauseDuration);
|
||
moveToTarget.Append(transformNode.DOMove(moveNodeOriginPos, 0f));
|
||
moveToTarget.SetLoops(-1);
|
||
}
|
||
|
||
private void DisposeGuideFingerDemoTimeout()
|
||
{
|
||
_guideFingerTimeoutDisposable?.Dispose();
|
||
_guideFingerTimeoutDisposable = null;
|
||
}
|
||
|
||
private void StartGuideFingerDemoTimeoutOnce()
|
||
{
|
||
if (_guideFingerTimeoutDisposable != null)
|
||
return;
|
||
var seconds = Mathf.Max(0.01f, guideFingerDemoTimeoutSeconds);
|
||
_guideFingerTimeoutDisposable = Observable
|
||
.Timer(TimeSpan.FromSeconds(seconds))
|
||
.Subscribe(_ =>
|
||
{
|
||
_guideBtnSkip.gameObject.SetActive(true);
|
||
});
|
||
}
|
||
|
||
private void OnGuideFingerDemoTimeout()
|
||
{
|
||
if (!this)
|
||
return;
|
||
ELog("OnGuideFingerDemoTimeout");
|
||
DisposeGuideFingerDemoTimeout();
|
||
StopGuidePiece01Animation();
|
||
StopGuideMove();
|
||
_guideBtnSkip?.gameObject.SetActive(false);
|
||
_thisEventManager?.SetIsInGuideAnim(false);
|
||
if (_canvasGroup)
|
||
_canvasGroup.blocksRaycasts = true;
|
||
|
||
}
|
||
|
||
private void StopGuidePiece01Animation()
|
||
{
|
||
if (pieceRendererArray is not { Length: > 1 })
|
||
return;
|
||
foreach (var pieceRenderer in pieceRendererArray)
|
||
{
|
||
if (pieceRenderer)
|
||
pieceRenderer.GetComponent<Animation>()?.Stop();
|
||
}
|
||
}
|
||
|
||
private void OnNewGuideFingerFinish()
|
||
{
|
||
DisposeGuideFingerDemoTimeout();
|
||
StopGuidePiece01Animation();
|
||
}
|
||
|
||
private void StopGuideMove()
|
||
{
|
||
if (moveNode)
|
||
{
|
||
moveNode.DOKill();
|
||
}
|
||
moveToTarget?.Kill();
|
||
_guide01.gameObject.SetActive(false);
|
||
}
|
||
protected override void OnDestroy()
|
||
{
|
||
DisposeGuideFingerDemoTimeout();
|
||
_timer?.Dispose();
|
||
_timer = null;
|
||
StopGuideMove();
|
||
moveToTarget?.Kill();
|
||
base.OnDestroy();
|
||
ELog("OnDestroy");
|
||
}
|
||
|
||
private void Update()
|
||
{
|
||
#if UNITY_EDITOR
|
||
if (Input.GetKeyDown(KeyCode.N))
|
||
{
|
||
boardRenderer.OnRestoreStep();
|
||
}
|
||
else if (Input.GetKeyDown(KeyCode.B))
|
||
{
|
||
boardRenderer.OnPrevStep();
|
||
}
|
||
|
||
if (Input.GetKeyDown(KeyCode.K))
|
||
{
|
||
isShow = !isShow;
|
||
}
|
||
|
||
if (Input.GetKeyDown(KeyCode.J))
|
||
{
|
||
_thisEventManager.JumpToStage(newStepValue);
|
||
}
|
||
#endif
|
||
}
|
||
#if UNITY_EDITOR
|
||
private bool isShow = false;
|
||
//
|
||
private string newStepStr;
|
||
|
||
private string newLoopStr;
|
||
|
||
private int newStepValue;
|
||
|
||
private int newLoopValue;
|
||
private async void OnGUI()
|
||
{
|
||
if (!isShow)
|
||
{
|
||
return;
|
||
}
|
||
|
||
// Set the button width and height
|
||
float buttonWidth = 300; // Replace with your desired width
|
||
float buttonHeight = 70; // Replace with your desired height
|
||
int fontSize = 40; // Replace with your desired font size
|
||
|
||
// Set the font size for text fields, buttons, and labels
|
||
GUI.skin.textField.fontSize = fontSize;
|
||
GUI.skin.button.fontSize = fontSize;
|
||
GUI.skin.label.fontSize = fontSize;
|
||
// 触发ChallengeShowPlayAniEvent 事件并能输入oldStep和newStep
|
||
GUILayout.Label("跳转关卡:");
|
||
newStepStr = GUILayout.TextField(newStepStr, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight));
|
||
|
||
int.TryParse(newStepStr, out newStepValue);
|
||
if (GUILayout.Button("跳转", GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)))
|
||
{
|
||
var bRet = int.TryParse(newStepStr, out var newStep);
|
||
if(bRet)
|
||
_thisEventManager.JumpToStage(newStep -1);
|
||
|
||
// Event.current.Use();
|
||
GUIUtility.hotControl = 0;
|
||
GUIUtility.keyboardControl = 0;
|
||
}
|
||
|
||
newLoopStr = GUILayout.TextField(newLoopStr, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight));
|
||
// int.TryParse(newLoopStr, out newLoopValue);
|
||
|
||
if (GUILayout.Button("轮数跳转", GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)))
|
||
{
|
||
var bRet = int.TryParse(newLoopStr, out newLoopValue);
|
||
if (bRet)
|
||
{
|
||
// _thisEventManager.JumpToStage(newStep -1);
|
||
// var newCycle = (newLoopValue != 0) ? 1 : newLoopValue ;
|
||
var newCycle = newLoopValue;
|
||
if (newCycle != _thisEventData.Cycle)
|
||
{
|
||
_thisEventData.Cycle = newCycle;
|
||
var step = _thisEventData.CurrentStagetId;
|
||
_thisEventManager.JumpToStage(step);
|
||
}
|
||
}
|
||
GUIUtility.hotControl = 0;
|
||
GUIUtility.keyboardControl = 0;
|
||
}
|
||
|
||
|
||
}
|
||
#endif
|
||
|
||
#endregion
|
||
|
||
#region LOG
|
||
|
||
private static void LogWarning(string message)
|
||
{
|
||
Debug.LogWarning($"<color=yellow>{nameof(EventBlockPanel)} => {message}</color>");
|
||
}
|
||
|
||
private static void LogError(string message)
|
||
{
|
||
Debug.LogError($"<color=red>{nameof(EventBlockPanel)} => {message}</color>");
|
||
}
|
||
|
||
private static void ELog(string message)
|
||
{
|
||
#if UNITY_EDITOR
|
||
if (!EventCubeMeltLogPolicy.EnableELog) return;
|
||
Debug.Log($"<color=orange>{nameof(EventBlockPanel)} => {message}</color>");
|
||
#endif
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 按钮事件
|
||
|
||
private void OnSkipGuide()
|
||
{
|
||
OnGuideFingerDemoTimeout();
|
||
}
|
||
private async void OnBtnAdd()
|
||
{
|
||
await Awaiters.NextFrame;
|
||
//
|
||
ShowNeoPackPanel();
|
||
}
|
||
|
||
private async void ShowNeoPackPanel()
|
||
{
|
||
var packID = _thisEventManager.EventCubeMeltMainData.PackPackID;
|
||
var packData = new EventNeoNormalPackData
|
||
{
|
||
EventId = _thisEventData.EventId,
|
||
PackId = packID,
|
||
// Panel = _thisEventManager.EventCubeMeltMainData.PackPanel
|
||
};
|
||
await EventNeoNormalPackPanel.TryShowAsync(packData);
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 用户函数
|
||
|
||
private void UpdateTopInfo()
|
||
{
|
||
ELog("UpdateTopInfo");
|
||
_txtTime.text = ConvertTools.ConvertTime2(_thisEventManager.GetRemainingTime());
|
||
//LocalizationMgr.GetFormatTextValue("UI_COMMON_end",
|
||
//ConvertTools.ConvertTime2(_thisEventManager.GetRemainingTime()));
|
||
// var dropId = _thisEventManager.EventCubeMeltMainData.FinalReward;
|
||
var dropId = _thisEventManager.GetFinalReward();
|
||
// var itemData = _playerItemData.GetItemDataByDropIdAndTypeLureInflation(null, dropId);
|
||
// _rewardFinal.SetData(itemData[0]);
|
||
_rewardFinal.InflationRate = _thisEventData.InflationRate;
|
||
_rewardFinal.SetDropIcon("",dropId);
|
||
UpdateLevel();
|
||
}
|
||
|
||
private void UpdateTargetInfo()
|
||
{
|
||
// 奖励
|
||
var stage = _thisEventManager.EventData.CurrentStagetId;
|
||
if (stage == _thisEventManager.StageCount - 1)
|
||
{
|
||
_rewardItemFinal.gameObject.SetActive(true);
|
||
var dropId = _thisEventManager.GetFinalReward();
|
||
_rewardItemFinal.InflationRate = _thisEventData.InflationRate;
|
||
_rewardItemFinal.SetDropIcon("",dropId);
|
||
_normalReward.gameObject.SetActive(false);
|
||
}
|
||
else
|
||
{
|
||
_rewardItemFinal.gameObject.SetActive(false);
|
||
_normalReward.gameObject.SetActive(true);
|
||
var dropId = _thisEventManager.EventCubeMeltCollectionData.CollectingReward;
|
||
var itemData = _playerItemData.GetItemDataByDropIdAndTypeLureInflation(_thisEventData.InflationRate, dropId);
|
||
try
|
||
{
|
||
_rewardItem1.SetData(itemData[0]);
|
||
if (itemData.Count > 1)
|
||
{
|
||
_rewardItem2.SetData(itemData[1]);
|
||
}
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
LogError($"UpdateTargetInfoFailed error={e.Message}");
|
||
}
|
||
}
|
||
|
||
|
||
// 当前完成的收集
|
||
UpdateCollectInfo();
|
||
UpdateWeapon();
|
||
}
|
||
|
||
private void UpdateWeapon()
|
||
{
|
||
|
||
_weaponImage?.gameObject.SetActive(true);
|
||
|
||
// if (true)
|
||
// {
|
||
// _videoPlayer?.gameObject.SetActive(true);
|
||
// SetUpProgress();
|
||
// return;
|
||
// }
|
||
var uiService = GContext.container.Resolve<IUIService>();
|
||
var sprName = _thisEventManager.EventCubeMeltCollectionData.CollectingIcon;
|
||
uiService.SetImageSprite(_weaponImage,sprName);
|
||
SetUpProgress();
|
||
}
|
||
|
||
[Header("武器变化周期")]
|
||
[SerializeField] private float weaponUpdateDuration = 0.5f;
|
||
[Tooltip("火焰变化周期")]
|
||
[SerializeField] private float fxIncreaseDuration = 0.8f;
|
||
private async void UpdateWeaponProgress()
|
||
{
|
||
// _fxUIEventCubemeltFireIncrease.gameObject.SetActive(true);
|
||
var percent = _thisEventManager.GetCollectProgress();
|
||
var startValue = _weaponImage.color.r;
|
||
var df = weaponUpdateDuration * (percent - startValue);
|
||
var newColor = new Color(percent, percent, percent, 1f);
|
||
_weaponImage.DOColor(newColor, df);
|
||
// 播放火焰特效
|
||
// await Awaiters.Seconds(fxIncreaseDuration); //
|
||
// _fxUIEventCubemeltFireIncrease.gameObject.SetActive(false);
|
||
}
|
||
|
||
|
||
public void SetUpProgress()
|
||
{
|
||
var percent = _thisEventManager.GetCollectProgress();
|
||
ELog($"SetUpProgress-> {percent}");
|
||
var image = _weaponImage.GetComponent<Image>();
|
||
// image.color = new Color(percent, percent, percent, 1f);
|
||
image.color = new Color(0, 0, 0, 1f);
|
||
}
|
||
|
||
private void UpdateCollectInfo()
|
||
{
|
||
// 注,默认 数值的数量不会超过 UI的数量,当前最多是3组
|
||
var iCount = _thisEventData.CollectItems.Count;
|
||
for (var i = 0; i < iCount; ++i)
|
||
{
|
||
var item = _thisEventData.CollectItems[i];
|
||
_collectItems[i].gameObject.SetActive(true);
|
||
_collectItems[i].InitWithData(item);
|
||
}
|
||
|
||
for (var i = iCount; i < _collectItems.Length; ++i)
|
||
{
|
||
_collectItems[i].gameObject.SetActive(false);
|
||
}
|
||
}
|
||
|
||
private void UpdateTickCount()
|
||
{
|
||
_txtNum.text = _thisEventData.TicketCount.ToString();
|
||
}
|
||
|
||
public RectTransform GetEndRectTransform(int cellTypeValue)
|
||
{
|
||
var items = _thisEventManager.GetCollectionItems();
|
||
var index = 0;
|
||
foreach (var kv in items)
|
||
{
|
||
var itemId = kv.Key;
|
||
if (itemId == (int)cellTypeValue)
|
||
{
|
||
//注意不要超值-
|
||
break;
|
||
}
|
||
|
||
index++;
|
||
}
|
||
|
||
if (index >= _collectItems.Length)
|
||
return null;
|
||
var root = _collectItems[index];
|
||
ELog($"GetEndPos ->{index} : {root}");
|
||
// return (RectTransform)root.Find("collect_icon").transform;
|
||
return root.GetAniTransform();
|
||
}
|
||
|
||
private void UpdateTimer(long _ = 0L)
|
||
{
|
||
var now = _thisEventManager.GetRemainingTime();
|
||
// _txtTime.text = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds);
|
||
|
||
// ConvertTools.ConvertTime2(now);
|
||
_txtTime.text =ConvertTools.ConvertTime2(now);
|
||
// LocalizationMgr.GetFormatTextValue("UI_COMMON_end", ConvertTools.ConvertTime2(now));
|
||
if (now.TotalMilliseconds < 0)
|
||
{
|
||
Settle();
|
||
}
|
||
}
|
||
|
||
private void Settle()
|
||
{
|
||
// timer?.Cancel();
|
||
// timer = null;
|
||
_txtTime.text = LocalizationMgr.GetText("UI_EventRankPopupPanel_13");
|
||
//结算
|
||
_thisEventManager.OnSettle();
|
||
}
|
||
|
||
// 设置代币图标
|
||
void SetIcon()
|
||
{
|
||
var itemId = _thisEventManager.EventCubeMeltMainData.ItemID;
|
||
var tables = GContext.container.Resolve<Tables>();
|
||
var data = tables.TbItem.GetOrDefault(itemId);
|
||
var imageData = new ShowImageData(_imgTicket, data.Icon);
|
||
GContext.container.Resolve<IUIService>().SetImageSprite(imageData);
|
||
}
|
||
|
||
private void UpdateLevel()
|
||
{
|
||
// ELog("UpdateLevel-> ");
|
||
// var count = _thisEventManager.EventCubeMeltMainData.StageList.Count;
|
||
var count = _thisEventManager.StageCount;
|
||
|
||
var curIndex = (_thisEventData.CurrentStagetId) % count;
|
||
var startIndex = 0;
|
||
var offsetIndex = count - _showRewardCount;
|
||
// curIndex = 14;
|
||
ELog($"UpdateLevel-> {curIndex}");
|
||
|
||
|
||
if (curIndex <= 1)
|
||
{
|
||
startIndex = 0;
|
||
}
|
||
else if (curIndex > offsetIndex)
|
||
{
|
||
startIndex = offsetIndex;
|
||
}
|
||
else
|
||
{
|
||
startIndex = curIndex - 1;
|
||
}
|
||
|
||
for (var i = 0; i < _showRewardCount - 1; i++)
|
||
{
|
||
var index = startIndex + i;
|
||
if (index >= count)
|
||
{
|
||
break;
|
||
}
|
||
|
||
var state = 0;
|
||
if (index < curIndex)
|
||
{
|
||
state = 2;
|
||
}
|
||
else if (index == curIndex)
|
||
{
|
||
state = 1;
|
||
}
|
||
|
||
_levels[i].SetState(state);
|
||
_levels[i].SetTextNum($"{index + 1}");
|
||
}
|
||
|
||
_levels[_showRewardCount - 1].SetTextNum($"{count}");
|
||
}
|
||
|
||
private void RefreshUI()
|
||
{
|
||
ELog("RefreshUI");
|
||
|
||
UpdateTopInfo();
|
||
UpdateTargetInfo();
|
||
UpdateGameContext();
|
||
UpdateTickCount();
|
||
}
|
||
|
||
//-
|
||
private async Task UpdateCollectAsync()
|
||
{
|
||
if (_isUpdatingCollect)
|
||
{
|
||
ELog("UpdateCollectSkip reason=Running");
|
||
return;
|
||
}
|
||
|
||
_isUpdatingCollect = true;
|
||
ELog("UpdateCollect-> ");
|
||
try
|
||
{
|
||
await Awaiters.NextFrame;
|
||
|
||
var iCount = _thisEventData.CollectItems.Count;
|
||
for (var i = iCount; i < _collectItems.Length; ++i)
|
||
{
|
||
_collectItems[i].gameObject.SetActive(false);
|
||
}
|
||
|
||
var tasks = new List<Task>();
|
||
|
||
for (var i = 0; i < iCount; ++i)
|
||
{
|
||
var item = _thisEventData.CollectItems[i];
|
||
tasks.Add(_collectItems[i].UpdateCollectItem(item));
|
||
}
|
||
|
||
GContext.Publish(new EventUISound("audio_ui_block_cube_refresh"));
|
||
|
||
// GContext.Publish(new EventCubeMeltWeaponProgress
|
||
// {
|
||
// percent = _thisEventManager.GetCollectProgress()
|
||
// });
|
||
await Task.WhenAll(tasks);
|
||
await CheckIfCollectFinished();
|
||
}
|
||
finally
|
||
{
|
||
_isUpdatingCollect = false;
|
||
}
|
||
}
|
||
|
||
|
||
private async Task CheckIfCollectFinished()
|
||
{
|
||
var isFinishThisStage = _thisEventManager.IsThisCollectFinished();
|
||
var isGetStageReward = _thisEventManager.IsGetStageReward();
|
||
if (isFinishThisStage )
|
||
{
|
||
#if AGG
|
||
using (var e = GEvent.GameEvent("event_cubemelt_complete"))
|
||
{
|
||
e.AddContent("stage_id",_thisEventData.CurrentStagetId);
|
||
}
|
||
#else
|
||
ELog($"event_cubemelt_complete -> {_thisEventData.CurrentStagetId} ");
|
||
#endif
|
||
|
||
_canvasGroup.blocksRaycasts = false;
|
||
if (!isGetStageReward)
|
||
{
|
||
await RunFinishStage();
|
||
if (_thisEventData.CurrentStagetId >= _thisEventManager.StageCount - 1)
|
||
{
|
||
await ShowCompleteShowPanel();
|
||
// UpdateToNextStage();
|
||
}
|
||
else
|
||
{
|
||
await CheckStageRewardsGet();
|
||
// await ShowCompleteShowPanel();
|
||
UpdateToNextStage();
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
private async Task CheckStageRewardsGet()
|
||
{
|
||
_isStageRewardLogic = _thisEventManager.PlayGetStageReward();
|
||
if (_isStageRewardLogic)
|
||
{
|
||
// await CheckStageRewardFinished();
|
||
ELog("WaitForStageRewardFinished");
|
||
_waitStageRewardTcs = new TaskCompletionSource<bool>();
|
||
await _waitStageRewardTcs.Task;
|
||
}
|
||
}
|
||
// private async Task CheckFinalRewardsGet()
|
||
// {
|
||
// var isFinishAll = _thisEventManager.IsFinishAllStage();
|
||
// var isFinalGet = _thisEventManager.IsGetFinalReward();
|
||
// if (isFinishAll && !isFinalGet)
|
||
// {
|
||
// _isFinalRewardLogic = _thisEventManager.PlayGetFinalRewards();
|
||
// if (_isFinalRewardLogic)
|
||
// {
|
||
// await CheckFinalRewardsFinished();
|
||
// }
|
||
// }
|
||
// }
|
||
private async Task CheckStageRewardFinished()
|
||
{
|
||
if (!_isStageRewardLogic) return;
|
||
while (true)
|
||
{
|
||
if (!_isStageRewardLogic)
|
||
return;
|
||
await Awaiters.Seconds(0.2f);
|
||
}
|
||
}
|
||
private async Task CheckFinalRewardsFinished()
|
||
{
|
||
if (!_isFinalRewardLogic) return;
|
||
while (true)
|
||
{
|
||
if (!_isFinalRewardLogic)
|
||
return;
|
||
await Awaiters.Seconds(1f);
|
||
}
|
||
}
|
||
|
||
// private readonly float _durationForShowFinishView = 1f;
|
||
private async Task RunFinishStage()
|
||
{
|
||
// _stageComplete.gameObject.SetActive(true);
|
||
// await Awaiters.Seconds(2f);
|
||
// _stageComplete.gameObject.SetActive(false);
|
||
|
||
await RunWeaponExhibit();
|
||
ClearBoardAndPieces();
|
||
}
|
||
|
||
private async Task RunWeaponExhibit()
|
||
{
|
||
// _fxUIEventCubemeltFireIncrease.gameObject.SetActive(true);
|
||
// await Awaiters.Seconds(fxIncreaseDuration); //
|
||
_weaponImage.gameObject.SetActive(false);
|
||
// _fxUIEventCubemeltFireIncrease.gameObject.SetActive(false);
|
||
|
||
OnWeaponExhibitNew();
|
||
// GContext.Publish(new EventCubeMeltWeaponExhibit());
|
||
// audio_ui_cubemelt_complete_show
|
||
// GContext.Publish(new EventUISound("audio_ui_cubemelt_complete_show"));
|
||
await WaitForExhibitFinished();
|
||
}
|
||
|
||
private TaskCompletionSource<bool> _waitExhibitTcs;
|
||
private async Task WaitForExhibitFinished()
|
||
{
|
||
ELog("WaitForExhibitFinished");
|
||
_waitExhibitTcs = new TaskCompletionSource<bool>();
|
||
await _waitExhibitTcs.Task;
|
||
}
|
||
|
||
private async Task ShowCompleteShowPanel()
|
||
{
|
||
var uiPanel = new UIType(_thisEventManager.EventCubeMeltMainData.CompletePanel);
|
||
var panel = await UIManager.Instance.ShowUI(uiPanel);
|
||
if (panel)
|
||
{
|
||
var stageId = _thisEventData.CurrentStagetId;
|
||
panel.GetComponent<EventBlockCompleteShowPanel>().UpdateStage(stageId);
|
||
}
|
||
|
||
// await Awaiters.Seconds(0.5f);
|
||
}
|
||
|
||
private async void OnGetReward()
|
||
{
|
||
ELog("OnGetReward");
|
||
await CheckStageRewardsGet();
|
||
UpdateToNextStage();
|
||
}
|
||
private void UpdateToNextStage()
|
||
{
|
||
ELog("UpdateToNextStage");
|
||
// await Awaiters.NextFrame;
|
||
_thisEventManager.UpdateToNextStage();
|
||
}
|
||
|
||
private void ClearBoardAndPieces()
|
||
{
|
||
if (boardRenderer)
|
||
{
|
||
boardRenderer.ClearBoard();
|
||
}
|
||
|
||
foreach (var pieceRenderer in pieceRendererArray)
|
||
{
|
||
if (pieceRenderer)
|
||
{
|
||
pieceRenderer.CleanPiece();
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
private async void OnWeaponExhibitNew()
|
||
{
|
||
ELog("OnWeaponExhibitNew");
|
||
|
||
// var s = string.Format("%2f", "video_block_viking_weapon_01");
|
||
// var stageId = _thisEventData.CurrentStagetId + 1 ;
|
||
// var s = $"video_block_viking_weapon_{stageId:D2}";
|
||
|
||
// CollectingIcon
|
||
var video = _thisEventManager.EventCubeMeltCollectionData.CollectingVideo;
|
||
await _blockVideoPlayer.PlayVideo(video);
|
||
_blockVideoPlayer.gameObject.SetActive(true);
|
||
var rootAni = root.GetComponent<Animation>();
|
||
rootAni.Play(aniEventBlockFinishName);
|
||
// await Awaiters.Seconds(4f);
|
||
// GContext.Publish(new EventCubeMeltWeaponExhibitFinished());
|
||
}
|
||
|
||
// private void OnBlockFinishEnd()
|
||
// {
|
||
// ELog("OnBlockFinishEnd");
|
||
// GContext.Publish(new EventCubeMeltWeaponExhibitFinished());
|
||
// }
|
||
//
|
||
#endregion
|
||
|
||
#region BlockGame 逻辑
|
||
private void Initialize()
|
||
{
|
||
// _thisEventManager.SetBoardDimension(new Vector2Int(boardWidth, boardHeight));
|
||
_thisEventManager.SetPieceDimension(new Vector2Int(pieceWidth, pieceHeight));
|
||
if (boardRenderer)
|
||
{
|
||
boardRenderer.TargetCellSize = pieceTargetSize;
|
||
boardRenderer.Initialize( _thisEventData.BoardViewSize.y,_thisEventData.BoardViewSize.x, _thisEventData.BoardData);
|
||
}
|
||
|
||
if (pieceRendererArray.Length > 0)
|
||
{
|
||
for (var i = 0; i < pieceRendererArray.Length; ++i)
|
||
{
|
||
ELog($"InitializePieceRenderer index={i} renderer={pieceRendererArray[i]}");
|
||
|
||
pieceRendererArray[i].Index = i;
|
||
pieceRendererArray[i].Initialize(pieceHeight, pieceWidth);
|
||
pieceRendererArray[i].ScaleFactor = pieceScaleFactor;
|
||
pieceRendererArray[i].OffsetY = pieceOffsetY;
|
||
pieceRendererArray[i].TargetSize = pieceTargetSize;
|
||
pieceRendererArray[i].DistanceFactor = pieceDistanceFactor;
|
||
}
|
||
}
|
||
}
|
||
[Space]
|
||
[Header("切关动画每一层显示延时")]
|
||
public float delayBetweenCells = 0.1f; // 每个单元格间隔0.3秒
|
||
[Header("切关动画格子缩放时间")]
|
||
public float scaleDuration = 0.2f; // 缩放动画持续时间
|
||
|
||
[Header("底部Piece 延时延时")]
|
||
public float delayBetweenPiece = 0.1f;
|
||
[Header("底部Piece 缩放时间")]
|
||
public float pieceScaleDuration = 0.3f;
|
||
public void OnEnterAnimationFinished()
|
||
{
|
||
ELog("OnEnterAnimationFinished()");
|
||
|
||
_ = RunStageSwitchAnimation();
|
||
|
||
}
|
||
private async Task RunStageSwitchAnimation()
|
||
{
|
||
var animationSequence = DOTween.Sequence();
|
||
var delay = 0f;
|
||
if(boardRenderer)
|
||
boardRenderer.UpdateBoardWithAnim(animationSequence,scaleDuration, delayBetweenCells,out delay);
|
||
|
||
for(var i = 0;i < pieceRendererArray.Length; ++i)
|
||
{
|
||
var pieceRenderer = pieceRendererArray[i];
|
||
if (pieceRenderer)
|
||
{
|
||
pieceRenderer.UpdatePieceWithAnim(animationSequence, pieceScaleDuration,delay + i * delayBetweenPiece);
|
||
}
|
||
}
|
||
|
||
// 可选:动画完成后的回调
|
||
animationSequence.OnComplete(OnSwitchStageAnimationEnd);
|
||
}
|
||
|
||
private void OnSwitchStageAnimationEnd()
|
||
{
|
||
_ = OnSwitchStageAnimationEndAsync();
|
||
}
|
||
private async Task OnSwitchStageAnimationEndAsync()
|
||
{
|
||
await Awaiters.NextFrame;
|
||
ELog("OnSwitchStageAnimationEnd");
|
||
OnNewGuide();
|
||
// 按钮有效
|
||
|
||
await CheckIfCollectFinished();
|
||
}
|
||
private void OnNewGuide()
|
||
{
|
||
var stageId = _thisEventData?.CurrentStagetId ?? -1;
|
||
var cycle = _thisEventData?.Cycle?? -1;
|
||
if (stageId == 0 && cycle == 0)
|
||
{
|
||
var bLoop = false;
|
||
#if UNITY_EDITOR
|
||
bLoop = false;
|
||
#endif
|
||
var isGuide = GContext.container.Resolve<GuideDataCenter>()
|
||
// .InspectTriggerGuide("EventBlockVikingPanel", curPanelName: gameObject.name);
|
||
.TriggerGuide(nameof(GroupName.Block01), "EventBlockVikingPanel",bLoop,gameObject.name);
|
||
if (isGuide)
|
||
{
|
||
GContext.OnEvent<AddIndexEvent>().Subscribe(GuideListener).AddTo(disposables);;
|
||
}
|
||
else
|
||
{
|
||
// var cycle = _thisEventData?.Cycle ?? -1;
|
||
if (_thisEventManager.IsInGuideAnim() && cycle == 0)
|
||
{
|
||
RunGuide01Anim();
|
||
}
|
||
else
|
||
{
|
||
_thisEventManager.SetIsInGuideAnim(false);
|
||
}
|
||
_canvasGroup.blocksRaycasts = true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
_canvasGroup.blocksRaycasts = true;
|
||
}
|
||
}
|
||
private async Task ShowCurrentStage()
|
||
{
|
||
await Awaiters.NextFrame;
|
||
var stage = _thisEventData.CurrentStagetId;
|
||
ELog($"ShowCurrentStage-> {stage}");
|
||
ClearBoardAndPieces();
|
||
GContext.Publish(new EventCubeMeltShowMinWeapon());
|
||
// await RunFinishRecoverAnim();
|
||
}
|
||
|
||
private void UpdateGameContext()
|
||
{
|
||
// 更新当前管卡的数据
|
||
if (boardRenderer)
|
||
{
|
||
boardRenderer.UpdateBoard();
|
||
}
|
||
|
||
foreach (var pieceRenderer in pieceRendererArray)
|
||
{
|
||
if (pieceRenderer)
|
||
{
|
||
pieceRenderer.UpdatePiece();
|
||
}
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
}
|
||
} |