Ejemplo n.º 1
0
        public void OnActionExecuting(ActionExecutingContext filterContext)
        {
            #region 记录访问记录

            try
            {
                //var userService = DependencyResolver.Current.GetService<IUserService>();
                //var context = filterContext.HttpContext;
                //var user = context.User;
                //var isLogined = user != null && user.Identity != null && user.Identity.IsAuthenticated;
                //var visit = new VisitDto
                //{
                //    IP = filterContext.HttpContext.Request.UserHostAddress,
                //    LoginName = isLogined ? user.Identity.Name : string.Empty,
                //    Url = context.Request.Url.PathAndQuery,
                //    UserId = isLogined ? user.Identity.GetLoginUserId() : "0"
                //};
                //Task.Run(async () => await userService.Visit(visit));
            }
            catch (Exception ex)
            {
                QuickLog.Error("SiteVisitFilterError", ex);
            }

            #endregion
        }
Ejemplo n.º 2
0
    internal static Stat GetStatByTag(string tag, Stat[] stats)
    {
        for (int i = 0; i < stats.Length; i++)
        {
            if (stats[i].tag.CompareTo(tag) == 0)
            {
                return(stats[i]);
            }
        }

        QuickLog.Msg("Stat with tag doesn't exist:", tag, "len", stats.Length);
        return(null);
    }
Ejemplo n.º 3
0
    private IEnumerator CKillUnit(PlayerStats unit)
    {
        Destroy(unit.UseParentAsRoot ? unit.transform.parent.gameObject : unit.gameObject);

        // activate the rest of after death stuff... ui, drops, etc.
        QuickLog.Msg("Triggering after death. times:" + afterDeath.Count);
        for (int i = 0; i < afterDeath.Count; i++)
        {
            yield return(StartCoroutine(afterDeath[i]()));
        }

        Debug.Log("After death coro working.");
        yield break;
    }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.J) && NotAttacking)
        {
            TriggerAttackAnimations();

            // RPG combat v 1 --> raycasting based.
            RaycastHit2D[] hits = Physics2D.BoxCastAll(RootObj.position, boxArea, 0, movement.LastDirection * Stat.GetFloat(atkDistanceTest));

            // filter self.
            for (int i = 0; i < hits.Length; i++)
            {
                if (!hits[i].transform.IsChildOf(RootObj))
                {
                    attacking.Push(hits[i]);
                }
            }

            // -- Do damage to unique targets --
            QuickLog.Msg(name, "basic attacks", attacking.Count);
            Transform lastRoot = null;
            while (attacking.Count > 0)
            {
                RaycastHit2D hit = attacking.Pop();
                //if (!hit.transform.gameObject.CompareTag("Collision"))
                //    continue;

                Collision c = hit.transform.GetComponent <Collision>();
                if (c == null)
                {
                    continue;
                }
                if (lastRoot == c.RootObj)
                {
                    continue;
                }

                lastRoot = c.RootObj;

                // do damage and apply all effects.
                c.GetStats().DoDamage(dmgItemTest);
                Gems.GetExpOnAttack();


                QuickLog.Msg(name, "- Damage", Stat.GetInt(dmgItemTest), "- >", hit.transform.name);
            }
        }
    }
Ejemplo n.º 5
0
 IEnumerator DropForPlayer()
 {
     QuickLog.Msg("Dropping", gemExpDrop);
     Gems.GetSomeExp(0, gemExpDrop);
     yield break;
 }
 public async Task StartAsync(CancellationToken cancellationToken)
 {
     await QuickLog.AsyncConsumer();     // or whatever you want to call
 }