Пример #1
0
        public List <AttributesValue> values; //Product-

        internal void Deserialize(Dictionary <string, object> dic)
        {
            foreach (string key in dic.Keys)
            {
                switch (key)
                {
                case "free":
                    free = MyJsonTool.getStringListValue(dic, key);
                    break;

                case "id":
                    id = MyJsonTool.getStringValue(dic, key);
                    break;

                case "name":
                    name = MyJsonTool.getStringValue(dic, key);
                    break;

                case "values":
                {
                    object obj = MyJsonTool.getValue(dic, key);
                    if (obj == null)
                    {
                        values = null;
                    }
                    else
                    {
                        values = new List <AttributesValue>();
                        List <object> list = obj as List <object>;
                        for (int i = 0; i < list.Count; i++)
                        {
                            AttributesValue value = new AttributesValue();
                            value.Deserialize(list[i] as Dictionary <string, object>);
                            values.Add(value);
                        }
                    }
                }
                break;

                default:
                    Debug.LogError("Json " + this.GetType().Name + " 里的 key = " + key + " 未实现!");
                    break;
                }
            }
        }
    public void DeSerialize(Dictionary <string, object> dic)
    {
        if (dic == null)
        {
            Debug.LogError("OriginalProjectData dic.DeSerialize(dic), dic = null");
            return;
        }
        data    = new OriginalInputData();
        version = new MyTimeData();
        foreach (string key in dic.Keys)
        {
            switch (key)
            {
            case "id":
                id = MyJsonTool.getStringValue(dic, key);
                break;

            case "meta":
                meta = MyJsonTool.getStringValue(dic, key);
                break;

            case "data":
            {
                object obj = MyJsonTool.getValue(dic, key);
                data.isOld = false;
                if (dic.ContainsKey("version") == false)
                {
                    data.isOld = true;
                }
                data.DeSerialize(obj as Dictionary <string, object>);
            }
            break;

            case "name":
                name = MyJsonTool.getStringValue(dic, key);
                break;

            case "description":
                description = MyJsonTool.getStringValue(dic, key);
                break;

            case "priceIdList":
                priceIdList = MyJsonTool.getStringListValue(dic, key);
                break;

            case "tempId":
                tempId = MyJsonTool.getIntValue(dic, key);
                break;

            case "idNew":
                isNew = MyJsonTool.getBoolValue(dic, key);
                //isNew = false;
                break;

            case "version":
            {
                object obj = MyJsonTool.getValue(dic, key);
                version.DeSerialize(obj as Dictionary <string, object>);
                //isNew = false;
            }
            break;

            default:
                break;
            }
        }
    }
Пример #3
0
    //public void WriteToProduct(JsonProduct product)
    //{
    //    product.id = id;
    //    product.seekId = model.id;
    //    product.thumbnail = model.vendorUrl;
    //    product.size = model.getSize;
    //    product.productType = model.productType;
    //    product.images = model.images;
    //    product.imagesResize = model.imagesResize;
    //    product.categories = model.categories;
    //    product.families = model.families;
    //    product.v = model.vendor;
    //    product.vu = model.vendorUrl;
    //    product.status = model.status;

    //    //亚马逊
    //    string top = model.top;//"http://midea-prod-assets.s3.cn-north-1.amazonaws.com.cn/i/7e3e90d9-da17-459d-b7ed-14e681519d6a/Top.png";//
    //                           //top = top.Replace("midea-prod-assets.s3.cn-north-1.amazonaws.com.cn/i/", "pms.3dshome.net/");
    //    product.top = top;

    //    //阿里云
    //    string path = model.model.modelUrl;//"4abd1bba-6d61-481e-9008-25295599e006"
    //    path = path.Replace("-fc.gz", ".assetbundle");
    //    path = path.Replace("midea-prod-assets.s3.cn-north-1.amazonaws.com.cn/i/", "midea-products.oss-cn-shanghai.aliyuncs.com/");
    //    path = path.Replace(".gz.bobj", ".assetbundle");
    //    path = path.Replace("hsm-prod-assets.s3.amazonaws.com/i/", "midea-products.oss-cn-shanghai.aliyuncs.com/");
    //    product.model3d = path;//"http://midea-products.oss-cn-shanghai.aliyuncs.com/7e3e90d9-da17-459d-b7ed-14e681519d6a/model.assetbundle";//path//;

    //    product.modelTexture = model.model.textureUrl;//.Replace("midea-prod-assets.s3.cn-north-1.amazonaws.com.cn/", "midea-products.oss-cn-shanghai.aliyuncs.com/");
    //    product.entityType = model.tp;

    //    //product.components = model.components;
    //    //product.isScalable = model.isScalable;
    //    //product.variations = model.variations;
    //    //product.variationId = model.variationId;
    //    //product.defaultHeight = model.defaultHeight;
    //    //product.unit = model.unit;
    //    //product.contentType = model.contentType;
    //    //product.entityType = model.entityType;
    //    //product.productURL = model.productURL;
    //    if (model.attributes != null)
    //    {
    //        for (int i = 0; i < model.attributes.Count; i++)
    //        {
    //            Product.Attributes1 attributes1 = model.attributes[i];
    //            if (attributes1.name == "ContentType" && attributes1.values.Count > 0)
    //            {
    //                product.contentType = attributes1.values[0].value;
    //            }
    //        }
    //        if (product.contentType.StartsWith("window/") == true) product.defaultHeight = 1;//2;//
    //    }
    //    else
    //    {

    //    }
    //    product.name = model.name;
    //    product.retailers = model.retailers;
    //    product.modifiedTime = model.modifiedTime;
    //    product.ticket = model.ticket;
    //    product.groups = model.groups;
    //    product.zIndex = model.zIndex;
    //    product.tileSize = model.tileSize;
    //    product.attributes = model.attributes;
    //    product.variations = model.variations;
    //}
    public void DeSerialize(Dictionary <string, object> dic)
    {
        foreach (string key in dic.Keys)
        {
            switch (key)
            {
            case "retailers":
                retailers = MyJsonTool.getStringListValue(dic, key);
                break;

            case "boundingBox":
            {
                boundingBox = new BoundingBox();
                object obj = MyJsonTool.getValue(dic, key);
                boundingBox.Deserialize(obj as Dictionary <string, object>);
            }
            break;

            case "modifiedTime":
                modifiedTime = MyJsonTool.getStringValue(dic, key);
                break;

            case "vendorUrl":
                vendorUrl = MyJsonTool.getStringValue(dic, key);
                break;

            case "images":
                images = MyJsonTool.getStringListValue(dic, key);
                break;

            case "imagesResize":
                imagesResize = MyJsonTool.getStringListValue(dic, key);
                break;

            case "ticket":
            {
                object obj = MyJsonTool.getValue(dic, key);
                if (obj == null)
                {
                    ticket = null;
                }
                else
                {
                    ticket = new Ticket();
                    ticket.Deserialize(obj as Dictionary <string, object>);
                }
            }
            break;

            case "groups":
                groups = MyJsonTool.getStringListValue(dic, key);
                break;

            case "families":
                families = MyJsonTool.getStringListValue(dic, key);
                break;

            case "top":
                top = MyJsonTool.getStringValue(dic, key);
                break;

            case "vendor":
                vendor = MyJsonTool.getStringValue(dic, key);
                break;

            case "name":
                name = MyJsonTool.getStringValue(dic, key);
                break;

            case "model":
            {
                object obj = MyJsonTool.getValue(dic, key);
                model = new GoodsURL();
                model.Deserialize(obj as Dictionary <string, object>);
            }
            break;

            case "status":
                status = MyJsonTool.getIntValue(dic, key);
                break;

            case "productType":
                productType = MyJsonTool.getStringValue(dic, key);
                break;

            case "id":
                id = MyJsonTool.getStringValue(dic, key);
                break;

            case "tp":
                tp = MyJsonTool.getStringValue(dic, key);
                break;

            case "zIndex":
                zIndex = MyJsonTool.getStringValue(dic, key);
                break;

            case "tileSize":
                tileSize = MyJsonTool.getStringValue(dic, key);
                break;

            case "attributes":
            {
                object obj = MyJsonTool.getValue(dic, key);
                attributes = new List <Attributes1>();
                List <object> list = obj as List <object>;
                for (int i = 0; i < list.Count; i++)
                {
                    Attributes1 attribute = new Attributes1();
                    attribute.Deserialize(list[i] as Dictionary <string, object>);
                    attributes.Add(attribute);
                }
            }
            break;

            case "categories":
                categories = MyJsonTool.getStringListValue(dic, key);
                break;

            case "variations":
                variations = MyJsonTool.getStringListValue(dic, key);
                break;

            default:
                Debug.LogError("Json " + this.GetType().Name + " 里的 key = " + key + " 未实现!");
                break;
            }
        }
    }
Пример #4
0
    public void DeSerialize(Dictionary <string, object> dic)
    {
        foreach (string key in dic.Keys)
        {
            switch (key)
            {
            case "id":
                id = MyJsonTool.getStringValue(dic, key);
                break;

            case "size":
                size = MyJsonTool.getVector3(dic, key);
                break;

            case "defaultHeight":
                defaultHeight = MyJsonTool.getFloatValue(dic, key);
                break;

            case "seekId":
                seekId = MyJsonTool.getStringValue(dic, key);
                break;

            case "name":
                name = MyJsonTool.getStringValue(dic, key);
                break;

            case "unit":
                unit = MyJsonTool.getStringValue(dic, key);
                break;

            case "productType":
                productType = MyJsonTool.getStringValue(dic, key);
                break;

            case "contentType":
                contentType = MyJsonTool.getStringValue(dic, key);
                break;

            case "entityType":
                entityType = MyJsonTool.getStringValue(dic, key);
                break;

            case "thumbnail":
                thumbnail = MyJsonTool.getStringValue(dic, key);
                break;

            case "images":
                images = MyJsonTool.getStringListValue(dic, key);
                break;

            case "imagesResize":
                imagesResize = MyJsonTool.getStringListValue(dic, key);
                break;

            case "categories":
                categories = MyJsonTool.getStringListValue(dic, key);
                break;

            case "families":
                families = MyJsonTool.getStringListValue(dic, key);
                break;

            case "v":
                v = MyJsonTool.getStringValue(dic, key);
                break;

            case "vu":
                vu = MyJsonTool.getStringValue(dic, key);
                break;

            case "productURL":
                productURL = MyJsonTool.getStringValue(dic, key);
                break;

            case "status":
                status = MyJsonTool.getIntValue(dic, key);
                break;

            case "modelTexture":
                modelTexture = MyJsonTool.getStringValue(dic, key);
                break;

            case "model3d":
            {
                //阿里云
                string path = MyJsonTool.getStringValue(dic, key);
                //alluserdata/youke001/Assetbundle/03e68276-b2f4-4a2a-ac71-c86b8690b618/model.assetbundle(Clone)
                //"http://hsm-prod-assets.s3.amazonaws.com/i/4abd1bba-6d61-481e-9008-25295599e006/model.gz.bobj"
                path = path.Replace("-fc.gz", ".assetbundle");
                path = path.Replace("midea-prod-assets.s3.cn-north-1.amazonaws.com.cn/i/", "midea-products.oss-cn-shanghai.aliyuncs.com/");

                path = path.Replace(".gz.bobj", ".assetbundle");
                path = path.Replace("hsm-prod-assets.s3.amazonaws.com/i/", "midea-products.oss-cn-shanghai.aliyuncs.com/");
                //path = path.Replace("hsm-prod-assets.s3.amazonaws.com/i/", "pms.3dshome.net/");

                model3d = path;
            }
            break;

            case "top":
            {
                //亚马逊
                string path = MyJsonTool.getStringValue(dic, key);
                //path = path.Replace("midea-products.oss-cn-shanghai.aliyuncs.com/", "pms.3dshome.net/");
                this.top = path;
            }
            break;

            case "variations":
                variations = MyJsonTool.getStringListValue(dic, key);
                break;

            case "variationId":
                variationId = MyJsonTool.getStringValue(dic, key);
                break;

            case "isScalable":
                isScalable = MyJsonTool.getBoolValue(dic, key);
                break;

            case "components":
                components = MyJsonTool.getStringListValue(dic, key);
                break;

            case "retailers":
                //retailers = MyJsonTool.getStringListValue(dic, key);
                break;

            case "modifiedTime":
                //modifiedTime = MyJsonTool.getStringListValue(dic, key);
                break;

            case "ticket":
                //ticket = MyJsonTool.getStringListValue(dic, key);
                break;

            case "groups":
                //groups = MyJsonTool.getStringListValue(dic, key);
                break;

            case "zIndex":
                //zIndex = MyJsonTool.getStringListValue(dic, key);
                break;

            case "tileSize":
                //tileSize = MyJsonTool.getStringListValue(dic, key);
                break;

            case "attributes":
                //attributes = MyJsonTool.getStringListValue(dic, key);
                break;

            default:
                Debug.LogWarning("Product缺少字段:" + key);
                break;
            }
        }
    }