public SaveGameForm(ArrayList historyM, ColorCheck whoF, ObjectCheck[,] masS) { InitializeComponent(); historyMas = historyM; whoFirst = whoF; masSave = masS; saveFileDialog1.InitialDirectory = textPath.Text = Application.StartupPath; }
private void Start() { controller = gameObject.GetComponent <CharacterController>(); dm = gameObject.GetComponent <DeathManager>(); cc = gameObject.GetComponent <ColorCheck>(); velocity = new Vector3(0, startSpeed, 0); isGrounded = true; wasGrounded = true; velocity = new Vector3(0, initialSpeedY, 0); }
// Start is called before the first frame update void Start() { movingCrosshairLeft = GameObject.Find("/Canvas/crosshair/crosshairMovingLeft"); movingCrosshairRight = GameObject.Find("/Canvas/crosshair/crosshairMovingRight"); blackPieLeft = GameObject.Find("/Canvas/blackPie/blackPieLeft"); blackPieRight = GameObject.Find("/Canvas/blackPie/blackPieRight"); halo = GameObject.Find("/Canvas/halo"); dm = GameObject.Find("FPS").GetComponent <DeathManager>(); cc = GameObject.Find("FPS").GetComponent <ColorCheck>(); }
void Start() { goToNextLevel = false; mainCamera = transform.Find("Main Camera").gameObject; controller = transform.gameObject.GetComponent <CharacterController>(); cameraHeightRange = new Vector2(-controller.height / 2f, 4f * controller.height / 10.25f); mySceneManager = GameObject.Find("/SceneManager").GetComponent <MySceneManager>(); cc = gameObject.GetComponent <ColorCheck>(); jumpEnabled = true; isDead = false; isShadowed = false; health = 1f; }
public CheckClass(int x, int y, ColorCheck cCheck, MainForm mainForm) { mf = mainForm; X = x; Y = y; typeCheck = TypeCheck.check; colorCheck = cCheck; mustGo = false; pictureBox = new PictureBox(); pictureBox.Size = new Size(mf.nSize, mf.nSize); if (!mf.changeSide) { pictureBox.Location = new Point(mf.nSize * y + mf.leftX, mf.nSize * x + mf.leftY); } else { pictureBox.Location = new Point(mf.nSize * (7 - y) + mf.leftX, mf.nSize * (7 - x) + mf.leftY); } if (colorCheck == ColorCheck.black) { pictureBox.Image = global::Checkers.Properties.Resources.check_black; dest = new int[0, 2]; } else if (colorCheck == ColorCheck.white) { pictureBox.Image = global::Checkers.Properties.Resources.check_white; dest = new int[0, 2]; } else if ((x + y) % 2 == 0) { pictureBox.Image = global::Checkers.Properties.Resources.empty; } else { pictureBox.Image = global::Checkers.Properties.Resources.full; } pictureBox.MouseDown += new System.Windows.Forms.MouseEventHandler(pictureBox_MouseDown); mainForm.Controls.Add(pictureBox); }
//Загрузить private void button2_Click(object sender, EventArgs e) { FileStream fs = new FileStream(textPath.Text, FileMode.Open, FileAccess.Read); byte[] xmlParameter = new byte[fs.Length]; fs.Read(xmlParameter, 0, xmlParameter.Length); fs.Close(); byte[] rez; try { // Обработка и сохранение полученного массива xmlInfo rez = UnpackXML(xmlParameter); } catch { MessageBox.Show("Файл повреждён."); return; } ArrayList masArray = new ArrayList(); MemoryStream ms = new MemoryStream(rez); XmlTextReader reader = new XmlTextReader(ms); ColorCheck whoF = ColorCheck.disable; ObjectCheck[,] saveMas = new ObjectCheck[8, 8]; try { while (!reader.EOF) { reader.Read(); if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "whofirst") { reader.Read(); if (reader.Value == "black") { whoF = ColorCheck.black; } else { whoF = ColorCheck.white; } reader.Read(); } if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "board") { int w = 0, q = 0; reader.Read(); string str; while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name.ToLower() == "board")) { if (reader.NodeType == XmlNodeType.Element) { reader.Read(); str = reader.Value; if (str == "check_black") { saveMas[w, q] = ObjectCheck.check_black; } else if (str == "check_black_dam") { saveMas[w, q] = ObjectCheck.check_black_dam; } else if (str == "check_white") { saveMas[w, q] = ObjectCheck.check_white; } else if (str == "check_white_dam") { saveMas[w, q] = ObjectCheck.check_white_dam; } else if (str == "empty") { saveMas[w, q] = ObjectCheck.empty; } else { saveMas[w, q] = ObjectCheck.full; } q++; if (q > 7) { w++; q = 0; } } reader.Read(); } } if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "parameter") { reader.Read(); string[] str = new string[6]; while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name.ToLower() == "parameter")) { if (reader.NodeType == XmlNodeType.Element) { string type = reader.Name; reader.Read(); switch (type.ToLower()) { case "par0": str[0] = reader.Value; reader.Read(); break; case "par1": str[1] = reader.Value; reader.Read(); break; case "par2": if (reader.Value != " ") { str[2] = reader.Value; } else { str[2] = ""; } reader.Read(); break; case "par3": str[3] = reader.Value; reader.Read(); break; case "par4": str[4] = reader.Value; reader.Read(); break; case "par5": if (reader.Value != " ") { str[5] = reader.Value; } else { str[5] = ""; } reader.Read(); break; } } reader.Read(); } masArray.Add(str); } } } catch { } finally { if (reader != null) { reader.Close(); } } mf.whoFirst = whoF; mf.masSave = saveMas; mf.historyMas = masArray; this.Close(); }