private void XYEndTB_TextChanged(object sender, TextChangedEventArgs e) { SCM.TBTreating(XEndTB, XSizeTB); SCM.TBTreating(YEndTB, YSizeTB); if (XEndTB.Text != "" && YEndTB.Text != "") { game.End = new cell(SCM.X(XEndTB), SCM.Y(YEndTB)); } }
//logic events begin private void Player1TB_TextChanged(object sender, TextChangedEventArgs e) { SCM.TBTreating(XPlayer1TB, game.MapSizeX); SCM.TBTreating(YPlayer1TB, game.MapSizeY); SCM.TBTreating(LifePlayer1TB, MaxPlayer1Life); if (XPlayer1TB.Text != "" && YPlayer1TB.Text != "" && LifePlayer1TB.Text != "") { game.InitPlayer1(SCM.X(XPlayer1TB), SCM.Y(YPlayer1TB), SCM.Int32(LifePlayer1TB)); } }
private void MapTB_TextChanged(object sender, TextChangedEventArgs e) { SCM.TBTreating(XMapTB, XSizeTB); SCM.TBTreating(YMapTB, YSizeTB); if (XMapTB.Text != "" && YMapTB.Text != "") { CostMapTB.Text = game.GetMapCell(SCM.X(XMapTB), SCM.Y(YMapTB)).Price.ToString(); } if (XMapTB.Text == "" && YMapTB.Text == "") { CostMapTB.Clear(); } }
private void CostMapTB_TextChanged(object sender, TextChangedEventArgs e) { if (XMapTB.Text != "" && YMapTB.Text != "") { SCM.TBTreating(CostMapTB, MaxCost); if (CostMapTB.Text != "") { game.InitMapCell(SCM.X(XMapTB), SCM.Y(YMapTB), SCM.Int32(CostMapTB)); graphicTBs[SCM.X(XMapTB), SCM.Y(YMapTB)].Text = CostMapTB.Text; } } else { CostMapTB.Clear(); } }
//Load map private void Load(string name) { FileStream a = new FileStream(path + name + ".txt", FileMode.Open); StreamReader str = new StreamReader(a); string[] ints = str.ReadLine().Split(' '); ints = str.ReadLine().Split(' '); XSizeTB.Text = ints[0]; YSizeTB.Text = ints[1]; for (int i = SCM.Y(YSizeTB); i >= 0; i--) { ints = str.ReadLine().Split(' '); for (int j = 0; j < SCM.Int32(XSizeTB); j++) { game.InitMapCell(i, j, Convert.ToInt32(ints[j])); } } XMapTB.Text = "1"; YMapTB.Text = "1"; ints = str.ReadLine().Split(); XEndTB.Text = ints[0]; YEndTB.Text = ints[1]; }
private void LifePlayer2TB_TextChanged(object sender, TextChangedEventArgs e) { if (XPlayer2TB.Text != "" && YPlayer2TB.Text != "") { SCM.TBTreating(LifePlayer2TB, MaxPlayer2Life); if (LifePlayer2TB.Text != "") { game.InitPlayer2(Convert.ToInt32(Player2CurrentChipLB.SelectedValue), SCM.X(XPlayer2TB), SCM.Y(YPlayer2TB), SCM.Int32(LifePlayer2TB)); } } else { LifePlayer2TB.Clear(); } }