Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        /// <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();
        }
Esempio n. 3
0
 public void Initialize(InterDomainHandler handler)
 {
     if (!Env.IsSandbox)
     {
         Env.Console.ExecuteString("map SandboxInteraction");
     }
     _app = Application.Instantiate <SandboxInteractionApp>();
 }
Esempio n. 4
0
        /// <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)
                                        )
                                    );
        }
Esempio n. 5
0
        /// <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);
        }
Esempio n. 6
0
        /// <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();
        }
Esempio n. 7
0
        }                                                                       ///< 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);
        }
Esempio n. 8
0
        /// <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;
        }
Esempio n. 9
0
        /// <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);
                }
            }
        }
Esempio n. 10
0
 public void Initialize(InterDomainHandler handler)
 {
     InterDomainHandler = handler;
     Env.Initialize();
 }
Esempio n. 11
0
 public void Initialize(InterDomainHandler handler)
 {
     _app = Application.Instantiate <SampleApp>();
 }
Esempio n. 12
0
 public void Initialize(InterDomainHandler handler)
 {
     app = Application.Instantiate <Game>();
     new EyeTrackerControl();
 }
Esempio n. 13
0
 public void Initialize(InterDomainHandler handler)
 {
     _addIn.Initialize(handler);
 }