Skip to content

GameSystemUI.MoveSystem ​

MoveControlBase 仅客户端 ​

命名空间 GameSystemUI.MoveSystem

csharp
public abstract class MoveControlBase : Panel, IThinker

移动控制系统的抽象基类 提供移动命令发送、镜头角度检测、单位切换等通用逻辑

构造函数 ​

MoveControlBase 仅客户端 ​

csharp
protected MoveControlBase()

MoveControlBase 仅客户端 ​

csharp
protected MoveControlBase(IGameLink<GameDataControlPanel> link)

属性 ​

StopMoveOnUnitChange 仅客户端 ​

csharp
public bool StopMoveOnUnitChange { get; set; }

是否在单位变化时停止移动

BindUnit 仅客户端 ​

csharp
public abstract Unit? BindUnit { get; set; }

当前绑定的单位

UseMainUnit 仅客户端 ​

csharp
public abstract bool UseMainUnit { get; set; }

是否自动绑定本地玩家主控单位。设为 false 时控件仍会派发输入事件,但不会自动发单位移动命令。

IsCurrentlyMoving 仅客户端 ​

csharp
protected abstract bool IsCurrentlyMoving { get; }

检查是否正在移动中

返回: true表示正在移动

方法 ​

GetCurrentMoveAngle 仅客户端 ​

csharp
protected abstract Angle? GetCurrentMoveAngle()

获取当前移动角度(如果正在移动)

返回: 当前移动角度,如果没有则返回null

OnBindUnitChanged 仅客户端 ​

csharp
protected abstract void OnBindUnitChanged(Unit? oldUnit, Unit? newUnit, bool wasMoving)

处理单位绑定变化的特定逻辑

  • oldUnit — 原来的单位
  • newUnit — 新的单位
  • wasMoving — 变化前是否正在移动

RaiseMoveInput 仅客户端 ​

csharp
protected void RaiseMoveInput(Angle angle, MoveInputState state)

RaiseMoveStopped 仅客户端 ​

csharp
protected void RaiseMoveStopped()

Move 仅客户端 ​

csharp
protected void Move(Angle angle)

发送移动命令(自动应用镜头偏移)

  • angle — 原始移动角度

MoveAdjust 仅客户端 ​

csharp
protected void MoveAdjust(Angle angle)

发送移动调整命令(自动应用镜头偏移)

  • angle — 原始移动角度

MoveStop 仅客户端 ​

csharp
protected void MoveStop()

发送停止移动命令

OnStartMoving 仅客户端 ​

csharp
protected void OnStartMoving()

开始移动时调用

OnStopMoving 仅客户端 ​

csharp
protected void OnStopMoving()

停止移动时调用

ExecuteMove 仅客户端 ​

csharp
protected void ExecuteMove(Angle angle)

执行移动命令(根据isFirstMove决定使用Move还是MoveAdjust)

  • angle — 移动角度

HandleBindUnitChange 仅客户端 ​

csharp
protected void HandleBindUnitChange(Unit? oldUnit, Unit? newUnit)

处理单位绑定变化的通用逻辑

  • oldUnit — 原来的单位
  • newUnit — 新的单位

Think 仅客户端 ​

csharp
public virtual void Think(int delta)

IThinker接口实现,检测镜头角度变化并发送修正移动命令

  • delta — 时间间隔(毫秒)

DisposeManaged 仅客户端 ​

csharp
protected override void DisposeManaged()

事件 ​

OnMoveInput 仅客户端 ​

csharp
public event EventHandler<MoveInputEventArgs>? OnMoveInput

移动输入事件。控件没有绑定 Unit 时也会触发,用于纯 SceneGraph、相机或自定义控制目标。

字段 ​

isFirstMove 仅客户端 ​

csharp
protected bool isFirstMove

标记是否是第一次移动

lastCameraYaw 仅客户端 ​

csharp
protected float lastCameraYaw

记录上一次的镜头yaw角度

MoveControlExtensions 仅客户端 ​

命名空间 GameSystemUI.MoveSystem

csharp
public static class MoveControlExtensions

方法 ​

GetMoveControl 仅客户端 ​

csharp
public static MoveControlBase? GetMoveControl(this Control control)

TryGetMoveControl 仅客户端 ​

csharp
public static bool TryGetMoveControl(this Control control, out MoveControlBase? moveControl)

SetUseMainUnit 仅客户端 ​

csharp
public static bool SetUseMainUnit(this Control control, bool useMainUnit)

BindMoveUnit 仅客户端 ​

csharp
public static bool BindMoveUnit(this Control control, Unit? unit)

MoveInputEventArgs 仅客户端 ​

命名空间 GameSystemUI.MoveSystem

csharp
public sealed class MoveInputEventArgs : EventArgs

构造函数 ​

MoveInputEventArgs 仅客户端 ​

csharp
public MoveInputEventArgs(MoveInputState state, Angle? angle, Angle? worldAngle, Vector2 direction, Vector2 worldDirection)

属性 ​

State 仅客户端 ​

csharp
public MoveInputState State { get; }

Angle 仅客户端 ​

csharp
public Angle? Angle { get; }

WorldAngle 仅客户端 ​

csharp
public Angle? WorldAngle { get; }

Direction 仅客户端 ​

csharp
public Vector2 Direction { get; }

WorldDirection 仅客户端 ​

csharp
public Vector2 WorldDirection { get; }

MoveInputState 仅客户端 ​

命名空间 GameSystemUI.MoveSystem

csharp
public enum MoveInputState

枚举值 ​

  • Started
  • Changed
  • Stopped