示例#1
0
        private void OnPlayerTargetEntityDatChanged(NetworkEntityGuid entity, EntityDataChangedArgs <ulong> changeArgs)
        {
            NetworkEntityGuid guid = new NetworkEntityGuid(changeArgs.NewValue);

            if (Logger.IsDebugEnabled)
            {
                Logger.Debug($"Player Target Changed to: {guid}");
            }

            CurrentTarget = guid;

            if (guid == NetworkEntityGuid.Empty)
            {
                //target was cleared.
                if (Logger.IsDebugEnabled)
                {
                    Logger.Debug($"Player cleared target.");
                }

                //TODO: We should register listener events to increase UI performance for untargeted callbacks
            }
            else
            {
                OnPlayerTargetChanged?.Invoke(this, new LocalPlayerTargetChangedEventArgs(guid));

                //We can at least set this active here I guess.
                TargetUnitFrame.SetElementActive(true);
            }
        }
示例#2
0
        private void OnPlayerExperienceChanged(NetworkEntityGuid entity, EntityDataChangedArgs <int> changeArgs)
        {
            //Just ignore the change args.
            int currentLevel      = LevelStrategy.ComputeLevelFromExperience(changeArgs.NewValue);
            int currentExperience = changeArgs.NewValue;

            int experienceToLevel          = LevelStrategy.TotalExperienceRequiredForLevel(currentLevel + 1) - LevelStrategy.TotalExperienceRequiredForLevel(currentLevel);
            int experienceIntoCurrentLevel = currentExperience - LevelStrategy.TotalExperienceRequiredForLevel(currentLevel);

            ExperienceBar.FillAmount = (float)experienceIntoCurrentLevel / experienceToLevel;
        }
示例#3
0
        private void OnTargetEntityHealthChanged(NetworkEntityGuid entity, EntityDataChangedArgs <int> args)
        {
            IEntityDataFieldContainer entityData = EntityDataMappable.RetrieveEntity(entity);

            //Ignore the changed value.
            int health    = entityData.GetFieldValue <int>(EntityObjectField.UNIT_FIELD_HEALTH);
            int maxHealth = entityData.GetFieldValue <int>(EntityObjectField.UNIT_FIELD_MAXHEALTH);

            TargetUnitFrame.HealthBar.BarText.Text           = $"{health} / {maxHealth}";
            TargetUnitFrame.HealthBar.BarFillable.FillAmount = (float)health / maxHealth;
        }
示例#4
0
        private void HandleModelChange([NotNull] NetworkEntityGuid entityGuid, EntityDataChangedArgs <int> changedModelId)
        {
            if (entityGuid == null)
            {
                throw new ArgumentNullException(nameof(entityGuid));
            }

            //The new id of the model is now known.
            CustomModelLoaderCancelable cancelable = AvatarLoaderFactory.Create(new CustomModelLoaderCreationContext(changedModelId.NewValue, entityGuid));

            if (AvatarLoaderMappable.ContainsKey(entityGuid))
            {
                AvatarLoaderMappable.RetrieveEntity(entityGuid).Cancel();
                AvatarLoaderMappable.ReplaceObject(entityGuid, cancelable);
            }
            else
            {
                AvatarLoaderMappable.AddObject(entityGuid, cancelable);
            }

            cancelable.StartLoading();
        }
示例#5
0
 private void OnLevelChanged(NetworkEntityGuid entity, EntityDataChangedArgs <int> changeArgs)
 {
     PlayerUnitFrame.UnitLevel.Text = changeArgs.NewValue.ToString();
 }
示例#6
0
 private void OnCurrentHealthChangedValue(NetworkEntityGuid source, EntityDataChangedArgs <int> changeArgs)
 {
     RecalulateHealthUI(source, changeArgs.NewValue);
 }
示例#7
0
 private void OnCurrentLevelChanged(NetworkEntityGuid entity, EntityDataChangedArgs <int> eventArgs)
 {
     RecaculateLevelUI(entity, eventArgs.NewValue);
 }
示例#8
0
 private void OnSpellCastingIdChanged(NetworkEntityGuid entity, EntityDataChangedArgs <int> changeArgs)
 {
     OnSpellCastingStateChanged?.Invoke(this, new SpellCastingStateChangedEventArgs(changeArgs.NewValue, PlayerDetails.EntityData.GetFieldValue <long>(EntityObjectField.UNIT_FIELD_CASTING_STARTTIME)));
 }
示例#9
0
 private void OnTargetEntityLevelChanged(NetworkEntityGuid entity, EntityDataChangedArgs <int> args)
 {
     TargetUnitFrame.UnitLevel.Text = args.NewValue.ToString();
 }