Пример #1
0
    void Awake()
    {
        // 例外処理
        DebugCommon.CheckArraysNull(numbers_);
        DebugCommon.Assert(0 < objectiveKillNum_ && objectiveKillNum_ < Mathf.Pow(10f, (float)(DIGIT_NUMER + 1)));

        Rect parentRect = GetComponent <RectTransform>().rect;

        // Imageを構成(newで簡単に生成できないのでこうした)
        imageWidth_ = parentRect.width / (float)DIGIT_NUMER;
        for (int i = 0; i < DIGIT_NUMER; i++)
        {
            imageObjects_[i] = new GameObject();

            RectTransform rectTrans = imageObjects_[i].AddComponent <RectTransform>();;
            rectTrans.SetParent(this.transform);
            rectTrans.anchoredPosition = new Vector2((i * imageWidth_) + (imageWidth_ / 2f), 0f);
            rectTrans.anchorMin        = new Vector2(0f, 0.5f);
            rectTrans.anchorMax        = new Vector2(0f, 0.5f);
            rectTrans.sizeDelta        = new Vector2(imageWidth_, parentRect.height);
            rectTrans.localScale       = new Vector3(1f, 1f, 1f);

            imageObjects_[i].AddComponent <Image>();
        }

        Draw();
    }
Пример #2
0
        // 引数に応じてランクにスコアを書き込み
        public static void Write(int rank, int score)
        {
            DebugCommon.Assert(1 <= rank && rank <= LIMIT_RANK);

            // 新しいランクのために既存のランクをずらす処理
            for (int i = LIMIT_RANK - 1; i >= rank; i--)
            {
                PlayerPrefs.SetInt((i + 1).ToString(), PlayerPrefs.GetInt(i.ToString()));
            }

            PlayerPrefs.SetInt(rank.ToString(), score);
        }