/// <summary> /// スコア加算 /// </summary> /// <param name="id">ユーザーID</param> /// <param name="s">加算スコア</param> /// <returns>スコアトップが更新されたか?</returns> public bool AddCharm(UserID id, int s) { int idx = (int)id; m_charmTable[idx] += s; if (m_topUserId == -1) { GuestScores.Add(id); m_topUserId = idx; // +Bonus m_charmTable[idx] += GuestScores.firstHitCharmBonus; return(true); } else { // 上書きしたユーザーが元々一位なら何もしない // 後から来たUserと一位タイの場合は後のUserが優先 if (m_topUserId == idx) { return(true); } else if (m_charmTable[idx] >= m_charmTable[m_topUserId]) { GuestScores.Add(id, (UserID)m_topUserId); m_topUserId = idx; return(true); } } return(false); }
// Use this for initialization void Start() { for (int i = 0; i < m_userScores.Length; i++) { scores[i].id = (UserID)(i); scores[i].score = GuestScores.GetScore(scores[i].id); } Array.Sort(scores, (a, b) => b.score - a.score); for (int i = 0; i < m_userScores.Length; i++) { switch (scores[i].id) { case UserID.User1: m_userScores[i].color = m_userColor[0]; m_userScores[i].text += " 1P " + scores[i].score.ToString(); break; case UserID.User2: m_userScores[i].color = m_userColor[1]; m_userScores[i].text += " 2P " + scores[i].score.ToString(); break; case UserID.User3: m_userScores[i].color = m_userColor[2]; m_userScores[i].text += " 3P " + scores[i].score.ToString(); break; case UserID.User4: m_userScores[i].color = m_userColor[3]; m_userScores[i].text += " 4P " + scores[i].score.ToString(); break; default: break; } if (i == 0) { m_1stImages[(int)scores[i].id].enabled = true; } else { m_1stImages[(int)scores[i].id].enabled = false; } m_rankImages[(int)scores[i].id].sprite = m_rankSprites[i]; } }
// Update is called once per frame void Update() { // カウントアップ演出はアルファ終わってから? m_userScore = GuestScores.GetScore(m_userID); int temp = m_userScore; for (int i = 0; i < m_numberImage.Length; i++) { // 1の位 m_numberImage[i].sprite = m_numberSpriteArray[temp % 10]; // 10の位 temp /= 10; } }
public void Initialize() { Reset(); GuestScores.AddMax(); }
void Awake() { GuestScores.Reset(m_firstHitCharmBonus); }