コード例 #1
0
 public void DrawTriangle(CCV3F_C4B[] corners, float borderThickness, CCColor4B borderColor)
 {
     DrawNode.DrawTriangleList(corners);
     if (borderThickness > 0)
     {
         for (int i = 0; i < 3; i++)
         {
             var p1 = corners[i].Vertices;
             var p2 = corners[(i + 1) % 3].Vertices;
             DrawNode.DrawLine(new CCPoint(p1.X, p1.Y), new CCPoint(p2.X, p2.Y), borderThickness, borderColor);
         }
     }
 }
コード例 #2
0
        private void RenderHexagon(Hexagon hexagon)
        {
            var visualSettings           = World.GameSettings.VisualSettings;
            var colorCollection          = visualSettings.ColorCollection;
            var layoutSettings           = World.GameSettings.LayoutSettings;
            var worldPosition            = hexagon.Position.GetWorldPosition(layoutSettings.HexagonRadius, layoutSettings.HexagonMargin);
            var corners                  = Corners.Select(c => c * layoutSettings.HexagonRadius + worldPosition).ToArray();
            var innerColor               = colorCollection.GetInnerHexagonColor(hexagon.ResourceType);
            var outerColor               = colorCollection.GetOuterHexagonColor(hexagon.ResourceType);
            var center                   = new CCV3F_C4B(worldPosition, innerColor);
            var adjacentHexagonPositions = hexagon.Position.GetAdjacentHexagonPositions();

            for (int i = 0; i < corners.Length; i++)
            {
                var p1 = new CCV3F_C4B(corners[i], outerColor);
                var p2 = new CCV3F_C4B(corners[(i + 1) % corners.Length], outerColor);
                DrawNode.DrawTriangle(p1, center, p2);
                if (World.HexagonManager[adjacentHexagonPositions[(6 - i + 2) % 6]]?.ResourceType != hexagon.ResourceType)
                {
                    DrawNode.DrawLine(corners[i], corners[(i + 1) % corners.Length], visualSettings.HexagonOuterBorderThickness, colorCollection.HexagonBorder);
                }
            }
            DrawNode.DrawText(worldPosition, hexagon.ResourceType.GetText(), Font.ArialFonts[32], new CCSize(layoutSettings.HexagonRadius * 2, layoutSettings.HexagonRadius * 2));
        }
コード例 #3
0
 public void DrawLine(CCPoint from, CCPoint to, float thickness, CCColor4B color)
 {
     DrawNode.DrawLine(from, to, thickness, color);
 }