refactoring
This commit is contained in:
parent
fbd0ba445a
commit
18d8721dd5
68 changed files with 2187 additions and 36 deletions
|
|
@ -1,8 +1,10 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Numerics;
|
||||
using Roboto.Memory;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Roboto.Core;
|
||||
using Roboto.Data;
|
||||
using Roboto.Engine;
|
||||
using Roboto.Input;
|
||||
using Roboto.Navigation;
|
||||
|
|
@ -14,9 +16,9 @@ namespace Automata.Ui.ViewModels;
|
|||
/// </summary>
|
||||
public sealed class EntityOverlayData
|
||||
{
|
||||
public Vector2 PlayerPosition;
|
||||
public float PlayerZ;
|
||||
public Matrix4x4? CameraMatrix;
|
||||
/// <summary>Player position at time the entity list was built (cold tick, 10Hz).</summary>
|
||||
public Vector2 SnapshotPlayerPosition;
|
||||
public float SnapshotPlayerZ;
|
||||
public EntityOverlayEntry[] Entries = [];
|
||||
}
|
||||
|
||||
|
|
@ -96,14 +98,19 @@ public partial class RobotoViewModel : ObservableObject, IDisposable
|
|||
/// </summary>
|
||||
public static volatile EntityOverlayData? OverlayData;
|
||||
|
||||
/// <summary>
|
||||
/// Shared GameDataCache for the overlay layer to read camera/player data directly.
|
||||
/// </summary>
|
||||
public static volatile GameDataCache? SharedCache;
|
||||
|
||||
public RobotoViewModel()
|
||||
{
|
||||
var config = new BotConfig();
|
||||
var memory = new MemoryAdapter();
|
||||
var reader = new GameMemoryReader();
|
||||
var humanizer = new Humanizer(config);
|
||||
var input = new InterceptionInputController(humanizer);
|
||||
|
||||
_engine = new BotEngine(config, memory, input);
|
||||
_engine = new BotEngine(config, reader, input);
|
||||
|
||||
_engine.StatusChanged += status =>
|
||||
{
|
||||
|
|
@ -119,7 +126,9 @@ public partial class RobotoViewModel : ObservableObject, IDisposable
|
|||
if (_engine.IsRunning) return;
|
||||
var ok = _engine.Start();
|
||||
IsRunning = _engine.IsRunning;
|
||||
if (!ok)
|
||||
if (ok)
|
||||
SharedCache = _engine.Cache;
|
||||
else
|
||||
StatusText = _engine.Status;
|
||||
}
|
||||
|
||||
|
|
@ -142,6 +151,7 @@ public partial class RobotoViewModel : ObservableObject, IDisposable
|
|||
NavStatus = "—";
|
||||
Entities.Clear();
|
||||
OverlayData = null;
|
||||
SharedCache = null;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
|
|
@ -232,9 +242,8 @@ public partial class RobotoViewModel : ObservableObject, IDisposable
|
|||
{
|
||||
OverlayData = new EntityOverlayData
|
||||
{
|
||||
PlayerPosition = state.Player.Position,
|
||||
PlayerZ = state.Player.Z,
|
||||
CameraMatrix = state.CameraMatrix,
|
||||
SnapshotPlayerPosition = state.Player.Position,
|
||||
SnapshotPlayerZ = state.Player.Z,
|
||||
Entries = overlayEntries.ToArray(),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue