Fix texture stuff
This commit is contained in:
@@ -6,12 +6,10 @@ using Chickensoft.Introspection;
|
||||
using Chickensoft.SaveFileBuilder;
|
||||
using Godot;
|
||||
using System;
|
||||
using System.IO.Abstractions;
|
||||
using System.Text.Json;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
using Zennysoft.Ma.Godot.Adapter;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
using System.IO;
|
||||
using SimpleInjector;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
@@ -82,10 +80,7 @@ public partial class Game : Node3D, IGame
|
||||
public void Setup()
|
||||
{
|
||||
_container = new SimpleInjector.Container();
|
||||
_container.Register<IFileSystem, FileSystem>();
|
||||
_container.Register<ISaveFileManager<GameData>, SaveFileManager<GameData>>();
|
||||
_container.Register<IGameRepo, GameRepo>(Lifestyle.Singleton);
|
||||
_container.Register<IGameLogic, GameLogic>(Lifestyle.Singleton);
|
||||
Module.Bootstrap(_container);
|
||||
_container.Verify();
|
||||
|
||||
GameRepo = _container.GetInstance<IGameRepo>();
|
||||
@@ -146,15 +141,15 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
var saveFileManager = _container.GetInstance<ISaveFileManager<GameData>>();
|
||||
var saveFileManager = _container.GetInstance<IMaSaveFileManager<GameData>>();
|
||||
SaveFile = new SaveFile<GameData>(
|
||||
root: GameChunk,
|
||||
onSave: saveFileManager.WriteToFile,
|
||||
onSave: saveFileManager.Save,
|
||||
onLoad: async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var gameData = await saveFileManager.ReadFromFile();
|
||||
var gameData = await saveFileManager.Load();
|
||||
return gameData;
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
@@ -246,7 +241,7 @@ public partial class Game : Node3D, IGame
|
||||
GameEventDepot.OnTeleportEntered();
|
||||
}
|
||||
|
||||
public async Task UseItem(IInventoryItem item)
|
||||
public async Task UseItem(InventoryItem item)
|
||||
{
|
||||
if (item is ConsumableItem consumableItem)
|
||||
{
|
||||
@@ -329,7 +324,7 @@ public partial class Game : Node3D, IGame
|
||||
GameRepo.RemoveItemFromInventory(item);
|
||||
}
|
||||
|
||||
public void DropItem(IInventoryItem item)
|
||||
public void DropItem(InventoryItem item)
|
||||
{
|
||||
var droppedScene = GD.Load<PackedScene>("res://src/items/dropped/DroppedItem.tscn");
|
||||
var dropped = droppedScene.Instantiate<DroppedItem>();
|
||||
@@ -338,11 +333,11 @@ public partial class Game : Node3D, IGame
|
||||
dropped.Drop();
|
||||
}
|
||||
|
||||
public void ThrowItem(IInventoryItem item)
|
||||
public void ThrowItem(InventoryItem item)
|
||||
{
|
||||
var thrownScene = GD.Load<PackedScene>("res://src/items/thrown/ThrownItem.tscn");
|
||||
var thrown = thrownScene.Instantiate<ThrownItem>();
|
||||
thrown.ItemThatIsThrown = item;
|
||||
thrown.ItemThatIsThrown = (InventoryItem)item;
|
||||
AddChild(thrown);
|
||||
thrown.Position += new Vector3(0, 1.5f, 0);
|
||||
thrown.Throw(_effectService);
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.Serialization;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[Meta, Id("game_data")]
|
||||
public partial record GameData
|
||||
{
|
||||
[Save("player_data")]
|
||||
public required PlayerData PlayerData { get; init; }
|
||||
|
||||
[Save("map_data")]
|
||||
public required MapData MapData { get; init; }
|
||||
|
||||
[Save("rescued_items")]
|
||||
public required RescuedItemDatabase RescuedItems { get; init; }
|
||||
}
|
||||
@@ -7,7 +7,7 @@ using Chickensoft.SaveFileBuilder;
|
||||
using Godot;
|
||||
using System.Threading.Tasks;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
using Zennysoft.Ma.Godot.Adapter;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvide<IGame>, IProvide<IPlayer>, IProvide<ISaveChunk<GameData>>, INode3D
|
||||
{
|
||||
@@ -21,11 +21,11 @@ public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvid
|
||||
|
||||
public IDungeonFloor CurrentFloor { get; }
|
||||
|
||||
public Task UseItem(IInventoryItem item);
|
||||
public Task UseItem(InventoryItem item);
|
||||
|
||||
public void DropItem(IInventoryItem item);
|
||||
public void DropItem(InventoryItem item);
|
||||
|
||||
public void ThrowItem(IInventoryItem item);
|
||||
public void ThrowItem(InventoryItem item);
|
||||
|
||||
public void FloorExitReached();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user