示例#1
0
    public override void Render()
    {
        if (!isVisible)
        {
            return;
        }
        bool highlight = currentState == State.Hovered || currentState == State.Pressed;

        RB.DrawRectFill(new Rect2i(pos, size), currentState == State.Pressed ? Color.yellow : castable ? Color.white : Color.cyan);

        RB.Print(pos + new Vector2i(2, 2), Color.black, spell.GetName());

        ElementDisplay[] displays = spell.GetElementDisplays(battle.BuildContext(screen.GetCurrentTargetPawnId()));
        int px = pos.x + 2;
        int py = pos.y + size.height - 18;

        for (int i = 0; i < displays.Length; i++)
        {
            displays[i].Render(px + i * 18, py);
        }

        if (highlight)
        {
            RB.DrawRect(new Rect2i(pos.x - 1, pos.y - 1, size.x + 2, size.y + 2), Color.yellow);
        }
        else
        {
            RB.DrawRect(new Rect2i(pos.x - 1, pos.y - 1, size.x + 2, size.y + 2), Color.black);
        }
    }