public static void ClientInit(IClientInitInterfaces initInterfaces) { MefClient.Init(Assembly.GetExecutingAssembly()); MefClient.AddType <IGameInfo>(new GameInfo(false)); LoadMefTypes <IClientInitInterfaces>(initInterfaces, typeof(MefClient)); var entMng = MefClient.GetExportedValue <IEntityManagerClient>(); entMng.GenerateClientClasses(); var consoleManager = MefClient.GetExportedValue <NI_ConsoleManager>(); foreach (var conCommand in MefClient.GetExportedValues <IConCommand>()) { consoleManager.Register(conCommand); } foreach (var conVar in MefClient.GetExportedValues <IConVariable>()) { consoleManager.Register(conVar); } initInterfaces.ClientGameDll = MefClient.GetExportedValue <M_IClientGameDll>(); }
public bool GenerateClientClasses() { var ret = new List <ClientClass>(); foreach (var c in MefClient.GetExports <BaseEntityClient>()) { object o = null; try { o = c.Value; } catch (Exception e) { _ConsoleManager.WriteLine(Color.Red, String.Format("Failed to create entity: {0}", e.Message)); continue; } var type = o.GetType(); if (type == null) { continue; } if (!ProcessClientClassType(type)) { _ConsoleManager.WriteLine(Color.Red, String.Format("Class {0} does not inheirt from BaseEntityClient. Skipping...", type.Name)); continue; } var sc = CombineClientClasses(type); ret.Add(sc); } ClientClasses = ret.ToArray(); return(true); }