This commit is contained in:
j0sh.oleary11
2021-02-03 19:06:37 -08:00
parent cf44e855e6
commit 8e34ae1b68
6 changed files with 28 additions and 49 deletions

View File

@@ -106,7 +106,6 @@ namespace CaveGame.Client
[PacketType.netDamageTile] = OnDamageTile,
[PacketType.netPlaceFurniture] = OnPlaceFurniture,
[PacketType.netRemoveFurniture] = OnRemoveFurniture,
[PacketType.sRejectLogin] = OnServerRejectLogin,
[PacketType.sAcceptLogin] = OnServerAcceptLogin,
[PacketType.sPlayerPeerJoined] = OnPeerJoined,
@@ -129,63 +128,31 @@ namespace CaveGame.Client
public float ServerKeepAlive { get; set; }
public GameClient(CaveGameGL _game) { } // empty???
public GameClient(CaveGameGL _game, AuthDetails login)
{
public GameClient(CaveGameGL _game) {
Game = _game;
InitNetworkEvents();
World = new LocalWorld(this);
Camera = new Camera2D{ Zoom = CameraZoom };
Chat = new GameChat(this);
World = new LocalWorld(this);
Camera = new Camera2D { Zoom = CameraZoom };
Chat = new GameChat(this);
PauseMenu = new PauseMenu(this);
Inventory = new PlayerContainerFrontend();
NetworkUsername = login.UserName;
NetClient = new NetworkClient(login.ServerAddress);
ClientTasks = new List<RepeatingIntervalTask>
{
new RepeatingIntervalTask(ReplicatePlayerState, 1 / 10.0f),
new RepeatingIntervalTask(ChunkUnloadingCheck, 1/2.0f),
new RepeatingIntervalTask(ChunkLoadingCheckUpdate, 1 / 2.0f),
};
/*FPSGraph = new GraphRenderer<FpsSample>
{
BackgroundColor = new Color(0.2f, 0.2f, 0.4f)*0.5f,
ScreenPosition = new Vector2(50, 500),
GraphSize = new Vector2(300, 120),
GraphName = "FPS",
YAxisMin = 0,
Scale = 0.5f,
YAxisMax = 240,
};
AverageData = new GraphRecorder<FpsSample>
{
Boldness = 2.0f,
Name = "Average FPS",
SampleCount = 500,
Color = Color.Yellow,
};
ImmediateData = new GraphRecorder<FpsSample>
{
Boldness = 1.0f,
Name = "FPS",
SampleCount = 500,
Color = Color.Gray*0.5f,
};*/
ChunkingRadius = 1;
}
public GameClient(CaveGameGL _game, AuthDetails login) : this(_game)
{
NetworkUsername = login.UserName;
NetClient = new NetworkClient(login.ServerAddress);
}
protected struct FpsSample : GraphSample
{
public double Value { get; set; }

View File

@@ -42,7 +42,6 @@ namespace CaveGame.Client.UI
public string InternalText { get { return InputBuffer; } }
public List<char> BlacklistedCharacters;
public bool ClearOnReturn { get; set; }
public string DisplayText

View File

@@ -28,8 +28,6 @@ namespace CaveGame.Client.UI
bool IsMouseInside(MouseState ms);
Vector2 AnchorPoint { get; set; }
Vector2 AbsoluteSize { get; }
Vector2 AbsolutePosition { get; }

View File

@@ -17,6 +17,8 @@ namespace CaveGame.Client.UI
public UINode FindFirstChildWithName(string name) => Children.First(t => t.Name == name);
public List<UINode> FindChildrenWithName(string name) => Children.FindAll(t => t.Name == name);
public bool Debugging { get; set; }
public bool ParentOverride { get; set; }

View File

@@ -29,6 +29,20 @@ namespace CaveGame.Core
return new Vector2((float)Math.Round(og.X, decimalplaces), (float)Math.Round(og.Y, decimalplaces));
}
public static float GetDelta(this GameTime gt)
{
return (float)gt.ElapsedGameTime.TotalSeconds;
}
public static Vector2 Lerp(this Vector2 a, Vector2 b, float alpha)
{
return new Vector2(
MathematicsExtensions.Lerp(a.X, b.X, alpha),
MathematicsExtensions.Lerp(a.Y, b.Y, alpha)
);
}
public static Vector2 GetY(this Vector2 vec) => new Vector2(0, vec.Y);
public static Vector2 GetX(this Vector2 vec) => new Vector2(vec.X, 0);

View File

@@ -18,9 +18,8 @@ namespace DataManagement
COMPLEX = 8,
STRING = 9,
BOOL = 10,
}
public abstract class MetabinaryTag
{
public abstract string Name { get; set; }