void AnimateWidget(GUIBase_Label label, float source, float target, string format = null) { var animation = MFGuiManager.AnimateWidget(label, source, target); if (animation != null) { animation.Duration = 0.5f; animation.AudioClip = CountDownSound; } }
void AnimateWidget(GUIBase_Label label, string text) { var animation = MFGuiManager.AnimateWidget(label, text); if (animation != null) { animation.Duration = 0.5f; animation.AudioClip = CountDownSound; } }
// PUBLIC METHODS public void SetData(int rank, int points) { //bool isMajorRank = PlayerPersistantInfo.IsMajorRank(rank); GUIBase_MultiSprite sprite = GuiBaseUtils.GetControl <GUIBase_MultiSprite>(Layout, PLAYERRANKPIC); sprite.State = string.Format("Rank_{0}", Mathf.Min(rank, sprite.Count - 1).ToString("D2")); GUIBase_Label label = GuiBaseUtils.GetControl <GUIBase_Label>(Layout, POINTS_LABEL); var animation = MFGuiManager.AnimateWidget(label, 0, points); if (animation != null) { animation.Duration = m_CountDownDuration; animation.AudioClip = m_CountDownSound; } #if (!UNITY_EDITOR) && (UNITY_ANDROID || UNITY_IPHONE) // set visibility of info text Layout.GetWidget(WOULDPOSTIT_NOTIFY).Show(true, true); string postMessage = string.Format(TextDatabase.instance[01150011], CloudUser.instance.nickName, rank); // register delegate for facebook button m_FacebookButton.Widget.Show(true, true); m_FacebookButton.RegisterTouchDelegate(() => { m_FacebookButton.SetDisabled(true); StartCoroutine(sendMessage(rank.ToString())); }); m_TwitterButton.Widget.Show(true, true); m_TwitterButton.RegisterTouchDelegate(() => { m_TwitterButton.SetDisabled(true); TwitterUtils.PostMessage(postMessage, (success) => { if (m_TwitterButton.Widget.Visible == true) { m_TwitterButton.SetDisabled(!success); } }); }); #else m_FacebookButton.Widget.Show(false, true); m_TwitterButton.Widget.Show(false, true); #endif }
void SetButtonValue(GUIBase_Button button, int oldValue, int newValue, bool animate) { if (oldValue == newValue) { return; } if (animate == false) { button.SetNewText(newValue.ToString()); } else { var animation = MFGuiManager.AnimateWidget(button, oldValue, newValue); if (animation != null) { animation.AudioClip = m_CountDownSound; } } }
public void Update() { if (m_Player == null) { return; } m_Root.Show(true, true); var animation = MFGuiManager.AnimateWidget(m_Root); animation.Duration = 0.15f; animation.Scale = 1.1f; animation.Alpha = 0.0f; bool isFriend = GameCloudManager.friendList.friends.FindIndex(obj => obj.PrimaryKey == m_Player.PrimaryKey) != -1; m_FriendIcon.Show(isFriend, true); int rank = PlayerPersistantInfo.GetPlayerRankFromExperience(m_Player.Experience); Color color = m_TeamColors[(int)m_Player.Team]; color.a = m_LocalPlayer == true ? 1.0f : 0.5f; m_Root.Color = color; m_NicknameLabel.SetNewText(GuiBaseUtils.FixNameForGui(m_Player.NickName)); m_StandLabel.SetNewText(m_Index.ToString()); m_ScoreLabel.SetNewText(m_Player.Score.ToString()); m_KillsLabel.SetNewText(m_Player.Kills.ToString()); m_DeadsLabel.SetNewText(m_Player.Deaths.ToString()); m_RankLabel.SetNewText(rank.ToString()); m_RankIcon.State = string.Format("Rank_{0}", Mathf.Min(rank, m_RankIcon.Count - 1).ToString("D2")); string platform; switch (m_Player.Platform) { case RuntimePlatform.Android: platform = "Plat_Andro"; break; case RuntimePlatform.IPhonePlayer: platform = "Plat_Apple"; break; case RuntimePlatform.WindowsPlayer: platform = "Plat_Pc"; break; case RuntimePlatform.OSXPlayer: platform = "Plat_Mac"; break; case RuntimePlatform.WindowsWebPlayer: platform = "Plat_Fb"; break; case RuntimePlatform.OSXWebPlayer: platform = "Plat_Fb"; break; default: platform = "Plat_Skull"; break; } m_PlatformIcon.State = platform; }