public AddInManager() { InterDomainHandler = new InterDomainHandler(); InterDomainHandler.RequestQuit += () => { _notifyUnload = true; }; _addInByName = new Dictionary <string, AddIn> (); AppDomain.CurrentDomain.AssemblyResolve += LoadFromExecutingFolder; var files = Directory.GetFiles(Application.ExecutionPath + "/mono/AddIns", "*.dll"); foreach (var f in files) { AddAssembly(new FileInfo(f).FullName); } _assemblyWatcher = new FileSystemWatcher(); _assemblyWatcher.Path = Application.ExecutionPath + "/mono/AddIns"; _assemblyWatcher.NotifyFilter = NotifyFilters.LastWrite; _assemblyWatcher.Filter = "*.dll"; _assemblyWatcher.Created += OnAssemblyChanged; _assemblyWatcher.Changed += OnAssemblyChanged; _assemblyWatcher.EnableRaisingEvents = true; Global.gEnv.pMonoRuntime.RegisterListener(this); FlowNode.OnSignal += OnFlowNodeSignal; }
/// <summary> /// Add-In Entry point. /// </summary> public void Initialize(InterDomainHandler handler) { if (!Env.IsSandbox) { Env.Console.ExecuteString("map Canyon"); } GameApp = Application.Instantiate <SydewinderApp>(); // Initialize Highscore with file name. Highscore.InitializeFromFile(HIGHSCORE_URL); GameApp.GameOver += showHighscore => { // Reset field of view to ehance 3D look. Camera.FieldOfView = 60f; UI.MainMenu.SetInactive(); if (showHighscore) { UI.MainMenu.SetupHighscoreMenuPerspective(); } else { UI.MainMenu.SetupMainMenuPerspective(); } }; InitializeMainMenu(); }
public void Initialize(InterDomainHandler handler) { if (!Env.IsSandbox) { Env.Console.ExecuteString("map SandboxInteraction"); } _app = Application.Instantiate <SandboxInteractionApp>(); }
/// <summary> /// Write entity properties to the InterDomainHandler (to re-use the property values after reloading assemblies). /// </summary> private static void StoreEntity(this InterDomainHandler handler, BaseEntity entity) { if (entity.EntityClass.PropertyHandler == null) { return; } handler.EntityCache.Add(entity.Id, new Tuple <string, Dictionary <string, string> > ( entity.EntityClass.Description.sName, entity.EntityClass.PropertyHandler.Store(entity) ) ); }
/// <summary> /// Read entity properties from the InterDomainHandler (usually after reloading the assemblies). /// </summary> private static void RetrieveEntity(this InterDomainHandler handler, BaseEntity entity) { if (!handler.EntityCache.ContainsKey(entity.Id)) { return; } if (!String.Equals(handler.EntityCache [entity.Id].Item1, entity.EntityClass.Description.sName, StringComparison.InvariantCultureIgnoreCase)) { return; } entity.EntityClass.PropertyHandler.Retrieve(entity, handler.EntityCache [entity.Id].Item2); }
/// <summary> /// Called by framework. Do not call directly. /// </summary> public static void Shutdown(InterDomainHandler handler) { if (!_isInitialized) { return; } _isInitialized = false; EntityFramework.Destroy(handler); GameFramework.Destroy(); SceneManager.Destroy(); LevelSystem.Destroy(); CryEngine.Mouse.Destroy(); Screen.Destroy(); CryEngine.Input.Destroy(); SystemHandler.Destroy(); }
} ///< Indicates whether CryEngine is run in Editor mode. /// <summary> /// Called by framework. Do not call directly. /// </summary> public static void Initialize(InterDomainHandler handler) { if (_isInitialized) { return; } _isInitialized = true; SystemHandler.Instantiate(); CryEngine.Input.Instanciate(); Screen.Instanciate(); CryEngine.Mouse.Instantiate(); SceneManager.Instantiate(); GameFramework.Instantiate(); LevelSystem.Instantiate(); EntityFramework.Instantiate(handler); }
/// <summary> /// Clean up the Entity Framework, including shutting down of all handled CESharp entities and disabling of CESharp entity classes. /// </summary> public static void Destroy(InterDomainHandler handler) { foreach (BaseEntity ent in s_managedEntities.Values) { handler.StoreEntity(ent); ent.OnShutdown(); } s_managedEntities.Clear(); //s_entityClassRegistry.UnregisterAll (); s_entityClassRegistry.DisableAll(); s_entityClassRegistry = null; s_entityUpdateListener.Update -= OnUpdate; s_entityUpdateListener.Dispose(); s_entityUpdateListener = null; s_entitySystemSink.Spawn -= OnSpawn; s_entitySystemSink.Event -= OnEvent; s_entitySystemSink.Remove -= OnRemove; s_entitySystemSink.Dispose(); s_entitySystemSink = null; }
/// <summary> /// Setup the CESharp EntityFramework, including registering of discovered CESharp entity classes and assumption of already spawned CESharp entites. /// </summary> public static void Instantiate(InterDomainHandler handler) { EntityProperty.RegisterConverters(); s_managedEntities = new Dictionary <uint, BaseEntity> (); s_entityClassRegistry = new EntityClassRegistry(); s_entityClassRegistry.RegisterAll(); s_entitySystemSink = new EntitySystemSink(); s_entitySystemSink.Spawn += OnSpawn; s_entitySystemSink.Event += OnEvent; s_entitySystemSink.Remove += OnRemove; s_entityUpdateListener = new EntityUpdateListener(); s_entityUpdateListener.Update += OnUpdate; // Assume already spawned entities IEntityIt it = Global.gEnv.pEntitySystem.GetEntityIterator(); if (it != null) { it.MoveFirst(); IEntity pEntity = null; while (!it.IsEnd()) { pEntity = it.Next(); EntityClass managedClass = s_entityClassRegistry.GetEntityClass(pEntity); if (managedClass == null) { continue; } Log.Info("[EntityFramework] Assume entity: {0} ({1})", pEntity.GetName(), managedClass.ProtoType.Name); BaseEntity instance = managedClass.CreateInstance(pEntity); handler.RetrieveEntity(instance); s_managedEntities.Add(pEntity.GetId(), instance); } } }
public void Initialize(InterDomainHandler handler) { InterDomainHandler = handler; Env.Initialize(); }
public void Initialize(InterDomainHandler handler) { _app = Application.Instantiate <SampleApp>(); }
public void Initialize(InterDomainHandler handler) { app = Application.Instantiate <Game>(); new EyeTrackerControl(); }
public void Initialize(InterDomainHandler handler) { _addIn.Initialize(handler); }