Пример #1
0
    void Init()
    {
        string configPath = SceneTools.getConfigPath();

        System.Reflection.PropertyInfo[] proInfo;
        ConfHelper.LoadFromExcel <BaseItem>(configPath + "BaseItem.xlsx", 0, out baseItemsData, out proInfo);
        Scene scene = SceneManager.GetActiveScene();

        if (scene == null)
        {
            return;
        }
        sceneName = scene.name;
        dataDir   = Application.streamingAssetsPath + "/SceneData/" + sceneName + "/";
        string lightJsonStr = SceneTools.getJsonFile(dataDir + "lightData/" + sceneName + "_0_light.json");

        //object ooo = fastJSON.JSON.Parse(lightJsonStr);
        //objLightData = (SceneObjLightData)fastJSON.JSON.Parse(lightJsonStr);
        objLightData = fastJSON.JSON.ToObject <SceneObjLightData>(lightJsonStr);
        string itemJsonStr = SceneTools.getJsonFile(dataDir + sceneName + "_0.json");

        sceneItem = fastJSON.JSON.ToObject <SceneItemJson>(itemJsonStr);

        //sceneItem = (SceneItemJson)fastJSON.JSON.ToObject(itemJsonStr);
        for (int i = 0; i < sceneItem.items.Count; i++)
        {
            itemState.Add(false);
        }
        tex = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/Res/Scene/" + sceneName + "/Lightmap-0_comp_light.exr");
    }