void OnUserReplyReceived(object sender, UserReplyEventArgs e) { //if (replies[e.SenderId - 2] != -2) //{ // Debug.Log("This is a big bug lol"); //} //else replies[e.SenderId] = e.Choice; if (Scene1Script.BubblesOn) { if (e.SenderId == player1) { AlexThought.SetActive(false); } else { JesseThought.SetActive(false); } } if (replies[player1] != -2 && replies[player2] != -2) { ContinueStory(replies[player1], replies[player2]); replies[player1] = -2; replies[player2] = -2; } }
void OnUserReplyReceived(object sender, UserReplyEventArgs e) { ContinueStory(e); }
public void ContinueStory(UserReplyEventArgs reply) { if (reply.SenderId == player1) { if (reply.Choice > -1) { mainStory1.ChooseChoiceIndex(reply.Choice); char1story.ChooseChoiceIndex(reply.Choice); } else { var mStory1 = mainStory1.state.ToJson(); System.IO.File.WriteAllText(@"D:\tese\RecoveryFiles\G" + Scene1Script.TestGroup + "PT2Main1.txt", mStory1); var c1Story = char1story.state.ToJson(); System.IO.File.WriteAllText(@"D:\tese\RecoveryFiles\G" + Scene1Script.TestGroup + "PT2c1.txt", c1Story); System.IO.File.WriteAllLines(@"D:\tese\RecoveryFiles\G" + Scene1Script.TestGroup + "PT2screenText1.txt", tBox1); } if (!char1story.canContinue && char1story.currentChoices.Count == 0 && finishTime1 == DateTime.MinValue) { finishTime1 = DateTime.Now; } if (char1story.canContinue && mainStory1.canContinue) { var line = mainStory1.Continue(); var textBox = FindObjectsOfType <Text>().FirstOrDefault(x => x.CompareTag("Text1")); if (textBox != null && !line.Equals("...\n")) { var tempColor = textBackgroundLeft.color; tempColor.a = 1f; textBackgroundLeft.color = tempColor; if (tBox1.Count == 7) { tBox1.RemoveAt(0); } if (tBox1.Count > 0) { tBox1[tBox1.Count - 1] = tBox1[tBox1.Count - 1].Replace("<color=yellow>", "").Replace("</color>", "").Replace("\n", ""); } tBox1.Add("<color=yellow>" + line.Replace("\n", "") + "</color>"); textBox.text = ""; foreach (var l in tBox1) { textBox.text += l + "\n"; } //textBox.text = textBox.text.Replace("<color=yellow>", "").Replace("</color>", ""); //textBox.text += "<color=yellow>" + line + "</color>"; } if (line.Equals("...\n")) { var tempColor = textBackgroundLeft.color; tempColor.a = 0.3f; textBackgroundLeft.color = tempColor; } var phoneStoryLine = char1story.Continue(); string choice0 = "", choice1 = "", choice2 = ""; var player = PhotonNetwork.CurrentRoom.Players .FirstOrDefault(x => x.Value.ActorNumber == player1); if (char1story.currentChoices.Count > 0) { choice0 = char1story.currentChoices[0].text; } if (char1story.currentChoices.Count > 1) { choice1 = char1story.currentChoices[1].text; } if (char1story.currentChoices.Count > 2) { choice2 = char1story.currentChoices[2].text; } var properties = new ExitGames.Client.Photon.Hashtable() { { "StoryText", phoneStoryLine }, { "Choice0", choice0 }, { "Choice1", choice1 }, { "Choice2", choice2 }, { "Continue", false }, { "Pick", -1 }, { "ActorId", 1 } }; if (!phoneStoryLine.Equals("...\n")) { properties.Add("Vibrate", true); } player.Value.SetCustomProperties(properties); } else { var player = PhotonNetwork.CurrentRoom.Players .FirstOrDefault(x => x.Value.ActorNumber == player1); var properties = new ExitGames.Client.Photon.Hashtable() { { "StoryText", "" }, { "Choice0", "" }, { "Choice1", "" }, { "Choice2", "" }, { "Continue", false }, { "Pick", -2 }, { "ActorId", 2 } }; player.Value.SetCustomProperties(properties); var otherPlayer = PhotonNetwork.CurrentRoom.Players .FirstOrDefault(x => x.Value.ActorNumber == player2); if ((int)otherPlayer.Value.CustomProperties["Pick"] == -2 && SceneManager.GetActiveScene().name.Equals("SplitScreen")) { var text = "Time waited: " + (finishTime1 > finishTime2 ? finishTime1.Subtract(finishTime2).TotalSeconds + " seconds." : finishTime2.Subtract(finishTime1).TotalSeconds + " seconds.") + "\nFinish time of first player: " + finishTime1 + "\nFinish time of second player: " + finishTime2; System.IO.File.WriteAllText(@"D:\tese\TestResults\times\timesG" + Scene1Script.TestGroup + "PT2.txt", text); SceneManager.LoadScene("Transition2"); } } } else { if (reply.Choice > -1) { mainStory2.ChooseChoiceIndex(reply.Choice); char2story.ChooseChoiceIndex(reply.Choice); } else { var mStory2 = mainStory2.state.ToJson(); System.IO.File.WriteAllText(@"D:\tese\RecoveryFiles\G" + Scene1Script.TestGroup + "PT2Main2.txt", mStory2); var c2Story = char2story.state.ToJson(); System.IO.File.WriteAllText(@"D:\tese\RecoveryFiles\G" + Scene1Script.TestGroup + "PT2c2.txt", c2Story); System.IO.File.WriteAllLines(@"D:\tese\RecoveryFiles\G" + Scene1Script.TestGroup + "PT2screenText2.txt", tBox2); } if (!char2story.canContinue && char2story.currentChoices.Count == 0 && finishTime2 == DateTime.MinValue) { finishTime2 = DateTime.Now; } if (char2story.canContinue && mainStory2.canContinue) { var line = mainStory2.Continue(); var textBox = FindObjectsOfType <Text>().FirstOrDefault(x => x.CompareTag("Text2")); if (textBox != null && !line.Equals("...\n")) { var tempColor = textBackgroundRight.color; tempColor.a = 1f; textBackgroundRight.color = tempColor; if (tBox2.Count == 5) { tBox2.RemoveAt(0); } if (tBox2.Count > 0) { tBox2[tBox2.Count - 1] = tBox2[tBox2.Count - 1].Replace("<color=yellow>", "").Replace("</color>", "").Replace("\n", ""); } tBox2.Add("<color=yellow>" + line.Replace("\n", "") + "</color>"); textBox.text = ""; foreach (var l in tBox2) { textBox.text += l + "\n"; } } if (line.Equals("...\n")) { var tempColor = textBackgroundRight.color; tempColor.a = 0.3f; textBackgroundRight.color = tempColor; } var phoneStoryLine = char2story.Continue(); string choice0 = "", choice1 = "", choice2 = ""; var player = PhotonNetwork.CurrentRoom.Players .FirstOrDefault(x => x.Value.ActorNumber == player2); if (char2story.currentChoices.Count > 0) { choice0 = char2story.currentChoices[0].text; } if (char2story.currentChoices.Count > 1) { choice1 = char2story.currentChoices[1].text; } if (char2story.currentChoices.Count > 2) { choice2 = char2story.currentChoices[2].text; } var properties = new ExitGames.Client.Photon.Hashtable() { { "StoryText", phoneStoryLine }, { "Choice0", choice0 }, { "Choice1", choice1 }, { "Choice2", choice2 }, { "Continue", false }, { "Pick", -1 }, { "ActorId", 1 } }; if (!phoneStoryLine.Equals("...\n")) { properties.Add("Vibrate", true); } player.Value.SetCustomProperties(properties); } else { var player = PhotonNetwork.CurrentRoom.Players .FirstOrDefault(x => x.Value.ActorNumber == player2); var properties = new ExitGames.Client.Photon.Hashtable() { { "StoryText", "" }, { "Choice0", "" }, { "Choice1", "" }, { "Choice2", "" }, { "Continue", false }, { "Pick", -2 }, { "ActorId", 2 } }; player.Value.SetCustomProperties(properties); var otherPlayer = PhotonNetwork.CurrentRoom.Players .FirstOrDefault(x => x.Value.ActorNumber == player1); if ((int)otherPlayer.Value.CustomProperties["Pick"] == -2) { var text = "Time waited: " + (finishTime1 > finishTime2 ? finishTime1.Subtract(finishTime2).TotalSeconds + " seconds." : finishTime2.Subtract(finishTime1).TotalSeconds + " seconds.") + "\nFinish time of first player: " + finishTime1 + "\nFinish time of second player: " + finishTime2; System.IO.File.WriteAllText(@"D:\tese\TestResults\times\timesG" + Scene1Script.TestGroup + "PT2.txt", text); SceneManager.LoadScene("Transition2"); } } } }
void OnUserReplyReceived(object sender, UserReplyEventArgs e) { }