public void OnResetButtonClicked() { QuestionPanel.Show("Do you want to save the game?", () => { // ez a QuestionPanel YesAction-je /* * string fileName = DateTime.Now.ToString("yyyy-dd-M--HH-mm-ss") + ".txt"; * string path = Application.dataPath; * * Debug.Log(path); * * DirectoryInfo di = new DirectoryInfo(Path.Combine(path, "Games")); * if (!di.Exists) * di.Create(); * * * Debug.Log(Path.Combine(di.FullName, fileName)); * Debug.Log("Mentve"); * var sr = File.CreateText(Path.Combine(di.FullName, fileName)); * //sr.WriteLine(JsonUtility.ToJson(tables)); * JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All }; * // sr.WriteLine(JsonConvert.SerializeObject(new MainMenuManager.SerializableObjects(), settings)); * * sr.WriteLine(JsonConvert.SerializeObject(CommandProcessor.Instance.getStackToSave(), settings)); * sr.Close();*/ GameSaveDataHolder gsdh = GameObject.FindGameObjectWithTag("GameSaveDataHolder").GetComponent <GameSaveDataHolder>(); gsdh.SaveToJSON(); CommandProcessor.Instance.CmdResetServerCommand(); LogManager.Instance.RpcShowLogPopup("Game saved"); }, () => { // ez a questionPanel NoAction-je CommandProcessor.Instance.CmdResetServerCommand(); }); }
public void OnIngameExitPressed() { if (isHosting) { QuestionPanel.Show("Are you sure you want to exit to the lobby?", () => { QuestionPanel.Show("Do you want to save the game?", () => { // ez a QuestionPanel YesAction-je /* * string fileName = DateTime.Now.ToString("yyyy-MM-dd--HH-mm-ss")+".txt"; * string path = Application.dataPath; * * Debug.Log(path); * * DirectoryInfo di = new DirectoryInfo(Path.Combine(path, "Games")); * if (!di.Exists) * di.Create(); * * * Debug.Log(Path.Combine(di.FullName, fileName)); * Debug.Log("Mentve"); * var sr = File.CreateText(Path.Combine(di.FullName, fileName)); * //sr.WriteLine(JsonUtility.ToJson(tables)); * JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All }; * // SerializableObjects so = new SerializableObjects(); * //so.loadForSave(); * // sr.WriteLine(JsonConvert.SerializeObject(CommandProcessor.Instance.getStackToSave(), settings)); * * sr.WriteLine(JsonConvert.SerializeObject(gsdh, settings)); * sr.Close(); */ GameSaveDataHolder gsdh = GameObject.FindGameObjectWithTag("GameSaveDataHolder").GetComponent <GameSaveDataHolder>(); gsdh.SaveToJSON(); lobbyNetworkManager.ChangeToLobbyScene(); HideMainMenu(); lobbyPanel.Show(() => { ShowMainMenu(); lobbyNetworkManager.StopHost(); }); }, () => { // ez a questionPanel NoAction-je lobbyNetworkManager.ChangeToLobbyScene(); HideMainMenu(); lobbyPanel.Show(() => { ShowMainMenu(); lobbyNetworkManager.StopHost(); }); }); }, null); } else { QuestionPanel.Show("Are you sure you want to leave the match?", () => { lobbyNetworkManager.StopClient(); lobbyPanel.Hide(); ShowMainMenu(); }, null); } }