Fix texture stuff

This commit is contained in:
2025-03-09 12:24:30 -07:00
parent b93630756c
commit d8c5bc8f78
112 changed files with 671 additions and 355 deletions

View File

@@ -0,0 +1,22 @@
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
[Meta, Id("player_data")]
public partial record PlayerData
{
[Save("player_stats")]
public required PlayerStats PlayerStats { get; init; }
[Save("player_inventory")]
public required IInventory Inventory { get; init; }
}
[Meta, Id("map_data")]
public partial record MapData
{
[Save("floor_list")]
public required List<string> FloorScenes { get; init; }
}

View File

@@ -0,0 +1,152 @@
using Chickensoft.Collections;
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
namespace Zennysoft.Game.Ma;
[Meta, Id("player_stats")]
public partial record PlayerStats
{
[Save("currentHP")]
public int CurrentHP { get; init; }
[Save("maximumHP")]
public int MaximumHP { get; init; }
[Save("currentVT")]
public int CurrentVT { get; init; }
[Save("maximumVT")]
public int MaximumVT { get; init; }
[Save("currentExp")]
public double CurrentExp { get; init; }
[Save("currentLevel")]
public int CurrentLevel { get; init; }
[Save("currentAttack")]
public int CurrentAttack { get; init; }
[Save("bonusAttack")]
public int BonusAttack { get; init; }
[Save("maxAttack")]
public int MaxAttack { get; init; }
[Save("currentDefense")]
public int CurrentDefense { get; init; }
[Save("bonusDefense")]
public int BonusDefense { get; init; }
[Save("maxDefense")]
public int MaxDefense { get; init; }
[Save("expToNextLevel")]
public int ExpToNextLevel { get; init; }
[Save("luck")]
public double Luck { get; init; }
}
public class PlayerStatController
{
public void Init(PlayerStats playerStats)
{
_currentHP.OnNext(playerStats.CurrentHP);
_maximumHP.OnNext(playerStats.MaximumHP);
_currentVT.OnNext(playerStats.CurrentVT);
_maximumVT.OnNext(playerStats.MaximumVT);
_currentExp.OnNext(playerStats.CurrentExp);
_currentLevel.OnNext(playerStats.CurrentLevel);
_currentAttack.OnNext(playerStats.CurrentAttack);
_bonusAttack.OnNext(playerStats.BonusAttack);
_maxAttack.OnNext(playerStats.MaxAttack);
_currentDefense.OnNext(playerStats.CurrentDefense);
_bonusDefense.OnNext(playerStats.BonusDefense);
_maxDefense.OnNext(playerStats.MaxDefense);
_expToNextLevel.OnNext(playerStats.ExpToNextLevel);
_luck.OnNext(playerStats.Luck);
}
public IAutoProp<int> CurrentHP => _currentHP;
public IAutoProp<int> MaximumHP => _maximumHP;
public IAutoProp<int> CurrentVT => _currentVT;
public IAutoProp<int> MaximumVT => _maximumVT;
public IAutoProp<int> CurrentAttack => _currentAttack;
public IAutoProp<int> MaxAttack => _maxAttack;
public IAutoProp<int> BonusAttack => _bonusAttack;
public IAutoProp<int> CurrentDefense => _currentDefense;
public IAutoProp<int> MaxDefense => _maxDefense;
public IAutoProp<int> BonusDefense => _bonusDefense;
public IAutoProp<double> CurrentExp => _currentExp;
public IAutoProp<int> ExpToNextLevel => _expToNextLevel;
public IAutoProp<int> CurrentLevel => _currentLevel;
public IAutoProp<double> Luck => _luck;
public void SetCurrentHP(int newValue)
{
var clampedValue = Mathf.Clamp(newValue, 0, MaximumHP.Value);
_currentHP.OnNext(clampedValue);
}
public void SetMaximumHP(int newValue)
{
_maximumHP.OnNext(newValue);
}
public void SetCurrentVT(int newValue)
{
var clampedValue = Mathf.Clamp(newValue, 0, MaximumVT.Value);
_currentVT.OnNext(clampedValue);
}
public void SetMaximumVT(int newValue)
{
_maximumVT.OnNext(newValue);
}
public void SetCurrentExp(double newValue)
{
_currentExp.OnNext(newValue);
}
public void SetCurrentLevel(int newValue)
{
_currentLevel.OnNext(newValue);
}
public void SetCurrentAttack(int newValue)
{
var clampedValue = Mathf.Clamp(newValue, 0, MaxAttack.Value);
_currentAttack.OnNext(clampedValue);
}
public void SetBonusAttack(int newValue)
{
_bonusAttack.OnNext(newValue);
}
public void SetMaxAttack(int newValue)
{
_maxAttack.OnNext(newValue);
}
public void SetCurrentDefense(int newValue)
{
var clampedValue = Mathf.Clamp(newValue, 0, MaxDefense.Value);
_currentDefense.OnNext(clampedValue);
}
public void SetBonusDefense(int newValue)
{
_bonusDefense.OnNext(newValue);
}
public void SetMaxDefense(int newValue)
{
_maxDefense.OnNext(newValue);
}
public void SetExpToNextLevel(int newValue)
{
_expToNextLevel.OnNext(newValue);
}
public void SetLuck(double newValue)
{
var clampedValue = Mathf.Clamp(newValue, 0, 1.0);
_luck.OnNext(clampedValue);
}
private readonly AutoProp<int> _currentHP = new(-1);
private readonly AutoProp<int> _maximumHP = new(-1);
private readonly AutoProp<int> _currentVT = new(-1);
private readonly AutoProp<int> _maximumVT = new(-1);
private readonly AutoProp<double> _currentExp = new(-1);
private readonly AutoProp<int> _currentLevel = new(-1);
private readonly AutoProp<int> _currentAttack = new(-1);
private readonly AutoProp<int> _bonusAttack = new(-1);
private readonly AutoProp<int> _maxAttack = new(-1);
private readonly AutoProp<int> _currentDefense = new(-1);
private readonly AutoProp<int> _bonusDefense = new(-1);
private readonly AutoProp<int> _maxDefense = new(-1);
private readonly AutoProp<int> _expToNextLevel = new(-1);
private readonly AutoProp<double> _luck = new(-1);
}

View File

@@ -1,6 +1,6 @@
using Godot;
namespace Zennysoft.Ma.Godot.Adapter;
namespace Zennysoft.Ma.Adapter;
public partial class PlayerLogic
{

View File

@@ -1,4 +1,4 @@
namespace Zennysoft.Ma.Godot.Adapter;
namespace Zennysoft.Ma.Adapter;
public partial class PlayerLogic
{

View File

@@ -1,4 +1,4 @@
namespace Zennysoft.Ma.Godot.Adapter;
namespace Zennysoft.Ma.Adapter;
public partial class PlayerLogic
{

View File

@@ -1,7 +1,7 @@
using Chickensoft.Introspection;
using Chickensoft.LogicBlocks;
namespace Zennysoft.Ma.Godot.Adapter;
namespace Zennysoft.Ma.Adapter;
public partial class PlayerLogic
{

View File

@@ -1,7 +1,7 @@
using Chickensoft.Introspection;
using Chickensoft.LogicBlocks;
namespace Zennysoft.Ma.Godot.Adapter;
namespace Zennysoft.Ma.Adapter;
public interface IPlayerLogic : ILogicBlock<PlayerLogic.State>;

View File

@@ -1,6 +1,6 @@
using Chickensoft.Introspection;
namespace Zennysoft.Ma.Godot.Adapter;
namespace Zennysoft.Ma.Adapter;
public partial class PlayerLogic
{

View File

@@ -1,7 +1,7 @@
using Chickensoft.Introspection;
using Godot;
namespace Zennysoft.Ma.Godot.Adapter;
namespace Zennysoft.Ma.Adapter;
public partial class PlayerLogic
{

View File

@@ -1,7 +1,7 @@
using Chickensoft.Introspection;
using Godot;
namespace Zennysoft.Ma.Godot.Adapter;
namespace Zennysoft.Ma.Adapter;
public partial class PlayerLogic
{

View File

@@ -1,6 +1,6 @@
using Chickensoft.Introspection;
namespace Zennysoft.Ma.Godot.Adapter;
namespace Zennysoft.Ma.Adapter;
public partial class PlayerLogic
{

View File

@@ -1,7 +1,7 @@
using Chickensoft.Introspection;
using Zennysoft.Game.Abstractions;
namespace Zennysoft.Ma.Godot.Adapter;
namespace Zennysoft.Ma.Adapter;
public partial class PlayerLogic
{