コード例 #1
0
    // Update is called once per frame
    protected virtual void Update()
    {
        if (IsStop)
        {
            return;
        }

        if (IsGroupMode)
        {
            GroupModeUpdate();
            return;
        }

        if (NowTarget == null)
        {
            NextTargetSearch();
            return;
        }

        if (!Damaged.isHitted)
        {
            MoveAdvanceToTarget(NowTarget, MoveSpeed);
        }

        if (IsAttackMode && (!IsAttacking))
        {
            ChangeAttackToRange();
        }

        IntervalTimeUpdate();
        HitLog.CheckEnd();
    }
コード例 #2
0
    /// <summary>
    /// 当たった時
    /// </summary>
    /// <param name="other"></param>
    protected override void OnTriggerEnter(Collider other)
    {
        //既に逃げ始めている
        if (IsEscape)
        {
            if (other.CompareTag(ConstTags.RunAwayPoint))
            {
                DestroyMe();
            }

            return;
        }

        // プレイヤの攻撃
        if (other.CompareTag(ConstTags.PlayerAttack))
        {
            var hito = other.GetComponent <HitObject>();

            bool isHit = !HitLog.CheckLog(hito);
            if (isHit)
            {
                SwtichHitted(hito);
                hito.DamageHp(MyHp);
                return;
            }
        }
    }
コード例 #3
0
        public async Task <string> GetRedirectUrl(string relativePath)
        {
            var requestUrl =
                $"{_httpContext.HttpContext.Request.Scheme}://{_httpContext.HttpContext.Request.Host}{_httpContext.HttpContext.Request.Path}{_httpContext.HttpContext.Request.QueryString.Value}";


            var value = _configuration.GetValue <string>("App:ShortenWebRootPath");

            var relativeValue = requestUrl.Replace(value, "");

            var urlMap = await _urlMapRepository.GetAll().FirstOrDefaultAsync(x => x.ShortenUrl == relativeValue);

            if (urlMap != null)
            {
                var hitLog = new HitLog()
                {
                    Id       = Guid.NewGuid().ToString(),
                    UrlMapId = urlMap.Id
                };
                await _hitLogRepository.CreateAsync(hitLog);

                urlMap.HitCount += 1;
                await _urlMapRepository.UpdateAsync(urlMap);

                return(urlMap.RawUrl);
            }

            throw new Exception($"The requested url does not exist!!");
        }
コード例 #4
0
    // Update is called once per frame
    protected override void Update()
    {
        if (IsEscape)
        {
            MoveAdvanceToTarget(NowTarget, MoveSpeed);
            HitLog.CheckEnd();
            return;
        }

        NowTarget = TargetPlayer;
        if (NowTarget == null)
        {
            return;
        }

        // 攻撃を喰らっていなくて、かつ移動出来る状態なら
        if (!Damaged.isHitted && (!IsStop))
        {
            MoveAdvanceToTarget(NowTarget, MoveSpeed);
        }

        if (IsAttackMode && (!IsAttacking))
        {
            ChangeAttackToRange();
        }

        HitLog.CheckEnd();
    }
コード例 #5
0
        public void DrawTextLog(HitLog log)
        {
            textlog.AppendText(player1.Name + " punch " + presenter.game.player2.Name + " in " + log.FirstPalyerPart + " on " + log.FirstPalyerHitValue + " and " + log.FirstPalyerResult + Environment.NewLine);
            textlog.AppendText(presenter.game.player2.Name + " punch " + player1.Name + " in " + log.SecondPlayerPart + " on " + log.SecondPlayerHitValue + " and " + log.SecondPlayerResult + Environment.NewLine);
            if ((presenter.game.player1.Hp <= 0) || (presenter.game.player2.Hp <= 0))
            {
                textlog.AppendText("Player " + player1.Name + " " + presenter.game.combatLog.Result + Environment.NewLine);
                MessageBox.Show("Player " + player1.Name + " " + presenter.game.combatLog.Result);
                player1.Exp += presenter.game.combatLog.Exp;
                SwitchScene(Scene.Menu, player1);  // kostil
            }
            if (presenter.gameType == GameType.PvE)
            {
                foreach (Control item in pnl_2nd_punch.Controls)
                {
                    if (item is Button)
                    {
                        (item as Button).UnMark();
                    }
                }
                switch (log.SecondPlayerPart)
                {
                case BodyPart.Head:
                {
                    btn_2nd_punch_head.ChangeMark();
                    break;
                }

                case BodyPart.Body:
                {
                    btn_2nd_punch_body.ChangeMark();
                    break;
                }

                case BodyPart.Feet:
                {
                    btn_2nd_punch_feet.ChangeMark();
                    break;
                }

                case BodyPart.LeftHand:
                {
                    btn_2nd_punch_lefthand.ChangeMark();
                    break;
                }

                case BodyPart.RightHand:
                {
                    btn_2nd_punch_righthand.ChangeMark();
                    break;
                }

                default:
                    break;
                }
            }
            textlog.AppendText("----------------------------------------------------------------" + "\n");
        }
コード例 #6
0
        public void Delate(int id)
        {
            HitLog hitLog = db.HitLog.Find(id);

            if (hitLog != null)
            {
                db.HitLog.Remove(hitLog);
            }
        }
コード例 #7
0
    void GroupModeUpdate()
    {
        if (!Damaged.isHitted)
        {
            MoveAdvanceToTarget(NowTarget, MoveSpeed);
        }

        IntervalTimeUpdate();
        HitLog.CheckEnd();
    }
コード例 #8
0
        public HitLogOutput(HitLog model)
        {
            UrlMapId = model.UrlMapId;
            if (model.UrlMap != null)
            {
                UrlMap = new UrlMapOutput(model.UrlMap);
            }

            CreationTime = model.CreationTime;
            IpAddress    = model.IpAddress;
            DeviceInfo   = model.DeviceInfo;
        }
コード例 #9
0
    /// <summary>
    /// ログのチェック(存在するならtrue)
    /// </summary>
    /// <param name="obj"></param>
    /// <returns></returns>
    public bool CheckLog(HitObject obj)
    {
        HitLog log = new HitLog(obj);

        for (int i = 0; i < LogList.Count; i++)
        {
            if (LogList[i] != null && LogList[i].checkEqual(log))
            {
                return(true);
            }
        }

        // 喰らったことの無いものとして格納
        LogList.Add(log);
        return(false);
    }
コード例 #10
0
    /// <summary>
    /// 当たり始めの判定
    /// </summary>
    /// <param name="other"></param>
    protected virtual void OnTriggerEnter(Collider other)
    {
        //既に逃げ始めている
        if (IsEscape)
        {
            if (other.CompareTag(ConstTags.RunAwayPoint))
            {
                DestroyMe();
            }

            return;
        }

        // プレイヤの攻撃
        if (other.CompareTag(ConstTags.PlayerAttack))
        {
            var hito = other.GetComponent <HitObject>();

            bool isHit = !HitLog.CheckLog(hito);
            if (isHit)
            {
                // 攻撃元の座標を受け取る
                HittedPlayerAttack(hito.ParentHit.myPlayer.GetPlayerObj());

                SwtichHitted(hito);
                hito.DamageHp(MyHp);
                CameraChance(hito);
                return;
            }
        }

        // ターゲット通過
        if (other.CompareTag(ConstTags.EnemyCheckPoint))
        {
            TargetIndex++;
            NextTargetSearch();
        }
        else if (other.CompareTag(ConstTags.City))
        {
            NextTargetSearch();
        }
    }
コード例 #11
0
        public bool checkEqual(HitLog log)
        {
            // 同じプレイヤーの攻撃ならtrue
            bool eqPl = (Hit.ParentHit.PlayerNo == log.Hit.ParentHit.PlayerNo);

            // 他者の攻撃であるので同じではない
            if (!eqPl)
            {
                return(false);
            }

            // 同じ攻撃動作ならtrue
            bool eqAct = (Hit.ParentHit == log.Hit.ParentHit);

            // 同じIDならtrue
            bool eqId = (Hit.Id == log.Hit.Id);

            // 同じ攻撃動作ならtrue
            // かつ同じIDのものならtrue、違うIDなら別として扱う
            return(eqAct ? (eqId) : (false));
        }
コード例 #12
0
        public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            // Do something before the action executes.
            var requestUrl =
                $"{context.HttpContext.Request.Scheme}://{context.HttpContext.Request.Host}{context.HttpContext.Request.Path}{context.HttpContext.Request.QueryString.Value}";

            _logger.LogTrace($"Requested URL: {requestUrl}");

            var value = _configuration.GetValue <string>("App:ShortenWebRootPathReplaceValue");

            var relativeValue = requestUrl.Replace(value, "");

            _logger.LogTrace($"Relative Path: {requestUrl}");

            var urlMap = await _urlMapRepository.GetAll().FirstOrDefaultAsync(x => string.Equals(x.ShortenUrl, relativeValue, StringComparison.InvariantCulture));

            if (urlMap != null)
            {
                var hitLog = new HitLog()
                {
                    Id       = Guid.NewGuid().ToString(),
                    UrlMapId = urlMap.Id
                };
                await _hitLogRepository.CreateAsync(hitLog);

                urlMap.HitCount += 1;
                await _urlMapRepository.UpdateAsync(urlMap);

                context.Result = new RedirectResult(urlMap.RawUrl, true);


                return;
            }

            // next() calls the action method.
            var resultContext = await next();

            // resultContext.Result is set.
            // Do something after the action executes.
        }
コード例 #13
0
        protected override void Seed(EF_Repository.Data.EfContext context)
        {
            var combat = new Combat()
            {
                Date = new DateTime(2014, 2, 16)
            };
            var newPlayer = new Player()
            {
                Login = "******", Password = "******", Email = "*****@*****.**", IsValidEmail = true, Date = new DateTime(2014, 2, 11)
            };
            var newPlayer1 = new Player()
            {
                Login = "******", Password = "******", Email = "*****@*****.**", IsValidEmail = true, Date = new DateTime(2014, 2, 11)
            };

            combat.Pvps.Add(new Pvp()
            {
                Player = newPlayer, Enemy = newPlayer1
            });
            var hitlog = new HitLog()
            {
                PlayerHitValue = 90, EnemyHitValue = 100, PlayerLogin = newPlayer.Login, EnemyLogin = newPlayer1.Login
            };

            combat.HitLog = hitlog;
            newPlayer.Transactions.Add(new Transaction()
            {
                Sum = 50, Date = new DateTime(2014, 1, 12)
            });
            newPlayer1.Transactions.Add(new Transaction()
            {
                Sum = 45, Date = new DateTime(2014, 1, 12)
            });

            combat.Winner = newPlayer1.Login;

            newPlayer.Combat  = combat;
            newPlayer1.Combat = combat;
            context.Players.Add(newPlayer);
            context.Players.Add(newPlayer1);

            var combat1 = new Combat()
            {
                Date = new DateTime(2012, 2, 15)
            };
            var newPlayer3 = new Player()
            {
                Login = "******", Password = "******", Email = "*****@*****.**", IsValidEmail = true, Date = new DateTime(2012, 2, 10)
            };

            combat1.Winner    = newPlayer3.Login;
            newPlayer3.Combat = combat1;
            newPlayer3.Combat.Pves.Add(new Pve()
            {
                Player = newPlayer3, Combat = combat1
            });
            var hitlog1 = new HitLog()
            {
                PlayerHitValue = 100, EnemyHitValue = 70, PlayerLogin = newPlayer3.Login, EnemyLogin = "******"
            };

            newPlayer3.Combat.HitLog = hitlog1;
            newPlayer3.Transactions.Add(new Transaction()
            {
                Player = newPlayer3, Sum = 40, Date = new DateTime(2012, 2, 12)
            });
            context.Players.Add(newPlayer3);
        }
コード例 #14
0
 public void Update(HitLog hitLog)
 {
     db.Entry(hitLog).State = EntityState.Modified;
 }
コード例 #15
0
ファイル: GameController.cs プロジェクト: SyrnikovEK/csharp
        public HitLog Turn(BodyPart player1punch, BodyPart player1block, BodyPart player2punch, BodyPart player2block)
        {
            HitLog log = new HitLog();

            // round preparation
            player1.SetBlock(player1block);
            player2.SetBlock(player2block);

            if (player2 is NPC)
            {
                player2punch = (BodyPart)(new Random().Next(5));
            }

            // Бьет первый игрок
            log.FirstPalyerHitValue = player2.GetHit(player1punch, new FightPapams(player1.Straight, player1.Agility));
            log.FirstPalyerPart     = player1punch;
            log.FirstPalyerResult   = log.FirstPalyerHitValue != 0 ? TurnResult.Wound : TurnResult.Miss;

            // Бьет второй игрок
            log.SecondPlayerHitValue = player1.GetHit(player2punch, new FightPapams(player2.Straight, player2.Agility));
            log.SecondPlayerPart     = player2punch;
            log.SecondPlayerResult   = log.SecondPlayerHitValue != 0 ? TurnResult.Wound : TurnResult.Miss;

            log.FirstPlayerCurrentHp  = player1.Hp;
            log.SecondPlayerCurrentHp = player2.Hp;

            combatLog.CombatHitLogs.Add(log);


            // Проверка смерти игрока и награда победителя
            if ((player1.Hp <= 0) && (player2.Hp > 0))  // player2 win
            {
                if (!(player2 is NPC))
                {
                    int oldExp = player2.Exp;
                    player2.AddExp((int)(player1.MaxHp * ((double)(player1.Straight + player1.Stamina + player1.Agility) / (double)(player2.Straight + player2.Stamina + player2.Agility))));
                    combatLog.CombatTime = DateTime.Now;
                    combatLog.Exp        = 0;
                    repos.GetAll().Where(x => x.PlayerDTOId == (player2 as Player).PlayerId).First().Exp = player2.Exp;
                    repos.Save();

                    combatLogRep.Add(combatLog);
                    //repos.Update((Player)player2);
                    // need save
                }
                combatLog.Result = GameResult.Loss;
            }
            if ((player2.Hp <= 0) && (player1.Hp > 0))  // player1 win
            {
                int oldExp = player1.Exp;
                player1.AddExp((int)(player2.MaxHp * ((double)(player2.Straight + player2.Stamina + player2.Agility) / (double)(player1.Straight + player1.Stamina + player1.Agility))));
                combatLog.CombatTime = DateTime.Now;
                combatLog.Result     = GameResult.Win;
                combatLog.Exp        = player1.Exp - oldExp;
                PlayerDTO pl = repos.GetAll().Where(x => x.PlayerDTOId == (player1 as Player).PlayerId).First();
                pl.Exp = player1.Exp;
                repos.Save();

                combatLogRep.Add(combatLog);
                //repos.Update((Player)player1);
                // need save
            }
            if ((player1.Hp <= 0) && (player2.Hp <= 0))  // draw
            {
                combatLog.CombatTime = DateTime.Now;
                combatLog.Result     = GameResult.Draw;
                combatLog.Exp        = 0;

                combatLogRep.Add(combatLog);
                // need save
            }

            log.CombatLogId = combatLog.CombatLogId;
            HitLogRepository hitLogRep = new HitLogRepository();

            hitLogRep.Add(log);
            return(log);
        }
コード例 #16
0
        protected override void Seed(ISD_13.Data.Context context)
        {
            var player1 = new Player()
            {
                Login = "******", Password = "******", EMail = "*****@*****.**", EMailValid = true, Date = DateTime.Now
            };
            var player2 = new Player()
            {
                Login = "******", Password = "******", EMail = "*****@*****.**", EMailValid = true, Date = DateTime.Now
            };
            var player3 = new Player()
            {
                Login = "******", Password = "******", EMail = "Superman@mail", EMailValid = false, Date = DateTime.Now
            };
            var player4 = new Player()
            {
                Login = "******", Password = "******", EMail = "Huntermail.ru", EMailValid = false, Date = DateTime.Now
            };
            var player5 = new Player()
            {
                Login = "******", Password = "******", EMail = "*****@*****.**", EMailValid = true, Date = DateTime.Now
            };
            var player6 = new Player()
            {
                Login = "******", Password = "******", EMail = "BOT", EMailValid = false, Date = DateTime.Now
            };

            context.Players.AddRange(new List <Player> {
                player1, player2, player3, player4, player5, player6
            });
            context.SaveChanges();


            var hit1 = new HitLog()
            {
                HitValue = 10, Part = BodyPart.Head, Result = 4, Date = DateTime.Now
            };
            var hit2 = new HitLog()
            {
                HitValue = 12, Part = BodyPart.Body, Result = 0, Date = DateTime.Now
            };
            var hit3 = new HitLog()
            {
                HitValue = 17, Part = BodyPart.Head, Result = 2, Date = DateTime.Now
            };
            var hit4 = new HitLog()
            {
                HitValue = 11, Part = BodyPart.Legs, Result = 5, Date = DateTime.Now
            };
            var hit5 = new HitLog()
            {
                HitValue = 7, Part = BodyPart.Legs, Result = 2, Date = DateTime.Now
            };
            var hit6 = new HitLog()
            {
                HitValue = 15, Part = BodyPart.Head, Result = 13, Date = DateTime.Now
            };
            var hit7 = new HitLog()
            {
                HitValue = 5, Part = BodyPart.Head, Result = 1, Date = DateTime.Now
            };
            var hit8 = new HitLog()
            {
                HitValue = 18, Part = BodyPart.Body, Result = 16, Date = DateTime.Now
            };
            var hit9 = new HitLog()
            {
                HitValue = 13, Part = BodyPart.Head, Result = 11, Date = DateTime.Now
            };
            var hit10 = new HitLog()
            {
                HitValue = 11, Part = BodyPart.Legs, Result = 8, Date = DateTime.Now
            };
            var hit11 = new HitLog()
            {
                HitValue = 7, Part = BodyPart.Legs, Result = 0, Date = DateTime.Now
            };
            var hit12 = new HitLog()
            {
                HitValue = 17, Part = BodyPart.Head, Result = 4, Date = DateTime.Now
            };
            var hit13 = new HitLog()
            {
                HitValue = 13, Part = BodyPart.Head, Result = 7, Date = DateTime.Now
            };
            var hit14 = new HitLog()
            {
                HitValue = 11, Part = BodyPart.Body, Result = 0, Date = DateTime.Now
            };
            var hit15 = new HitLog()
            {
                HitValue = 19, Part = BodyPart.Head, Result = 13, Date = DateTime.Now
            };
            var hit16 = new HitLog()
            {
                HitValue = 21, Part = BodyPart.Legs, Result = 18, Date = DateTime.Now
            };
            var hit17 = new HitLog()
            {
                HitValue = 17, Part = BodyPart.Legs, Result = 0, Date = DateTime.Now
            };
            var hit18 = new HitLog()
            {
                HitValue = 18, Part = BodyPart.Head, Result = 8, Date = DateTime.Now
            };

            context.HitLogs.AddRange(new List <HitLog> {
                hit1, hit2, hit3, hit4, hit5, hit6, hit17, hit8, hit9,
                hit10, hit11, hit12, hit13, hit14, hit15, hit16, hit17, hit18
            });

            var transaction1 = new Transaction()
            {
                Date = DateTime.Now, Player = player1, Sum = 100
            };
            var transaction2 = new Transaction()
            {
                Date = DateTime.Now, Player = player2, Sum = 200
            };
            var transaction3 = new Transaction()
            {
                Date = DateTime.Now, Player = player3, Sum = 150
            };
            var transaction4 = new Transaction()
            {
                Date = DateTime.Now, Player = player4, Sum = 70
            };
            var transaction5 = new Transaction()
            {
                Date = DateTime.Now, Player = player5, Sum = 40
            };
            var transaction6 = new Transaction()
            {
                Date = DateTime.Now, Player = player1, Sum = 120
            };
            var transaction7 = new Transaction()
            {
                Date = DateTime.Now, Player = player1, Sum = 80
            };
            var transaction8 = new Transaction()
            {
                Date = DateTime.Now, Player = player5, Sum = 220
            };
            var transaction9 = new Transaction()
            {
                Date = DateTime.Now, Player = player4, Sum = 180
            };
            var transaction10 = new Transaction()
            {
                Date = DateTime.Now, Player = player3, Sum = 170
            };
            var transaction11 = new Transaction()
            {
                Date = DateTime.Now, Player = player3, Sum = 420
            };
            var transaction12 = new Transaction()
            {
                Date = DateTime.Now, Player = player2, Sum = 10
            };

            context.Transactions.AddRange(new List <Transaction> {
                transaction1, transaction2, transaction3, transaction4, transaction5, transaction6,
                transaction7, transaction8, transaction9, transaction10, transaction11, transaction12
            });

            Combat combat1 = new Combat
            {
                CombatTypePVP = true,
                FirstPlayer   = player1,
                SecondPlayer  = player2,
                Date          = DateTime.Now,
                Winner        = player1,
                Experience    = 15,
                CombatLog     = new List <HitLog>()
                {
                    hit1, hit2
                }
            };

            combat1.Players.Add(player1);
            combat1.Players.Add(player2);
            Combat combat2 = new Combat
            {
                CombatTypePVP = true,
                FirstPlayer   = player2,
                SecondPlayer  = player1,
                Date          = DateTime.Now,
                Winner        = player2,
                Experience    = 11,
                CombatLog     = new List <HitLog>()
                {
                    hit3, hit4
                }
            };

            combat2.Players.Add(player1);
            combat2.Players.Add(player2);
            Combat combat3 = new Combat
            {
                CombatTypePVP = true,
                FirstPlayer   = player2,
                SecondPlayer  = player5,
                Date          = DateTime.Now,
                Winner        = player2,
                Experience    = 10,
                CombatLog     = new List <HitLog>()
                {
                    hit5, hit6
                }
            };

            combat3.Players.Add(player2);
            combat3.Players.Add(player5);
            Combat combat4 = new Combat
            {
                CombatTypePVP = false,
                FirstPlayer   = player3,
                SecondPlayer  = player6,
                Date          = DateTime.Now,
                Winner        = player3,
                Experience    = 14,
                CombatLog     = new List <HitLog>()
                {
                    hit7, hit8
                }
            };

            combat4.Players.Add(player3);
            combat4.Players.Add(player6);
            Combat combat5 = new Combat
            {
                CombatTypePVP = false,
                FirstPlayer   = player2,
                SecondPlayer  = player6,
                Date          = DateTime.Now,
                Winner        = player6,
                Experience    = 4,
                CombatLog     = new List <HitLog>()
                {
                    hit9, hit10
                }
            };

            combat5.Players.Add(player3);
            combat5.Players.Add(player6);
            Combat combat6 = new Combat
            {
                CombatTypePVP = true,
                FirstPlayer   = player4,
                SecondPlayer  = player1,
                Date          = DateTime.Now,
                Winner        = player4,
                Experience    = 17,
                CombatLog     = new List <HitLog>()
                {
                    hit11, hit12
                }
            };

            combat6.Players.Add(player1);
            combat6.Players.Add(player4);
            Combat combat7 = new Combat
            {
                CombatTypePVP = true,
                FirstPlayer   = player3,
                SecondPlayer  = player4,
                Date          = DateTime.Now,
                Winner        = player3,
                Experience    = 9,
                CombatLog     = new List <HitLog>()
                {
                    hit13, hit14
                }
            };

            combat7.Players.Add(player3);
            combat7.Players.Add(player4);
            Combat combat8 = new Combat
            {
                CombatTypePVP = true,
                FirstPlayer   = player5,
                SecondPlayer  = player1,
                Date          = DateTime.Now,
                Winner        = player1,
                Experience    = 3,
                CombatLog     = new List <HitLog>()
                {
                    hit15, hit16
                }
            };

            combat8.Players.Add(player1);
            combat8.Players.Add(player5);
            Combat combat9 = new Combat
            {
                CombatTypePVP = true,
                FirstPlayer   = player4,
                SecondPlayer  = player2,
                Date          = DateTime.Now,
                Winner        = player2,
                Experience    = 8,
                CombatLog     = new List <HitLog>()
                {
                    hit17, hit18
                }
            };

            combat9.Players.Add(player4);
            combat9.Players.Add(player2);
            context.Combats.Add(combat1);
            context.Combats.Add(combat2);
            context.Combats.Add(combat3);
            context.Combats.Add(combat4);
            context.Combats.Add(combat5);
            context.Combats.Add(combat6);
            context.Combats.Add(combat7);
            context.Combats.Add(combat8);
            context.Combats.Add(combat9);
            context.SaveChanges();
        }
コード例 #17
0
 public void Create(HitLog hitLog)
 {
     db.HitLog.Add(hitLog);
 }