using System;
namespace AibisDream
{
///
/// 游戏状态
///
public enum GameState
{
NotStarted, // 未开始
Playing, // 游戏中
Paused, // 暂停
GameOver // 游戏结束
}
///
/// 游戏逻辑接口
/// 负责管理游戏的整体流程和状态
///
public interface IBlockPuzzleGameLogic
{
///
/// 当前游戏状态
///
GameState CurrentState { get; }
///
/// 当前分数(已放置的格子数量)
///
int Score { get; }
///
/// 当前选中的形状
///
IBlockShape CurrentShape { get; }
///
/// 网格系统
///
IBlockPuzzleGrid Grid { get; }
///
/// 放置验证器
///
IPlacementValidator Validator { get; }
///
/// 游戏开始事件
///
event Action OnGameStart;
///
/// 游戏结束事件
///
event Action OnGameOver;
///
/// 形状放置成功事件
///
event Action OnShapePlaced;
///
/// 形状放置失败事件
///
event Action OnShapePlaceFailed;
///
/// 分数变化事件
///
event Action OnScoreChanged;
///
/// 初始化游戏
///
/// 网格宽度
/// 网格高度
void InitializeGame(int gridWidth, int gridHeight);
///
/// 开始游戏
///
void StartGame();
///
/// 暂停游戏
///
void PauseGame();
///
/// 继续游戏
///
void ResumeGame();
///
/// 结束游戏
///
void EndGame();
///
/// 重置游戏
///
void ResetGame();
///
/// 选择形状
///
/// 要选择的形状
void SelectShape(IBlockShape shape);
///
/// 尝试放置当前选中的形状到指定位置
///
/// 网格X坐标
/// 网格Y坐标
/// 是否放置成功
bool TryPlaceShape(int gridX, int gridY);
///
/// 旋转当前选中的形状
///
/// 旋转角度
void RotateCurrentShape(RotationAngle angle);
///
/// 检查是否还有可放置的形状
///
/// 可用的形状列表
/// 是否还有可放置的形状
bool HasPlaceableShapes(IBlockShape[] availableShapes);
///
/// 获取下一个可用的形状
///
/// 形状池
/// 下一个形状,如果没有则返回null
IBlockShape GetNextShape(IBlockShape[] shapePool);
}
}