Пример #1
0
    private int finalScore;     // time score + jewellery score

    public void UpdateGUI()
    {
        // Time
        TimeGUI timeGUI   = Resources.FindObjectsOfTypeAll <TimeGUI>()[0] as TimeGUI;
        double  time      = System.Math.Round(timeGUI.GetTime(), 2);
        int     idealTime = timeGUI.GetIdealTime();

        timeText.text = time + "s";

        int timeScore = idealTime * 1000;               // 1st time category

        timeScore -= (int)((time - idealTime) * 1000);
        // time: 0s, 60s, 90s, 120s
        // score: 120000, 60000, 30000, 0

        // Jewellery
        Bag bag = Resources.FindObjectsOfTypeAll <Bag>()[0] as Bag;
        Dictionary <ItemColor, int> jewellerys = bag.GetAllJewellarys();

        ItemColor[] colors = ItemColor.GetValues(typeof(ItemColor)) as ItemColor[];

        DisableJewelleryIcon(jewellerys);
        int jewelleryScore = GetJewelleryScore(jewellerys);             // 2nd time category

        // score: 5000, 10000, 15000

        // Final score
        finalScore = timeScore + jewelleryScore;

        // Update data
        GetComponent <BinaryCharacterSaver>().StageClear(finalScore);

        // int scoreAppendDigit = GetScoreAppendDigit(finalScore, 6);	// 000000
        // string scoreAppend = GetScoreAppendString(scoreAppendDigit);

        // scoreText.text = scoreAppend + finalScore;

        // buttons.SetActive(true);
    }