Пример #1
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: On Challenge Finish
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private void OnChallengeFinish()
    {
        // Show Results?
        bool bShowResults = m_eChallengeActivity == ChallengeActivity.CHALLENGE_MODE;

        // Was Challenge Mode? Then we can update the feathers as needed
        if (bShowResults && !TutorialManager_Base.TutorialOpened)
        {
            ChallengeGameScoreManager.ScoreResult eScoreResult = ChallengeGameScoreManager.GetScoreResult(Mathf.CeilToInt(sm_fScore * 100.0f));
            int iChallengeScore = (eScoreResult == ChallengeGameScoreManager.ScoreResult.TERRIBLE)        ? 0 :
                                  (eScoreResult == ChallengeGameScoreManager.ScoreResult.OKAY)            ? 1 :
                                  (eScoreResult == ChallengeGameScoreManager.ScoreResult.GOOD)            ? 2 : 3;
            int iCompletionCount = SavedPreferenceTool.GetInt(m_ePlaylistTrack.ToString() + "_FeatherCount", 0);
            if (iChallengeScore > iCompletionCount)
            {
                ChallengeFeathersInfo.NewlyObtainedFeathers = (iChallengeScore - iCompletionCount);
                SavedPreferenceTool.SaveInt(m_ePlaylistTrack.ToString() + "_FeatherCount", iChallengeScore);    // Save to the Challenge itself, now you'll see these feathers light up when in the challenge select!
                ChallengeFeathersInfo.AccumulatedFeathers += ChallengeFeathersInfo.NewlyObtainedFeathers;       // Add to the total accumulated Feathers
            }
            else
            {
                ChallengeFeathersInfo.NewlyObtainedFeathers = 0;
            }
        }

        // Stop Active Challenge!
        m_rGameManager.StopChallenge(bShowResults);
        StopBackingTrack();
    }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Draw Playlist Options
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    protected void DrawPlaylistOptions()
    {
        AddSpaces(3);
        m_bShowAllNotes = EditorGUILayout.Foldout(m_bShowAllNotes, (m_bShowAllNotes ? "Hide All Notes" : "Show All Notes"));
        if (m_bShowAllNotes)
        {
            SoundsRhythmMemoryGame.PlaybackInfo[] aCurrentPlaylist = CurrentPlaylist;
            for (int i = 0; i < aCurrentPlaylist.Length; ++i)
            {
                string labelFieldText = (m_eCurrentPlaylist.ToString() + "- Note " + ((((i + 1) < 10) ? "0" : "") + (i + 1).ToString()) + ": ") + "Selected Sound: ";
                float  enumWidth      = 170.0f;
                float  fltWidth       = 80.0f;
                float  txtWidth       = 90.0f;

                EditorGUILayout.LabelField(labelFieldText);
                Rect drawPos = GetScaledRect();
                drawPos.x    += (drawPos.width - fltWidth);
                drawPos.width = fltWidth;
                aCurrentPlaylist[i].endTime = EditorGUI.FloatField(drawPos, aCurrentPlaylist[i].endTime);
                drawPos.x    -= 60.0f;
                drawPos.width = txtWidth;
                EditorGUI.LabelField(drawPos, "EndTime:");
                drawPos.x    -= 70.0f;
                drawPos.width = fltWidth;
                aCurrentPlaylist[i].startTime = EditorGUI.FloatField(drawPos, aCurrentPlaylist[i].startTime);
                drawPos.x    -= 65.0f;
                drawPos.width = txtWidth;
                EditorGUI.LabelField(drawPos, "StartTime:");
                drawPos.x               -= enumWidth;
                drawPos.width            = (enumWidth + 5.0f);
                aCurrentPlaylist[i].type = (TambourineSoundsManager.SoundTypes)EditorGUI.EnumPopup(drawPos, new GUIContent("", "The sound which will be played"), aCurrentPlaylist[i].type);
            }
        }
    }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Toggle Awarded Feathers
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private void ToggleAwardedFeathers()
    {
        int completionCount = SavedPreferenceTool.GetInt(m_eChallengeID.ToString() + "_FeatherCount", 0);

        for (int i = 0; i < m_arAwardedFeathersNotifier.Length; ++i)
        {
            if (i < completionCount)
            {
                m_arAwardedFeathersNotifier[i].ShowActiveFeather();
            }
            else
            {
                m_arAwardedFeathersNotifier[i].ShowInactiveFeather();
            }
        }
    }