예제 #1
0
        internal async void GetPokemon()
        {
            HttpClient client = new HttpClient(); //makes new accesable HTTP client

            //calls website, sending the user entry, website responds and sends back data
            //var uri = new Uri(string.Format( $"http://pokeapi.co/api/v2/pokemon/{PokemonEnteredByUser}/"));

            var uri = new Uri("https://pokeapi.co/api/v2/pokemon/" + PokemonEnteredByUser + "/");


            //THERE IS AN ERROR HERE WHERE THE APP BREAKS FOR NO REASON I DON'T KNOW HOW TO FIX IT
            //I looked into the data the API is sendiong me and have decided to abandon this project and work on a different API
            //This pokemon one give a LOT of useless information that is far too comp[icated to display
            var response = await client.GetAsync(uri);


            PokedexItem PokedexData = null;

            if (response.IsSuccessStatusCode)
            {
                var content = await response.Content.ReadAsStringAsync();

                PokedexData = PokedexItem.FromJson(content);
            }
            PokedexCollection.Add(PokedexData); //adds recived data to collection
        }
예제 #2
0
파일: ODData.cs 프로젝트: shuitian/Odyssey
 static public void SetHArmorData(PokedexItem item, int id)
 {
     item.armor        = float.Parse(ODSetting.hArmorTable[id]["baseArmor"]);
     item.damageDerate = HyperbolaArmorComponent.CalculateDamageDerates(ODSetting.settingDic["damageHArmorModifiedValue"], new float[1] {
         item.armor
     })[0];
 }
예제 #3
0
        //navigate to new page
        //sends all dta data currently in the model to the new page
        private async void NavToMoreInfoPage(PokedexItem pokedexItem)
        {
            var navParams = new NavigationParameters();

            navParams.Add("PokedexItemInfo", pokedexItem);
            await _navigationService.NavigateAsync("MoreInfoPage", navParams);
        }
예제 #4
0
 public void ChooseStartPokemon(PokedexItem item)
 {
     ODGame.isFirstStart = false;
     Log.WriteLog("你选择了 " + item.characterName + " 作为你的初始神奇宝贝!");
     ODUI.instance.ShowFirstStartPanel(false);
     pokemons[item.id - 1].discovery = true;
     ODData.OwnPokemon(item.id);
 }
예제 #5
0
파일: ODData.cs 프로젝트: shuitian/Odyssey
    static public void SetAttackData(PokedexItem item, int attackId, int attackSpeedId, int attackDisId)
    {
        item.attack = new float[1] {
            float.Parse(ODSetting.attackTable[attackId]["attacks"])
        }[0];

        item.attackInterval = AttackSpeed.GetAttackInterval(float.Parse(ODSetting.attackSpeedTable[attackSpeedId]["baseAttackInterval"]), ODSetting.settingDic["attackSpeedTimeModifiedValue"], ODSetting.settingDic["baseAttackSpeed"]);

        item.minAttackDis = float.Parse(ODSetting.attDisTable[attackDisId]["min"]);
        item.maxAttackDis = float.Parse(ODSetting.attDisTable[attackDisId]["max"]);
    }
예제 #6
0
    private void SetupButtons()
    {
        for (int i = 0; i < itemList.Count; i++)
        {
            Pokemon item = itemList[i];

            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel);

            PokedexItem sampleButton = newButton.GetComponent <PokedexItem>();
            sampleButton.Setup(item);
        }
    }
예제 #7
0
파일: ODData.cs 프로젝트: shuitian/Odyssey
    static public PokedexItem GetPokedexItemById(int id)
    {
        PokedexItem item = new PokedexItem();

        item.id            = id;
        item.characterName = ODSetting.pokemonsTable[id]["name"];
        SetHpData(item, int.Parse(ODSetting.pokemonsTable[id]["hp_id"]));
        SetAttackData(item, int.Parse(ODSetting.pokemonsTable[id]["attack_id"]), int.Parse(ODSetting.pokemonsTable[id]["attackspeed_id"]), int.Parse(ODSetting.pokemonsTable[id]["att_dis_id"]));
        SetHArmorData(item, int.Parse(ODSetting.pokemonsTable[id]["h_armor_id"]));
        SetMoveData(item, int.Parse(ODSetting.pokemonsTable[id]["move_id"]));
        item.discovery = Sql.IsHavePokemon(id);
        return(item);
    }
예제 #8
0
 public static string ToJson(this PokedexItem self) => JsonConvert.SerializeObject(self, Converter.Settings);
예제 #9
0
    public void SetUIDate(PokedexItem item, bool discoveryMask = true)
    {
        bool   undiscovery     = !(discoveryMask || item.discovery);
        string undiscoveryText = "未知";

        this.item = item;
        if (icon)
        {
            icon.sprite = item.icon;
            if (undiscovery)
            {
                icon.color = Color.black;
            }
            else
            {
                icon.color = Color.white;
            }
        }
        if (characterNameText)
        {
            characterNameText.text = (undiscovery)?undiscoveryText:item.characterName;
        }
        if (maxHpText)
        {
            maxHpText.text = (undiscovery)?undiscoveryText:item.maxHp + "";
        }
        if (hpRecoverText)
        {
            hpRecoverText.text = (undiscovery)?undiscoveryText:item.hpRecover + "";
        }
        if (attackText)
        {
            attackText.text = (undiscovery)?undiscoveryText:item.attack + "";
        }
        if (attackIntervalText)
        {
            attackIntervalText.text = (undiscovery)?undiscoveryText:item.attackInterval + "";
        }
        if (minAttackDisText)
        {
            minAttackDisText.text = (undiscovery)?undiscoveryText:item.minAttackDis + "";
        }
        if (maxAttackDisText)
        {
            maxAttackDisText.text = (undiscovery)?undiscoveryText:item.maxAttackDis + "";
        }
        if (armorText)
        {
            armorText.text = (undiscovery)?undiscoveryText:item.armor + "";
        }
        if (damageDerateText)
        {
            damageDerateText.text = (undiscovery)?undiscoveryText:item.damageDerate + "";
        }
        if (moveSpeedText)
        {
            moveSpeedText.text = (undiscovery)?undiscoveryText:item.moveSpeed + "";
        }

        if (chooseButton)
        {
            chooseButton.onClick.AddListener(() => Pokedex.instance.ChooseStartPokemon(item));
        }
    }
예제 #10
0
 private void TestingFunc()
 {
     PokedexItem PokedexData = null;
 }
예제 #11
0
파일: ODData.cs 프로젝트: shuitian/Odyssey
 static public void SetMoveData(PokedexItem item, int id)
 {
     item.moveSpeed = float.Parse(ODSetting.moveTable[id]["baseMoveSpeed"]);
 }
예제 #12
0
파일: ODData.cs 프로젝트: shuitian/Odyssey
 static public void SetHpData(PokedexItem item, int id)
 {
     item.maxHp     = float.Parse(ODSetting.hpTable[id]["baseMaxHp"]);
     item.hpRecover = float.Parse(ODSetting.hpTable[id]["baseHpRecover"]);
 }