コード例 #1
0
        protected override void OnLocalPlayerTargetChanged(LocalPlayerTargetChangedEventArgs args)
        {
            IEntityDataFieldContainer entityData = EntityDataMappable.RetrieveEntity(args.TargetedEntity);

            EntityDataChangeCallbackService.RegisterCallback <int>(args.TargetedEntity, (int)BaseObjectField.UNIT_FIELD_LEVEL, OnTargetEntityLevelChanged);

            //Only initialize if we have their values
            if (entityData.DataSetIndicationArray.Get((int)BaseObjectField.UNIT_FIELD_LEVEL))
            {
                OnTargetEntityLevelChanged(args.TargetedEntity, new EntityDataChangedArgs <int>(0, entityData.GetFieldValue <int>(BaseObjectField.UNIT_FIELD_LEVEL)));
            }
        }
コード例 #2
0
 protected override void OnLocalPlayerTargetChanged(LocalPlayerTargetChangedEventArgs args)
 {
     //If it's exists, it's the best case scenario and we're good to go.
     if (NameQueryable.Exists(args.TargetedEntity))
     {
         string name = NameQueryable.Retrieve(args.TargetedEntity);
         TargetUnitFrame.UnitName.Text = name;
     }
     else
     {
         //TODO: We need to handle this case better.
         if (Logger.IsWarnEnabled)
         {
             Logger.Warn($"Could not load target entity name.");
         }
     }
 }
コード例 #3
0
        protected override void OnLocalPlayerTargetChanged(LocalPlayerTargetChangedEventArgs args)
        {
            IEntityDataFieldContainer entityData = EntityDataMappable.RetrieveEntity(args.TargetedEntity);

            foreach (var unreg in Unregisterables)
            {
                unreg.Unregister();
            }

            Unregisterables.Clear();

            //Listen for both max and current health.
            Unregisterables.Add(EntityDataChangeCallbackService.RegisterCallback <int>(args.TargetedEntity, (int)EntityObjectField.UNIT_FIELD_HEALTH, OnTargetEntityHealthChanged));
            Unregisterables.Add(EntityDataChangeCallbackService.RegisterCallback <int>(args.TargetedEntity, (int)EntityObjectField.UNIT_FIELD_MAXHEALTH, OnTargetEntityHealthChanged));

            //Only initialize if we have their values
            if (entityData.DataSetIndicationArray.Get((int)EntityObjectField.UNIT_FIELD_HEALTH))
            {
                OnTargetEntityHealthChanged(args.TargetedEntity, new EntityDataChangedArgs <int>(0, 0));
            }
        }