コード例 #1
0
        protected override void ItemSelected(AdvancedDropdownItem item)
        {
            if (m_Instance == null)
            {
                return;
            }

            TerrainPieceInfo terrainPieceInfo = m_Instance.m_Scene.GetCurrentTerrainPieceInfo();

            if (terrainPieceInfo == null)
            {
                return;
            }

            string fileName = item.name;
            string fileParentPath;

            if (Child2ParentDict.TryGetValue(fileName, out fileParentPath))
            {
                string extension = Path.GetExtension(fileName);
                if (!string.IsNullOrEmpty(extension))
                {
                    fileName = fileName.Replace(extension, string.Empty);
                }
                string filePath = fileParentPath + "/" + fileName;

                LogHelper.Trace?.Log("TerrainMakerTool", "ItemSelected", filePath);

                m_Instance.GUI_CreateBuilding_WaitCreateBuildingPathList.Add(filePath);
            }
        }
コード例 #2
0
    //-- 表现

    /// <summary>
    /// 逻辑位置转为动态颜色 站立位置改变,颜色跟随改变
    /// </summary>
    /// <param name="terrainPiece"></param>
    /// <returns></returns>
    public Color LogicPositionToDynamicColor(TerrainPieceInfo terrainPiece)
    {
        bool IsCurLogicPosition = terrainPiece.LogicPosition == m_Scene.Input.CurLogicPosition;
        bool IsEndLogicPosition = terrainPiece.LogicPosition == m_Scene.Input.EndLogicPosition;
        bool IsCurLayer         = terrainPiece.LogicPosition.y == m_Scene.Input.CurLogicPosition.y;
        bool IsCover            = terrainPiece.ArtInfo.IsCoverBaseInfo;

        //最终地块
        if (IsEndLogicPosition)
        {
            return(m_Scene.Color.Piece_End);
        }
        //当前地块
        if (IsCurLogicPosition)
        {
            return(m_Scene.Color.Piece_Current);
        }

        Color color = new Color();

        //地块自带颜色
        if (IsCover)
        {
            Color myColor = terrainPiece.ArtInfo.MyColor;
            color = new Color(myColor.r, myColor.g, myColor.b, 1);
        }

        //当前层级
        if (IsCurLayer)
        {
            //使用自带颜色+层级透明度
            if (IsCover)
            {
                color.a = m_Scene.Color.Floor_Current.a;
                return(color);
            }
            //可到达的周围地块
            if (IsCurrentCanArriveTerrainPiece(terrainPiece.LogicPosition))
            {
                return(m_Scene.Color.Piece_ArriveAround);
            }
            else
            {
                return(m_Scene.Color.Piece_Other);
            }
        }
        //其他层级
        else
        {
            //使用自带颜色+层级透明度
            if (IsCover)
            {
                color.a = m_Scene.Color.Floor_Other.a;
                return(color);
            }
            return(m_Scene.Color.Floor_Other);
        }
    }
コード例 #3
0
    public void UpdateCurrentTerrainPieceArt()
    {
        TerrainPieceInfo current = GetCurrentTerrainPieceInfo();

        if (current != null)
        {
            UpdateTerrainArt(current);
        }
    }
コード例 #4
0
    public void UpdateTerrain()
    {
        Dictionary <Vector3, TerrainPieceInfo> .Enumerator enumerator = LogicPosition2TerrainPieceDict.GetEnumerator();
        while (enumerator.MoveNext())
        {
            TerrainPieceInfo terrainPieceInfo = enumerator.Current.Value;

            UpdateTerrainLogic(terrainPieceInfo);
            UpdateTerrainArt(terrainPieceInfo);
        }
    }
コード例 #5
0
    private void GUI_CreateBuilding()
    {
        TerrainPieceInfo terrainPieceInfo = m_Scene.GetCurrentTerrainPieceInfo();

        if (terrainPieceInfo == null)
        {
            return;
        }

        GUI_Title("地块建筑");

        if (GUILayout.Button("创建建筑", GUILayout.Width(GUI_ButtonWidth)))
        {
            var dropdown = new BuildingDropdown(new AdvancedDropdownState());
            dropdown.Show(new Rect(-200, -250, 400, 500));
        }

        if (GUI_CreateBuilding_WaitCreateBuildingPathList.Count > 0)
        {
            for (int index = 0; index < GUI_CreateBuilding_WaitCreateBuildingPathList.Count; index++)
            {
                string filePath = GUI_CreateBuilding_WaitCreateBuildingPathList[index];

                m_Scene.CreateBuilding(filePath);
            }

            GUI_CreateBuilding_WaitCreateBuildingPathList.Clear();
        }

        //显示现有的
        Dictionary <GameObject, TerrainPieceBuildingInfo> .Enumerator enumerator = terrainPieceInfo.ArtInfo.BuildingDict.GetEnumerator();
        while (enumerator.MoveNext())
        {
            GameObject gameObject = enumerator.Current.Key;
            Transform  transform  = gameObject.transform;
            TerrainPieceBuildingInfo terrainPieceBuildingInfo = enumerator.Current.Value;

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(transform.name);
            if (GUILayout.Button("X", GUILayout.Width(GUI_ButtonWidth)))
            {
                GameObject.DestroyImmediate(gameObject);
                terrainPieceInfo.ArtInfo.BuildingDict.Remove(gameObject);
                break;
            }
            EditorGUILayout.EndHorizontal();
        }
    }
コード例 #6
0
    public void CreateTerrainPiece(Vector3 logicPosition)
    {
        if (LogicPosition2TerrainPieceDict.ContainsKey(logicPosition))
        {
            return;
        }

        TerrainPieceInfo terrainPieceInfo = m_Root.PieceFactory.CreateBasisTerrainPiece(logicPosition);

        UpdateTerrainLogic(terrainPieceInfo);
        UpdateTerrainArt(terrainPieceInfo);

        terrainPieceInfo.Transform.SetParent(m_RootTerrainGameObject.transform);

        LogicPosition2TerrainPieceDict.Add(logicPosition, terrainPieceInfo);
    }
コード例 #7
0
    /// <summary>
    /// 是否当前站立块周围可以到达的地块
    /// </summary>
    /// <param name="logicPosition"></param>
    /// <returns></returns>
    public bool IsCurrentCanArriveTerrainPiece(Vector3 logicPosition)
    {
        TerrainPieceInfo curTerrainPieceInfo = m_Scene.GetCurrentTerrainPieceInfo();
        Vector3          distance            = curTerrainPieceInfo.LogicPosition - logicPosition;

        TerrainPieceDirection terrainPieceDirection;

        if (m_Tool.V32EnumDirectionDict.TryGetValue(distance, out terrainPieceDirection))
        {
            bool enable;
            if (curTerrainPieceInfo.DirectionFlagDict.TryGetValue(terrainPieceDirection, out enable))
            {
                return(enable);
            }
        }
        return(false);
    }
コード例 #8
0
    public void CreateBuilding(string filePath)
    {
        TerrainPieceInfo terrainPieceInfo = GetCurrentTerrainPieceInfo();

        GameObject buildingResource   = m_Root.Tool.LoadResource <GameObject>(filePath);
        GameObject buildingGameObject = GameObject.Instantiate(buildingResource);
        Transform  buildingTransfrom  = buildingGameObject.transform;

        buildingTransfrom.SetParent(terrainPieceInfo.BuildingRootTransform);
        buildingTransfrom.localPosition = Vector3.zero;

        TerrainPieceBuildingInfo terrainPieceBuildingInfo = new TerrainPieceBuildingInfo();

        terrainPieceBuildingInfo.ResourcePath = filePath;

        terrainPieceInfo.ArtInfo.BuildingDict.Add(buildingGameObject, terrainPieceBuildingInfo);
    }
コード例 #9
0
    private void UpdatePieceBuilding(TerrainPieceInfo terrainPiece)
    {
        TerrainPieceInfo floorTerrainPieceInfo = GetCurrentTerrainPieceInfo();
        bool             isInFloor             = false;

        if (floorTerrainPieceInfo != null)
        {
            isInFloor = terrainPiece.LogicPosition.y == floorTerrainPieceInfo.LogicPosition.y;
        }

        Dictionary <GameObject, TerrainPieceBuildingInfo> .Enumerator enumerator = terrainPiece.ArtInfo.BuildingDict.GetEnumerator();
        while (enumerator.MoveNext())
        {
            GameObject buildingGameObject = enumerator.Current.Key;
            buildingGameObject.SetActive(isInFloor);
        }
    }
コード例 #10
0
    /// <summary>
    /// 更新地块可以移动的方向
    /// </summary>
    /// <param name="terrainPiece"></param>
    public void ChangeTerrainPieceEnableDirection(TerrainPieceInfo terrainPiece, TerrainPieceDirection terrainPieceDirection, bool enable)
    {
        Dictionary <TerrainPieceDirection, bool> directionFlagDict = terrainPiece.DirectionFlagDict;
        Dictionary <TerrainPieceDirection, bool> updateDict        = new Dictionary <TerrainPieceDirection, bool>();

        // 可以兼容的方向
        Dictionary <TerrainPieceDirection, List <TerrainPieceDirection> > terrainPieceDirectionCompatibleDict = m_Root.GamePlay.GetTerrainPieceDirectionCompatibleDict();
        List <TerrainPieceDirection> compatibleDirectionList = terrainPieceDirectionCompatibleDict[terrainPieceDirection];

        for (int index = 0; index < compatibleDirectionList.Count; index++)
        {
            TerrainPieceDirection compatibleDirection = compatibleDirectionList[index];
            updateDict.Add(compatibleDirection, directionFlagDict[compatibleDirection]);
        }

        updateDict[terrainPieceDirection] = enable;

        //不能兼容的方向
        Dictionary <TerrainPieceDirection, bool> .Enumerator enumerator = directionFlagDict.GetEnumerator();
        while (enumerator.MoveNext())
        {
            TerrainPieceDirection curTerrainPieceDirection = enumerator.Current.Key;
            if (!updateDict.ContainsKey(curTerrainPieceDirection))
            {
                if (enable)
                {
                    updateDict.Add(curTerrainPieceDirection, false);
                }
                else
                {
                    updateDict.Add(curTerrainPieceDirection, directionFlagDict[curTerrainPieceDirection]);
                }
            }
        }

        //更新
        enumerator = updateDict.GetEnumerator();
        while (enumerator.MoveNext())
        {
            TerrainPieceDirection curTerrainPieceDirection = enumerator.Current.Key;
            directionFlagDict[curTerrainPieceDirection] = enumerator.Current.Value;
        }
    }
コード例 #11
0
    private void UpdateTerrainArt(TerrainPieceInfo terrainPiece)
    {
        Transform terrainPieceTransform = terrainPiece.Transform;

        terrainPieceTransform.position   = terrainPiece.WorldPosition;
        terrainPieceTransform.localScale = m_BuildingInfo.TerrainSize;

        Material pieceMaterial = terrainPiece.PieceMaterial;

        pieceMaterial.color = m_Root.GamePlay.LogicPositionToDynamicColor(terrainPiece);

        int pieceShaderLayer = m_Root.GamePlay.GetFloorShaderTargerLayer((int)terrainPiece.LogicPosition.y, FloorShaderLayer.Piece);

        pieceMaterial.renderQueue = pieceShaderLayer;

        UpdatePieceSidePosition(terrainPiece);

        UpdatePieceBuilding(terrainPiece);
    }
コード例 #12
0
    private void GUI_ChangeCurrent()
    {
        TerrainPieceInfo terrainPieceInfo = m_Scene.GetCurrentTerrainPieceInfo();

        if (terrainPieceInfo == null)
        {
            return;
        }

        GUI_Title("设置当前地块");

        EditorGUILayout.BeginHorizontal();
        GUI_ChangeCurrent_CurLogicPosition = EditorGUILayout.Vector3Field("当前逻辑位置", GUI_ChangeCurrent_CurLogicPosition);
        if (GUILayout.Button("确定", GUILayout.Width(GUI_ButtonWidth)))
        {
            SetCurrentSelectPiece(GUI_ChangeCurrent_CurLogicPosition);
        }
        EditorGUILayout.EndHorizontal();
    }
コード例 #13
0
    private void SceneGUI_ShowCurrentAndRound()
    {
        TerrainPieceInfo terrainPieceInfo = m_Scene.GetCurrentTerrainPieceInfo();

        if (terrainPieceInfo == null)
        {
            return;
        }

        if (m_TerrainMakerSceneRender == null)
        {
            GameObject gameObject = new GameObject();
            gameObject.name           = "TerrainMakerSceneRender";
            m_TerrainMakerSceneRender = gameObject.AddComponent <TerrainMakerSceneRender>();
        }

        m_TerrainMakerSceneRender.Clean();

        if (!SceneGUI_ShowCurrentAndRound_Init)
        {
            SceneGUI_ShowCurrentAndRound_PieceWidthRadius   = m_Scene.Building.TerrainSize.x / 2;
            SceneGUI_ShowCurrentAndRound_PieceHeighthRadius = m_Scene.Building.TerrainSize.z / 2;
            SceneGUI_ShowCurrentAndRound_RoundWorlds        = new Vector3[4];
        }

        Vector3 curLogic = terrainPieceInfo.LogicPosition;
        Vector3 curWorld = terrainPieceInfo.WorldPosition;

        SceneGUI_DrawBox(curLogic, curWorld);


        Dictionary <TerrainPieceDirection, Vector3> .Enumerator enumerator = m_Tool.Enum2Vector3Direction.GetEnumerator();
        while (enumerator.MoveNext())
        {
            Vector3 roundLogic = curLogic + enumerator.Current.Value;
            Vector3 roundWorld = m_GamePlay.LogicPositionToWorldPosition(roundLogic);
            SceneGUI_DrawBox(roundLogic, roundWorld);
        }

        SceneGUI_ShowCurrentAndRound_Init = true;
    }
コード例 #14
0
    private void UpdatePieceSidePosition(TerrainPieceInfo terrainPiece)
    {
        int index = 0;

        Dictionary <TerrainPieceDirection, bool> .Enumerator enumerator = terrainPiece.DirectionFlagDict.GetEnumerator();
        while (enumerator.MoveNext())
        {
            TerrainPieceDirection direction = enumerator.Current.Key;
            bool enable = enumerator.Current.Value;

            if (direction == TerrainPieceDirection.Up)
            {
                terrainPiece.UpFlagTransform.gameObject.SetActive(enable);
            }
            else if (direction == TerrainPieceDirection.Down)
            {
                terrainPiece.DownFlagTransform.gameObject.SetActive(enable);
            }
            else
            {
                Transform  sideTransform  = terrainPiece.SideTransforms[index];
                GameObject sideGameobject = sideTransform.gameObject;

                sideGameobject.SetActive(enable);

                if (enable)
                {
                    Vector3 v3Direction  = m_Root.Tool.Enum2Vector3Direction[direction];
                    Vector3 sidePosition = v3Direction * m_BuildingInfo.SideShiftingValue;
                    sideTransform.localPosition = sidePosition;

                    Material material    = terrainPiece.SideMaterials[index];
                    int      shaderLayer = m_Root.GamePlay.GetFloorShaderTargerLayer((int)terrainPiece.LogicPosition.y, FloorShaderLayer.PieceSide);
                    material.renderQueue = shaderLayer;
                }

                index += 1;
            }
        }
    }
コード例 #15
0
    /// <summary>
    /// 创建基础地块
    /// </summary>
    /// <param name="logicPosition"></param>
    public TerrainPieceInfo CreateBasisTerrainPiece(Vector3 logicPosition)
    {
        TerrainPieceInfo terrainPieceInfo = new TerrainPieceInfo();

        if (m_ResourceTerrainPiece == null)
        {
            m_ResourceTerrainPiece = m_Root.Tool.LoadResource <GameObject>(m_Scene.ResourcePath.TerrainPiecePath);
        }

        //logic
        terrainPieceInfo.LogicPosition = logicPosition;

        terrainPieceInfo.DirectionFlagDict = new Dictionary <TerrainPieceDirection, bool>
        {
            { TerrainPieceDirection.Left, true },
            { TerrainPieceDirection.Right, true },
            { TerrainPieceDirection.Forward, true },
            { TerrainPieceDirection.Back, true },
            { TerrainPieceDirection.Up, false },
            { TerrainPieceDirection.Down, false },
        };
        terrainPieceInfo.DirectionMeasureDict = new Dictionary <TerrainPieceDirection, int>
        {
            { TerrainPieceDirection.Left, 1 },
            { TerrainPieceDirection.Right, 1 },
            { TerrainPieceDirection.Forward, 1 },
            { TerrainPieceDirection.Back, 1 },
            { TerrainPieceDirection.Up, 1 },
            { TerrainPieceDirection.Down, 1 },
        };

        //art
        GameObject terrainPiece = GameObject.Instantiate(m_ResourceTerrainPiece);

        terrainPiece.name           = "x:" + logicPosition.x + " y:" + logicPosition.y + " z:" + logicPosition.z;
        terrainPieceInfo.GameObject = terrainPiece;

        Transform terrainPieceTransform = terrainPiece.transform;

        terrainPieceInfo.Transform = terrainPieceTransform;

        // -- 预制体内的对象
        Transform pieceTransform = terrainPieceTransform.Find(m_Scene.GameObjectPath.PieceMaterialPath);
        Material  pieceMaterial  = pieceTransform.GetComponent <Renderer>().material;

        terrainPieceInfo.PieceMaterial = pieceMaterial;

        Transform sideRootTransform = terrainPieceTransform.Find(m_Scene.GameObjectPath.SideRootPath);
        int       childCount        = sideRootTransform.childCount;

        Transform[] sides         = new Transform[childCount];
        Material[]  sideMaterials = new Material[childCount];
        for (int index = 0; index < sides.Length; index++)
        {
            Transform sideTransform = sideRootTransform.GetChild(index);
            sides[index] = sideTransform;
            Transform sideMaterialPath = sideTransform.Find(m_Scene.GameObjectPath.SideMaterialPath);
            sideMaterials[index] = sideMaterialPath.GetComponent <Renderer>().material;
        }
        terrainPieceInfo.SideTransforms = sides;
        terrainPieceInfo.SideMaterials  = sideMaterials;

        Transform upFlagTransform = terrainPieceTransform.Find(m_Scene.GameObjectPath.UpPath);

        terrainPieceInfo.UpFlagTransform = upFlagTransform;

        Transform downFlagTransform = terrainPieceTransform.Find(m_Scene.GameObjectPath.DownPath);

        terrainPieceInfo.DownFlagTransform = downFlagTransform;

        Transform buildingRootTransform = terrainPieceTransform.Find(m_Scene.GameObjectPath.BuildingRootPath);

        terrainPieceInfo.BuildingRootTransform = buildingRootTransform;


        // artInfo
        TerrainPieceArtInfo terrainPieceArtInfo = new TerrainPieceArtInfo();

        terrainPieceArtInfo.IsShowPiece     = true;
        terrainPieceArtInfo.IsCoverBaseInfo = false;
        terrainPieceArtInfo.BuildingDict    = new Dictionary <GameObject, TerrainPieceBuildingInfo>();

        terrainPieceInfo.ArtInfo = terrainPieceArtInfo;

        return(terrainPieceInfo);
    }
コード例 #16
0
    private void UpdateTerrainLogic(TerrainPieceInfo terrainPiece)
    {
        Vector3 worldPosition = m_Root.GamePlay.LogicPositionToWorldPosition(terrainPiece.LogicPosition);

        terrainPiece.WorldPosition = worldPosition;
    }
コード例 #17
0
        protected override AdvancedDropdownItem BuildRoot()
        {
            Child2ParentDict.Clear();

            var root = new AdvancedDropdownItem("地块建筑选择");

            if (m_Instance == null)
            {
                return(root);
            }

            TerrainPieceInfo terrainPieceInfo = m_Instance.m_Scene.GetCurrentTerrainPieceInfo();

            if (terrainPieceInfo == null)
            {
                return(root);
            }

            TerrainMakerDefine.ToolSetting toolSetting = m_Instance.m_Define.Setting;

            List <string> directionList = toolSetting.SceneBuildingDirectionList;

            if (directionList != null && directionList.Count > 0)
            {
                var directionHalf = new AdvancedDropdownItem("文件夹");
                root.AddChild(directionHalf);

                for (int index = 0; index < directionList.Count; index++)
                {
                    string directionPath = directionList[index];

                    DirectoryInfo directoryInfo = new DirectoryInfo("Assets/" + directionPath);
                    FileInfo[]    fileInfos     = directoryInfo.GetFiles();

                    if (fileInfos.Length == 0)
                    {
                        continue;
                    }

                    var directionItem = new AdvancedDropdownItem(directionPath);

                    for (int j = 0; j < fileInfos.Length; j++)
                    {
                        string fileName = fileInfos[j].Name;
                        if (fileName.EndsWith("meta"))
                        {
                            continue;
                        }

                        var fileItem = new AdvancedDropdownItem(fileName);
                        directionItem.AddChild(fileItem);
                        directionItem.AddSeparator();

                        Child2ParentDict.Add(fileName, directionPath);
                    }

                    directionHalf.AddChild(directionItem);
                }
            }

            root.AddSeparator();

            List <string> fileList = toolSetting.SceneBuildingFileList;

            if (fileList != null && fileList.Count > 0)
            {
                var fileHalf = new AdvancedDropdownItem("文件");
                root.AddChild(fileHalf);

                for (int index = 0; index < fileList.Count; index++)
                {
                    string filePath = fileList[index];
                    string fileName = Path.GetFileNameWithoutExtension(filePath);

                    var fileItem = new AdvancedDropdownItem(fileName);
                    fileHalf.AddChild(fileItem);
                    fileHalf.AddSeparator();

                    Child2ParentDict.Add(fileName, IOHelper.GetDirectoryPath(filePath));
                }
            }
            return(root);
        }
コード例 #18
0
    private void GUI_UpdateCurTerrainPiece()
    {
        TerrainPieceInfo terrainPieceInfo = m_Scene.GetCurrentTerrainPieceInfo();

        if (terrainPieceInfo == null)
        {
            return;
        }

        GUI_Title("当前地块");

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("逻辑位置", GUILayout.Width(GUI_LableWidth));
        EditorGUILayout.LabelField(terrainPieceInfo.LogicPosition.x.ToString());
        EditorGUILayout.LabelField(terrainPieceInfo.LogicPosition.y.ToString());
        EditorGUILayout.LabelField(terrainPieceInfo.LogicPosition.z.ToString());
        EditorGUILayout.EndHorizontal();

        // IsCoverBaseInfo
        EditorGUILayout.BeginHorizontal();
        if (!GUI_UpdateCurTerrainPiece_Init)
        {
            GUI_UpdateCurTerrainPiece_IsCover = terrainPieceInfo.ArtInfo.IsCoverBaseInfo;
        }
        EditorGUILayout.LabelField("是否颜色覆盖", GUILayout.Width(GUI_LableWidth));
        GUI_UpdateCurTerrainPiece_IsCover = EditorGUILayout.Toggle(GUI_UpdateCurTerrainPiece_IsCover);
        if (GUI_UpdateCurTerrainPiece_IsCover != terrainPieceInfo.ArtInfo.IsCoverBaseInfo)
        {
            terrainPieceInfo.ArtInfo.IsCoverBaseInfo = GUI_UpdateCurTerrainPiece_IsCover;
            IsUpdateCurrentPiece = true;
        }
        EditorGUILayout.EndHorizontal();

        // MyColor
        EditorGUILayout.BeginHorizontal();
        if (!GUI_UpdateCurTerrainPiece_Init)
        {
            GUI_UpdateCurTerrainPiece_MyColor = terrainPieceInfo.ArtInfo.MyColor;
        }
        EditorGUILayout.LabelField("自身颜色", GUILayout.Width(GUI_LableWidth));
        GUI_UpdateCurTerrainPiece_MyColor = EditorGUILayout.ColorField(GUI_UpdateCurTerrainPiece_MyColor);
        if (GUI_UpdateCurTerrainPiece_MyColor != terrainPieceInfo.ArtInfo.MyColor)
        {
            terrainPieceInfo.ArtInfo.MyColor = GUI_UpdateCurTerrainPiece_MyColor;
            IsUpdateCurrentPiece             = true;
        }
        EditorGUILayout.EndHorizontal();

        //Direction
        Dictionary <TerrainPieceDirection, bool> .Enumerator enumerator = terrainPieceInfo.DirectionFlagDict.GetEnumerator();
        if (!GUI_UpdateCurTerrainPiece_Init || GUI_UpdateCurTerrainPiece_UpdateDirection)
        {
            GUI_UpdateCurTerrainPiece_DirectionEnableDict.Clear();
            GUI_UpdateCurTerrainPiece_DirectionMeasureDict.Clear();
            while (enumerator.MoveNext())
            {
                TerrainPieceDirection terrainPieceDirection = enumerator.Current.Key;
                bool enable = enumerator.Current.Value;
                GUI_UpdateCurTerrainPiece_DirectionEnableDict.Add(terrainPieceDirection, enable);

                int measure = terrainPieceInfo.DirectionMeasureDict[terrainPieceDirection];
                GUI_UpdateCurTerrainPiece_DirectionMeasureDict.Add(terrainPieceDirection, measure);
            }

            GUI_UpdateCurTerrainPiece_UpdateDirection = false;
        }
        if (TerrainPieceDirectionNameDict == null)
        {
            TerrainPieceDirectionNameDict = new Dictionary <TerrainPieceDirection, string>()
            {
                { TerrainPieceDirection.Left, "左边(x = 1)" },
                { TerrainPieceDirection.Right, "右边(x = -1)" },
                { TerrainPieceDirection.Forward, "前边(z = 1)" },
                { TerrainPieceDirection.Back, "后边(z = -1)" },
                { TerrainPieceDirection.Up, "往上(y = 1)" },
                { TerrainPieceDirection.Down, "向下(y = -1)" },
            };
        }
        while (enumerator.MoveNext())
        {
            TerrainPieceDirection terrainPieceDirection = enumerator.Current.Key;
            bool   enable  = enumerator.Current.Value;
            string name    = TerrainPieceDirectionNameDict[terrainPieceDirection];
            int    measure = terrainPieceInfo.DirectionMeasureDict[terrainPieceDirection];

            bool isChange = false;

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.LabelField(name, GUILayout.Width(GUI_LableWidth));
            bool guiEnabele = GUI_UpdateCurTerrainPiece_DirectionEnableDict[terrainPieceDirection];
            guiEnabele = EditorGUILayout.Toggle(guiEnabele);
            if (guiEnabele != enable)
            {
                m_Scene.ChangeTerrainPieceEnableDirection(terrainPieceInfo, terrainPieceDirection, guiEnabele);

                IsUpdateCurrentPiece = true;
                GUI_UpdateCurTerrainPiece_UpdateDirection = true;

                isChange = true;
            }

            if (guiEnabele)
            {
                int guiMeasure = GUI_UpdateCurTerrainPiece_DirectionMeasureDict[terrainPieceDirection];
                guiMeasure = EditorGUILayout.IntField(guiMeasure);
                if (guiMeasure != measure)
                {
                    terrainPieceInfo.DirectionMeasureDict[terrainPieceDirection]          = guiMeasure;
                    GUI_UpdateCurTerrainPiece_DirectionMeasureDict[terrainPieceDirection] = guiMeasure;

                    IsUpdateCurrentPiece = true;

                    isChange = true;
                }
            }

            EditorGUILayout.EndHorizontal();

            if (isChange)
            {
                break;
            }
        }

        GUI_UpdateCurTerrainPiece_Init = true;
    }