Unity for Cities:Skyline mod,不确定如何制作可编辑的文本字段

时间:2016-03-25 15:51:19

标签: uitextfield cities-skylines-api

摘要:有一个按钮来启动mod,这会打开一个设置屏幕。 希望能够允许用户输入更新的高度。 我无法使字段可编辑,但可以按我的意愿显示文本字段和值。

    //Calling code
    int top = 1;
    addUILabel(marqueeTerrianPanel, top, Title);
    top += 25;
    ipHeight = addTextField(marqueeTerrianPanel, top, "Height");
   //Procedure to add a textfield
    private UITextField addTextField(UIPanel panel, int yPos, string text)
    {
        UITextField label = panel.AddUIComponent<UITextField>();
        label.relativePosition = new Vector3(1, yPos);
        label.builtinKeyNavigation = true;
        label.height = 20;
        label.width = 80;
        label.text = text;
        label.readOnly = false;
        label.canFocus = true;
        label.isInteractive = true;
        label.enabled = true;
        label.color = Color.white;
        label.bottomColor = Color.white;
        label.textColor = Color.black;
        return label;
    }

1 个答案:

答案 0 :(得分:0)

我确实找到了解决方案。差异主要是苏打水和誓言,好吧精灵和诅咒。

scaleTextBox.cursorBlinkTime = 0.45f;
scaleTextBox.cursorWidth = 1;
scaleTextBox.selectionSprite = "EmptySprite";
scaleTextBox.normalBgSprite = "TextFieldPanel";
scaleTextBox.hoveredBgSprite = "TextFieldPanelHovered";
scaleTextBox.focusedBgSprite = "TextFieldPanel";