internal void set_value(int value, string text) { Value.text = text; if (GaugeMax != GaugeMin) { Bar.SetFillWidth(Bar.bar_width, value, GaugeMin, GaugeMax); } else { Bar.SetFillWidth(0); } }
private void refresh_ranking_bar(Stat_Bar bar, int score) { int bar_length = score * RANKING_BAR_LENGTH / 150; // 100% yellow bar with green bonus if (bar_length > RANKING_BAR_LENGTH * 2 / 3) { bar.SetFillWidth(RANKING_BAR_LENGTH * 2 / 3); bar.bonus_width = bar_length - bar.fill_width; } // Short yellow bar with red penalty else { bar.SetFillWidth(bar_length); bar.bonus_width = bar.fill_width - RANKING_BAR_LENGTH * 2 / 3; } }
private void refresh_bar(int stat, int bonus, int cap) { if (cap > MAX_STAT) { stat = (int)((stat * MAX_STAT) / cap); bonus = (int)((bonus * MAX_STAT) / cap); cap = (int)MAX_STAT; } int total_width = (int)Math.Round(Math.Min(MAX_STAT, (stat + bonus)) * STAT_BAR_WIDTH / MAX_STAT); stat = (int)Math.Round(stat * STAT_BAR_WIDTH / MAX_STAT); bonus = total_width - stat; if (bonus < 0) { stat = total_width; } Bar.SetFillWidth(stat, 1, 0, 1); //@Debug: actually use this function Bar.bonus_width = bonus; Bar.bar_width = (int)Math.Round(cap * STAT_BAR_WIDTH / MAX_STAT); }
internal void refresh_value(int value) { Bar.SetFillWidth(Bar.bar_width, value, GaugeMin, GaugeMax); Label.text = string.Format(FormatString, value); }