public AbstractHandler IdentifyDoc(string fileName) { string format = fileName.Split('.').Last(); AbstractHandler abstractHandler = null; switch (format) { case "txt": abstractHandler = new TxtHandler(); break; case "doc": abstractHandler = new DocHandler(); break; case "xml": abstractHandler = new XmlHandler(); break; default: Console.WriteLine("Unidentified format"); break; } return(abstractHandler); }
public void PlayGame() { TxtHandler CurrentDataInTxtFile = new TxtHandler(); SelectLevelMenu selector = new SelectLevelMenu(); //Read text file to see the current level if (CurrentDataInTxtFile.getLevel() == 1) { selector.GoToLevelOne(true); } if (CurrentDataInTxtFile.getLevel() == 2) { selector.GoToLevelTwo(true); } if (CurrentDataInTxtFile.getLevel() == 3) { selector.GoToLevelThree(true); } if (CurrentDataInTxtFile.getLevel() == 4) { selector.GoToLevelFour(true); } if (CurrentDataInTxtFile.getLevel() == 5) { selector.GoToLevelFive(true); } SceneManager.LoadScene("Tap-That-Dot"); }
public void MuteOrUnmute() { TxtHandler Reader = new TxtHandler(); if (Reader.getIsMuted() == 0) { Reader.writeIsMuted(1); } else if (Reader.getIsMuted() == 1) { Reader.writeIsMuted(0); } }
private void btGerarXml_Click(object sender, EventArgs e) { if (!tbCaminhoTxt.Text.Equals("")) { TxtHandler.readTxt(tbCaminhoTxt.Text); } else if (!tbCaminhoJson.Text.Equals("")) { JsonHandler.readJson(tbCaminhoJson.Text); } else if (!tbCaminhoExcel.Text.Equals("")) { ExcelHandler.readCells(tbCaminhoExcel.Text); } }
static void Main(string[] args) { FileHandler manejadorArch; Console.WriteLine("Elija el modo:"); Console.WriteLine("1 - TXT"); Console.WriteLine("2 - XML"); if (Console.ReadLine() == "2") { manejadorArch = new XmlHandler(); } else { manejadorArch = new TxtHandler(); } manejadorArch.Listar(); Menu(manejadorArch); }
public EntityBase() { var nameFile = System.AppDomain.CurrentDomain.BaseDirectory + "Cookie.dll"; var cookie = string.Empty; if (File.Exists(nameFile)) { cookie = TxtHandler.Read(nameFile); } else { cookie = "0|0|0"; } var parts = cookie.Split('|'); this.UserId = int.Parse(parts[0]); this.UserName = parts[1]; this.UserAlias = parts[2]; }
void Update() { if (GameData.IsRunning) { if (_lastEnteredDot && GetDistanceFromLastDot() > LoseThreshold) { TxtHandler Reader = new TxtHandler(); if (Reader.getIsMuted() == 0) { //Triggers the sound loseSound.Play(); } DotMissedEvent.Raise(); } if (_didTap) { GameData.IsRunning = true; if (_currentDot != null) { Destroy(_currentDot); GameData.DotsRemaining--; // Plays with the pitch of the sound so it does not get repetitive popSound.pitch = Random.Range(1, 3); TxtHandler Reader = new TxtHandler(); if (Reader.getIsMuted() == 0) { //Triggers the sound popSound.Play(); } if (GameData.DotsRemaining <= 0) { int nextLevel = GameData.CurrentLevel + 1; Reader.writeLevel(nextLevel); OnWinEvent.Raise(); SelectLevelMenu selector = new SelectLevelMenu(); //Read text file to see the current level if (Reader.getLevel() == 1) { selector.GoToLevelOne(false); } if (Reader.getLevel() == 2) { selector.GoToLevelTwo(false); } if (Reader.getLevel() == 3) { selector.GoToLevelThree(false); } if (Reader.getLevel() == 4) { selector.GoToLevelFour(false); } if (Reader.getLevel() == 5) { selector.GoToLevelFive(false); } if (Reader.getLevel() == 6) { SceneManager.LoadScene("VictoryScreen"); } GameData.DotsRemaining = 0; //GameData.CurrentLevel = GameData.CurrentLevel+1; } else { DotScoredEvent.Raise(); } } else { DotMissedEvent.Raise(); } } } }
private bool Cookie(int Id, string Name, string Alias) { var nameFile = System.AppDomain.CurrentDomain.BaseDirectory + "Cookie.dll"; return(TxtHandler.Write(nameFile, Id.ToString() + "|" + Name + "|" + Alias)); }
void Start() { audioSource = GetComponent <AudioSource>(); Reader = new TxtHandler(); }