public IEnumerator GetScores() { using (UnityWebRequest request = UnityWebRequest.Get($"{URL}/scores")) { // Create WebRequest yield return(request.SendWebRequest()); // Check for Error if (request.error != null) { Debug.Log("Error: (GetScores)" + request.error); } else { FireRes data = FireRes.CreateFromJSON(request.downloadHandler.text); try { int i = 0; scores = new Score[data.documents.Length]; foreach (FireDoc doc in data.documents) { scores[i++] = new Score(doc.fields.name.stringValue, doc.fields.score.integerValue); } } catch (NullReferenceException) { scores = new Score[0]; } } } }
void UpdateIntelligence() { IntField.GetComponent <Text> ().text = Int + ""; this.Att_MgDmg = 5 * Int; this.Att_MgDmgCrit = 2 * Int; this.Att_FireRes = 1 * Con + 1 * Int; this.Att_IceRes = 1 * Con + 1 * Int;; this.Att_LightRes = 1 * Con + 1 * Int; MgDmg.GetComponent <Text> ().text = Att_MgDmg + ""; MgDmgCrit.GetComponent <Text> ().text = Att_MgDmgCrit + ""; FireRes.GetComponent <Text> ().text = Att_FireRes + ""; IceRes.GetComponent <Text> ().text = Att_IceRes + ""; LightRes.GetComponent <Text> ().text = Att_LightRes + ""; }
void UpdateConstituition() { ConField.GetComponent <Text> ().text = Con + ""; this.Att_Weight = 2 * Str + 1 * Con; this.Att_HP = 2 * Str + 5 * Con; this.Att_Armor = 1 * Con; this.Att_FireRes = 1 * Con + 1 * Int; this.Att_IceRes = 1 * Con + 1 * Int; this.Att_LightRes = 1 * Con + 1 * Int; Weight.GetComponent <Text> ().text = Att_Weight + ""; HP.GetComponent <Text> ().text = Att_HP + ""; Armor.GetComponent <Text> ().text = Att_Armor + ""; FireRes.GetComponent <Text> ().text = Att_FireRes + ""; IceRes.GetComponent <Text> ().text = Att_IceRes + ""; LightRes.GetComponent <Text> ().text = Att_LightRes + ""; }
private void DrawResistances() { if (!(bool)Settings.Resistances) { return; } FireRes = TryGetStat("fire_damage_resistance_%"); FireResTotal = TryGetStat("uncapped_fire_damage_resistance_%"); MaxFireRes = TryGetStat("maximum_fire_damage_resistance_%") != 0 ? TryGetStat("maximum_fire_damage_resistance_%") : 75; ColdRes = TryGetStat("cold_damage_resistance_%"); ColdResTotal = TryGetStat("uncapped_cold_damage_resistance_%"); MaxColdRes = TryGetStat("maximum_cold_damage_resistance_%") != 0 ? TryGetStat("maximum_cold_damage_resistance_%") : 75; LightRes = TryGetStat("lightning_damage_resistance_%"); LightResTotal = TryGetStat("uncapped_lightning_damage_resistance_%"); MaxLightRes = TryGetStat("maximum_lightning_damage_resistance_%") != 0 ? TryGetStat("maximum_lightning_damage_resistance_%") : 75; ChaosRes = TryGetStat("chaos_damage_resistance_%"); ChaosResTotal = TryGetStat("uncapped_chaos_damage_resistance_%"); MaxChaosRes = TryGetStat("maximum_chaos_damage_resistance_%") != 0 ? TryGetStat("maximum_chaos_damage_resistance_%") : 75; var num1 = 0; var num2 = 0; var num3 = 0; var num4 = 0; try { num1 = ResistanceDifference(FireRes, FireResTotal, MaxFireRes); num2 = ResistanceDifference(ColdRes, ColdResTotal, MaxColdRes); num3 = ResistanceDifference(LightRes, LightResTotal, MaxLightRes); num4 = ResistanceDifference(ChaosRes, ChaosResTotal, MaxChaosRes); } catch { } Graphics.DrawText($"{"Fire:".PadRight(8, ' ')}{FireRes.ToString().PadRight(5, ' ')}({(num1 > 0 ? "+" + num1 : num1.ToString())})", new Vector2(Settings.ResistanceX, Settings.ResistanceY), Settings.FireResistanceColor, FontAlign.Left); Graphics.DrawText($"{"Cold:".PadRight(8, ' ')}{ColdRes.ToString().PadRight(5, ' ')}({(num2 > 0 ? "+" + num2 : num2.ToString())})", new Vector2(Settings.ResistanceX, Settings.ResistanceY + Settings.ResistanceTextSize), Settings.ColdResistanceColor, FontAlign.Left); Graphics.DrawText($"{"Light:".PadRight(8, ' ')}{LightRes.ToString().PadRight(5, ' ')}({(num3 > 0 ? "+" + num3 : num3.ToString())})", new Vector2(Settings.ResistanceX, Settings.ResistanceY + Settings.ResistanceTextSize * 2), Settings.LightningResistanceColor, FontAlign.Left); Graphics.DrawText($"{"Chaos:".PadRight(8, ' ')}{ChaosRes.ToString().PadRight(5, ' ')}({(num4 > 0 ? "+" + num4 : num4.ToString())})", new Vector2(Settings.ResistanceX, Settings.ResistanceY + Settings.ResistanceTextSize * 3), Settings.ChaosResistanceColor, FontAlign.Left); }