Skip to content

Commit

Permalink
Fixes #1396
Browse files Browse the repository at this point in the history
  • Loading branch information
estarriol authored and mayjak committed Nov 17, 2020
1 parent bf74d40 commit dd6d5e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
25 changes: 12 additions & 13 deletions unity/Assets/Scripts/UI/UIElementBorder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,22 @@ private void CreateBorder(Transform transform, RectTransform rectTrans, string t
}

// Set the thickness of the lines
float thick = (float)Math.Floor(thickness * UIScaler.GetPixelsPerUnit());
if (thick == 0)
{
thick = 1.0f;
}

bLine[0].GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Bottom, -thick, thick);
bLine[0].GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, -thick, rectTrans.rect.width + thick);
float thick = thickness * UIScaler.GetPixelsPerUnit();

// Bottom line
bLine[0].GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Bottom, 0, thick);
bLine[0].GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, -thick, rectTrans.rect.width);
// Top line
bLine[1].GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, -thick, thick);
bLine[1].GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, -thick, rectTrans.rect.width + thick);
//
bLine[1].GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, -thick, rectTrans.rect.width);

// Left line
bLine[2].GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, -thick, rectTrans.rect.height + thick);
bLine[2].GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, -thick, thick);
//
bLine[3].GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, -thick, rectTrans.rect.height + 2 * thick);
bLine[3].GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Right, -thick, thick);
// Right line
bLine[3].GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, -thick, rectTrans.rect.height + thick);
bLine[3].GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Right, 0, thick);

}

/// <summary>
Expand Down
5 changes: 1 addition & 4 deletions unity/Assets/Scripts/UI/UIWindowSelectionListAudio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ protected override float DrawItem(SelectionItemTraits item, Transform transform,
UIElement ui = new UIElement(transform);
ui.SetLocation(0, offset, 18.9f, 1);
var audioFilePath = FindAudioPathIfExists(key);
if (!string.IsNullOrEmpty(audioFilePath))
{
ui.SetButton(delegate { SelectItem(key); });
}
ui.SetButton(delegate { SelectItem(key ?? ""); });
ui.SetBGColor(item.GetColor());
ui.SetText(item.GetDisplay(), Color.black);

Expand Down

0 comments on commit dd6d5e7

Please # to comment.