Text NextLetter(letter current) { Text next = letter1; if (current == letter.L1) { currentLetter = letter.L2; next = letter2; } else if (current == letter.L2) { currentLetter = letter.L3; next = letter3; } else if (current == letter.L3) { currentLetter = letter.L4; next = letter4; } else if (current == letter.L4) { currentLetter = letter.L5; next = letter5; } else if (current == letter.L5) { //end //replay currentLetter = letter.End; next = null; stringToEdit = (letter1.text + letter2.text + letter3.text + letter4.text + letter5.text); } return(next); }
private const string charsToBeCounted = "abcdefghikjlmnopqrstuvwxyz"; // ABCDEFGHIKJLMNOPQRSTUVWXYZ capital letters not needed converting the string to lowercase public static Dictionary <char, letter> letterCounter(string word) { var ret = new Dictionary <char, letter>(); word = word.ToLower(); foreach (char ch in word) { if (charsToBeCounted.Contains(ch)) { letter l = null; if (ret.ContainsKey(ch)) { l = ret[ch]; } else { l = new letter(); ret.Add(ch, l); } l.count++; l.stringValue = "Any value you want"; } } return(ret); }
//this just runs the charToLetter command on every char in a string and returns a letter array public static letter[] stringToLetter(string s) { char[] c = s.ToCharArray(); letter[] l = new letter[c.Length]; for (int i = 0; i < c.Length; i++) { l[i] = charToLetter(c[i]); } return(l); }
List <letter> Get_alphabet() { List <letter> alphabet = new List <letter>(); for (int i = 65; i <= 90; i++) { letter letter = new letter(); letter.id = i; letter.value = ((char)i).ToString(); alphabet.Add(letter); } return(alphabet); }
/*public Model(default_primitives shape) * { * switch (shape) * { * case default_primitives.Cube: * initialize_lists(); * add_cube_vertices(); * add_texture_coordinates(); * add_indices_and_normals(); * * * break; * } } */ public Model(letter K) { switch (K) { case letter.K: initialize_lists(); Add_letter_K_vertices(); add_texture_coordinates(); add_indices_and_normals(); break; } }
// Update is called once per frame void Update() { timer += Time.deltaTime; if (counter > 0 && timer >= timeOut) { timer = 0.0f; counter--; if (nextLetter == letter.LEFT) { tmp = Instantiate(LetterLeft, initialPositionLetterLeft, Quaternion.identity) as GameObject; nextLetter = letter.RIGHT; } else { tmp = Instantiate(LetterRight, initialPositionLetterRight, Quaternion.identity) as GameObject; nextLetter = letter.LEFT; } tmp.transform.parent = dialog; } }
public void Load() { letters = new List <letter>(); int pos = 0; metaDataSize = BitConverter.ToInt32(filebytes, pos); pos += 4; imageDataStart = BitConverter.ToInt32(filebytes, pos); pos += 4; imageDataSize = BitConverter.ToInt32(filebytes, pos); pos += 4; numLetters = BitConverter.ToInt16(filebytes, pos); pos = 0x10; characterHeightInPixels = BitConverter.ToInt16(filebytes, pos); pos = 0x14; for (int i = 0; i < numLetters; i++) { letter newLetter = new letter() { name = (char)BitConverter.ToInt16(filebytes, pos) }; pos += 2; pos += 2; letters.Add(newLetter); } pos += 0x10; foreach (letter l in letters) { l.height = filebytes[pos]; pos += 2; l.width = filebytes[pos]; pos += 2; pos += 0x06; l.imageOffset = BitConverter.ToInt32(filebytes, pos); pos += 4; pos++; l.type = filebytes[pos]; pos++; } foreach (letter l in letters) { int numVersions = 1; if (l.type != 0) { for (int bitShiftedTemp = l.type; bitShiftedTemp > 0; bitShiftedTemp >>= 1) { numVersions += bitShiftedTemp & 0x01; } numVersions = 2; } else { l.height = characterHeightInPixels; if (letters.IndexOf(l) == (letters.Count - 1)) { l.width = (((imageDataStart + imageDataSize) - l.imageOffset) / numVersions) / characterHeightInPixels; } else { l.width = ((letters[letters.IndexOf(l) + 1].imageOffset - l.imageOffset) / numVersions) / characterHeightInPixels; } } for (int i = 0; i < numVersions; i++) { pos = l.imageOffset; l.images.Add(new Bitmap(l.width, l.height)); for (int y = 0; y < l.height; y++) { for (int x = 0; x < l.width; x++) { l.images[i].SetPixel(x, y, Color.FromArgb(filebytes[pos], 0, 0, 0)); pos++; } } } } }
void Start() { score = GameObject.FindGameObjectWithTag("Score").GetComponent <GetHit>().GetScore(); yourScore.text = ("Your Score was: " + score); currentLetter = letter.L1; currentSpot = letter1; //content = new GUIContent(); //style.alignment = TextAnchor.MiddleCenter; fileName = "highscore.txt"; var sr = new StreamReader("Assets/Resources/" + fileName); var fileContents = sr.ReadToEnd(); sr.Close(); //Dictionary<string, float> badguys = new Dictionary<string, float>(); lines = fileContents.Split("\n"[0]); // lines[-1].Remove(); float highest = 0; float[] scores = new float[lines.Length]; var holder = new string[lines.Length]; //List<float> scores = new List<float>(); int index = 0; foreach (string line in lines) { display.text += line + "\n"; } /* * * //print(line); * scores[index] = (float.Parse(line.Split(": "[0])[1])); * * if (scores[index] > highest) * { * highest = scores[index]; * * } * * if (index == 0) * { * holder[0] = lines[0]; * } * * for (int i = 0; i != index; i++) * { * print("i: " + i + " | " + index); * //print(float.Parse(holder[i].Split(": "[1])[1])); * //if (scores[index] > float.Parse(holder[0].Split(": "[1])[1])) * { * if (holder[i] != null) * { * if (scores[index] > float.Parse(holder[i].Split(": "[0])[1])) * { * int temp = i; * * for (int q = index - i; q > 0; q--) * { * // print("q: "+q); * print("q: " + q + "vs i: " + i); * if (i < q) * { * holder[q] = holder[q - i]; * i++; * } * * } * //holder[index] = holder[i]; * holder[i] = lines[index]; * break; * } * else * { * holder[index] = lines[index]; * * } * * } * //else if (lines[index] != holder[0]) * * print("new: " + holder[i]); * } * //else * { * * * } * } * * print(holder[0]); * * //print(line); * index++; * } * * } * foreach (string line in holder) * { * display.text += line + "\n"; * } * print(holder[3]); * */ }
private void Button_Click(object sender, RoutedEventArgs e) { letter letter = new letter(Email.Text, Title.Text, Content.Text); history.Items.Add(letter.toString()); }
select(min, max, letter, password)).End();