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); } }
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; }
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; }
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(); }
private void OnLevelChanged(NetworkEntityGuid entity, EntityDataChangedArgs <int> changeArgs) { PlayerUnitFrame.UnitLevel.Text = changeArgs.NewValue.ToString(); }
private void OnCurrentHealthChangedValue(NetworkEntityGuid source, EntityDataChangedArgs <int> changeArgs) { RecalulateHealthUI(source, changeArgs.NewValue); }
private void OnCurrentLevelChanged(NetworkEntityGuid entity, EntityDataChangedArgs <int> eventArgs) { RecaculateLevelUI(entity, eventArgs.NewValue); }
private void OnSpellCastingIdChanged(NetworkEntityGuid entity, EntityDataChangedArgs <int> changeArgs) { OnSpellCastingStateChanged?.Invoke(this, new SpellCastingStateChangedEventArgs(changeArgs.NewValue, PlayerDetails.EntityData.GetFieldValue <long>(EntityObjectField.UNIT_FIELD_CASTING_STARTTIME))); }
private void OnTargetEntityLevelChanged(NetworkEntityGuid entity, EntityDataChangedArgs <int> args) { TargetUnitFrame.UnitLevel.Text = args.NewValue.ToString(); }