Ejemplo n.º 1
0
        protected override void OnWorldStateChanged(World world, bool created)
        {
            if (created)
            {
                base.OnWorldStateChanged(world, true);

                EventHandler.RegisterEvent <Unit, Unit, int, HitType>(EventHandler.GlobalDispatcher, GameEvents.SpellDamageDone, OnSpellDamageDone);
                EventHandler.RegisterEvent <Unit, Unit, int, bool>(EventHandler.GlobalDispatcher, GameEvents.SpellHealingDone, OnSpellHealingDone);
                EventHandler.RegisterEvent <Unit, Unit, SpellMissType>(EventHandler.GlobalDispatcher, GameEvents.SpellMissDone, OnSpellMiss);
                EventHandler.RegisterEvent <Unit, int, SpellProcessingToken>(EventHandler.GlobalDispatcher, GameEvents.SpellLaunched, OnSpellLaunch);
                EventHandler.RegisterEvent <Unit, int>(EventHandler.GlobalDispatcher, GameEvents.SpellHit, OnSpellHit);

                nameplateController.Initialize();
                floatingTextController.Initialize();
                spellVisualController.Initialize();
                selectionCircleController.Initialize();
                unitRendererController.Initialize();
            }
            else
            {
                unitRendererController.Deinitialize();
                nameplateController.Deinitialize();
                selectionCircleController.Deinitialize();
                floatingTextController.Deinitialize();
                spellVisualController.Deinitialize();

                EventHandler.UnregisterEvent <Unit, Unit, int, HitType>(EventHandler.GlobalDispatcher, GameEvents.SpellDamageDone, OnSpellDamageDone);
                EventHandler.UnregisterEvent <Unit, Unit, int, bool>(EventHandler.GlobalDispatcher, GameEvents.SpellHealingDone, OnSpellHealingDone);
                EventHandler.UnregisterEvent <Unit, Unit, SpellMissType>(EventHandler.GlobalDispatcher, GameEvents.SpellMissDone, OnSpellMiss);
                EventHandler.UnregisterEvent <Unit, int, SpellProcessingToken>(EventHandler.GlobalDispatcher, GameEvents.SpellLaunched, OnSpellLaunch);
                EventHandler.UnregisterEvent <Unit, int>(EventHandler.GlobalDispatcher, GameEvents.SpellHit, OnSpellHit);

                base.OnWorldStateChanged(world, false);
            }
        }
Ejemplo n.º 2
0
        protected override void OnWorldDeinitializing(WorldManager world)
        {
            if (world.HasClientLogic)
            {
                nameplateController.Deinitialize();
                selectionCircleController.Deinitialize();
                floatingTextController.Deinitialize();
                spellVisualController.Deinitialize();

                EventHandler.UnregisterEvent <Unit, Unit, int, bool>(EventHandler.GlobalDispatcher, GameEvents.SpellDamageDone, OnSpellDamageDone);
                EventHandler.UnregisterEvent <Unit, Unit, int, bool>(EventHandler.GlobalDispatcher, GameEvents.SpellHealingDone, OnSpellHealingDone);
                EventHandler.UnregisterEvent <Unit, int, SpellProcessingToken, Vector3>(EventHandler.GlobalDispatcher, GameEvents.SpellLaunched, OnSpellLaunch);
                EventHandler.UnregisterEvent <Unit, int>(EventHandler.GlobalDispatcher, GameEvents.SpellHit, OnSpellHit);

                world.UnitManager.EventEntityAttached -= OnEventEntityAttached;
                world.UnitManager.EventEntityDetach   -= OnEventEntityDetach;

                foreach (UnitRenderer unitRenderer in unitRenderers)
                {
                    unitRenderer.Deinitialize();
                }

                unitRenderersById.Clear();
                unitRenderers.Clear();
            }

            base.OnWorldDeinitializing(world);
        }
Ejemplo n.º 3
0
        internal void Unregister()
        {
            EventHandler.UnregisterEvent <WorldManager>(EventHandler.GlobalDispatcher, GameEvents.WorldInitialized, OnWorldInitialized);
            EventHandler.UnregisterEvent <WorldManager>(EventHandler.GlobalDispatcher, GameEvents.WorldDeinitializing, OnWorldDeinitializing);

            SetListeners(false, false, false);
        }
Ejemplo n.º 4
0
            public void HandlePlayerControlLost()
            {
                playerCircle.UpdateUnit(null);
                targetCircle.UpdateUnit(null);

                EventHandler.UnregisterEvent(renderingReference.Player, GameEvents.UnitTargetChanged, onPlayerTargetChanged);
            }
Ejemplo n.º 5
0
        protected override void OnUnregister()
        {
            EventHandler.UnregisterEvent <string, NetworkingMode>(EventHandler.GlobalDispatcher, GameEvents.GameMapLoaded, OnMapLoaded);
            EventHandler.UnregisterEvent(EventHandler.GlobalDispatcher, GameEvents.DisconnectedFromMaster, OnDisconnectedFromMaster);

            restartCount = 0;
            tokenSource.Cancel();
        }
Ejemplo n.º 6
0
        private void Deinitialize()
        {
            EventHandler.UnregisterEvent(UnitRenderer.Unit, GameEvents.UnitFactionChanged, onFactionChangedAction);

            castFrame.UpdateCaster(null);
            healthFrame.Unit = null;

            UnitRenderer = null;
        }
Ejemplo n.º 7
0
        private void OnApplicationQuit()
        {
            EventHandler.UnregisterEvent <WorldManager>(EventHandler.GlobalDispatcher, GameEvents.WorldInitialized, OnWorldInitialized);
            EventHandler.UnregisterEvent <WorldManager>(EventHandler.GlobalDispatcher, GameEvents.WorldDeinitializing, OnWorldDeinitializing);

            world?.Dispose();
            scriptableClientContainer.Unregister();
            scriptableCoreContainer.Unregister();
        }
Ejemplo n.º 8
0
        private void DeinitializeUnit()
        {
            EventHandler.UnregisterEvent(unit, GameEvents.UnitAttributeChanged, onAttributeChangedAction);
            EventHandler.UnregisterEvent(unit, GameEvents.UnitTargetChanged, onUnitTargetChanged);

            targetUnitFrame?.UpdateUnit(null);
            unitBuffDisplayFrame?.UpdateUnit(null);

            unit = null;
        }
Ejemplo n.º 9
0
            public void Deinitialize()
            {
                EventHandler.UnregisterEvent(showDeselectedHealthOption, GameEvents.GameOptionChanged, OnHealthOptionChanged);

                for (int i = activeNameplates.Count - 1; i >= 0; i--)
                {
                    GameObjectPool.Return(activeNameplates[i], true);
                    Destroy(activeNameplates[i]);
                }

                activeNameplates.Clear();
                activeNameplateByRenderers.Clear();
                unplatedRenderers.Clear();
            }
Ejemplo n.º 10
0
        protected override void OnUnregister()
        {
            EventHandler.UnregisterEvent <UnitModel, UnitRenderer, bool>(this, GameEvents.UnitModelAttached, OnUnitModelAttached);

            spellAnimationInfoContainer.Unregister();
            animationInfoContainer.Unregister();
            spellVisualsInfoContainer.Unregister();
            auraVisualsInfoContainer.Unregister();
            classIconsByClassType.Unregister();
            colorsBySpellPowerType.Unregister();
            modelSettingsContainer.Unregister();

            Assert.IsTrue(unitRenderersByHitBoxes.Count == 0);

            unitRenderersByHitBoxes.Clear();
            container = null;

            base.OnUnregister();
        }
Ejemplo n.º 11
0
            public void Deinitialize()
            {
                EventHandler.UnregisterEvent <WorldEntity, bool>(rendering.World, GameEvents.ServerVisibilityChanged, OnServerVisibilityChanged);
                rendering.World.UnitManager.EventEntityAttached -= OnEventEntityAttached;
                rendering.World.UnitManager.EventEntityDetach   -= OnEventEntityDetach;

                foreach (UnitRenderer unitRenderer in unitRenderers)
                {
                    unitRenderer.Detach(UnitModelReplacementMode.Complete);
                }

                foreach (UnitModel fadingModel in fadingModels)
                {
                    fadingModel.Deinitialize();
                }

                unitRenderersById.Clear();
                unitRenderers.Clear();
                detachedUnits.Clear();
                fadingModels.Clear();
            }
        internal void Unregister()
        {
            EventHandler.UnregisterEvent <World, bool>(GameEvents.WorldStateChanged, OnWorldStateChanged);

            SetListeners(false, false, false);
        }
Ejemplo n.º 13
0
            public void HandlePlayerControlLost()
            {
                rendering.UnregisterHandler(this);

                EventHandler.UnregisterEvent(rendering.Player, GameEvents.UnitTargetChanged, OnPlayerTargetChanged);
            }