private void FillFieldWithWords(List <MyVectorInt> coordList) { int step = 0; for (int wordNum = 0; wordNum < WordsList.Count; wordNum++) { WordPos.Add(new List <MyVectorInt>()); for (int letterNum = 0; letterNum < WordsList[wordNum].Length; letterNum++) { char letter = WordsList[wordNum][letterNum]; int x = coordList[step].X; int y = coordList[step].Y; WordPos[wordNum].Add(coordList[step]); CellLetter[x, y] = letter; CellColor[x, y] = Settings.FieldColor; step++; } } }
/// <summary> /// Generates the foldings for our document. /// </summary> /// <param name="document">The current document.</param> /// <param name="fileName">The filename of the document.</param> /// <param name="parseInformation">Extra parse information, not used in this sample.</param> /// <returns>A list of FoldMarkers.</returns> public List <FoldMarker> GenerateFoldMarkers(IDocument document, string fileName, object parseInformation) { List <FoldMarker> list = new List <FoldMarker>(); Stack <WordPos> startLines = new Stack <WordPos>(); Stack <int> startBlocks = new Stack <int>(); Stack <int> startTags = new Stack <int>(); Stack <WordPos> startCom = new Stack <WordPos>(); Stack <WordPos> startPHP = new Stack <WordPos>(); // Create foldmarkers for the whole document, enumerate through every line. for (int i = 0; i <= document.TotalNumberOfLines - 1; i++) { LineSegment seg = document.GetLineSegment(i); TextWord lastWord = null; TextWord nextWord = default(TextWord); for (int p = 0; p <= seg.Words.Count - 1; p++) { TextWord text = seg.Words[p]; if (p < seg.Words.Count - 1) { if (((TextWord)seg.Words[p + 1]).IsWhiteSpace) { if (p < seg.Words.Count - 2) { nextWord = seg.Words[p + 2]; } else { nextWord = text; } } else { nextWord = seg.Words[p + 1]; } } else { nextWord = text; } // REGION HANDLER if (lastWord != null) { if (lastWord.Word == "#") { if (string.Compare(text.Word, "end", true) == 0 & string.Compare(nextWord.Word, "region", true) == 0) { p = p + 1; if (startLines.Count > 0) { WordPos pos = startLines.Pop(); if (pos.Line < i) { list.Add(new FoldMarker(document, pos.Line, pos.Col - 1, i, text.Offset + text.Length + 7, FoldType.Region, "Region : " + pos.Caption)); } } } else if (string.Compare(text.Word, "endregion", true) == 0) { if (startLines.Count > 0) { WordPos pos = startLines.Pop(); if (pos.Line < i) { list.Add(new FoldMarker(document, pos.Line, pos.Col - 1, i, text.Offset + text.Length, FoldType.Region, "Region : " + pos.Caption)); } } } else if (string.Compare(text.Word, "region", true) == 0) { string caption = ""; for (int c = p + 1; c <= seg.Words.Count - 1; c++) { if (seg.Words[c].IsWhiteSpace) { caption += " "; } else { caption += seg.Words[c].Word; } } caption = caption.Replace("\"", "").Trim(); startLines.Push(new WordPos(i, ref text, caption)); break; // TODO: might not be correct. Was : Exit For } } } // PHPDoc handler if (text.Word == "/**") { startCom.Push(new WordPos(i, ref text)); } // COMMENTS HANDLER if (text.Word == "/*") { startCom.Push(new WordPos(i, ref text)); } if (text.Word == "*/") { if (startCom.Count > 0) { WordPos pos = startCom.Pop(); if (pos.Line < i) { list.Add(new FoldMarker( document, pos.Line, pos.Col, i, text.Offset + 2, FoldType.Region, String.Format("/* {0} */", MainForm.rm.GetString("FoldTextComment")) )); } } } if (!text.HasDefaultColor) { if ((text.Word == "<?php") || (text.Word == "<?")) { startPHP.Push(new WordPos(i, ref text)); //startTags.Push(i); } if (text.Word == "?>") { if (startPHP.Count > 0) { WordPos pos = startPHP.Pop(); //int start = startTags.Pop(); if (pos.Line < i) { list.Add(new FoldMarker(document, pos.Line, pos.Col, i, text.Offset + 2, FoldType.Region, "<? PHP Script ?>")); } } } } if (!text.HasDefaultColor) { if (text.Word == "{") { startBlocks.Push(i); } if (text.Word == "}") { if (startBlocks.Count > 0) { int start = startBlocks.Pop(); if (start < i - 1) { list.Add(new FoldMarker( document, start, document.GetLineSegment(start).Length - 1, i, text.Offset + text.Length )); } } } } lastWord = text; } } if (startLines.Count > 0) { WordPos start = startLines.Pop(); if (start.Line < document.TotalNumberOfLines - 1) { list.Add(new FoldMarker( document, start.Line, start.Col - 1, document.TotalNumberOfLines - 1, 0, FoldType.Region, String.Format("{0} : ", MainForm.rm.GetString("FoldTextUnfinishedRegion")) + start.Caption )); } } //If startBlocks.Count > 0 Then // Dim start As Integer = startBlocks.Pop() // if start < document.TotalNumberOfLines - 1 then // list.Add(New FoldMarker(document, start, document.GetLineSegment(start).Length, document.TotalNumberOfLines - 1, 0)) // end if //End If return(list); }
public void DrawGameTest() { foreach (GameObject go in tileslist) { Destroy(go); } tileslist.Clear(); int position = 0; print("---DrawGameTest---->>>>>" + CrToShow.Count); foreach (CrossedWord crw in CrToShow) { WordPos wordpos = new WordPos(); wordsposition.Add(wordpos); for (int i = 0; i < crw.Size; i++) { if (crw.WordDirection == CrossedWord.Direction.Horizontal) { Vector2 pos = new Vector2((crw.StartingPosition.X + i) * 100, crw.StartingPosition.Y * 100); bool bAlreadyOnBoard = false; //print("---CrossedWord---->>>>>" + i + "---->>" + tileslist.Count); for (int j = 0; j < tileslist.Count && !bAlreadyOnBoard; j++) { if (tileslist[j].GetComponent <OTSprite>().position.Equals(pos)) { bAlreadyOnBoard = true; } } //if (!bAlreadyOnBoard) { GameObject aTile = Instantiate(tile) as GameObject; aTile.GetComponent <OTSprite>().position = pos; aTile.transform.parent = transform; Answers += Char.ToUpper(crw.Word[i]); wordsposition[position].Word.Add(aTile); aTile.GetComponentInChildren <OTTextSprite>().text = "" + Char.ToUpper(crw.Word[i]); tileslist.Add(aTile); } } else { Vector2 pos = new Vector2(crw.StartingPosition.X * 100, (crw.StartingPosition.Y - i) * 100); bool bAlreadyOnBoard = false; for (int j = 0; j < tileslist.Count && !bAlreadyOnBoard; j++) { if (tileslist[j].GetComponent <OTSprite>().position.Equals(pos)) { bAlreadyOnBoard = true; } } //if (!bAlreadyOnBoard) { GameObject aTile = Instantiate(tile) as GameObject; aTile.GetComponent <OTSprite>().position = pos; aTile.transform.parent = transform; Answers += Char.ToUpper(crw.Word[i]); //print("----Verticle-->>>>" + Char.ToUpper(crw.Word[i])); wordsposition[position].Word.Add(aTile); aTile.GetComponentInChildren <OTTextSprite>().text = "" + Char.ToUpper(crw.Word[i]); tileslist.Add(aTile); } } } position++; Answers += "|"; print("----out of loop---->>>" + Answers); } float xMin = 0; float yMin = 0; float xMax = 0; float yMax = 0; for (int i = 0; i < tileslist.Count; i++) { if (tileslist[i].transform.position.x <= xMin) { xMin = tileslist[i].transform.position.x; } if (tileslist[i].transform.position.y <= yMin) { yMin = tileslist[i].transform.position.y; } if (tileslist[i].transform.position.x >= xMax) { xMax = tileslist[i].transform.position.x; } if (tileslist[i].transform.position.y >= yMax) { yMax = tileslist[i].transform.position.y; } } Row = (xMax) / 100; Collum = (Mathf.Abs(yMin)) / 100; int Writeposition = 0; foreach (CrossedWord crw in CrToShow) { for (float j = yMax; j >= yMin; j -= 100) { for (float k = xMin; k <= xMax; k += 100) { for (int i = 0; i < wordsposition[Writeposition].Word.Count; i++) { if (wordsposition[Writeposition].Word[i].transform.position.x == k && wordsposition[Writeposition].Word[i].transform.position.y == j) { Data += wordsposition[Writeposition].Word[i].transform.GetChild(0).GetComponent <OTTextSprite>().text + " "; //print("tileslist[i]------>>>>>" + wordsposition[Writeposition].Word[i].transform.GetChild(0).GetComponent<OTTextSprite>().text); goto Found; } } //print("+ "); Data += "+ "; Found: Data += ""; } Data += "\n"; } Data += "$"; Data += "\n"; Writeposition++; } print(Data); //String Data = ""; //for (float j = yMax; j >= yMin; j -= 100) //{ // for (float k = xMin; k <= xMax; k += 100) // { // for (int i = 0; i < tileslist.Count; i++) // { // if (tileslist[i].transform.position.x == k && tileslist[i].transform.position.y == j) // { // Data += tileslist[i].transform.GetChild(0).GetComponent<OTTextSprite>().text + " "; // //print("tileslist[i]------>>>>>" + tileslist[i].transform.GetChild(0).GetComponent<OTTextSprite>().text); // goto Found; // } // } // //print("+ "); // Data += "+ "; // Found: // Data += ""; // } // Data += "\n"; //} //print(Data); //string[] linees = Data.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries); //for (int i = 0; i < linees.Length; i++) //{ // string[] Character = linees[i].Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); // for (int j = 0; j < Character.Length; j++) // { // print("------->>>>" + Character[j]); // // if (Character[j] != "+") // // { // // line.GenerateNumbers.Add(GameObject.Find("Cell" + i + "_" + j).GetComponent<RectTransform>()); // // } // } //} SaveMap(); }