70 lines
1.9 KiB
C#
70 lines
1.9 KiB
C#
using System;
|
|
using Framework;
|
|
using Gameplay.Guide;
|
|
using LTGame;
|
|
using TGS;
|
|
using UnityEngine;
|
|
|
|
namespace Gameplay.Level
|
|
{
|
|
public abstract class BaseLevelState : NBaseState
|
|
{
|
|
protected Level _level;
|
|
|
|
public BaseLevelState(Level level, int stateId) : base(stateId)
|
|
{
|
|
_level = level;
|
|
}
|
|
|
|
public override void Run(float dt)
|
|
{
|
|
// 暂停状态下不执行
|
|
if (_level.IsPause()) return;
|
|
|
|
base.Run(dt);
|
|
}
|
|
|
|
protected override void _OnEnter(NBaseState exitState,
|
|
object param)
|
|
{
|
|
}
|
|
|
|
protected override void _OnRunning()
|
|
{
|
|
|
|
}
|
|
|
|
protected override void _OnExit(NBaseState exitState,
|
|
object param)
|
|
{
|
|
}
|
|
|
|
protected abstract void _OnCellClick(TerrainGridSystem tgs, int cellIndex, int buttonIndex);
|
|
|
|
protected abstract void _OnClick(Vector2 screenPosition);
|
|
|
|
public void ClickFromScreen(Vector2 screenPos)
|
|
{
|
|
_OnClick(screenPos);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 检查能否点击地板
|
|
/// </summary>
|
|
protected void CheckCellClick(TerrainGridSystem tgs, int cellIndex, int buttonIndex)
|
|
{
|
|
if (GuideManager.Instance.IsGuiding && // 在新手引导中
|
|
GuideManager.Instance.IsControlFloor && // 是否控制地板点击
|
|
GuideManager.Instance.FloorIndex != cellIndex) // 点击的不是指定地板
|
|
{
|
|
EventManager.Instance.Send(EventManager.EventName.ToFightModelDragSuc, false);
|
|
return;
|
|
}
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.Guide_ClickFloor, cellIndex);
|
|
|
|
DebugUtil.LogG($"用户点击格子:{cellIndex}");
|
|
_OnCellClick(tgs, cellIndex, buttonIndex);
|
|
}
|
|
}
|
|
} |