public void OnBtnYesClick()
        {
            Vector2Int mapSize = new Vector2Int();

            switch (drpdMapSize.value)
            {
            case 0:
                mapSize = new Vector2Int(16, 9);
                break;

            case 1:
                mapSize = new Vector2Int(32, 18);
                break;

            case 2:
                mapSize = new Vector2Int(64, 36);
                break;

            case 3:
                mapSize = new Vector2Int(128, 72);
                break;

            default:
                mapSize = new Vector2Int(16, 9);
                Debug.LogWarning("地图创建参数 - 地图大小下拉列表框出现未设定选项");
                break;
            }
            HexMapCreateArgs args = new HexMapCreateArgs(mapSize);

            context.CreateHexMap(args);
            Exit();
        }
Exemple #2
0
 /// <summary>
 /// 根据地图创建参数 新建地图
 /// </summary>
 /// <param name="args">地图创建参数</param>
 public void CreateHexMap(HexMapCreateArgs args)
 {
     ClearAllMap();
     Debug.Log($"x:{args.MapSize.x} y:{args.MapSize.y}");
     m_HexGrid = new HexGrid(args, GameDataCentre.TerrainThroughCostDict, GameDataCentre, HexTileMap);
     m_HexGrid.RefresAll();
     hexCellDebugTxtCanvas.BuildHexPosTxt(m_HexGrid.HexCells.GetLength(0), m_HexGrid.HexCells.GetLength(1));
     marginMeshTilemap.ResetSize(args.MapSize);
     RoleManager.hexGrid = m_HexGrid;
 }