Esempio n. 1
0
    public static ScenePageWindow CreateWindow()
    {
        Rect rect = new Rect(0, 0, 500, 200);

        window = (ScenePageWindow)EditorWindow.GetWindowWithRect(typeof(ScenePageWindow), rect, true, "页签");

        return(window);
    }
Esempio n. 2
0
    void OnGUI()
    {
        if (string.IsNullOrEmpty(sceneName))
        {
            EditorGUILayout.HelpBox("请先保存场景", MessageType.Error);
            return;
        }
        //if (lightMapTex == null)
        //{
        //    EditorGUILayout.HelpBox("请先烘焙场景",MessageType.Error);
        //}

        if (!Lightmapping.isRunning && isRunning)
        {
            isRunning = false;
            SaveLightData();
        }

        EditorGUILayout.BeginVertical();
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("当前场景名称:" + sceneName);
        //lightMapTex = (Texture2D)EditorGUILayout.ObjectField(lightMapTex, typeof(Texture2D), true);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();

        if (selectDataIndex >= 0 && m_allAssetName.Count > selectDataIndex && m_allAssetName[selectDataIndex] != null)
        {
            EditorGUILayout.LabelField("当前场景数据:" + m_allAssetName[selectDataIndex]);
        }
        sceneDataIndex = EditorGUILayout.Popup(sceneDataIndex, m_allAssetName.ToArray());
        if (selectDataIndex != sceneDataIndex)
        {
            LoadAssetData();
        }
        if (GUILayout.Button("添加分页"))
        {
            AddDataPage();
        }
        if (GUILayout.Button("删除分页"))
        {
            RemoveDataPage();
        }

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("添加物品"))
        {
            AddItem();
        }
        if (GUILayout.Button("添加节点"))
        {
            AddItemNode();
        }
        if (GUILayout.Button("移除物品"))
        {
            RemoveItem();
        }
        if (GUILayout.Button("输出"))
        {
            SaveItem();
        }

        if (GUILayout.Button("提取场景光照"))
        {
            SceneBake();
        }

        if (GUILayout.Button("同步所有数据"))
        {
            // SceneBake();
            if (UnityEditor.EditorUtility.DisplayDialog("Title", "别点错页签了,下手谨慎点----", "是", "取消"))
            {
                Debug.Log("SyncItem ===");
                SyncAllItem();
            }
        }

        if (GUILayout.Button("同步页签数据"))
        {
            // SceneBake();
            ScenePageWindow pageWin = ScenePageWindow.CreateWindow();
            pageWin.SetAllAssetName(m_allAssetName);
            pageWin.Show();
        }

        EditorGUILayout.EndHorizontal();

        #region 具体物品
        EditorGUILayout.BeginHorizontal();

        EditorGUILayout.BeginVertical();
        itemBeginScroll = EditorGUILayout.BeginScrollView(itemBeginScroll, GUILayout.Width(250), GUILayout.Height(580));
        InitItem();
        EditorGUILayout.EndScrollView();
        EditorGUILayout.EndVertical();

        GUILayout.BeginVertical();
        itemInfoBenginScroll = EditorGUILayout.BeginScrollView(itemInfoBenginScroll, GUILayout.Width(550), GUILayout.Height(580));
        ItemClick(selectItem);
        EditorGUILayout.EndScrollView();
        GUILayout.EndVertical();

        EditorGUILayout.EndHorizontal();
        #endregion
        EditorGUILayout.EndVertical();
    }