private void RollBtn_Click(object sender, RoutedEventArgs e) { uint m = uint.Parse(ModifierTxt.Text); int s = int.Parse(SidesTxt.Text); int a = int.Parse(AddTxt.Text); Declarations.RollToText(rnd, ResultTxt, ResultsLbl, m, s, a); /* * int result = 0; * * for (int i = 0; i < m; i++) * { * int add = rnd.Next(s) + 1; * result += add; * * var lgb = new LinearGradientBrush() * { * StartPoint = new Point(0, 1), * EndPoint = new Point(0, 0) * }; * * GradientStop gs1, gs2; * * if (add == 1) * { * gs1 = new GradientStop() { Color = Colors.Red, Offset = 0 }; * gs2 = new GradientStop() { Color = Colors.DarkRed, Offset = 1 }; * } * else if (add == s) * { * gs1 = new GradientStop() { Color = Colors.Lime, Offset = 0 }; * gs2 = new GradientStop() { Color = Colors.Green, Offset = 1 }; * } * else * { * gs1 = new GradientStop() { Color = Colors.LightGray, Offset = 0 }; * gs2 = new GradientStop() { Color = Colors.DarkGray, Offset = 1 }; * } * * lgb.GradientStops = new GradientStopCollection { gs1, gs2 }; * * ResultsLbl.Background = lgb; * } * * result += a; * * ResultTxt.Text = result.ToString(); */ }
public void Roll(TextBlock txt, Border border) { Declarations.RollToText(rnd, txt, border, modifier, sides, add); }
private void AbilityCheck(int value) { //ResultTxt.Text = (rnd.Next(20) + value + 1).ToString(); ResultTxt.Text = Declarations.Roll(rnd, 1, 20, value).ToString(); }