You've already forked taptap2024_GJ_chidouren
updat core
This commit is contained in:
80
Assets/Scripts/Views/GamePanel.cs
Normal file
80
Assets/Scripts/Views/GamePanel.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Coffee.UIEffects;
|
||||
using Framework.Timer;
|
||||
using Framework.Utils.UITools;
|
||||
using Game;
|
||||
using Game.Component;
|
||||
using Game.EventDefine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using IcecreamView;
|
||||
using UniFramework.Event;
|
||||
|
||||
namespace Views
|
||||
{
|
||||
public class GamePanel : IcecreamView.IC_AbstractModule
|
||||
{
|
||||
[SerializeField] private ETCJoystick _joystick;
|
||||
[SerializeField] private UIEffect _redPoint;
|
||||
[SerializeField] private UIEffect _greenPoint;
|
||||
[SerializeField] private UIEffect _bluePoint;
|
||||
[SerializeField] private Image _slider;
|
||||
[SerializeField] private TextNumber _textNumber;
|
||||
|
||||
public override void OnInitView ()
|
||||
{
|
||||
this._textNumber.TextAfterHandler = (value) => $"{value}/{MapContent.Instance.ScenePart.completeConditionNumber}";
|
||||
this._joystick.onMove.AddListener (OnMovePlayer);
|
||||
this._joystick.onMoveEnd.AddListener (OnEndMovePlayer);
|
||||
}
|
||||
|
||||
private void OnEndMovePlayer ()
|
||||
{
|
||||
MapContent.Instance.PlayerEntity.OnMoveEnd ();
|
||||
}
|
||||
|
||||
private void OnMovePlayer (Vector2 arg)
|
||||
{
|
||||
if (!MapContent.Instance.IsActiveGame)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MapContent.Instance.PlayerEntity.OnMove (arg);
|
||||
}
|
||||
|
||||
|
||||
public override void OnOpenView (IC_ViewData parameters)
|
||||
{
|
||||
this._redPoint.effectFactor = RoomManager.Instance.PartIndex >= 1 ? 0 : 0.8f;
|
||||
this._greenPoint.effectFactor = RoomManager.Instance.PartIndex >= 2 ? 0 : 0.8f;
|
||||
this._bluePoint.effectFactor = RoomManager.Instance.PartIndex >= 3 ? 0 : 0.8f;
|
||||
UniEvent.AddListener<GameEventDefine.OverlyCoin> (OnChangeCoin);
|
||||
UniEvent.AddListener<GlobalEventDefine.RefreshView> (OnChangeCoin);
|
||||
OnChangeCoin (null);
|
||||
// GameUpdateMgr.Instance.AddUpdater (DoUpdate);
|
||||
}
|
||||
|
||||
public override void OnCloseView ()
|
||||
{
|
||||
// GameUpdateMgr.Instance.RemoveUpdater (DoUpdate);
|
||||
UniEvent.RemoveListener<GameEventDefine.OverlyCoin> ( OnChangeCoin);
|
||||
UniEvent.RemoveListener<GlobalEventDefine.RefreshView> ( OnChangeCoin);
|
||||
}
|
||||
|
||||
private void DoUpdate ()
|
||||
{
|
||||
this._slider.fillAmount = MapContent.Instance.ScenePart.CurProgress;
|
||||
this._textNumber.Number = MapContent.Instance.ScenePart.CurrentConditionNumber;
|
||||
}
|
||||
|
||||
private void OnChangeCoin (IEventMessage eventMessage)
|
||||
{
|
||||
// var message = eventMessage as GameEventDefine.OverlyCoin;
|
||||
this._slider.fillAmount = MapContent.Instance.ScenePart.CurProgress;
|
||||
this._textNumber.Number = MapContent.Instance.ScenePart.CurrentConditionNumber;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user