init commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using Godot;
|
||||
|
||||
public partial class ItemStats : Node {
|
||||
|
||||
// Item 0
|
||||
public StatItem[] stats = {
|
||||
new StatItem{
|
||||
ItemName = "Sniper",
|
||||
InventorySize = new Vector2I(1, 4),
|
||||
Weight = 400,
|
||||
IsQuantityItem = false,
|
||||
ToolPath = "res://Prefab/Tools/Sniper.tscn",
|
||||
ToolDamage = 50
|
||||
},
|
||||
|
||||
// Item 1
|
||||
new StatItem{
|
||||
|
||||
},
|
||||
|
||||
// Item 2
|
||||
new StatItem{
|
||||
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public class StatItem {
|
||||
public string ItemName {get; set;} = "";
|
||||
public Vector2I InventorySize {get; set;}
|
||||
public int Weight {get; set;}
|
||||
public bool IsQuantityItem {get; set;}
|
||||
public int MaxQuantity {get; set;}
|
||||
public string ToolPath {get; set;}
|
||||
public int ToolDamage { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using Godot;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public partial class MistoxNet : Node{
|
||||
Options _Options;
|
||||
Reference _Reference;
|
||||
|
||||
public override void _Ready() {
|
||||
_Options = GetNode<Options>( "/root/Options" );
|
||||
_Reference = GetNode<Reference>("/root/Reference");
|
||||
_Reference.MistoxNet = this;
|
||||
}
|
||||
|
||||
public async Task<(bool, Account)> TrySession( string UserName, string Password ) {
|
||||
using( System.Net.Http.HttpClient client = new System.Net.Http.HttpClient() ) {
|
||||
HttpResponseMessage response = await client.PostAsJsonAsync( "https://mistox.net/api/account/session", new Account { UserName = UserName, PasswordHash = Password } );
|
||||
string result = await response.Content.ReadAsStringAsync();
|
||||
Account User = JsonConvert.DeserializeObject<Account>(result);
|
||||
if( User != null && string.IsNullOrEmpty( User.Error ) ) {
|
||||
return (true, User);
|
||||
}
|
||||
return (false, User);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<(bool, Account)> TryLogin( string UserName, string Password ) {
|
||||
using( System.Net.Http.HttpClient client = new System.Net.Http.HttpClient() ) {
|
||||
HttpResponseMessage response = await client.PostAsJsonAsync( "https://mistox.net/api/account/login", new Account { UserName = UserName, PasswordHash = Password } );
|
||||
string result = await response.Content.ReadAsStringAsync();
|
||||
Account User = JsonConvert.DeserializeObject<Account>(result);
|
||||
if( User != null && string.IsNullOrEmpty( User.Error ) ) {
|
||||
return (true, User);
|
||||
}
|
||||
return (false, User);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public class Account {
|
||||
public int ID { get; set; } // PK
|
||||
public string UserName { get; set; } = "";
|
||||
public string Email { get; set; } = "";
|
||||
public bool EmailVerified { get; set; } = false;
|
||||
public string PasswordHash { get; set; } = "";
|
||||
public string Error { get; set; } = "";
|
||||
}
|
||||
|
||||
public class ProjectMistData {
|
||||
public int AccountID { get; set; } // PK
|
||||
public int Credits { get; set; }
|
||||
public int OddballTimer { get; set; }
|
||||
public string SessionToken { get; set; } = "";
|
||||
public int SessionID { get; set; }
|
||||
public int Kills { get; set; }
|
||||
public int Deaths { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Options : Node {
|
||||
|
||||
// Server Settings
|
||||
public ENetMultiplayerPeer connection;
|
||||
public bool isServer = false;
|
||||
public string Host = "mistox.net";
|
||||
public int Port = 6500;
|
||||
public int SelectedMap = 0;
|
||||
public int maxPlayers = 32;
|
||||
public bool isAlive = false;
|
||||
public double timeBetweenDropsReset = 2f; // in Minutes
|
||||
|
||||
// Saved Settings
|
||||
public SettingsFile _SettingsFile;
|
||||
|
||||
// Alert Settings
|
||||
public float AlertTime = 2f;
|
||||
public float AlertPauseTime = 1f;
|
||||
|
||||
// Select Tool
|
||||
public float ClickDistance = 5;
|
||||
|
||||
}
|
||||
|
||||
namespace Godot {
|
||||
|
||||
public static class Extensions {
|
||||
public static T [] Join<T>( this T [] first, T [] second ) {
|
||||
T[] bytes = new T[first.Length + second.Length];
|
||||
#pragma warning disable CA2018 // 'Buffer.BlockCopy' expects the number of bytes to be copied for the 'count' argument
|
||||
Buffer.BlockCopy( first, 0, bytes, 0, first.Length );
|
||||
Buffer.BlockCopy( second, 0, bytes, first.Length, second.Length );
|
||||
#pragma warning restore CA2018 // 'Buffer.BlockCopy' expects the number of bytes to be copied for the 'count' argument
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static T [] Sub<T>( this T [] data, int index, int length ) {
|
||||
T[] result = new T[length];
|
||||
Array.Copy( data, index, result, 0, length );
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Godot;
|
||||
|
||||
public partial class Reference : Node {
|
||||
public MistoxNet MistoxNet { get; set; }
|
||||
public Alert Alert { get; set; }
|
||||
public GameHandler GameHandler { get; set; }
|
||||
public Humanoid Humanoid { get; set; }
|
||||
public Inventory Inventory { get; set; }
|
||||
public Node Workspace { get; set; }
|
||||
public WorldEnvironment Lighting { get; set; }
|
||||
public Control GameUI { get; set; }
|
||||
public Camera3D Camera { get; set; }
|
||||
public MainMenu MainMenu { get; set; }
|
||||
public PreGame PreGame { get; set; }
|
||||
public Settings SettingsFrame { get; set; }
|
||||
public SessionHandler SessionHandler { get; set; }
|
||||
public Control ToolBar{ get; set; }
|
||||
|
||||
public MultiplayerSpawner GameSpawner { get; set; }
|
||||
public Node3D PlayerSpawnPoints { get; set; }
|
||||
public MultiplayerSpawner ItemSpawner{ get; set; }
|
||||
public Node3D ItemSpawnPoints { get; set; }
|
||||
public Node ItemSpawnPath{ get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user