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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Views/GamePanel.cs.meta
Normal file
11
Assets/Scripts/Views/GamePanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ab7a718343b5ab488f7741f46cee848
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -15,8 +15,7 @@ namespace Views{
|
||||
public Button _settingGame;
|
||||
public Button _aboutGame;
|
||||
|
||||
public Button _achiveGame;
|
||||
public Button _changlleGame;
|
||||
|
||||
|
||||
public override void OnOpenView(IC_ViewData parameters)
|
||||
{
|
||||
@@ -33,8 +32,8 @@ namespace Views{
|
||||
this._toGame.onClick.AddListener (OnClickToGame , SeAudio.Btn_Click);
|
||||
this._aboutGame.onClick.AddListener(OnClickAboutGame , SeAudio.Btn_Click);
|
||||
this._settingGame.onClick.AddListener(OnClickSettingGame , SeAudio.Btn_Click);
|
||||
this._achiveGame.onClick.AddListener(OnClickAchiveGame , SeAudio.Btn_Click);
|
||||
this._changlleGame.onClick.AddListener(OnClickChanglleGame , SeAudio.Btn_Click);
|
||||
// this._achiveGame.onClick.AddListener(OnClickAchiveGame , SeAudio.Btn_Click);
|
||||
// this._changlleGame.onClick.AddListener(OnClickChanglleGame , SeAudio.Btn_Click);
|
||||
}
|
||||
|
||||
private void OnClickChanglleGame()
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace Views
|
||||
public const string GameRevertPanel ="GameRevertPanel";
|
||||
public const string SelectWeaponPanel ="SelectWeaponPanel";
|
||||
public const string AboutPanel ="AboutPanel";
|
||||
public const string GamePanel ="GamePanel";
|
||||
//Code end
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user