private bool Init() { sceneConfigPath = Application.dataPath + "/" + sceneConfigPath; Scene curScene = SceneManager.GetActiveScene(); if (curScene == null) { window.Close(); window = null; UnityEditor.EditorUtility.DisplayDialog("Title", "请先打开场景", "是"); return(false); } m_sceneName = curScene.name; LoadGroups(); string configPath = SceneTools.getConfigPath(); try { baseItemsData.Clear(); System.Reflection.PropertyInfo[] proInfo; ConfHelper.LoadFromExcel <BaseItem>(configPath + "exhibit.xlsx", 0, out baseItemsData, out proInfo); } catch (IOException ex) { window.Close(); window = null; UnityEditor.EditorUtility.DisplayDialog("Title", "先关表!!!", "是"); return(false); } return(true); }
private void LoadResSceneData() { string configPath = SceneTools.getConfigPath(); System.Reflection.PropertyInfo[] sceneProInfo; ConfHelper.LoadFromExcel <SceneConfig>(configPath + "sceneResEditor.xlsx", 0, out sceneConfig, out sceneProInfo); }
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"); }
bool Init() { //load base item for table Scene scene = SceneManager.GetActiveScene(); if (scene != null) { sceneName = scene.name; pathDir = "Assets" + pathDir + scene.name + "/"; //+ ".asset"; } if (string.IsNullOrEmpty(sceneName) || sceneName.Equals("EmptyScene") || sceneName.Equals("main_ui")) { UnityEditor.EditorUtility.DisplayDialog("Title", "当前场景为空!!!", "是"); return(false); } m_allItemInfo = JsonToSceneData.RevertAsset(); lightTempPath += sceneName; scenePath += sceneName; jsonPath = Application.dataPath + jsonPath + sceneName + "/"; string configPath = SceneTools.getConfigPath(); try { System.Reflection.PropertyInfo[] proInfo; ConfHelper.LoadFromExcel <BaseItem>(configPath + "exhibit.xlsx", 0, out baseItemsData, out proInfo); List <SceneConfig> sceneConfig; System.Reflection.PropertyInfo[] sceneProInfo; ConfHelper.LoadFromExcel <SceneConfig>(configPath + "sceneResEditor.xlsx", 0, out sceneConfig, out sceneProInfo); sceneID = getSceneID(sceneConfig); //if (!Directory.Exists(pathDir)) //{ // Directory.CreateDirectory(pathDir); // //创建asset // itemInfos = ScriptableObject.CreateInstance<SceneItemInfo>(); // itemInfos.items = new List<ItemInfo>(); // AssetDatabase.CreateAsset(itemInfos, pathDir + sceneName + "_0.asset"); // AssetDatabase.Refresh(); //} //string[] allAssetPath = Directory.GetFiles(pathDir, "*.asset"); for (int i = 0; i < m_allItemInfo.Count; i++) { m_allAssetName.Add(m_allItemInfo[i].jsonName); } LoadAssetData(); GameObject[] cameraPoint = GameObject.FindGameObjectsWithTag("cameraPoint"); m_allCameraNode.Add("MainCamera"); for (int i = 0; i < cameraPoint.Length; i++) { m_allCameraNode.Add(cameraPoint[i].name); } UserLog.OpenSceneLog(); } catch (IOException ex) { window.Close(); window = null; UnityEditor.EditorUtility.DisplayDialog("Title", "先关表!!!", "是"); return(false); } return(true); }
public bool Init() { string sceneConfigPath = Application.dataPath + "/" + LightingData.constConfigPath; string scenePath = Application.dataPath + "/Res/Scene/"; Scene curScene = SceneManager.GetActiveScene(); if (curScene == null) { window.Close(); window = null; UnityEditor.EditorUtility.DisplayDialog("Title", "请先打开场景", "是"); return(false); } m_sceneName = curScene.name; lightSystem = new LightSystem(new LightingData(curScene.name, sceneConfigPath, SceneTools.getConfigPath(), scenePath)); recoverSystem = new LightRecoverSystem(new LightingData(curScene.name, sceneConfigPath, SceneTools.getConfigPath(), scenePath)); lightSystem.OnInit(); Lightmapping.completed = lightSystem.BakeOver; return(true); }