Esempio n. 1
0
        // C_Skill
        public void HandleSkill(Player player, C_Skill skillPacket)
        {
            if (player == null)
            {
                return;
            }

            ObjectInfo info = player.Info;

            if (info.PosInfo.State != CreatureState.Idle)
            {
                return;
            }

            // TODO : 스킬 사용가능한지 검증


            // 통과
            info.PosInfo.State = CreatureState.Skill;

            S_Skill skill = new S_Skill()
            {
                Info = new SkillInfo()
            };

            skill.ObjectId     = info.ObjectId;
            skill.Info.SkillId = skillPacket.Info.SkillId; // 유저가 보내준 스킬
            Broadcast(player.CellPos, skill);

            Data.Skill skillData = null;
            if (DataManager.SkillDict.TryGetValue(skill.Info.SkillId, out skillData) == false)
            {
                return;
            }

            // 스킬 종류에 따른 로직
            switch (skillData.skillType)
            {
            case SkillType.SkillAuto:     // 평타
                                          // 데미지 판정
                Vector2Int skillPos = player.GetFrontCellPos(info.PosInfo.MoveDir);
                GameObject target   = Map.Find(skillPos);
                if (target != null)
                {
                    this.Push(target.OnDamaged, player, player.Info.StatInfo.Attack);
                }
                break;

            case SkillType.SkillProjectile:     // 투사체
                SpawnProjectile(player, skillData);
                break;

            case SkillType.SkillNone:
                break;

            default:
                return;
            }
        }
Esempio n. 2
0
        public SkillIcon(Model.LearnedSkills tempLearnedSkills, Data.Skill skill)
        {
            _tempLearnedSkills = tempLearnedSkills;
            _skill             = skill;

            this.Image = GetSkillImage();
            // Set the reverse, then toggle to update the image as well
            _enabled = !_tempLearnedSkills.Contains(skill.SkillID);

            ApplyStyle();
            BindEvents();
            Toggle();
        }
        public async Task <IActionResult> OnGetAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Skill = await _context.Skills.SingleOrDefaultAsync(m => m.ID == id);

            if (Skill == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Esempio n. 4
0
        /// <summary>
        /// 使用技能
        /// 0 ->普攻
        /// 1 - 3 ->固定技能
        /// 4 - ~ ->特技特效
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public Data.Skill UseSkill(int index)
        {
            Data.Skill skill = new Data.Skill();
            skill.Id = -1;
            if (this.Data.Skills.Count < 5)
            {
                BDebug.Log("技能数量错误! id:" + this.Data.Id);
            }
            //获取skill
            var id = this.Data.Skills[index];

            skill = SqliteHelper.DB.GetTable <Data.Skill>().Where((s) => s.Id == id).First();

            return(skill);
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Skill = await _context.Skill.FirstOrDefaultAsync(m => m.Id == id);

            if (Skill == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task <IActionResult> OnPostAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Skill = await _context.Skills.FindAsync(id);

            if (Skill != null)
            {
                _context.Skills.Remove(Skill);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Esempio n. 7
0
        public void SpawnProjectile(GameObject owner, Data.Skill skillData)
        {
            if (skillData.projectile.name == "Arrow")
            {
                Arrow arrow = ObjectManager.Instance.Add <Arrow>();

                if (arrow == null)
                {
                    return;
                }
                arrow.Data            = skillData;             // 해당스킬의 정보시트
                arrow.Owner           = owner;                 // 주인은 플레이어
                arrow.PosInfo.State   = CreatureState.Moving;  // 화살은 계속 움직임
                arrow.PosInfo.PosX    = owner.PosInfo.PosX;    // 화살 생성위치
                arrow.PosInfo.PosY    = owner.PosInfo.PosY;
                arrow.PosInfo.MoveDir = owner.PosInfo.MoveDir;
                arrow.Speed           = skillData.projectile.speed; // 화살정보 입력
                                                                    // 화살 입갤
                this.Push(this.EnterGame, arrow, false);            //EnterGame(arrow);
            }
            // else if (skillData.projectile.name == "FireBall") {} // TODO 다른 투사체
        }
Esempio n. 8
0
        /// <summary>
        /// 被攻击
        /// </summary>
        /// <param name="skill"></param>
        /// <exception cref="NotImplementedException"></exception>
        public void Behurt(Data.Skill skill)
        {
            this.State.SetData("Behurt", null);
//            foreach (var b in skill.SkillBlocks)
//            {
//                for (int i = 0; i < b.Data.Params_Formula.Count; i++)
//                {
//                    var f = b.Data.Params_Formula[i];
//
//                    f = ReplaceFormulaAttribute(f, "a.");
//                    if (f.Contains("a"))
//                    {
//                        BDebug.LogError("buff公式有错误 id:" + b.Data.Id);
//                        break;
//                    }
//
//
//                    b.Data.Params_Formula[i] = f;
//                }
//            }
//            //一批次添加buff
//            this.BuffProcess.AddBuffs(skill.Buffs.ToArray());
        }
Esempio n. 9
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            Username = HttpContext.Session.GetString("username"); // establish session
            if (Username != null)
            {
                if (id == null)
                {
                    return(NotFound());
                }

                Skill = await _context.Skill.FirstOrDefaultAsync(m => m.Id == id);

                if (Skill == null)
                {
                    return(NotFound());
                }
                return(Page());
            }
            else
            {
                return(RedirectToPage("../Index"));
            }
        }
        public void HandleSkill(Player player, C_Skill skillPacket)
        {
            if (player == null)
            {
                return;
            }

            ObjectInfo info = player.Info;

            if (info.PosInfo.State != CreatureState.Idle)
            {
                return;
            }

            // TODO : 스킬 사용 가능 여부 체크
            info.PosInfo.State = CreatureState.Skill;
            S_Skill skill = new S_Skill()
            {
                Info = new SkillInfo()
            };

            skill.ObjectId     = info.ObjectId;
            skill.Info.SkillId = skillPacket.Info.SkillId;
            Broadcast(skill);

            Data.Skill skillData = null;
            if (DataManager.SkillDict.TryGetValue(skillPacket.Info.SkillId, out skillData) == false)
            {
                return;
            }

            switch (skillData.skillType)
            {
            case SkillType.SkillAuto:
            {
                Vector2Int skillPos = player.GetFrontCellPos(info.PosInfo.MoveDir);
                GameObject target   = Map.Find(skillPos);
                if (target != null)
                {
                    Console.WriteLine("Hit GameObject !");
                }
            }
            break;

            case SkillType.SkillProjectile:
            {
                Arrow arrow = ObjectManager.Instance.Add <Arrow>();
                if (arrow == null)
                {
                    return;
                }

                arrow.Owner           = player;
                arrow.Data            = skillData;
                arrow.PosInfo.State   = CreatureState.Moving;
                arrow.PosInfo.MoveDir = player.PosInfo.MoveDir;
                arrow.PosInfo.PosX    = player.PosInfo.PosX;
                arrow.PosInfo.PosY    = player.PosInfo.PosY;
                arrow.Speed           = skillData.projectile.speed;
                Push(EnterGame, arrow);
            }
            break;
            }
        }
Esempio n. 11
0
        // GameRoom의 JobSerilizer에 의해 실행되기 때문에 EnterGame같은거 직접 불러도 됨
        public void HandleSkill(Player player, C_Skill skillPacket)
        {
            if (player == null) // player가 지금 GameRoom에 소속되었는지도 체크
            {
                return;
            }

            // 스킬분기처리.. 몇 개 없다는 가정하에
            // 스킬이 많아지면 Skill 클래스를 따로 파서 플레이어에 주입하는게 낫다

            ObjectInfo info = player.Info;

            if (info.PosInfo.State != CreatureState.Idle)
            {
                return;
            }

            // 스킬 사용 가능 여부 체크

            // 스킬 애니메이션 맞춰주는 부분
            info.PosInfo.State = CreatureState.Skill;
            S_Skill skill = new S_Skill()
            {
                Info = new SkillInfo()
            };                                                        // info도 클래스임

            skill.ObjectId     = info.ObjectId;
            skill.Info.SkillId = skillPacket.Info.SkillId; // 나중에 시트로 뺄거야
            Broadcast(skill);                              // 에코서버마냥 전파한다

            // 이제 DB에서 Id에 해당하는 스킬데이터를 뽑아온다
            Data.Skill skillData = null;
            if (DataManager.SkillDict.TryGetValue(skillPacket.Info.SkillId, out skillData) == false)
            {
                return;
            }

            // id에 해당하는 스킬이 있다
            switch (skillData.skillType)
            {
            case SkillType.SkillAuto:
            {
                // 주먹질
                // 데미지 판정 -> 항상 치팅 대비
                // 내 공격방향에 적이 있나 없나 체크
                // GetFrontCellPos에 MoveDir.None 처리가 없으니
                // 항상 공격자의 위치를 반환해서 아무대나 떄려도 타격이 되는 문제가 있었음
                // MoveDir.None이 그냥 키입력 여부를 받는거라 서버에는 필요없으므로 전체적으로 없애기로함
                Vector2Int skillPos = player.GetFrontCellPos(info.PosInfo.MoveDir);
                GameObject target   = Map.Find(skillPos);
                if (target != null)
                {
                    Console.WriteLine("Hit GameObject!");
                }
            }
            break;

            case SkillType.SkillProjectile:
            {
                // 화살 생성
                // 클라에서도 화살이 날아가는것을 계산하고 있어야 치팅을 방지할수 있다.
                // 어떤 투사체인지 구분할수 있는게 필요 (지금은 화살만..)
                Arrow arrow = ObjectManager.Instance.Add <Arrow>();
                if (arrow == null)
                {
                    return;
                }

                // 데이터 대입
                arrow.Owner           = player;
                arrow.Data            = skillData; // 투사체를 생성한 주체(스킬)의 정보를 저장
                arrow.PosInfo.State   = CreatureState.Moving;
                arrow.PosInfo.MoveDir = player.PosInfo.MoveDir;
                arrow.PosInfo.PosX    = player.PosInfo.PosX;
                arrow.PosInfo.PosY    = player.PosInfo.PosY;
                arrow.Speed           = skillData.projectile.speed;
                // 직접 불러서 해도 전혀 문제없긴함 EnterGame(arrow)
                Push(EnterGame, arrow);         // 치팅방지 + 코드재사용(화살이 생성됐음을 모두에게 알림)
            }
            break;
            }
        }