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
            public void HandlePlayerControlGained()
            {
                playerCircle.UpdateUnit(renderingReference.Player);
                targetCircle.UpdateUnit(renderingReference.Player.Target);

                EventHandler.RegisterEvent(renderingReference.Player, GameEvents.UnitTargetChanged, onPlayerTargetChanged);
            }
        internal void Register()
        {
            config = BoltRuntimeSettings.instance.GetConfigCopy();
            config.connectionRequestTimeout = (int)(MaxConnectionAttemptTime * 1000.0f);

            SetListeners(false, false, false);

            EventHandler.RegisterEvent <World, bool>(GameEvents.WorldStateChanged, OnWorldStateChanged);
        }
Ejemplo n.º 4
0
        protected override void OnRegistered()
        {
            settings.Apply();

            EventHandler.RegisterEvent <string, NetworkingMode>(EventHandler.GlobalDispatcher, GameEvents.GameMapLoaded, OnMapLoaded);
            EventHandler.RegisterEvent(EventHandler.GlobalDispatcher, GameEvents.DisconnectedFromMaster, OnDisconnectedFromMaster);

            StartServer();
        }
Ejemplo n.º 5
0
        protected override void OnRegistered()
        {
            gameManager = FindObjectOfType <GameManager>();
            settings.Apply();

            EventHandler.RegisterEvent <string, NetworkingMode>(GameEvents.GameMapLoaded, OnMapLoaded);
            EventHandler.RegisterEvent(GameEvents.DisconnectedFromMaster, OnDisconnectedFromMaster);

            StartServer();
        }
Ejemplo n.º 6
0
        internal void Register()
        {
            config = BoltRuntimeSettings.instance.GetConfigCopy();
            config.connectionRequestTimeout = (int)(MaxConnectionAttemptTime * 1000.0f);

            SetListeners(false, false, false);

            EventHandler.RegisterEvent <WorldManager>(EventHandler.GlobalDispatcher, GameEvents.WorldInitialized, OnWorldInitialized);
            EventHandler.RegisterEvent <WorldManager>(EventHandler.GlobalDispatcher, GameEvents.WorldDeinitializing, OnWorldDeinitializing);
        }
Ejemplo n.º 7
0
            public void Initialize()
            {
                Assert.IsTrue(unitRendererHandlers.Count == 0);
                Assert.IsTrue(unitRenderers.Count == 0);
                Assert.IsTrue(unitRenderersById.Count == 0);
                Assert.IsTrue(detachedUnits.Count == 0);

                rendering.World.UnitManager.EventEntityAttached += OnEventEntityAttached;
                rendering.World.UnitManager.EventEntityDetach   += OnEventEntityDetach;
                EventHandler.RegisterEvent <WorldEntity, bool>(rendering.World, GameEvents.ServerVisibilityChanged, OnServerVisibilityChanged);
            }
Ejemplo n.º 8
0
        private void Awake()
        {
            DontDestroyOnLoad(gameObject);

            scriptableCoreContainer.Register();
            scriptableClientContainer.Register();

            gameTimer.Start();

            EventHandler.RegisterEvent <WorldManager>(EventHandler.GlobalDispatcher, GameEvents.WorldInitialized, OnWorldInitialized);
            EventHandler.RegisterEvent <WorldManager>(EventHandler.GlobalDispatcher, GameEvents.WorldDeinitializing, OnWorldDeinitializing);
        }
Ejemplo n.º 9
0
        private void Initialize(UnitRenderer unitRenderer)
        {
            UnitRenderer = unitRenderer;

            unitName.text = unitRenderer.Unit.Name;
            castFrame.UpdateCaster(unitRenderer.Unit);
            healthFrame.Unit = unitRenderer.Unit;
            healthFrame.AlphaTransitionSpeed = nameplateSettings.HealthAlphaTrasitionSpeed;

            OnFactionChanged();

            EventHandler.RegisterEvent(UnitRenderer.Unit, GameEvents.UnitFactionChanged, onFactionChangedAction);
        }
Ejemplo n.º 10
0
        private void Awake()
        {
            DontDestroyOnLoad(gameObject);
            Assert.RaiseExceptions = Application.isEditor || UnityEngine.Debug.isDebugBuild;

            scriptableCoreContainer.Register();
            scriptableClientContainer.Register();

            gameTimer.Start();

            EventHandler.RegisterEvent <WorldManager>(EventHandler.GlobalDispatcher, GameEvents.WorldInitialized, OnWorldInitialized);
            EventHandler.RegisterEvent <WorldManager>(EventHandler.GlobalDispatcher, GameEvents.WorldDeinitializing, OnWorldDeinitializing);
        }
Ejemplo n.º 11
0
        private void InitializeUnit(Unit unit)
        {
            this.unit     = unit;
            unitName.text = unit.Name;
            targetUnitFrame?.UpdateUnit(unit.Target);
            unitBuffDisplayFrame?.UpdateUnit(unit);

            OnAttributeChanged(EntityAttributes.Health);
            OnAttributeChanged(EntityAttributes.Power);

            EventHandler.RegisterEvent(unit, GameEvents.UnitAttributeChanged, onAttributeChangedAction);
            EventHandler.RegisterEvent(unit, GameEvents.UnitTargetChanged, onUnitTargetChanged);
        }
Ejemplo n.º 12
0
        private void InitializeUnit(Unit unit)
        {
            this.unit        = unit;
            unitName.text    = unit.Name;
            classIcon.sprite = rendering.ClassIconsByClassType.Value(unit.ClassType);

            targetUnitFrame?.UpdateUnit(unit.Target);
            unitBuffDisplayFrame?.UpdateUnit(unit);

            OnAttributeChanged(EntityAttributes.Health);
            OnAttributeChanged(EntityAttributes.Power);

            EventHandler.RegisterEvent(unit, GameEvents.UnitAttributeChanged, onAttributeChangedAction);
            EventHandler.RegisterEvent(unit, GameEvents.UnitTargetChanged, onUnitTargetChanged);
        }
Ejemplo n.º 13
0
        private void Initialize(UnitRenderer unitRenderer)
        {
            UnitRenderer = unitRenderer;

            transform.SetParent(interfaceReference.FindRoot(InterfaceCanvasType.Nameplate));
            transform.position = UnitRenderer.TagContainer.FindNameplateTag();
            unitName.text      = unitRenderer.Unit.Name;
            castFrame.UpdateCaster(unitRenderer.Unit);
            healthFrame.Unit = unitRenderer.Unit;
            healthFrame.AlphaTransitionSpeed = nameplateSettings.HealthAlphaTrasitionSpeed;

            OnFactionChanged();

            EventHandler.RegisterEvent(UnitRenderer.Unit, GameEvents.UnitFactionChanged, onFactionChangedAction);
        }
Ejemplo n.º 14
0
        protected override void OnWorldInitialized(WorldManager world)
        {
            base.OnWorldInitialized(world);

            if (world.HasClientLogic)
            {
                world.UnitManager.EventEntityAttached += OnEventEntityAttached;
                world.UnitManager.EventEntityDetach   += OnEventEntityDetach;

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

                nameplateController.Initialize();
                floatingTextController.Initialize();
                spellVisualController.Initialize();
                selectionCircleController.Initialize();
            }
        }
Ejemplo n.º 15
0
        protected override void OnRegistered()
        {
            base.OnRegistered();

            if (!Application.isEditor)
            {
                autoIncludedMaterials.Clear();
            }

            container = GameObject.FindGameObjectWithTag("Renderer Container").transform;

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

            EventHandler.RegisterEvent <UnitModel, UnitRenderer, bool>(this, GameEvents.UnitModelAttached, OnUnitModelAttached);
        }
Ejemplo n.º 16
0
            public void HandlePlayerControlGained()
            {
                EventHandler.RegisterEvent(rendering.Player, GameEvents.UnitTargetChanged, OnPlayerTargetChanged);

                rendering.RegisterHandler(this);
            }
Ejemplo n.º 17
0
            public void Initialize()
            {
                GameObjectPool.PreInstantiate(nameplatePrototype.gameObject, preinstantiatedCount);

                EventHandler.RegisterEvent(showDeselectedHealthOption, GameEvents.GameOptionChanged, OnHealthOptionChanged);
            }