public IParseble Parse(JSONNode projectNode)
        {
            id     = projectNode ["id"].AsInt;
            name   = projectNode ["name"];
            nameEn = projectNode ["nameEn"];
            virtualCurrencyName    = projectNode ["virtualCurrencyName"];
            virtualCurrencyIconUrl = projectNode ["virtualCurrencyImage"];
            merchantId             = projectNode ["merchantId"].AsInt;
            isDiscrete             = projectNode ["isDiscrete"].AsBool;
            projectUrl             = projectNode ["projectUrl"];
            returnUrl             = projectNode ["returnUrl"];
            isKeepUsers           = projectNode ["isKeepUsers"].AsBool;
            recurringPackageCount = projectNode ["recurringPackageCount"].AsInt;
            eula             = projectNode ["eula"];
            canRepeatPayment = projectNode ["canRepeatPayment"].AsBool;

            JSONClass   jsonObj  = projectNode["components"].AsObject;
            IEnumerator elements = jsonObj.GetEnumerator();

            while (elements.MoveNext())
            {
                KeyValuePair <string, JSONNode> elem = (KeyValuePair <string, JSONNode>)elements.Current;
                string localName = elem.Value["name"].Value;
                bool   isEnabled = elem.Value["enabled"].AsBool;
                Debug.Log("elem.Key " + elem.Key + " name " + localName + " isEnabled " + isEnabled);
                XComponent newComponent = new XComponent(localName, isEnabled);
                components.Add(elem.Key, newComponent);
            }
            return(this);
        }
Esempio n. 2
0
        public IParseble Parse(JSONNode projectNode)
        {
            id = projectNode ["id"].AsInt;
            name = projectNode ["name"];
            nameEn = projectNode ["nameEn"];
            virtualCurrencyName = projectNode ["virtualCurrencyName"];
            virtualCurrencyIconUrl = projectNode ["virtualCurrencyImage"];
            merchantId = projectNode ["merchantId"].AsInt;
            isDiscrete = projectNode ["isDiscrete"].AsBool;
            projectUrl = projectNode ["projectUrl"];
            returnUrl = projectNode ["returnUrl"];
            isKeepUsers = projectNode ["isKeepUsers"].AsBool;
            recurringPackageCount = projectNode ["recurringPackageCount"].AsInt;
            eula = projectNode ["eula"];
            canRepeatPayment = projectNode ["canRepeatPayment"].AsBool;

            JSONClass jsonObj = projectNode["components"].AsObject;
            IEnumerator elements = jsonObj.GetEnumerator();
            while (elements.MoveNext()) {
                KeyValuePair<string, JSONNode> elem = (KeyValuePair<string, JSONNode>)elements.Current;
                string localName = elem.Value["name"].Value;
                bool isEnabled = elem.Value["enabled"].AsBool;
                Debug.Log ("elem.Key " + elem.Key + " name " + localName + " isEnabled " + isEnabled);
                XComponent newComponent = new XComponent(localName, isEnabled);
                components.Add(elem.Key, newComponent);
            }
            return this;
        }