public static IRequest CreateHitRequest(this ITracker tracker, HitBase hit)
        {
            hit.ClientId           = tracker.ClientId;
            hit.WebPropertyId      = tracker.TrackingId;
            hit.ApplicationId      = tracker.ApplicationId;
            hit.ApplicationName    = tracker.ApplicationName;
            hit.ApplicationVersion = tracker.ApplicationVersion;
            var request = new HitRequestBase(hit);


            return(request);
        }
예제 #2
0
        public static KeyValuePair <string, string> GetPropertyString(this HitBase hit, string properyName)
        {
            try
            {
                var pInfo = typeof(HitBase).GetProperty(properyName)?.GetCustomAttributes(typeof(HitAttribute), false).Cast <HitAttribute>().FirstOrDefault();

                if (pInfo == null)
                {
                    return(new KeyValuePair <string, string>());              // Ignore properties without custom attributes.
                }
                var value = hit.GetType().GetProperty(properyName)?.GetValue(hit, null);

                return(new KeyValuePair <string, string>(pInfo.Parm, value?.ToString()));
            }
            catch (Exception e)
            {
                Console.WriteLine($"Failed to build property string {e}");
                throw;
            }
        }
예제 #3
0
    public void Init(MovementBase _movement, AbilityBase _ability, AttackBase _attack, DeathBase _death, HitBase _hit)
    {
        _anim = GetComponent <Animator>();

        if (_movement != null)
        {
            _movement.OnMovement += HandleMovement;
        }
        if (_ability != null)
        {
            _ability.OnAbility += HandleAbility;
        }
        if (_attack != null)
        {
            _attack.OnAttack += HandleAttack;
        }
        if (_death != null)
        {
            _death.OnDeath += HandleDeath;
        }
        if (_hit != null)
        {
            _hit.OnHit += HandleHit;
        }
    }
 public MockRequest(HitBase requestHit)
 {
 }