Ejemplo n.º 1
0
    static void CreateWindow()
    {
        Rect rect = new Rect(0, 0, 800, 700);

        window = (SceneWindow)EditorWindow.GetWindowWithRect(typeof(SceneWindow), rect, true, "场景编辑器");
        if (window.Init())
        {
            window.Show();
        }
    }
Ejemplo n.º 2
0
    private static void Init()
    {
        SceneWindow instance = GetWindow <SceneWindow>();

        instance.Show();
    }
Ejemplo n.º 3
0
    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);
    }