refactor(重构): 重构了事件驱动的代码体系,使用全新命名和版本,以及测试套件的初试
- 移除了.csproj文件 - 更新了.gitignore,添加了.editorconfig - 重构了IBoard和IPiece接口,引入了新的事件处理机制 - 优化了CCBoard、CCPiece等类的实现,使用新的事件驱动模型 - 删除了冗余代码,提高了代码的可读性和可维护性
This commit is contained in:
@ -2,17 +2,21 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Vector2I = Vector.Vector2I;
|
||||
|
||||
|
||||
public interface IPiece {
|
||||
public interface IPieceOn {
|
||||
void OnPos(object self, Vector2I oldPos) {}
|
||||
void OnMove(object self, Vector2I oldPos) {}
|
||||
void OnSelected(object self, bool oldIsSelected) {}
|
||||
void OnName(object self, string oldName) {}
|
||||
}
|
||||
|
||||
IPieceOn? On { get; protected set; }
|
||||
Vector2I Pos { get; set; }
|
||||
string Name { get; set; }
|
||||
bool IsSelected { get; set; }
|
||||
Dictionary<string, object> Data { get; set; }
|
||||
|
||||
event EventHandler<Vector2I> OnPos;
|
||||
event EventHandler<Vector2I> OnMove;
|
||||
event EventHandler<bool> OnSelected;
|
||||
event EventHandler<string> OnName;
|
||||
|
||||
bool CanMove(Vector2I to);
|
||||
bool Move(Vector2I pos);
|
||||
}
|
||||
|
Reference in New Issue
Block a user