Example #1
0
        static public ExpressionMinigameSettings FromJSON(JSONNode inJson, ExpressionMinigameCategories inCategories)
        {
            ExpressionMinigameSettings settings = new ExpressionMinigameSettings();

            settings.Categories = inCategories;

            settings.ID = inJson["id"].AsInt;

            settings.Value = inJson["value"].AsInt;

            if (inJson["operator"] != null)
            {
                settings.Operator      = (inJson["operator"].Value == "+" ? OperatorType.Add : OperatorType.Subtract);
                settings.FixedOperator = true;
            }
            else
            {
                settings.FixedOperator = false;
            }

            settings.NumValueSlots = inJson["valueSlots"].AsInt;
            settings.TimeLimit     = inJson["timeLimit"].AsFloat;

            var chickens = inJson["chickens"].AsArray;

            settings.Chickens = new int[chickens.Count];
            for (int i = 0; i < chickens.Count; ++i)
            {
                settings.Chickens[i] = chickens[i].AsInt;
            }

            return(settings);
        }
        private void ParseLevelCollection(JSONArray inNode, ExpressionMinigameCategories inCategories)
        {
            List <ExpressionMinigameSettings> levels = new List <ExpressionMinigameSettings>();

            m_Levels[inCategories] = levels;
            foreach (JSONNode node in inNode)
            {
                ExpressionMinigameSettings level = ExpressionMinigameSettings.FromJSON(node, inCategories);
                levels.Add(level);
            }
        }