Description:
Factor out line code.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -68,6 +68,17 | |||||
|
68 | return true; |
|
68 | return true; |
|
69 | } |
|
69 | } |
|
70 |
|
70 | ||
|
|
71 | public String line_format(String name, decimal first, decimal second) { | ||
|
|
72 | int between_name_col = 6; | ||
|
|
73 | int between_cols = 4; | ||
|
|
74 | var first_formatted = String.Format("${0:}", first).PadLeft(6, '.'); | ||
|
|
75 | var second_formatted = String.Format("${0:}", second).PadLeft(6, '.'); | ||
|
|
76 | |||
|
|
77 | var formatted = String.Format("{0,5:}{1:}{2,6:}{3:}{4,6:}", name, new String('.', between_name_col), first_formatted, new String('.', between_cols), second_formatted); | ||
|
|
78 | |||
|
|
79 | return formatted; | ||
|
|
80 | } | ||
|
|
81 | |||
|
71 | public void draw(SpriteBatch batch) |
|
82 | public void draw(SpriteBatch batch) |
|
72 | { |
|
83 | { |
|
73 |
|
84 | ||
@@ -102,8 +113,8 | |||||
|
102 | batch.DrawString(font, String.Format("Starting Funds.........${0:}", this.budget.money), new Vector2(x, bar_height * 2 + y), Color.Black); |
|
113 | batch.DrawString(font, String.Format("Starting Funds.........${0:}", this.budget.money), new Vector2(x, bar_height * 2 + y), Color.Black); |
|
103 |
|
114 | ||
|
104 | batch.DrawString(font, String.Format("REVENUE", this.budget.upkeep), new Vector2(x, bar_height * 4 + y), Color.Black); |
|
115 | batch.DrawString(font, String.Format("REVENUE", this.budget.upkeep), new Vector2(x, bar_height * 4 + y), Color.Black); |
|
105 |
batch.DrawString(font, |
|
116 | batch.DrawString(font, line_format("Subsidy", this.budget.subsidy, this.previous_budget.subsidy), new Vector2(x, bar_height * 5 + y), Color.Black); |
|
106 |
batch.DrawString(font, |
|
117 | batch.DrawString(font, line_format("Contracts", this.budget.contracts, this.previous_budget.contracts), new Vector2(x, bar_height * 6 + y), Color.Black); |
|
107 | batch.DrawString(font, String.Format("Misc...................${0:}....${1:}", this.budget.misc, this.previous_budget.misc), new Vector2(x, bar_height * 7 + y), Color.Black); |
|
118 | batch.DrawString(font, String.Format("Misc...................${0:}....${1:}", this.budget.misc, this.previous_budget.misc), new Vector2(x, bar_height * 7 + y), Color.Black); |
|
108 |
|
119 | ||
|
109 | batch.DrawString(font, String.Format("EXPENSES", this.budget.upkeep), new Vector2(x, bar_height * 10 + y), Color.Black); |
|
120 | batch.DrawString(font, String.Format("EXPENSES", this.budget.upkeep), new Vector2(x, bar_height * 10 + y), Color.Black); |
You need to be logged in to leave comments.
Login now