Пример #1
0
 private float OtherVelueSum(GachaRarity rarity)
 {
     return(fields
            .Where(kv => kv.Key != rarity && kv.Key != GachaRarity.N)
            .Select(kv => kv.Value)
            .Select(field => float.Parse(field.text))
            .Sum());
 }
Пример #2
0
    private void ChangeProbability(GachaRarity rarity, float value)
    {
        var otherValueSum = this.OtherVelueSum(rarity);

        if (value + otherValueSum > 100f)
        {
            this.fields[GachaRarity.N].text = 0f.ToString();
            this.fields[rarity].text        = (100f - otherValueSum).ToString();
        }
        else
        {
            this.fields[GachaRarity.N].text = (100f - value - otherValueSum).ToString();
            this.fields[rarity].text        = value.ToString();
        }
    }