private void clearSongState()
        {
            this.songState = new AudicaSongState();

            // this is potentially read all the time but only updates if a song is playing so we should initialise everything to actual sane values ...
            this.songState.songId           = "";
            this.songState.songName         = "";
            this.songState.songArtist       = "";
            this.songState.songAuthor       = "";
            this.songState.difficulty       = "";
            this.songState.classification   = "";
            this.songState.songLength       = TimeSpan.FromSeconds(0).ToString();
            this.songState.timeElapsed      = TimeSpan.FromSeconds(0).ToString();
            this.songState.timeRemaining    = TimeSpan.FromSeconds(0).ToString();
            this.songState.progress         = 0;
            this.songState.currentTick      = 0;
            this.songState.ticksTotal       = 0;
            this.songState.songSpeed        = 1;
            this.songState.health           = 1;
            this.songState.score            = 0;
            this.songState.scoreMultiplier  = 1;
            this.songState.streak           = 0;
            this.songState.highScore        = 0;
            this.songState.isNoFailMode     = AudicaGameStateManager.prefs ? AudicaGameStateManager.prefs.NoFail.mVal : false;
            this.songState.isPracticeMode   = AudicaGameStateManager.config ? AudicaGameStateManager.config.practiceMode : false;
            this.songState.isFullComboSoFar = true;
            this.songState.modifiers        = AudicaGameStateManager.modifiers ? AudicaGameStateManager.modifiers.GetCurrentModifiers()
                                              .Select((GameplayModifiers.Modifier mod) => GameplayModifiers.GetModifierString(mod))
                                              .ToList <string>()
                : new List <string>();
        }
Ejemplo n.º 2
0
        public string Status(AudicaGameState gameState, AudicaSongState songState)
        {
            JSONObject gameStatus    = new JSONObject();
            JSONObject gameStateJSON = new JSONObject();
            JSONObject songStateJSON = new JSONObject();

            JSONArray modifiers = new JSONArray();

            songState.modifiers.ForEach((string modifier) => {
                modifiers.Add(modifier);
            });

            gameStateJSON["leftColor"]   = gameState.leftColor;
            gameStateJSON["rightColor"]  = gameState.rightColor;
            gameStateJSON["targetSpeed"] = gameState.targetSpeed;
            gameStateJSON["meleeSpeed"]  = gameState.meleeSpeed;
            gameStateJSON["aimAssist"]   = gameState.aimAssist;
            // TODO: timing assist value?

            songStateJSON["songId"]           = songState.songId;
            songStateJSON["songName"]         = songState.songName;
            songStateJSON["songArtist"]       = songState.songArtist;
            songStateJSON["songAuthor"]       = songState.songAuthor;
            songStateJSON["difficulty"]       = songState.difficulty;
            songStateJSON["classification"]   = songState.classification;
            songStateJSON["songLength"]       = songState.songLength;
            songStateJSON["timeElapsed"]      = songState.timeElapsed;
            songStateJSON["timeRemaining"]    = songState.timeRemaining;
            songStateJSON["progress"]         = songState.progress;
            songStateJSON["currentTick"]      = songState.currentTick;
            songStateJSON["totalTicks"]       = songState.ticksTotal;
            songStateJSON["songSpeed"]        = songState.songSpeed;
            songStateJSON["health"]           = songState.health;
            songStateJSON["score"]            = songState.score;
            songStateJSON["scoreMultiplier"]  = songState.scoreMultiplier;
            songStateJSON["streak"]           = songState.streak;
            songStateJSON["highScore"]        = songState.highScore;
            songStateJSON["isNoFailMode"]     = songState.isNoFailMode;
            songStateJSON["isPracticeMode"]   = songState.isPracticeMode;
            songStateJSON["isFullComboSoFar"] = songState.isFullComboSoFar;
            songStateJSON["modifiers"]        = modifiers;

            gameStatus["gameSettings"] = gameStateJSON;
            gameStatus["songStatus"]   = songStateJSON;

            return(gameStatus.ToString());
        }