protected override void OnViewShow() { base.OnViewShow(); RegisterButtonDelegate(CLOSE_BUTTON, () => { ForceClose(); }, null); RegisterButtonDelegate(SKIPANIM_BUTTON, () => { MFGuiManager.FlushAnimations(); }, null); m_IsPremiumAccountActive = CloudUser.instance.isPremiumAccountActive; }
protected override void OnViewShow() { base.OnViewShow(); // register delegate for close button m_CloseButton.RegisterTouchDelegate(() => { Owner.Back(); SendResult(E_PopupResultCode.Cancel); }); RegisterButtonDelegate(SKIPANIM_BUTTON, () => { MFGuiManager.FlushAnimations(); }, null); // enable social buttons m_FacebookButton.SetDisabled(false); m_TwitterButton.SetDisabled(false); }
IEnumerator UpdateList(List <RoundFinalResult.PlayerResult> players, E_Team winners) { GUIBase_List list = GuiBaseUtils.GetControl <GUIBase_List>(Layout, "Table"); GUIBase_Widget outline = GuiBaseUtils.GetChild <GUIBase_Widget>(list, "MyPlayer"); Row[] rows = new Row[list.numOfLines]; outline.Show(false, true); // sort player by score RoundFinalResult.PlayerResult[] score = players.ToArray(); System.Array.Sort(score, (x, y) => { int res = y.Score.CompareTo(x.Score); if (res == 0) { // descending by kills res = y.Kills.CompareTo(x.Kills); if (res == 0) { // increasing by deaths res = x.Deaths.CompareTo(y.Deaths); if (res == 0) { // increasing by names res = x.NickName.CompareTo(y.NickName); } } } return(res); }); // prepare rows E_Team team = E_Team.Last; for (int idx = 0; idx < list.numOfLines; ++idx) { RoundFinalResult.PlayerResult player = idx < players.Count ? players[idx] : null; if (player != null && player.Team != team) { team = player.Team; } int stand = player != null?System.Array.FindIndex(score, obj => obj.PrimaryKey == player.PrimaryKey) + 1 : -1; rows[idx] = new Row(stand, list.GetWidgetOnLine(idx), player, player != null && player.PrimaryKey == m_PrimaryKey); } yield return(new WaitForSeconds(0.2f)); // show rows for (int idx = 0; idx < list.numOfLines; ++idx) { rows[idx].Update(); do { if (m_SkipAnimations == true) { MFGuiManager.FlushAnimations(); } yield return(new WaitForEndOfFrame()); } while (MFGuiManager.IsAnimating == true); if (rows[idx].PrimaryKey == m_PrimaryKey) { outline.transform.position = list.GetWidgetOnLine(idx).transform.position; outline.SetModify(); outline.Show(true, true); } MFGuiManager.Instance.PlayOneShot(m_ShowRowSound); } }
void FlushAnimations() { MFGuiManager.FlushAnimations(); }
// PRIVATE MEMBERS IEnumerator ShowResults(RoundFinalResult results) { results = results ?? new RoundFinalResult(); List <RoundFinalResult.PlayerResult> players = results.PlayersScore ?? new List <RoundFinalResult.PlayerResult>(); E_Team enemy = results.Team == E_Team.Good ? E_Team.Bad : E_Team.Good; E_Team winners = results.Winner ? results.Team : enemy; // sort players if (results.GameType != E_MPGameType.DeathMatch) { players.Sort((x, y) => { int res = x.Team.CompareTo(y.Team); if (res == 0) { // descending by score res = y.Score.CompareTo(x.Score); } else { res = x.Team == winners ? -1 : +1; } return(res); }); } m_TeamColors[(int)E_Team.None] = m_NoTeamColor; m_TeamColors[(int)E_Team.Good] = m_TeamGoodColor; m_TeamColors[(int)E_Team.Bad] = m_TeamBadColor; ShowResultText(results, winners); ShowResultImage(results, winners); yield return(StartCoroutine(UpdateList(players, winners))); yield return(new WaitForSeconds(0.2f)); PreyNightmare prey = new PreyNightmare(Layout.GetWidget("Prey")); prey.CountDownSound = m_CountDownSound; prey.Update(players.Find(obj => obj.PrimaryKey == results.Prey.PrimaryKey), results.Prey); PreyNightmare nightmare = new PreyNightmare(Layout.GetWidget("Nightmare")); nightmare.CountDownSound = m_CountDownSound; nightmare.Update(players.Find(obj => obj.PrimaryKey == results.Nightmare.PrimaryKey), results.Nightmare); if (m_SkipAnimations == true) { MFGuiManager.FlushAnimations(); } #if !UNITY_STANDALONE int screenShotPlace = 3; #if FB_LOGIN_REVIEW screenShotPlace = 100; #endif if (results.Place < screenShotPlace) { GUIBase_Widget socNetsRoot = Layout.GetWidget("SocialNetworks", false); if (socNetsRoot != null) { socNetsRoot.Show(true, true); RegisterButtonDelegate("FB_Button", null, (inside) => { if (inside) { PostResults(true, results); } }); RegisterButtonDelegate("TW_Button", null, (inside) => { if (inside) { PostResults(false, results); } }); } } #endif }