mirror of
https://github.com/Quackster/Minerva.git
synced 2025-06-29 21:07:45 +00:00
update to support avatara with fixed asset loading
This commit is contained in:
parent
612edbe013
commit
a6c5239881
3 changed files with 25 additions and 23 deletions
2
Avatara
2
Avatara
|
@ -1 +1 @@
|
|||
Subproject commit 46cd828b6cc59462fa9a43dd3ca6f0051a58bbfa
|
||||
Subproject commit 6e7c9a54c58a92d641010b4a24474515a16dab9d
|
|
@ -9,7 +9,6 @@ namespace Minerva.Controllers
|
|||
public class FigureController : Controller
|
||||
{
|
||||
private readonly ILogger<FigureController> _logger;
|
||||
private static FiguredataReader? figuredataReader;
|
||||
|
||||
public FigureController(ILogger<FigureController> logger)
|
||||
{
|
||||
|
@ -19,16 +18,6 @@ namespace Minerva.Controllers
|
|||
[HttpGet("habbo-imaging/avatarimage")]
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (figuredataReader == null)
|
||||
{
|
||||
FigureExtractor.Parse();
|
||||
|
||||
figuredataReader = new FiguredataReader();
|
||||
figuredataReader.LoadFigurePalettes();
|
||||
figuredataReader.loadFigureSetTypes();
|
||||
figuredataReader.LoadFigureSets();
|
||||
}
|
||||
|
||||
string size = "b";
|
||||
int bodyDirection = 2;
|
||||
int headDirection = 2;
|
||||
|
@ -131,18 +120,10 @@ namespace Minerva.Controllers
|
|||
|
||||
if (figure != null && figure.Length > 0)
|
||||
{
|
||||
var avatar = new Avatar(figure, size, bodyDirection, headDirection, figuredataReader, action: action, gesture: gesture, headOnly: headOnly, frame: frame, carryDrink: carryDrink, cropImage: cropImage);
|
||||
var avatar = new Avatar(FiguredataReader.Instance, figure, size, bodyDirection, headDirection, action: action, gesture: gesture, headOnly: headOnly, frame: frame, carryDrink: carryDrink, cropImage: cropImage);
|
||||
var figureData = avatar.Run();
|
||||
|
||||
try
|
||||
{
|
||||
var figureData = avatar.Run();
|
||||
return File(figureData, "image/png");
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
return File(figureData, "image/png");
|
||||
}
|
||||
|
||||
return StatusCode(403);
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
using Avatara;
|
||||
using Avatara.Figure;
|
||||
|
||||
namespace Minerva
|
||||
{
|
||||
public class Program
|
||||
|
@ -26,7 +29,25 @@ namespace Minerva
|
|||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
LoadFigureAssets(app.Services.CreateScope());
|
||||
|
||||
app.Run();
|
||||
}
|
||||
|
||||
private static void LoadFigureAssets(IServiceScope scope)
|
||||
{
|
||||
Console.WriteLine("Loading flash assets...");
|
||||
|
||||
FlashExtractor.Instance.Load();
|
||||
|
||||
Console.WriteLine($"{FlashExtractor.Instance.Parts.Count} flash assets loaded");
|
||||
|
||||
Console.WriteLine("Loading figure data...");
|
||||
|
||||
FiguredataReader.Instance.Load();
|
||||
Console.WriteLine($"{FiguredataReader.Instance.FigureSets.Count} figure sets loaded");
|
||||
Console.WriteLine($"{FiguredataReader.Instance.FigureSetTypes.Count} figure set types loaded");
|
||||
Console.WriteLine($"{FiguredataReader.Instance.FigurePalettes.Count} figure palettes loaded");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue