IEnumerator RunShowSideMenu() { SideMenu sideMenu = SideMenu.Instance; LargeCubeCluster cubeCluster = LargeCubeCluster.Instance; sideMenu.ShowBackground(true); //Fades in background... //Wait sometime after background fades in... yield return(new WaitForSeconds(1.5f)); sideMenu.ShowJoinConversation(true); CubeCluster.HidePlayerCubes = false; //Show player cubes, in cube cluster... sideMenu.ShowCameraView(true); //Fades in cube cluster view... yield return(new WaitForSeconds(m_cubeWaitTime)); cubeCluster.ShowCluster(true); //Slides in cube cluster... yield return(new WaitForSeconds(1f)); sideMenu.ShowTakePoll(true); yield return(new WaitForSeconds(3f)); Player.ShowPointPoll = true; AppManager.State = AppManager.AppState.CAN_TAKE_POLL; PanelManager.Instance.ClearAllPanels(); }
IEnumerator RunHideSideMenu() { SideMenu sideMenu = SideMenu.Instance; LargeCubeCluster cubeCluster = LargeCubeCluster.Instance; sideMenu.ShowTakePoll(false); yield return(new WaitForSeconds(1f)); cubeCluster.ShowCluster(false); yield return(new WaitForSeconds(m_cubeWaitTime)); sideMenu.ShowCameraView(false); CubeCluster.HidePlayerCubes = true; sideMenu.ShowJoinConversation(false); sideMenu.ShowBackground(false); //Fade out background... yield return(new WaitForSeconds(1f)); PollManager.Instance.ResetTwitter(); AppManager.State = AppManager.AppState.ATTRACT_CUBES; }
IEnumerator RunPollCountdown() { ContentManager content = ContentManager.Instance; PanelManager panelManager = PanelManager.Instance; CenterScreen centerScreen = CenterScreen.Instance; SideMenu sideMenu = SideMenu.Instance; CenterMenu centerMenu = CenterMenu.Instance; RightMenu rightMenu = RightMenu.Instance; LeftMenu leftMenu = LeftMenu.Instance; LargeCubeCluster largeCubeCluster = LargeCubeCluster.Instance; SmallCubeCluster smallCubeCluster = SmallCubeCluster.Instance; EqualCubeCluster equalCubeCluster = EqualCubeCluster.Instance; float pollCountdown = StartupSettings.Instance.PollCountdown; PlayerManager playerManager = PlayerManager.Instance; var activePlayers = playerManager.ActivePlayers; yield return(new WaitForSeconds(m_beforeCountdownTime)); //Wait for show icon above to go away... yield return(new WaitForSeconds(1f)); Player.ShowMoveCubeText = false; Player.CountdownValue = (int)pollCountdown; Player.ShowCountdownValue = true; StartCoroutine(Player.RunCountdown(null)); yield return(new WaitForSeconds(pollCountdown + 1f)); Player.ShowCountdownValue = false; yield return(new WaitForSeconds(1f)); m_yesNoActive = false; rightMenu.ShowActiveNo(false); centerMenu.ShowActiveYes(false); rightMenu.HideInactiveNo(false); centerMenu.HideInactiveYes(false); { //Poll results start here... bool leftHasNotChanged = true; bool rightHasNotChanged = true; foreach (Player player in playerManager.ActivePlayers) { if (panelManager.ContainsPlayer(player, 1)) //center panel... { leftHasNotChanged = false; m_answerInfo.answerA += 1; } else if (panelManager.ContainsPlayer(player, 2)) //right panel... { rightHasNotChanged = false; m_answerInfo.answerB += 1; } } bool largeIsRight = m_answerInfo.answerA < m_answerInfo.answerB; bool smallIsRight = m_answerInfo.answerA > m_answerInfo.answerB; //Filters players from cube clusters they didn't vote for... FilterActivePlayers(largeIsRight, smallIsRight); centerScreen.MoveUpHeader(true); centerMenu.MoveDownYes(true); rightMenu.MoveDownNo(true); yield return(new WaitForSeconds(1f)); CubeCluster.HidePlayerCubes = false; Player.ShowColor = false; float total = m_answerInfo.answerA + m_answerInfo.answerB; int leftPercent = (int)((m_answerInfo.answerA / total) * 100); int rightPercent = (int)((m_answerInfo.answerB / total) * 100); centerMenu.StartPollAPercentCountdown(m_percentCountdownTime, leftPercent); rightMenu.StartPollAPercentCountdown(m_percentCountdownTime, rightPercent); largeCubeCluster.InstantShowCluster(); smallCubeCluster.InstantShowCluster(); equalCubeCluster.InstantShowCluster(); if (largeIsRight) { centerMenu.ShowSmallResults(true); rightMenu.ShowLargeResults(true); } else if (smallIsRight) { centerMenu.ShowLargeResults(true); rightMenu.ShowSmallResults(true); } else //They are equal... { rightMenu.ShowLargeResults(true); centerMenu.ShowEqualResults(true); } yield return(new WaitForSeconds(m_percentCountdownTime)); yield return(new WaitForSeconds(2f)); if (leftHasNotChanged) { centerMenu.HideLargePercent(true); centerMenu.HideSmallPercent(true); if (largeIsRight) { smallCubeCluster.Explode(); } else if (smallIsRight) { largeCubeCluster.Explode(); } else { equalCubeCluster.Explode(); } } if (rightHasNotChanged) { rightMenu.HideLargePercent(true); rightMenu.HideSmallPercent(true); if (largeIsRight) { largeCubeCluster.Explode(); } else if (smallIsRight) { smallCubeCluster.Explode(); } else { largeCubeCluster.Explode(); } } yield return(new WaitForSeconds(StartupSettings.Instance.AfterPollATimeout)); centerMenu.ShowLargeResults(false); centerMenu.ShowSmallResults(false); centerMenu.ShowEqualResults(false); rightMenu.ShowLargeResults(false); rightMenu.ShowSmallResults(false); rightMenu.ShowEqualResults(false); //Updating poll answers and starting takeaway... content.OpenConnection(); content.PutPollAnswers(m_answerInfo); PollManager.Instance.StartTakeaway(m_poll.Question_Id); content.CloseConnection(); yield return(new WaitForSeconds(2f)); centerMenu.HideLargePercent(false); rightMenu.HideLargePercent(false); centerMenu.HideSmallPercent(false); rightMenu.HideSmallPercent(false); largeCubeCluster.DestroyCluster(); largeCubeCluster.CreateCluster(); smallCubeCluster.DestroyCluster(); smallCubeCluster.CreateCluster(); equalCubeCluster.DestroyCluster(); equalCubeCluster.CreateCluster(); //Cleanup... largeCubeCluster.FilteredPlayers.Clear(); smallCubeCluster.FilteredPlayers.Clear(); equalCubeCluster.FilteredPlayers.Clear(); } //Cleanup... Player.ShowColor = false; Player.ShowInactiveColor = true; Player.ShowCountdownValue = false; Player.ShowMoveIcon = true; StartCoroutine(Player.ShowHashtagOverTime(m_hashtagShowTime)); sideMenu.ShowBackground(false); rightMenu.ShowBackground(false); centerMenu.ShowBackground(false); leftMenu.ShowBackground(false); centerScreen.ShowHeader(false); centerMenu.ShowPollA(false); rightMenu.ShowPollA(false); //Wait some time for animations above to take effect... yield return(new WaitForSeconds(1.5f)); centerScreen.ResetHeader(); centerMenu.ResetYesAnimator(); rightMenu.ResetNoAnimator(); yield return(new WaitForSeconds(1.5f)); //Allow streaming cubes to start streaming in again... //TODO: Should be AppState.TAKE_AWAY... AppManager.State = AppManager.AppState.ATTRACT_CUBES; PanelManager.Instance.ClearAllPanels(); }
IEnumerator RunPollCountdown() { ContentManager content = ContentManager.Instance; CenterScreen centerScreen = CenterScreen.Instance; SideMenu sideMenu = SideMenu.Instance; CenterMenu centerMenu = CenterMenu.Instance; RightMenu rightMenu = RightMenu.Instance; LeftMenu leftMenu = LeftMenu.Instance; BarGraph barGraph = BarGraph.Instance; PlayerManager playerManager = PlayerManager.Instance; float pollCountdown = StartupSettings.Instance.PollCountdown; GraphAnswerInfo answerInfo = null; var poll = content.PollBList[m_pollQuestionCounter]; var activePlayers = playerManager.ActivePlayers; yield return(new WaitForSeconds(m_beforeCountdownTime)); Player.CheckRange = true; //Wait for show icon above to go away... yield return(new WaitForSeconds(1f)); Player.ShowMoveCubeText = false; Player.CountdownValue = (int)pollCountdown; Player.ShowCountdownValue = true; StartCoroutine(Player.RunCountdown(null)); yield return(new WaitForSeconds(pollCountdown + 1f)); Player.ShowCountdownValue = false; Player.CheckRange = false; yield return(new WaitForSeconds(1f)); centerScreen.MoveUpHeader(true); centerScreen.HideRangeBar(true); centerScreen.ShowBarGraph(true); //Wait some time before showing bar graph... yield return(new WaitForSeconds(1f)); //Bar graph stuff... { content.OpenConnection(); answerInfo = (GraphAnswerInfo)content.GetPollAnswersB(poll.Question_Id); content.CloseConnection(); //Setting data and showing bar graph... int highestNum = 0; foreach (int num in answerInfo.numbers) { if (num > highestNum) { highestNum = num; } } float multipler = highestNum > 0f ? 10f / highestNum : 0f; int numVotesPerCube = (int)Mathf.Ceil(highestNum / 10f); for (int i = 0, count = answerInfo.numbers.Count; i < count; ++i) { int num = highestNum > 10 ? (int)Mathf.Ceil(answerInfo.numbers[i] / ((float)(numVotesPerCube))) : (int)Mathf.Round(answerInfo.numbers[i] * multipler); barGraph.SetNumberRows(i, num); } barGraph.ShowTable(true); //Adding player cubes to bar graph... yield return(new WaitForSeconds(3f)); foreach (Player player in activePlayers) { float range = 0f; if (centerScreen.InRangeOfRangeBar( player.transform.position, ref range)) { int index = (int)(answerInfo.numbers.Count * range); GameObject cube = barGraph.AddCubeToRow(index); barGraph.ShowCube(cube, player.ActiveColor); ++answerInfo.numbers[index]; Player.ShowColor = false; } } } //Wait some time before cleaning up bar graph... yield return(new WaitForSeconds( StartupSettings.Instance.AfterPollBTimeout)); barGraph.HideTable(); //Wait some time for animation above to take effect... yield return(new WaitForSeconds(2f)); content.OpenConnection(); content.PutPollAnswers(answerInfo); PollManager.Instance.StartTakeaway(poll.Question_Id); content.CloseConnection(); yield return(new WaitForSeconds(1f)); //Cleanup... Player.ShowColor = false; Player.ShowInactiveColor = true; Player.ShowCountdownValue = false; Player.ShowMoveIcon = true; StartCoroutine(Player.ShowHashtagOverTime(m_hashtagShowTime)); sideMenu.ShowBackground(false); rightMenu.ShowBackground(false); centerMenu.ShowBackground(false); leftMenu.ShowBackground(false); centerScreen.ShowHeader(false); centerScreen.ShowPollB(false); //Wait some time for animations above to take effect... yield return(new WaitForSeconds(2f)); centerScreen.ResetHeader(); centerScreen.HideRangeBar(false); centerScreen.ShowBarGraph(false); //Puts app back in ambient mode... AppManager.State = AppManager.AppState.ATTRACT_CUBES; PanelManager.Instance.ClearAllPanels(); }