Exemplo n.º 1
0
 private static Skill GetSkill(EquipmentItemOptionSheet.Row row, TableSheets tableSheets,
                               IRandom random)
 {
     try
     {
         var skillRow =
             tableSheets.SkillSheet.OrderedList.First(r => r.Id == row.SkillId);
         var dmg    = random.Next(row.SkillDamageMin, row.SkillDamageMax + 1);
         var chance = random.Next(row.SkillChanceMin, row.SkillChanceMax + 1);
         var skill  = SkillFactory.Get(skillRow, dmg, chance);
         return(skill);
     }
     catch (InvalidOperationException)
     {
         return(null);
     }
 }
Exemplo n.º 2
0
        public async Task Query()
        {
            const string query = @"
            {
                id
                grade
                level
                elementalType
                setId
                itemId
                stat {
                    type
                    value
                }
                statsMap {
                    hP
                    aTK
                    dEF
                    cRI
                    hIT
                    sPD
                }
                skills {
                    id
                    elementalType
                    chance
                    power
                }
            }";

            var row       = Fixtures.TableSheetsFX.EquipmentItemSheet.OrderedList.First(r => r.ItemSubType == ItemSubType.Weapon);
            var equipment = new Weapon(row, Guid.NewGuid(), 0);
            var skillRow  = Fixtures.TableSheetsFX.SkillSheet.OrderedList.First();
            var skill     = SkillFactory.Get(skillRow, 1, 1);

            equipment.Skills.Add(skill);

            var queryResult = await ExecuteQueryAsync <EquipmentType>(query, source : equipment);

            Assert.Null(queryResult.Errors);
        }
Exemplo n.º 3
0
        public async Task Query(int power, int chance)
        {
            const string query = @"
            {
                id
                elementalType
                power
                chance
            }";

            var row         = Fixtures.TableSheetsFX.SkillSheet.OrderedList.First();
            var skill       = SkillFactory.Get(row, power, chance);
            var queryResult = await ExecuteQueryAsync <Headless.GraphTypes.States.Models.SkillType>(query, source : skill);

            Assert.Equal(new Dictionary <string, object>
            {
                ["id"]            = row.Id,
                ["elementalType"] = row.ElementalType.ToString().ToUpper(),
                ["power"]         = power,
                ["chance"]        = chance,
            }, queryResult.Data);
        }
Exemplo n.º 4
0
        public void ExecuteDefaultAttack()
        {
            var skills = new Skills();

            // add default attack
            var defaultAttack = GetDefaultAttackSkill();

            skills.Add(defaultAttack);

            // add skill
            const int skillId = 130005;

            _skillSheet.TryGetValue(skillId, out var skillRow);
            var skill = SkillFactory.Get(skillRow, 100, 0);

            skills.Add(skill);

            // select skill
            var selectedSkill = skills.Select(_random);

            Assert.Equal(defaultAttack.SkillRow.Id, selectedSkill.SkillRow.Id);
        }
Exemplo n.º 5
0
        public override void Show(bool ignoreShowAnimation = false)
        {
            _modal.gameObject.SetActive(true);

            Peers.Find("Scrollbar")
            .GetComponent <Scrollbar>()
            .onValueChanged
            .AddListener((location) => ScrollBarHandler(Peers, location));
            StagedTxs.Find("Scrollbar")
            .GetComponent <Scrollbar>()
            .onValueChanged
            .AddListener((location) => ScrollBarHandler(StagedTxs, location));
            Blocks.Find("Scrollbar")
            .GetComponent <Scrollbar>()
            .onValueChanged
            .AddListener((location) => ScrollBarHandler(Blocks, location));
            OnChainTableSheet.Find("Scrollbar")
            .GetComponent <Scrollbar>()
            .onValueChanged
            .AddListener((location) => ScrollBarHandler(OnChainTableSheet, location));
            LocalTableSheet.Find("Scrollbar")
            .GetComponent <Scrollbar>()
            .onValueChanged
            .AddListener((location) => ScrollBarHandler(LocalTableSheet, location));
            Refresh(OnChainTableSheet);
            Refresh(LocalTableSheet);
            Refresh(Peers);
            Refresh(StagedTxs);
            ScrollBarHandler(Peers, 0);
            ScrollBarHandler(StagedTxs, 0);
            ScrollBarHandler(OnChainTableSheet, 0);
            ScrollBarHandler(LocalTableSheet, 0);

            BtnOpen.gameObject.SetActive(false);
            foreach (var i in Enumerable.Range(1, Game.Game.instance.TableSheets.StageWaveSheet.Count))
            {
                Button newButton = Instantiate(buttonBase, list.content);
                newButton.GetComponentInChildren <Text>().text = i.ToString();
                newButton.onClick.AddListener(() => DummyBattle(i));
                newButton.gameObject.SetActive(true);
            }

            var skills = new List <Model.Skill.Skill>();

            foreach (var skillRow in Game.Game.instance.TableSheets.SkillSheet)
            {
                var skill = SkillFactory.Get(skillRow, 50, 100);
                skills.Add(skill);
                Button newButton = Instantiate(buttonBase, skillList.content);
                newButton.GetComponentInChildren <Text>().text =
                    $"{skillRow.GetLocalizedName()}_{skillRow.ElementalType}";
                newButton.onClick.AddListener(() => SelectSkill(skill));
                newButton.gameObject.SetActive(true);
            }

            _skills = skills.ToArray();

            TableAssets = GetTableAssetsHavingDifference();
            TableSheetsDropdown.options = TableAssets.Keys.Select(s => new Dropdown.OptionData(s)).ToList();
            if (TableSheetsDropdown.options.Count == 0)
            {
                Debug.Log("It seems there is no table having difference.");
                Display(nameof(OnChainTableSheet), "No content.");
                Display(nameof(LocalTableSheet), "No content.");
                PatchButton.SetActive(false);
            }
            else
            {
                RefreshTableSheets();
            }

            base.Show(ignoreShowAnimation);
        }