コード例 #1
0
    public void GameFinish()
    {
        textRecord.text = "";
        timeEnd         = Time.time - timeStart;
        bool setRecord = false;

        for (int i = 0; i < 9; i++)
        {
            // 更新舊紀錄
            if (setRecord)
            {
                newRecord[i] = loadRecord[i - 1];
                newDate[i]   = loadDate[i - 1];
                UpdateRecord(i);
            }
            else
            {
                // 刷新紀錄
                if (timeEnd < loadRecord[i])
                {
                    setRecord    = true;
                    newRecord[i] = (int)timeEnd;
                    dateNow      = TextCustom.TextColor("yellow",
                                                        TextCustom.TextSize(37,
                                                                            " --- " +
                                                                            DateTime.Now.Year + "." +
                                                                            DateTime.Now.Month + "." +
                                                                            DateTime.Now.Day + " - " +
                                                                            DateTime.Now.Hour + ":" +
                                                                            DateTime.Now.Minute + ":" +
                                                                            DateTime.Now.Second));
                    newDate[i] = dateNow;
                    SetRecord(i);
                }
                else
                {
                    newRecord[i] = loadRecord[i];
                    newDate[i]   = loadDate[i];
                    UpdateRecord(i);
                }
            }
        }
    }
コード例 #2
0
 private string OrderColor(int rank)
 {
     return(TextCustom.TextColor("#FFD700", rank + ". "));
 }
コード例 #3
0
 void SetRecord(int index)
 {
     PlayerPrefs.SetInt(saveRecord + index, newRecord[index]);
     PlayerPrefs.SetString(saveDate + index, newDate[index]);
     textRecord.text += RankColor(index + 1) + TextCustom.TextColor("lime", MinuteTransform(newRecord[index], timerSize)) + newDate[index] + "\n";
 }