-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameModelInstance.cs
More file actions
32 lines (28 loc) · 1008 Bytes
/
GameModelInstance.cs
File metadata and controls
32 lines (28 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using Microsoft.Extensions.DependencyInjection;
using Raid.Toolkit.Extensibility;
using System;
namespace Raid.Toolkit.Community.Extensibility.Utilities
{
public class GameModelInstance<T> where T : ModelScopeBase
{
public string Id { get; private set; }
public string Name { get; private set; }
public IGameInstance GameInstance { get; }
private readonly IServiceProvider ServiceProvider;
public T GetModelScope()
{
return ActivatorUtilities.CreateInstance<T>(ServiceProvider, GameInstance.Runtime);
}
public override string ToString()
{
return Name;
}
public GameModelInstance(IServiceProvider serviceProvider, IGameInstance gameInstance)
{
ServiceProvider = serviceProvider;
GameInstance = gameInstance;
Id = gameInstance.Id;
Name = GetModelScope().AppModel._userWrapper.UserGameSettings.GameSettings.Name;
}
}
}