public override void Add(string aKey, JSONNode aItem)
        {
            if (aItem == null)
            {
                aItem = JSONNull.CreateOrGet();
            }

            if (aKey != null)
            {
                if (m_Dict.ContainsKey(aKey))
                {
                    m_Dict[aKey] = aItem;
                }
                else
                {
                    m_Dict.Add(aKey, aItem);
                }
            }
            else
            {
                m_Dict.Add(Guid.NewGuid().ToString(), aItem);
            }
        }
示例#2
0
    public override void Add(string aKey, JSONNode aItem)
    {
        if (aItem == null)
        {
            aItem = new JSONNull();
        }

        if (!string.IsNullOrEmpty(aKey))
        {
            if (m_Dict.ContainsKey(aKey))
            {
                m_Dict[aKey] = aItem;
            }
            else
            {
                m_Dict.Add(aKey, aItem);
            }
        }
        else
        {
            m_Dict.Add(Guid.NewGuid().ToString(), aItem);
        }
    }
示例#3
0
        static void DoLoad(string client, string name)
        {
            Time.timeScale = 0;
            ApiManager.Instance.TimeLimit  = 0.0;
            ApiManager.Instance.FrameLimit = 0;

            ApiManager.Instance.Agents.Clear();

            var agentManager = ROSAgentManager.Instance;

            agentManager.currentMode = StartModeTypes.API;
            agentManager.Clear();

            NPCManager.Instance?.DespawnAllNPC();

            var menu = Object.FindObjectOfType <MenuManager>();

            menu.LoadScene(name, () =>
            {
                ApiManager.Instance.CurrentTime  = 0.0;
                ApiManager.Instance.CurrentFrame = 0;
                ApiManager.Instance.SendResult(client, JSONNull.CreateOrGet());
            });
        }
示例#4
0
 public override JSONNode this[int aIndex]
 {
     get
     {
         if (aIndex < 0 || aIndex >= m_Dict.Count)
         {
             return(null);
         }
         return(m_Dict.ElementAt(aIndex).Value);
     }
     set
     {
         if (value == null)
         {
             value = JSONNull.CreateOrGet();
         }
         if (aIndex < 0 || aIndex >= m_Dict.Count)
         {
             return;
         }
         string key = m_Dict.ElementAt(aIndex).Key;
         m_Dict[key] = value;
     }
 }
示例#5
0
        private void UpdateModJSON()
        {
            if (_statusJSON["mod"] == null)
            {
                _statusJSON["mod"] = new JSONObject();
            }
            JSONObject modJSON = (JSONObject)_statusJSON["mod"];

            modJSON["multiplier"]          = gameStatus.modifierMultiplier;
            modJSON["obstacles"]           = gameStatus.modObstacles == null || gameStatus.modObstacles == "NoObstacles" ? (JSONNode) new JSONBool(false) : (JSONNode) new JSONString(gameStatus.modObstacles);
            modJSON["instaFail"]           = gameStatus.modInstaFail;
            modJSON["noFail"]              = gameStatus.modNoFail;
            modJSON["batteryEnergy"]       = gameStatus.modBatteryEnergy;
            modJSON["batteryLives"]        = gameStatus.modBatteryEnergy || gameStatus.modInstaFail ? (JSONNode) new JSONNumber(gameStatus.batteryLives) : (JSONNode)JSONNull.CreateOrGet();
            modJSON["disappearingArrows"]  = gameStatus.modDisappearingArrows;
            modJSON["noBombs"]             = gameStatus.modNoBombs;
            modJSON["songSpeed"]           = gameStatus.modSongSpeed;
            modJSON["songSpeedMultiplier"] = gameStatus.songSpeedMultiplier;
            modJSON["noArrows"]            = gameStatus.modNoArrows;
            modJSON["ghostNotes"]          = gameStatus.modGhostNotes;
            modJSON["failOnSaberClash"]    = gameStatus.modFailOnSaberClash;
            modJSON["strictAngles"]        = gameStatus.modStrictAngles;
            modJSON["fastNotes"]           = gameStatus.modFastNotes;
            modJSON["smallNotes"]          = gameStatus.modSmallNotes;
            modJSON["proMode"]             = gameStatus.modProMode;
            modJSON["zenMode"]             = gameStatus.modZenMode;
        }
示例#6
0
 private void UpdateNoteCutJSON()
 {
     _noteCutJSON["noteID"]           = gameStatus.noteID;
     _noteCutJSON["noteType"]         = stringOrNull(gameStatus.noteType);
     _noteCutJSON["noteCutDirection"] = stringOrNull(gameStatus.noteCutDirection);
     _noteCutJSON["noteLine"]         = gameStatus.noteLine;
     _noteCutJSON["noteLayer"]        = gameStatus.noteLayer;
     _noteCutJSON["speedOK"]          = gameStatus.speedOK;
     _noteCutJSON["directionOK"]      = gameStatus.noteType == "Bomb" ? (JSONNode)JSONNull.CreateOrGet() : (JSONNode) new JSONBool(gameStatus.directionOK);
     _noteCutJSON["saberTypeOK"]      = gameStatus.noteType == "Bomb" ? (JSONNode)JSONNull.CreateOrGet() : (JSONNode) new JSONBool(gameStatus.saberTypeOK);
     _noteCutJSON["wasCutTooSoon"]    = gameStatus.wasCutTooSoon;
     _noteCutJSON["initialScore"]     = gameStatus.initialScore == -1 ? (JSONNode)JSONNull.CreateOrGet() : (JSONNode) new JSONNumber(gameStatus.initialScore);
     _noteCutJSON["finalScore"]       = gameStatus.finalScore == -1 ? (JSONNode)JSONNull.CreateOrGet() : (JSONNode) new JSONNumber(gameStatus.finalScore);
     _noteCutJSON["cutDistanceScore"] = gameStatus.cutDistanceScore == -1 ? (JSONNode)JSONNull.CreateOrGet() : (JSONNode) new JSONNumber(gameStatus.cutDistanceScore);
     _noteCutJSON["swingRating"]      = gameStatus.swingRating;
     _noteCutJSON["multiplier"]       = gameStatus.cutMultiplier;
     _noteCutJSON["saberSpeed"]       = gameStatus.saberSpeed;
     if (!_noteCutJSON["saberDir"].IsArray)
     {
         _noteCutJSON["saberDir"] = new JSONArray();
     }
     _noteCutJSON["saberDir"][0]           = gameStatus.saberDirX;
     _noteCutJSON["saberDir"][1]           = gameStatus.saberDirY;
     _noteCutJSON["saberDir"][2]           = gameStatus.saberDirZ;
     _noteCutJSON["saberType"]             = stringOrNull(gameStatus.saberType);
     _noteCutJSON["timeDeviation"]         = gameStatus.timeDeviation;
     _noteCutJSON["cutDirectionDeviation"] = gameStatus.cutDirectionDeviation;
     if (!_noteCutJSON["cutPoint"].IsArray)
     {
         _noteCutJSON["cutPoint"] = new JSONArray();
     }
     _noteCutJSON["cutPoint"][0] = gameStatus.cutPointX;
     _noteCutJSON["cutPoint"][1] = gameStatus.cutPointY;
     _noteCutJSON["cutPoint"][2] = gameStatus.cutPointZ;
     if (!_noteCutJSON["cutNormal"].IsArray)
     {
         _noteCutJSON["cutNormal"] = new JSONArray();
     }
     _noteCutJSON["cutNormal"][0]        = gameStatus.cutNormalX;
     _noteCutJSON["cutNormal"][1]        = gameStatus.cutNormalY;
     _noteCutJSON["cutNormal"][2]        = gameStatus.cutNormalZ;
     _noteCutJSON["cutDistanceToCenter"] = gameStatus.cutDistanceToCenter;
     _noteCutJSON["timeToNextBasicNote"] = gameStatus.timeToNextBasicNote;
 }
示例#7
0
        private void UpdatePerformanceJSON()
        {
            if (gameStatus.start == 0)
            {
                _statusJSON["performance"] = null;
                return;
            }

            if (_statusJSON["performance"] == null)
            {
                _statusJSON["performance"] = new JSONObject();
            }
            JSONObject performanceJSON = (JSONObject)_statusJSON["performance"];

            performanceJSON["rawScore"]           = gameStatus.rawScore;
            performanceJSON["score"]              = gameStatus.score;
            performanceJSON["currentMaxScore"]    = gameStatus.currentMaxScore;
            performanceJSON["rank"]               = gameStatus.rank;
            performanceJSON["passedNotes"]        = gameStatus.passedNotes;
            performanceJSON["hitNotes"]           = gameStatus.hitNotes;
            performanceJSON["missedNotes"]        = gameStatus.missedNotes;
            performanceJSON["lastNoteScore"]      = gameStatus.lastNoteScore;
            performanceJSON["passedBombs"]        = gameStatus.passedBombs;
            performanceJSON["hitBombs"]           = gameStatus.hitBombs;
            performanceJSON["combo"]              = gameStatus.combo;
            performanceJSON["maxCombo"]           = gameStatus.maxCombo;
            performanceJSON["multiplier"]         = gameStatus.multiplier;
            performanceJSON["multiplierProgress"] = gameStatus.multiplierProgress;
            performanceJSON["batteryEnergy"]      = gameStatus.modBatteryEnergy || gameStatus.modInstaFail ? (JSONNode) new JSONNumber(gameStatus.batteryEnergy) : (JSONNode)JSONNull.CreateOrGet();
            performanceJSON["softFailed"]         = gameStatus.softFailed;
        }
示例#8
0
        private void UpdateBeatmapJSON()
        {
            if (gameStatus.songName == null)
            {
                _statusJSON["beatmap"] = null;
                return;
            }

            if (_statusJSON["beatmap"] == null)
            {
                _statusJSON["beatmap"] = new JSONObject();
            }
            JSONObject beatmapJSON = (JSONObject)_statusJSON["beatmap"];

            beatmapJSON["songName"]        = stringOrNull(gameStatus.songName);
            beatmapJSON["songSubName"]     = stringOrNull(gameStatus.songSubName);
            beatmapJSON["songAuthorName"]  = stringOrNull(gameStatus.songAuthorName);
            beatmapJSON["levelAuthorName"] = stringOrNull(gameStatus.levelAuthorName);
            beatmapJSON["songCover"]       = String.IsNullOrEmpty(gameStatus.songCover) ? (JSONNode)JSONNull.CreateOrGet() : (JSONNode) new JSONString(gameStatus.songCover);
            beatmapJSON["songHash"]        = stringOrNull(gameStatus.songHash);
            beatmapJSON["levelId"]         = stringOrNull(gameStatus.levelId);
            beatmapJSON["songBPM"]         = gameStatus.songBPM;
            beatmapJSON["noteJumpSpeed"]   = gameStatus.noteJumpSpeed;
            beatmapJSON["songTimeOffset"]  = new JSONNumber(gameStatus.songTimeOffset);
            beatmapJSON["start"]           = gameStatus.start == 0 ? (JSONNode)JSONNull.CreateOrGet() : (JSONNode) new JSONNumber(gameStatus.start);
            beatmapJSON["paused"]          = gameStatus.paused == 0 ? (JSONNode)JSONNull.CreateOrGet() : (JSONNode) new JSONNumber(gameStatus.paused);
            beatmapJSON["length"]          = new JSONNumber(gameStatus.length);
            beatmapJSON["difficulty"]      = stringOrNull(gameStatus.difficulty);
            beatmapJSON["notesCount"]      = gameStatus.notesCount;
            beatmapJSON["bombsCount"]      = gameStatus.bombsCount;
            beatmapJSON["obstaclesCount"]  = gameStatus.obstaclesCount;
            beatmapJSON["maxScore"]        = gameStatus.maxScore;
            beatmapJSON["maxRank"]         = gameStatus.maxRank;
            beatmapJSON["environmentName"] = gameStatus.environmentName;
        }
示例#9
0
 private JSONNode StringOrNull(string str) => str == null ? (JSONNode)JSONNull.CreateOrGet() : (JSONNode) new JSONString(str);
示例#10
0
        public void Execute(string client, JSONNode args)
        {
            var uid = args["uid"].Value;

            GameObject obj;

            if (ApiManager.Instance.Agents.TryGetValue(uid, out obj))
            {
                var sticky  = args["sticky"].AsBool;
                var control = args["control"];

                var vc = obj.GetComponent <VehicleController>();

                var steering = control["steering"].AsFloat;
                var throttle = control["throttle"].AsFloat;
                var breaking = control["breaking"].AsFloat;

                vc.ApplyControl(sticky, steering, throttle - breaking);

                var reverse = control["reverse"].AsBool;
                if (reverse)
                {
                    while (!vc.InReverse)
                    {
                        vc.GearboxShiftDown();
                    }
                }
                else
                {
                    while (vc.InReverse)
                    {
                        vc.GearboxShiftUp();
                    }
                }

                var handbrake = args["control"]["handbrake"].AsBool;
                vc.SetHandBrake(handbrake);

                if (args["control"]["headlights"] != null)
                {
                    int headlights = args["control"]["headlights"].AsInt;
                    vc.ForceHeadlightsOff();
                    for (int i = 0; i < headlights; i++)
                    {
                        vc.ChangeHeadlightMode();
                    }
                }

                if (args["control"]["windshield_wipers"] != null)
                {
                    int state = args["control"]["windshield_wipers"].AsInt;
                    if (state == 0)
                    {
                        vc.SetWindshiledWiperLevelOff();
                    }
                    else if (state == 1)
                    {
                        vc.SetWindshiledWiperLevelLow();
                    }
                    else if (state == 2)
                    {
                        vc.SetWindshiledWiperLevelMid();
                    }
                    else if (state == 3)
                    {
                        vc.SetWindshiledWiperLevelHigh();
                    }
                }

                if (args["control"]["turn_signal_right"] != null)
                {
                    bool on = args["control"]["turn_signal_right"].AsBool;
                    if (on)
                    {
                        vc.EnableLeftTurnSignal();
                    }
                    else
                    {
                        vc.DisbleTurnSignals();
                    }
                }

                if (args["control"]["turn_signal_right"] != null)
                {
                    bool on = args["control"]["turn_signal_right"].AsBool;
                    if (on)
                    {
                        vc.EnableRightTurnSignal();
                    }
                    else
                    {
                        vc.DisbleTurnSignals();
                    }
                }

                ApiManager.Instance.SendResult(client, JSONNull.CreateOrGet());
            }
            else
            {
                ApiManager.Instance.SendError(client, $"Agent '{uid}' not found");
            }
        }
示例#11
0
 public void Execute(string client, JSONNode args)
 {
     Run();
     ApiManager.Instance.SendResult(client, JSONNull.CreateOrGet());
 }
示例#12
0
        private static JSONNode DoObject2JSONNode(string key, object obj, JSONNode parent)
        {
            if (obj == null)
            {
                JSONNode jnull = new JSONNull();
                if (!DoObject2JSONNode_AddToParent(parent, key, jnull))
                {
                    return(jnull);
                }
            }
            else if (obj is IDictionary)
            {
                JSONObject jobject = Johny.JSONNodePool.Claim(typeof(Johny.JSONObject)).AsObject;
                var        it      = (obj as IDictionary).GetEnumerator();
                while (it.MoveNext())
                {
                    DoObject2JSONNode(it.Key as string, it.Value, jobject);
                }

                if (!DoObject2JSONNode_AddToParent(parent, key, jobject))
                {
                    return(jobject);
                }
            }
            else if (obj is ICollection)
            {
                JSONArray jarray = Johny.JSONNodePool.Claim(typeof(Johny.JSONArray)).AsArray;
                var       it     = (obj as ICollection).GetEnumerator();
                while (it.MoveNext())
                {
                    DoObject2JSONNode(string.Empty, it.Current, jarray);
                }

                if (!DoObject2JSONNode_AddToParent(parent, key, jarray))
                {
                    return(jarray);
                }
            }
            else if (obj is string)
            {
                JSONString jstring = Johny.JSONNodePool.Claim(typeof(Johny.JSONString)) as JSONString;
                jstring.InitString(obj as string);

                if (!DoObject2JSONNode_AddToParent(parent, key, jstring))
                {
                    return(jstring);
                }
            }
            else if (obj is bool)
            {
                JSONBool jbool = new JSONBool((bool)obj);
                if (!DoObject2JSONNode_AddToParent(parent, key, jbool))
                {
                    return(jbool);
                }
            }
            else if (obj is System.Enum)
            {
                JSONNumber jnum = new JSONNumber((int)obj);
                if (!DoObject2JSONNode_AddToParent(parent, key, jnum))
                {
                    return(jnum);
                }
            }
            else if (IsNumeric(obj))
            {
                double     dd   = Convert.ToDouble(obj);
                JSONNumber jnum = new JSONNumber(dd);
                if (!DoObject2JSONNode_AddToParent(parent, key, jnum))
                {
                    return(jnum);
                }
            }
            else
            {
                EB.Debug.LogError($"此类型JSON无法解析,请自行转换成基本类型!==> {obj.GetType().FullName}");
            }

            return(null);
        }
示例#13
0
        public JSONObject Parse()
        {
            Stack <JSONObject> objects   = new Stack <JSONObject>();
            JSONObject         lastValue = null;

            Stack <ParserState> states = new Stack <ParserState>();
            ParserState         state  = ParserState.None;

            Stack <int>    indexs = new Stack <int>();
            Stack <string> keys   = new Stack <string>();

            JSONObject curValue = null;

            int    index = 0;
            string key   = null;

            do
            {
                var type = lexer.Next();
                if (!CheckSyntaxByState(state, type))
                {
                    return(CreateErrorObject(lexer.currentToken));
                }

                switch (type)
                {
                case TokenType.TokLBracket:
                    objects.Push(lastValue);
                    states.Push(state);
                    indexs.Push(index);

                    index     = 0;
                    lastValue = new JSONArray();
                    state     = ParserState.StartArray;
                    break;

                case TokenType.TokLBrace:
                    objects.Push(lastValue);
                    states.Push(state);
                    keys.Push(key);

                    lastValue = new JSONObject();
                    state     = ParserState.StartObject;
                    break;

                case TokenType.TokRBracket:
                    index     = indexs.Pop();
                    curValue  = lastValue;
                    lastValue = objects.Pop();
                    state     = states.Pop();
                    break;

                case TokenType.TokRBrace:
                    key       = keys.Pop();
                    curValue  = lastValue;
                    lastValue = objects.Pop();
                    state     = states.Pop();
                    break;

                case TokenType.TokString:
                    if (state == ParserState.StartObjectElement)
                    {
                        key = lexer.currentToken.stringToken;
                        var nextType = lexer.Next();
                        if (nextType != TokenType.TokColon)
                        {
                            return(CreateErrorObject(lexer.currentToken));
                        }
                        state = ParserState.StartObjectKey;
                    }
                    else
                    {
                        curValue = new JSONObject(lexer.currentToken.stringToken);
                    }
                    break;

                case TokenType.TokNumber:
                    curValue = new JSONObject(lexer.currentToken.numberToken);
                    break;

                case TokenType.TokTrue:
                    curValue = new JSONObject(true);
                    break;

                case TokenType.TokFalse:
                    curValue = new JSONObject(false);
                    break;

                case TokenType.TokNull:
                    curValue = new JSONNull();
                    break;

                case TokenType.TokComma:
                    break;

                case TokenType.TokEnd:
                    return(CreateErrorObject(lexer.currentToken));
                }

                if (state == ParserState.None)
                {
                    return(curValue);
                }

                if (!SwitchStateAndSetElement(ref state, ref curValue, ref lastValue, ref index, ref key))
                {
                    return(CreateErrorObject(lexer.currentToken));
                }
            } while (true);
        }
示例#14
0
 private JSONNode stringOrNull(string str)
 {
     return(str == null ? (JSONNode)JSONNull.CreateOrGet() : (JSONNode) new JSONString(str));
 }
示例#15
0
        private void ChangeType(object sender, EventArgs e)
        {
            ComboBox c = (ComboBox)sender;
            JSONNode n = (JSONNode)c.Tag;
            TreeNode t = JSONFormUtil.FindTreeNode(tview_object.TopNode, n);
            JSONNode newnode;

            switch (c.SelectedIndex)
            {
            case 0:
                newnode = new JSONArray();
                break;

            case 1:
                newnode = new JSONBool(true);
                break;

            case 2:
                newnode = new JSONNull();
                break;

            case 3:
                newnode = new JSONNumber(0);
                break;

            case 4:
                newnode = new JSONObject();
                break;

            case 5:
                newnode = new JSONString("type a string");
                break;

            default:
                newnode = new JSONNull();
                break;
            }
            t.Nodes.Clear();
            t.Text = newnode.type.GetTypeString();
            t.Tag  = newnode;
            JSONNode pNode = n.parent;

            for (int i = 0; i < pNode.Count; ++i)
            {
                if (ReferenceEquals(pNode[i], n))
                {
                    pNode[i] = newnode;
                    break;
                }
            }
            Panel p = (Panel)c.Parent;

            p.Tag = newnode;

            Control keybox         = FindControl(p, "keybox");
            string  original_key   = keybox.Text;
            bool    original_fixed = keybox.Enabled;

            p.Controls.Clear();

            p.Controls.Add(CreateKeyBox(newnode, original_key, original_fixed));
            p.Controls.Add(CreateComboBox(newnode));
            p.Controls.Add(CreateDeleteButton(newnode));
            if (newnode.type == JSONType.Object || newnode.type == JSONType.Array)
            {
                p.Controls.Add(CreateValueLabel());
                p.Controls.Add(CreateModifyButton(newnode));
                Panel g = CreateJSONNodeGroupBox(newnode, p);
                p.Controls.Add(CreateNewNodeButton(newnode));
                g.BackColor = FormConstValue.baseColor;
                g.Location  = new Point(FormConstValue.stepX, FormConstValue.stepY);
                p.Controls.Add(g);
            }
            else
            {
                p.Controls.Add(CreateValueTextBox(newnode));
            }
            PanelReSort(p);
        }
示例#16
0
        private void UpdateBeatmapJSON()
        {
            if (gameStatus.songName == null)
            {
                _statusJSON["beatmap"] = null;
                return;
            }

            if (_statusJSON["beatmap"] == null)
            {
                _statusJSON["beatmap"] = new JSONObject();
            }
            JSONObject beatmapJSON = (JSONObject)_statusJSON["beatmap"];

            beatmapJSON["songName"]                = stringOrNull(gameStatus.songName);
            beatmapJSON["songSubName"]             = stringOrNull(gameStatus.songSubName);
            beatmapJSON["songAuthorName"]          = stringOrNull(gameStatus.songAuthorName);
            beatmapJSON["levelAuthorName"]         = stringOrNull(gameStatus.levelAuthorName);
            beatmapJSON["songCover"]               = String.IsNullOrEmpty(gameStatus.songCover) ? (JSONNode)JSONNull.CreateOrGet() : (JSONNode) new JSONString(gameStatus.songCover);
            beatmapJSON["songHash"]                = stringOrNull(gameStatus.songHash);
            beatmapJSON["levelId"]                 = stringOrNull(gameStatus.levelId);
            beatmapJSON["songBPM"]                 = gameStatus.songBPM;
            beatmapJSON["noteJumpSpeed"]           = gameStatus.noteJumpSpeed;
            beatmapJSON["noteJumpStartBeatOffset"] = gameStatus.noteJumpStartBeatOffset;
            beatmapJSON["songTimeOffset"]          = new JSONNumber(gameStatus.songTimeOffset);
            beatmapJSON["start"]           = gameStatus.start == 0 ? (JSONNode)JSONNull.CreateOrGet() : (JSONNode) new JSONNumber(gameStatus.start);
            beatmapJSON["paused"]          = gameStatus.paused == 0 ? (JSONNode)JSONNull.CreateOrGet() : (JSONNode) new JSONNumber(gameStatus.paused);
            beatmapJSON["length"]          = new JSONNumber(gameStatus.length);
            beatmapJSON["difficulty"]      = stringOrNull(gameStatus.difficulty);
            beatmapJSON["difficultyEnum"]  = stringOrNull(gameStatus.difficultyEnum);
            beatmapJSON["characteristic"]  = stringOrNull(gameStatus.characteristic);
            beatmapJSON["notesCount"]      = gameStatus.notesCount;
            beatmapJSON["bombsCount"]      = gameStatus.bombsCount;
            beatmapJSON["obstaclesCount"]  = gameStatus.obstaclesCount;
            beatmapJSON["maxScore"]        = gameStatus.maxScore;
            beatmapJSON["maxRank"]         = gameStatus.maxRank;
            beatmapJSON["environmentName"] = gameStatus.environmentName;

            if (beatmapJSON["color"] == null)
            {
                beatmapJSON["color"] = new JSONObject();
            }
            JSONObject colorJSON = (JSONObject)beatmapJSON["color"];

            UpdateColor(gameStatus.colorSaberA, colorJSON, "saberA");
            UpdateColor(gameStatus.colorSaberB, colorJSON, "saberB");
            UpdateColor(gameStatus.colorEnvironment0, colorJSON, "environment0");
            UpdateColor(gameStatus.colorEnvironment1, colorJSON, "environment1");
            UpdateColor(gameStatus.colorEnvironmentBoost0, colorJSON, "environment0Boost");
            UpdateColor(gameStatus.colorEnvironmentBoost1, colorJSON, "environment1Boost");
            UpdateColor(gameStatus.colorObstacle, colorJSON, "obstacle");
        }
示例#17
0
        private void UpdatePerformanceJSON()
        {
            if (this.GameStatus.start == 0)
            {
                this.StatusJSON["performance"] = null;
                return;
            }

            if (this.StatusJSON["performance"] == null)
            {
                this.StatusJSON["performance"] = new JSONObject();
            }
            var performanceJSON = this.StatusJSON["performance"].AsObject;

            performanceJSON["rawScore"].AsInt        = this.GameStatus.rawScore;
            performanceJSON["score"].AsInt           = this.GameStatus.score;
            performanceJSON["currentMaxScore"].AsInt = this.GameStatus.currentMaxScore;
            performanceJSON["relativeScore"].AsFloat = this.GameStatus.relativeScore;
            performanceJSON["rank"] = this.GameStatus.rank;
            performanceJSON["passedNotes"].AsInt          = this.GameStatus.passedNotes;
            performanceJSON["hitNotes"].AsInt             = this.GameStatus.hitNotes;
            performanceJSON["missedNotes"].AsInt          = this.GameStatus.missedNotes;
            performanceJSON["lastNoteScore"].AsInt        = this.GameStatus.lastNoteScore;
            performanceJSON["passedBombs"].AsInt          = this.GameStatus.passedBombs;
            performanceJSON["hitBombs"].AsInt             = this.GameStatus.hitBombs;
            performanceJSON["combo"].AsInt                = this.GameStatus.combo;
            performanceJSON["maxCombo"].AsInt             = this.GameStatus.maxCombo;
            performanceJSON["multiplier"].AsInt           = this.GameStatus.multiplier;
            performanceJSON["multiplierProgress"].AsFloat = this.GameStatus.multiplierProgress;
            performanceJSON["batteryEnergy"]              = this.GameStatus.modBatteryEnergy || this.GameStatus.modInstaFail ? (JSONNode) new JSONNumber(this.GameStatus.batteryEnergy) : (JSONNode)JSONNull.CreateOrGet();
            performanceJSON["energy"].AsFloat             = this.GameStatus.energy;
            performanceJSON["softFailed"].AsBool          = this.GameStatus.softFailed;
            performanceJSON["currentSongTime"].AsInt      = this.GameStatus.currentSongTime;
        }