Example #1
0
    void RefreshGridSingleLineCount(
        int requiredLineCnt,
        MapGeneratorGUIGridLineDirection dir)
    {
        var targetList = GetGridList(dir);
        int createCnt  = requiredLineCnt - targetList.Count;

        for (int i = 0; i < createCnt; i++)
        {
            CreateGridLine(dir);
        }
    }
Example #2
0
    Image CreateGridLine(MapGeneratorGUIGridLineDirection direction)
    {
        var targetLineList = GetGridList(direction);
        var result         = new GameObject(targetLineList.Count.ToString()).AddComponent <Image>();

        result.transform.SetParent(GetGridRoot(direction));
        result.rectTransform.sizeDelta = new Vector2(direction == MapGeneratorGUIGridLineDirection.Horizontal ? Screen.height : Screen.width, baseLineThickness);
        result.rectTransform.rotation  = direction == MapGeneratorGUIGridLineDirection.Horizontal ? Quaternion.Euler(0, 0, 90) : Quaternion.identity;
        result.color = gridColor;

        targetLineList.Add(result);

        return(result);
    }
Example #3
0
 RectTransform GetGridRoot(MapGeneratorGUIGridLineDirection dir)
 {
     return(dir == MapGeneratorGUIGridLineDirection.Horizontal ? gridHorizontalRoot : gridVerticalRoot);
 }
Example #4
0
 List <Image> GetGridList(MapGeneratorGUIGridLineDirection dir)
 {
     return(dir == MapGeneratorGUIGridLineDirection.Horizontal ? horizontalLines : verticalLines);
 }