Initial Checkin of Code
This commit is contained in:
parent
19b557ee9b
commit
0bee2ee47b
44 changed files with 7965 additions and 0 deletions
26
Library/Support/Enums.cs
Normal file
26
Library/Support/Enums.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
namespace PokemonLike.Library.Support;
|
||||
|
||||
public enum LogLevel
|
||||
{
|
||||
None,
|
||||
Error,
|
||||
Info,
|
||||
Warn,
|
||||
Debug,
|
||||
}
|
||||
|
||||
public enum ECharacterAnimation
|
||||
{
|
||||
IdleDown,
|
||||
IdleUp,
|
||||
IdleLeft,
|
||||
IdleRight,
|
||||
TurnDown,
|
||||
TurnUp,
|
||||
TurnLeft,
|
||||
TurnRight,
|
||||
WalkDown,
|
||||
WalkUp,
|
||||
WalkLeft,
|
||||
WalkRight,
|
||||
}
|
||||
1
Library/Support/Enums.cs.uid
Normal file
1
Library/Support/Enums.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b0tdcpfs7kdnl
|
||||
18
Library/Support/Globals.cs
Normal file
18
Library/Support/Globals.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using Godot;
|
||||
|
||||
namespace PokemonLike.Library.Support;
|
||||
|
||||
public partial class Globals : Node
|
||||
{
|
||||
public static Globals Instance { get; private set; }
|
||||
|
||||
[ExportCategory("Gameplay")]
|
||||
[Export] public int GRID_SIZE = 16;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
Logger.Info("Loading Globals ... ");
|
||||
}
|
||||
}
|
||||
1
Library/Support/Globals.cs.uid
Normal file
1
Library/Support/Globals.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dwiq8oy8sm0o3
|
||||
35
Library/Support/Logger.cs
Normal file
35
Library/Support/Logger.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace PokemonLike.Library.Support;
|
||||
|
||||
public static class Logger
|
||||
{
|
||||
public static string ColorTable(LogLevel level) => level switch
|
||||
{
|
||||
LogLevel.None => "white",
|
||||
LogLevel.Error => "firebrick",
|
||||
LogLevel.Info => "white",
|
||||
LogLevel.Warn => "gold",
|
||||
LogLevel.Debug => "green",
|
||||
};
|
||||
|
||||
public static LogLevel LogLevel { get; set; } = LogLevel.Debug;
|
||||
|
||||
public static void Log(LogLevel level, params object[] message)
|
||||
{
|
||||
if (level > LogLevel) return;
|
||||
var timeStamp = $"[lb]{DateTime.Now:yyyy-MM-dd HH:mm:ss}[rb]";
|
||||
var callingMethod = new StackTrace().GetFrame(2)?.GetMethod();
|
||||
var lvl = $"{level}".ToUpper();
|
||||
var clsName = callingMethod?.DeclaringType?.Name == null ? "UnknownClass" : callingMethod!.DeclaringType!.Name;
|
||||
var mthdName = callingMethod?.Name == null ? "UnknownMethod" : callingMethod!.Name;
|
||||
var msg = $"{timeStamp} [lb][color={ColorTable(level)}]{lvl}[/color][rb] [color=cyan][lb]{clsName}->{mthdName}[rb][/color] ";
|
||||
Godot.GD.PrintRich([msg, ..message]);
|
||||
}
|
||||
|
||||
public static void Info(params object[] message) => Log(LogLevel.Info, message);
|
||||
public static void Warn(params object[] message) => Log(LogLevel.Warn, message);
|
||||
public static void Debug(params object[] message) => Log(LogLevel.Debug, message);
|
||||
public static void Error(params object[] message) => Log(LogLevel.Error, message);
|
||||
}
|
||||
1
Library/Support/Logger.cs.uid
Normal file
1
Library/Support/Logger.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dhh1dnlsq1yfp
|
||||
28
Library/Support/Modules.cs
Normal file
28
Library/Support/Modules.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using Godot;
|
||||
|
||||
namespace PokemonLike.Library.Support;
|
||||
|
||||
public static class Modules
|
||||
{
|
||||
public static bool IsActionJustPressed() => (
|
||||
Input.IsActionJustPressed("move_up") ||
|
||||
Input.IsActionJustPressed("move_down") ||
|
||||
Input.IsActionJustPressed("move_left") ||
|
||||
Input.IsActionJustPressed("move_right")
|
||||
);
|
||||
|
||||
public static bool IsActionPressed() => (
|
||||
Input.IsActionPressed("move_up") ||
|
||||
Input.IsActionPressed("move_down") ||
|
||||
Input.IsActionPressed("move_left") ||
|
||||
Input.IsActionPressed("move_right")
|
||||
);
|
||||
|
||||
public static bool IsActionJustReleased() => (
|
||||
Input.IsActionJustReleased("move_up") ||
|
||||
Input.IsActionJustReleased("move_down") ||
|
||||
Input.IsActionJustReleased("move_left") ||
|
||||
Input.IsActionJustReleased("move_right")
|
||||
);
|
||||
|
||||
}
|
||||
1
Library/Support/Modules.cs.uid
Normal file
1
Library/Support/Modules.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b4t7lcjfe10mc
|
||||
Loading…
Add table
Add a link
Reference in a new issue