Fix texture stuff
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
using Chickensoft.Collections;
|
||||
using Chickensoft.SaveFileBuilder;
|
||||
using Godot;
|
||||
using Zennysoft.Ma.Godot.Adapter;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
@@ -44,7 +45,7 @@ public interface IPlayer : IKillable, IProvide<ISaveChunk<PlayerData>>
|
||||
|
||||
public void ModifyBonusLuck(double amount);
|
||||
|
||||
public Inventory Inventory { get; }
|
||||
public IInventory Inventory { get; }
|
||||
|
||||
public PlayerStatController Stats { get; }
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ using Godot.Collections;
|
||||
using SimpleInjector;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Zennysoft.Ma.Godot.Adapter;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
@@ -34,7 +35,7 @@ public partial class Player : CharacterBody3D, IPlayer
|
||||
public Basis CurrentBasis => Transform.Basis;
|
||||
public PlayerStatController Stats { get; set; } = default!;
|
||||
|
||||
public Inventory Inventory { get; private set; } = default!;
|
||||
public IInventory Inventory { get; private set; } = default!;
|
||||
|
||||
public IAutoProp<Weapon> EquippedWeapon => _equippedWeapon;
|
||||
private AutoProp<Weapon> _equippedWeapon { get; set; } = new AutoProp<Weapon>(new Weapon());
|
||||
@@ -153,9 +154,9 @@ public partial class Player : CharacterBody3D, IPlayer
|
||||
PlayerLogic.Set(_gameRepo);
|
||||
|
||||
var defaultWeapon = new Weapon();
|
||||
defaultWeapon.ItemStats = _defaultWeapon;
|
||||
defaultWeapon.Stats = _defaultWeapon;
|
||||
var defaultArmor = new Armor();
|
||||
defaultArmor.ItemStats = _defaultArmor;
|
||||
defaultArmor.Stats = _defaultArmor;
|
||||
Inventory.TryAdd(defaultWeapon);
|
||||
Inventory.TryAdd(defaultArmor);
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.Serialization;
|
||||
using System.Collections.Generic;
|
||||
|
||||
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 Inventory Inventory { get; init; }
|
||||
}
|
||||
|
||||
[Meta, Id("map_data")]
|
||||
public partial record MapData
|
||||
{
|
||||
[Save("floor_list")]
|
||||
public required List<string> FloorScenes { get; init; }
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user