Esempio n. 1
0
 public void Fill(Component com, MyJson.IJsonNode json)
 {
     MeshRenderer t = com as MeshRenderer;
     t.castShadows = json.GetDictItem("castShadows").AsBool();
     t.receiveShadows = json.GetDictItem("receiveShadows").AsBool();
     t.useLightProbes = json.GetDictItem("useLightProbes").AsBool();
     List<Material> mats = new List<Material>();
     foreach (var item in json.GetDictItem("materials").AsList())
     {
         Material mat = new Material(Shader.Find(item.GetDictItem("shader").AsString()));
         mat.name = item.GetDictItem("name").AsString();
         List<string> keywords = new List<string>();
         foreach (var key in item.GetDictItem("shaderkeyword").AsList())
         {
             keywords.Add(key.AsString());
         }
         mat.shaderKeywords = keywords.ToArray();
         if (item.HaveDictItem("maintex"))
         {
             mat.mainTexture = AssetMgr.Instance.GetTexture(item.GetDictItem("maintex").AsString());
         }
         mats.Add(mat);
     }
     t.sharedMaterials = mats.ToArray();
 }
Esempio n. 2
0
    public void Fill(Component com, MyJson.IJsonNode json)
    {
        MeshCollider t = com as MeshCollider;
        var jsono = json as MyJson.JsonNode_Object;

        t.isTrigger = jsono["isTrigger"] as MyJson.JsonNode_ValueNumber;
        t.sharedMesh = AssetMgr.Instance.GetMesh(jsono["mesh"].ToString());
        t.convex = json.GetDictItem("convex").AsBool();
        t.smoothSphereCollisions = json.GetDictItem("smoothSphereCollisions").AsBool();
    }
Esempio n. 3
0
    public void Fill(Component com, MyJson.IJsonNode json)
    {
        Light t = com as Light;
        t.type = (LightType)json.GetDictItem("type").AsInt();
        if (t.type == LightType.Spot)
        {
            t.range = (float)json.GetDictItem("range").AsDouble();
            t.spotAngle = (float)json.GetDictItem("spotangle").AsDouble();




        }
        if (t.type == LightType.Point)
        {
            t.range = (float)json.GetDictItem("range").AsDouble();

        }

        if (t.type != LightType.Area)
        {
            t.color = ComponentTypeConvert.StringToColor(json.GetDictItem("color").AsString());
            t.intensity = (float)json.GetDictItem("intensity").AsDouble();

            //t.cookie
            //t.cookiesize
            t.shadows = (LightShadows)json.GetDictItem("shadowtype").AsInt();

            if (t.shadows != LightShadows.None)
            {
                t.shadowStrength = (float)json.GetDictItem("shadowStrength").AsDouble();
                t.shadowBias = (float)json.GetDictItem("shadowBias").AsDouble();
                //shadow质量找不到怎么操作
            }

            if (t.shadows == LightShadows.Soft)
            {
                t.shadowSoftness = (float)json.GetDictItem("shadowSoftness").AsDouble();
                t.shadowSoftnessFade = (float)json.GetDictItem("shadowSoftnessFade").AsDouble();

            }
            //Drawhalo not found
            //flare
            t.renderMode = (LightRenderMode)json.GetDictItem("renderMode").AsInt();

            json.SetDictValue("renderMode", (int)t.renderMode);
            t.cullingMask = json.GetDictItem("cullingMask").AsInt();

            //lightmapping not found


        }
    }