Exemple #1
0
    public MenuInGame(FSM parentFsm, UIManager2 panel1, UIManager2 panel2)
        : base(parentFsm, panel1, panel2, "MenuInGame.fsm")
    {
        timeClient = TimeManager.Instance.Create();

        InitUI();

        int stageId = (int)parentFsm.Variables["stageId"];

        /*
        // ddong
        if (stageId < 2000)
        {
            stageId += 2000;
        }
        */

        InitStage(stageId, out stageEntity, out gameEntity);

        Rect fieldArea = UI.GetFieldArea();
        field = CreateField(stageEntity, fieldArea, timeClient, fsm);

        // ddong
        int subClassCode = 11;
        int level = 1;
        int trainLevel = 1;

        this.subClassEntity = TableLoader.GetTable<SubClassEntity>().Get(subClassCode);
        ClassLevelEntity levelEntity = TableLoader.GetTable<ClassLevelEntity>().Get(subClassEntity.classCode, level);
        TrainLevelEntity trainLevelEntity = TableLoader.GetTable<TrainLevelEntity>().Get(subClassEntity.classCode, trainLevel);
        FieldObjectEntity objectField = TableLoader.GetTable<FieldObjectEntity>().Get(subClassEntity.objectCode);

        Rect puzzleArea = UI.GetPuzzleArea();
        CreatePuzzle(puzzleArea, timeClient, subClassCode, out puzzleRecord, out puzzlePanel);

        user = CreateUser(stageEntity, UI, fsm);
        heroCharacter = CreateCharacter(objectField, levelEntity, trainLevelEntity, subClassEntity, user, puzzlePanel, itemDropManager, UI.AddBuffIcon, UI.RemoveBuffIcon, fsm);
        itemDropManager = new ConsumableSpawn(stageEntity.gameModeCode, levelEntity.consumableTier);

        Func<float> getLifeDrainRate = (() => gameEntity.defaultHP);
        new PlayerCharacter(user, heroCharacter, getLifeDrainRate, fsm);
        /*
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, OnCharacterHPChanged);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, UI.ChangeHP);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.MP, UI.ChangeMana);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.Armor, UI.ChangeShield);
        */

        UI.InitCommendSlots(fsm, heroCharacter);

        field.AddPlayerCharacter(heroCharacter);
        field.FocusOnForced(heroCharacter, 0);
        puzzlePanel.SetQueue(user.commandQueue);

        var screenPosTable = TableLoader.GetTable<ScreenPositionEntity2>();
        var hpToPos = screenPosTable.Values.Select(x => new KeyValuePair<float, float>(x.hp, x.screenPos));
        convertHPRatioToScreenPos = new RangeConvertor(hpToPos).Convert;

        SetFocusTarget(heroCharacter);
    }
        public async Task <ParentEntity> getAsyncParents(SearchModel formdata)
        {
            ChildEntity newChild        = new ChildEntity();
            var         createDateChild = new DateTime(2022, 4, 8, 4, 35, 11);

            newChild.createdDate = createDateChild;
            newChild.name        = "NewChild";
            newChild.sequenceNo  = 32;

            ParentEntity newParent        = new ParentEntity();
            var          createDateParent = new DateTime(2020, 1, 10, 11, 25, 20);

            newParent.createdDate = createDateParent;
            newParent.name        = "NewParent";
            newParent.sequenceNo  = 32;
            newParent.ChildEntity.Add(newChild);

            SubClassEntity newSubClass        = new SubClassEntity();
            var            createSubClassDate = new DateTime(2026, 6, 13, 10, 11, 12);

            newSubClass.createdDate = createSubClassDate;
            newSubClass.name        = "NewSubClass";
            newSubClass.sequenceNo  = 102;

            newParent.SubClassEntity = newSubClass;

            BranchEntity newFirstBranch     = new BranchEntity();
            var          newFirstBranchDate = new DateTime(2023, 2, 14, 14, 22, 15);

            newFirstBranch.createdDate = newFirstBranchDate;
            newFirstBranch.name        = "NewSubClass";
            newFirstBranch.sequenceNo  = 102;
            newParent.FirstBranch.Add(newFirstBranch);


            BranchEntity newSecondBranch     = new BranchEntity();
            var          newSecondBranchDate = new DateTime(2024, 6, 24, 10, 35, 7);

            newSecondBranch.createdDate = newSecondBranchDate;
            newSecondBranch.name        = "NewSubClass";
            newSecondBranch.sequenceNo  = 102;
            newParent.SecondBranch.Add(newSecondBranch);

            return(newParent);
        }
Exemple #3
0
    static Status2<HeroStatusType> InitStatus(ObjectHolder owner, Stat2 stat, SubClassEntity subClassEntity)
    {
        var blockAtt1 = TableLoader.GetTable<BlockEntity2>().Get(subClassEntity.attackBlock1);
        var blockAtt2 = TableLoader.GetTable<BlockEntity2>().Get(subClassEntity.attackBlock2);

        Status2<HeroStatusType> ret = new Status2<HeroStatusType>(stat,
            new Status2<HeroStatusType>.Init(HeroStatusType.hp, 0, HeroStatType.maxHP, 0),
            new Status2<HeroStatusType>.Init(HeroStatusType.ap, 0, HeroStatType.maxAP, 0),
            new Status2<HeroStatusType>.Init(HeroStatusType.mp, 0, HeroStatType.maxMP, 0),

            new Status2<HeroStatusType>.Init(HeroStatusType.attack1CP, 0, blockAtt1.maxCP1, 0),
            new Status2<HeroStatusType>.Init(HeroStatusType.attack1ChargeCount, 0, blockAtt1.maxChargeCount, 0),
            new Status2<HeroStatusType>.Init(HeroStatusType.attack2CP, 0, blockAtt2.maxCP1, 0),
            new Status2<HeroStatusType>.Init(HeroStatusType.attack2ChargeCount, 0, blockAtt2.maxChargeCount, 0),

            new Status2<HeroStatusType>.Init(HeroStatusType.speed, 0, HeroStatType.moveSpeed, 0));
        return ret;
    }
Exemple #4
0
    public HeroCharacter(FieldObjectEntity objectField, SubClassEntity subClassEntity, ClassLevelEntity levelEntity, TrainLevelEntity trainLevelEntity, bool toLeft, InGameUser user, PuzzlePanel puzzlePanel, Buff.Handle onBuff, Buff.Handle onDeBuff, FSM parentFsm)
        : base(objectField, toLeft, parentFsm)
    {
        this.subClassEntity = subClassEntity;
        this.user = user;
        this.puzzlePanel = puzzlePanel;

        this.stat = new Stat2<HeroStatType>(StatGenerator.ExportData<HeroStatType>(levelEntity, trainLevelEntity));
        this.status = InitStatus(this, stat, subClassEntity);

        Register(stat);
        Register(status);

        /*
        RegisterDeathCondition(x => x.Get(HeroStatusType.hp) == 0);
        RegisterBuffHandler(onBuff, onDeBuff);

        RegistActions();

        SkillCommand skillCommand = InitSkill(this, skillId, itemHeroLevel.Level);
        AddCommandSet("skill", 1, false, E_CommandConsume.Skill, null).TryAdd(skillCommand);
         * */
    }
Exemple #5
0
    static HeroCharacter CreateCharacter(FieldObjectEntity objectField, ClassLevelEntity levelEntity, TrainLevelEntity trainLevelEntity, SubClassEntity subClassEntity, InGameUser user, PuzzlePanel puzzlePanel, ConsumableSpawn itemDropManager, System.Action<StatusEffectEntity2> addBuffIcon, System.Action<StatusEffectEntity2> removeBuffIcon, FSM parentFsm)
    {
        Buff.Handle onBuff = delegate(Buff buff)
        {
            if (addBuffIcon != null)
            {
                addBuffIcon(buff.statusEffectEntity);
            }
        };
        Buff.Handle onDeBuff = delegate(Buff buff)
        {
            if (removeBuffIcon != null)
            {
                removeBuffIcon(buff.statusEffectEntity);
            }
        };
        HeroCharacter heroCharacter = new HeroCharacter(objectField, subClassEntity, levelEntity, trainLevelEntity, false, user, puzzlePanel, onBuff, onDeBuff, parentFsm);

        {
            Action action = ActionPattern.Create("Vector(Self; [HeroStatType.moveSpeed]; 0; 0; false)").Generate(heroCharacter.Stat);
            heroCharacter.Fire(action, null);
            heroCharacter.PauseMoving();
        }

        for (int i = 0; i < 4; i++)
        {
            heroCharacter.AddItemSlot(i, user.commandQueue);
        }

        {
            heroCharacter.AddAction(Action.E_Type.Money,
                delegate(float value, GameInstance firer, string[] param)
                {
                    Action action = ActionPattern.Create("Action(User; Money; {0})").Generate(heroCharacter.Stat, value);
                    if (action != null)
                    {
                        heroCharacter.Fire(action, null);
                    }
                    return null;
                }
            );
            heroCharacter.AddAction(Action.E_Type.Exp,
                delegate(float value, GameInstance firer, string[] param)
                {
                    Action action = ActionPattern.Create("Action(User; Exp; {0})").Generate(heroCharacter.Stat, value);
                    if (action != null)
                    {
                        heroCharacter.Fire(action, null);
                    }
                    return null;
                }
            );
            heroCharacter.AddAction(Action.E_Type.GetConsumable,
                delegate(float value, GameInstance firer, string[] param)
                {
                    if (RandomTool.IsIn(value))
                    {
                        var itemCommand = new ItemCommand(itemDropManager.Pick());
                        if (itemCommand != null)
                        {
                            heroCharacter.TryAddItem(itemCommand);
                        }
                    }
                    return null;
                }
            );
        }

        return heroCharacter;
    }
        public void addParentWithChildEntity()
        {
            using (UnitOfWork worker = new UnitOfWork(new SqliteTestDbContext()))
            {
                ChildEntity newChild        = new ChildEntity();
                var         createDateChild = new DateTime(2022, 4, 8, 4, 35, 11);
                newChild.createdDate = createDateChild;
                newChild.name        = "NewChild";
                newChild.sequenceNo  = 32;

                ParentEntity newParent        = new ParentEntity();
                var          createDateParent = new DateTime(2020, 1, 10, 11, 25, 20);
                newParent.createdDate = createDateParent;
                newParent.name        = "NewParent";
                newParent.sequenceNo  = 32;
                newParent.ChildEntity.Add(newChild);

                SubClassEntity newSubClass        = new SubClassEntity();
                var            createSubClassDate = new DateTime(2026, 6, 13, 10, 11, 12);
                newSubClass.createdDate = createSubClassDate;
                newSubClass.name        = "NewSubClass";
                newSubClass.sequenceNo  = 102;

                newParent.SubClassEntity = newSubClass;

                BranchEntity newFirstBranch     = new BranchEntity();
                var          newFirstBranchDate = new DateTime(2023, 2, 14, 14, 22, 15);
                newFirstBranch.createdDate = newFirstBranchDate;
                newFirstBranch.name        = "NewSubClass";
                newFirstBranch.sequenceNo  = 102;
                newParent.FirstBranch.Add(newFirstBranch);


                BranchEntity newSecondBranch     = new BranchEntity();
                var          newSecondBranchDate = new DateTime(2024, 6, 24, 10, 35, 7);
                newSecondBranch.createdDate = newSecondBranchDate;
                newSecondBranch.name        = "NewSubClass";
                newSecondBranch.sequenceNo  = 102;
                newParent.SecondBranch.Add(newSecondBranch);

                worker.ParentEntityRepository.Add(newParent);


                Assert.AreEqual(1, worker.ParentEntityRepository.Count());
                var newParentDb = worker.ParentEntityRepository.GetAll().ToList();
                Assert.AreEqual(1, newParentDb.Count);
                Assert.AreEqual("NewParent", newParentDb.FirstOrDefault().name);
                Assert.AreEqual(32, newParentDb.FirstOrDefault().sequenceNo);
                Assert.AreEqual(createDateParent.ToString(), newParentDb.FirstOrDefault().createdDate.ToString());
                Assert.Greater(newParentDb.FirstOrDefault().Id, 0);


                Assert.AreEqual(1, worker.ChildEntityRepository.Count());
                var newChildDb = worker.ChildEntityRepository.GetAll().ToList();
                Assert.AreEqual(1, newChildDb.Count);
                Assert.AreEqual("NewChild", newChildDb.FirstOrDefault().name);
                Assert.AreEqual(32, newChildDb.FirstOrDefault().sequenceNo);
                Assert.AreEqual(createDateChild.ToString(), newChildDb.FirstOrDefault().createdDate.ToString());
                Assert.Greater(newChildDb.FirstOrDefault().Id, 0);


                Assert.AreEqual(1, worker.SubClassEntityRepository.Count());
                var newSubClassDb = worker.SubClassEntityRepository.GetAll().ToList();
                Assert.AreEqual(1, newSubClassDb.Count);
                Assert.AreEqual("NewSubClass", newSubClassDb.FirstOrDefault().name);
                Assert.AreEqual(102, newSubClassDb.FirstOrDefault().sequenceNo);
                Assert.AreEqual(createSubClassDate.ToString(), newSubClassDb.FirstOrDefault().createdDate.ToString());
                Assert.Greater(newSubClassDb.FirstOrDefault().Id, 0);
            }
        }