2020-06-18 01:04:08 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
using RobocraftX.GUI.MyGamesScreen;
|
|
|
|
|
using RobocraftX.GUI;
|
|
|
|
|
using Svelto.ECS;
|
|
|
|
|
|
|
|
|
|
using GamecraftModdingAPI.Engines;
|
|
|
|
|
using GamecraftModdingAPI.Utility;
|
|
|
|
|
|
|
|
|
|
namespace GamecraftModdingAPI.App
|
|
|
|
|
{
|
|
|
|
|
public class AppEngine : IFactoryEngine
|
|
|
|
|
{
|
|
|
|
|
public event EventHandler<MenuEventArgs> EnterMenu;
|
|
|
|
|
|
|
|
|
|
public event EventHandler<MenuEventArgs> ExitMenu;
|
|
|
|
|
|
|
|
|
|
public IEntityFactory Factory { set; private get; }
|
|
|
|
|
|
|
|
|
|
public string Name => "GamecraftModdingAPIAppEngine";
|
|
|
|
|
|
|
|
|
|
public bool isRemovable => false;
|
|
|
|
|
|
|
|
|
|
public EntitiesDB entitiesDB { set; private get; }
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
IsInMenu = false;
|
|
|
|
|
ExceptionUtil.InvokeEvent(ExitMenu, this, new MenuEventArgs { });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Ready()
|
|
|
|
|
{
|
|
|
|
|
IsInMenu = true;
|
|
|
|
|
ExceptionUtil.InvokeEvent(EnterMenu, this, new MenuEventArgs { });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// app functionality
|
|
|
|
|
|
|
|
|
|
public bool IsInMenu
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
private set;
|
|
|
|
|
} = false;
|
|
|
|
|
|
|
|
|
|
public Game[] GetMyGames()
|
|
|
|
|
{
|
|
|
|
|
EntityCollection<MyGameDataEntityStruct> mgsevs = entitiesDB.QueryEntities<MyGameDataEntityStruct>(MyGamesScreenExclusiveGroups.MyGames);
|
2020-11-09 21:18:25 +00:00
|
|
|
|
var mgsevsB = mgsevs.ToBuffer().buffer;
|
2020-06-18 01:04:08 +00:00
|
|
|
|
Game[] games = new Game[mgsevs.count];
|
|
|
|
|
for (int i = 0; i < mgsevs.count; i++)
|
|
|
|
|
{
|
2020-11-09 21:18:25 +00:00
|
|
|
|
Utility.Logging.MetaDebugLog($"Found game named {mgsevsB[i].GameName}");
|
|
|
|
|
games[i] = new Game(mgsevsB[i].ID);
|
2020-06-18 01:04:08 +00:00
|
|
|
|
}
|
|
|
|
|
return games;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public struct MenuEventArgs
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|