本文整理汇总了C#中UIPanel.AddUIComponent方法的典型用法代码示例。如果您正苦于以下问题:C# UIPanel.AddUIComponent方法的具体用法?C# UIPanel.AddUIComponent怎么用?C# UIPanel.AddUIComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIPanel
的用法示例。
在下文中一共展示了UIPanel.AddUIComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeCheckbox
public static UICheckBox MakeCheckbox(UIPanel panel, string name, string text, Vector2 position, bool value,
CheckboxSetValue setValue)
{
var label = panel.AddUIComponent<UILabel>();
label.name = name;
label.text = text;
label.relativePosition = position;
label.textScale = 0.8f;
label.textColor = Color.black;
var checkbox = panel.AddUIComponent<UICheckBox>();
checkbox.AlignTo(label, UIAlignAnchor.TopLeft);
checkbox.relativePosition = new Vector3(checkbox.relativePosition.x + 274.0f, checkbox.relativePosition.y - 2.0f);
checkbox.size = new Vector2(16.0f, 16.0f);
checkbox.isVisible = true;
checkbox.canFocus = true;
checkbox.isInteractive = true;
if (setValue != null)
{
checkbox.eventCheckChanged += (component, newValue) => setValue(newValue);
}
var uncheckSprite = checkbox.AddUIComponent<UISprite>();
uncheckSprite.size = new Vector2(16.0f, 16.0f);
uncheckSprite.relativePosition = new Vector3(0, 0);
uncheckSprite.spriteName = "check-unchecked";
uncheckSprite.isVisible = true;
var checkSprite = checkbox.AddUIComponent<UISprite>();
checkSprite.size = new Vector2(16.0f, 16.0f);
checkSprite.relativePosition = new Vector3(0, 0);
checkSprite.spriteName = "check-checked";
checkbox.isChecked = value;
checkbox.checkedBoxObject = checkSprite;
return checkbox;
}
示例2: MakeButton
public static UIButton MakeButton(UIPanel panel, string name, string text, Vector2 position, ButtonClicked clicked)
{
var button = panel.AddUIComponent<UIButton>();
button.name = name;
button.text = text;
button.relativePosition = position;
button.size = new Vector2(200.0f, 24.0f);
button.normalBgSprite = "ButtonMenu";
button.disabledBgSprite = "ButtonMenuDisabled";
button.hoveredBgSprite = "ButtonMenuHovered";
button.focusedBgSprite = "ButtonMenu";
button.pressedBgSprite = "ButtonMenuPressed";
button.textScale = 0.8f;
button.eventClick += (component, param) => clicked();
return button;
}
示例3: Awake
public override void Awake()
{
size = new Vector2(5, 5);
anchor = UIAnchorStyle.Top;
helpBg = AddUIComponent<UIPanel>();
helpBg.backgroundSprite = "GenericPanel";
helpBg.color = new Color32(0, 0, 120, 200);
helpBg.area = new Vector4(10, 65, 230, 70);
usageText = helpBg.AddUIComponent<UILabel>();
usageText.relativePosition = new Vector2(5, 5);
usageText.textScale = 0.6f;
usageText.text =
"Left Click to see all Trafic\n" +
"Right Click to see traffic for one direction\n" +
"Shift + Right Click for the other direction\n" +
"Hover over other roads to see how much is \n" +
"going through that location.\n";
reportBreakDown = AddUIComponent<BreakdownPanel>();
reportBreakDown.title.text = "Selected";
reportBreakDown.title.tooltip = "A breakdown of all traffic going through the selected road segement";
reportBreakDown.isVisible = false;
reportBreakDown.relativePosition = new Vector2(10, 150);
reportBreakDown.eventHighlightType += (String s) =>
{
if (eventHighlightType != null)
eventHighlightType(s);
};
highlightBreakDown = AddUIComponent<BreakdownPanel>();
highlightBreakDown.title.text = "...highlighted";
highlightBreakDown.isVisible = false;
highlightBreakDown.relativePosition = new Vector2(220, 150);
base.Awake();
}
示例4: Start
//public void ButtonEnabler(UITextureSprite sPrite) {
//if (sPrite == FavCimsCBMenuSprite) {
//FavCimsCBMenuSprite.texture = FavCimsCBETexture;
//FavCimsBBMenuSprite.texture = FavCimsBBDTexture;
//FavCimsSBMenuSprite.texture = FavCimsSBDTexture;
//} else if (sPrite == FavCimsBBMenuSprite) {
//FavCimsCBMenuSprite.texture = FavCimsCBDTexture;
//FavCimsBBMenuSprite.texture = FavCimsBBETexture;
//FavCimsSBMenuSprite.texture = FavCimsSBDTexture;
//} else if (sPrite == FavCimsSBMenuSprite) {
//FavCimsCBMenuSprite.texture = FavCimsCBDTexture;
//FavCimsBBMenuSprite.texture = FavCimsBBDTexture;
//FavCimsSBMenuSprite.texture = FavCimsSBETexture;
//}
//return;
//}
public override void Start()
{
var uiView = UIView.GetAView();
this.name = "FavCimsPanel";
this.width = 1200;
this.height = 700;
this.opacity = 0.95f;
this.eventVisibilityChanged += (component, value) => change_visibility_event ();
//Main Panel BG Texture
Texture FavCimsMainBGTexture = ResourceLoader.loadTexture ((int)this.width, (int)this.height, "UIMainPanel.mainbg.png");
FavCimsMainBGTexture.wrapMode = TextureWrapMode.Clamp;
FavCimsMainBGTexture.filterMode = FilterMode.Bilinear;
//FavCimsMainBGTexture.anisoLevel = 9; Set 1 Bad to 9 Very God
FavCimsMainBGTexture.name = "FavCimsMainBGTexture";
UITextureSprite FavCimsMainBGSprite;
FavCimsMainBGSprite = this.AddUIComponent<UITextureSprite> ();
FavCimsMainBGSprite.name = "FavCimsMainBGSprite";
FavCimsMainBGSprite.texture = FavCimsMainBGTexture;
FavCimsMainBGSprite.relativePosition = new Vector3 (0, 0);
FavCimsMainBGSprite.eventMouseDown += delegate {
if (Input.GetMouseButton (0)) {
if (this.GetComponentInChildren<WindowController> () != null) {
this.PanelMover = this.GetComponentInChildren<WindowController> ();
this.PanelMover.ComponentToMove = this;
this.PanelMover.Stop = false;
this.PanelMover.Start ();
} else {
this.PanelMover = this.AddUIComponent (typeof(WindowController)) as WindowController;
this.PanelMover.ComponentToMove = this;
}
this.opacity = 0.5f;
}
};
FavCimsMainBGSprite.eventMouseUp += delegate {
if (this.PanelMover != null) {
this.PanelMover.Stop = true;
this.PanelMover.ComponentToMove = null;
this.PanelMover = null;
}
this.opacity = 1f;
};
//Main Panel Title Texture
Texture FavCimsTitleTexture;
FavCimsTitleTexture = ResourceLoader.loadTexture ((int)this.width, 58, "UIMainPanel.favcimstitle.png");
FavCimsTitleTexture.wrapMode = TextureWrapMode.Clamp;
FavCimsTitleTexture.filterMode = FilterMode.Bilinear;
FavCimsTitleTexture.mipMapBias = -0.5f;
//FavCimsTitleTexture.anisoLevel = 9; // Set 1 Bad to 9 Very God
FavCimsTitleTexture.name = "FavCimsTitleTexture";
FavCimsTitleSprite = FavCimsMainBGSprite.AddUIComponent<UITextureSprite> ();
FavCimsTitleSprite.name = "FavCimsTitleSprite";
FavCimsTitleSprite.texture = FavCimsTitleTexture;
float FavCimsTitleSpriteRelPosX = ((this.width / 2) - (float)FavCimsTitleTexture.width / 2);
FavCimsTitleSprite.relativePosition = new Vector3 (FavCimsTitleSpriteRelPosX, 0);
///////////////////////////////////////////////
//Game Default Close Button
//////////////////////////////////////////////
UIButton FavCimsMenuCloseButton = this.AddUIComponent<UIButton> ();
FavCimsMenuCloseButton.name = "FavCimsMenuCloseButton";
FavCimsMenuCloseButton.width = 32;
FavCimsMenuCloseButton.height = 32;
FavCimsMenuCloseButton.normalBgSprite = "buttonclose";
FavCimsMenuCloseButton.hoveredBgSprite = "buttonclosehover";
FavCimsMenuCloseButton.pressedBgSprite = "buttonclosepressed";
FavCimsMenuCloseButton.opacity = 1;
FavCimsMenuCloseButton.useOutline = true;
FavCimsMenuCloseButton.playAudioEvents = true;
FavCimsMenuCloseButton.eventClick += (component, eventParam) => FavoritesCimsButton.FavCimsPanelToggle ();
//Printing
FavCimsMenuCloseButton.relativePosition = new Vector3 (this.width - (FavCimsMenuCloseButton.width * 1.5f), ((float)FavCimsTitleTexture.height / 2) - FavCimsMenuCloseButton.height / 2);
///////////////////////////////////////////////
//Main Panel Menu Background Texture
//.........这里部分代码省略.........
示例5: SetupScrollPanel
private void SetupScrollPanel()
{
//this probably needs to exist, otherwise the autoLayout of this UITransportPanel places the scrollbar weird
_panelForScrollPanel = AddUIComponent<UIPanel> ();
// needed so that the colorpicker finds the right parent
_panelForScrollPanel.gameObject.AddComponent<UICustomControl>();
_panelForScrollPanel.width = width - 6;
//_captions reporting 450 height? fixed value of 20
_panelForScrollPanel.height = height - _title.height - _buttons.height - 20 - autoLayoutPadding.bottom * 4 - autoLayoutPadding.top * 4;
// taken from http://www.reddit.com/r/CitiesSkylinesModding/comments/2zrz0k/extended_public_transport_ui_provides_addtional/cpnet5q
_scrollablePanel = _panelForScrollPanel.AddUIComponent<UIScrollablePanel> ();
_scrollablePanel.width = _scrollablePanel.parent.width - 5f;
_scrollablePanel.height = _scrollablePanel.parent.height;
_scrollablePanel.autoLayout = true;
_scrollablePanel.autoLayoutDirection = LayoutDirection.Vertical;
_scrollablePanel.autoLayoutStart = LayoutStart.TopLeft;
_scrollablePanel.autoLayoutPadding = new RectOffset (0, 0, 1, 1);
_scrollablePanel.clipChildren = true;
_scrollablePanel.pivot = UIPivotPoint.TopLeft;
_scrollablePanel.AlignTo (_scrollablePanel.parent, UIAlignAnchor.TopLeft);
UIScrollbar scrollbar = _panelForScrollPanel.AddUIComponent<UIScrollbar> ();
scrollbar.width = scrollbar.parent.width - _scrollablePanel.width;
scrollbar.height = scrollbar.parent.height;
scrollbar.orientation = UIOrientation.Vertical;
scrollbar.pivot = UIPivotPoint.BottomLeft;
scrollbar.AlignTo (scrollbar.parent, UIAlignAnchor.TopRight);
scrollbar.minValue = 0;
scrollbar.value = 0;
scrollbar.incrementAmount = 50;
UISlicedSprite tracSprite = scrollbar.AddUIComponent<UISlicedSprite> ();
tracSprite.relativePosition = Vector2.zero;
tracSprite.autoSize = true;
tracSprite.size = tracSprite.parent.size;
tracSprite.fillDirection = UIFillDirection.Vertical;
tracSprite.spriteName = "ScrollbarTrack";
scrollbar.trackObject = tracSprite;
UISlicedSprite thumbSprite = tracSprite.AddUIComponent<UISlicedSprite> ();
thumbSprite.relativePosition = Vector2.zero;
thumbSprite.fillDirection = UIFillDirection.Vertical;
thumbSprite.autoSize = true;
thumbSprite.width = thumbSprite.parent.width;
thumbSprite.spriteName = "ScrollbarThumb";
scrollbar.thumbObject = thumbSprite;
_scrollablePanel.verticalScrollbar = scrollbar;
_scrollablePanel.eventMouseWheel += (component, param) =>
{
var sign = Math.Sign(param.wheelDelta);
_scrollablePanel.scrollPosition += new Vector2(0, sign*(-1) * 20);
};
}
示例6: SetupScrollPanel
private void SetupScrollPanel()
{
ModLogger.Debug("Setting up scroll panel");
// Create the main panel hosting the scrollable panel
_mainPanel = AddUIComponent<UIPanel>();
_mainPanel.gameObject.AddComponent<UICustomControl>();
_mainPanel.width = width - UIConstants.MainWindowMainPanelWidthOffset;
int[] offsettingItems = new int[] { UIConstants.TitlePanelHeight, UIConstants.CaptionPanelLabelOffset, UIConstants.CaptionPanelHeight, UIConstants.FilterPanelHeight, autoLayoutPadding.bottom * 4, autoLayoutPadding.top * 4 };
_mainPanel.height = height - offsettingItems.Sum();
// taken from http://www.reddit.com/r/CitiesSkylinesModding/comments/2zrz0k/extended_public_transport_ui_provides_addtional/cpnet5q
_scrollablePanel = _mainPanel.AddUIComponent<UIScrollablePanel>();
_scrollablePanel.width = _scrollablePanel.parent.width - UIConstants.MainWindowScrollablePanelWidthOffset - 10;
_scrollablePanel.height = _scrollablePanel.parent.height;
_scrollablePanel.autoLayout = true;
_scrollablePanel.autoLayoutDirection = LayoutDirection.Vertical;
_scrollablePanel.autoLayoutStart = LayoutStart.TopLeft;
_scrollablePanel.autoLayoutPadding = UIConstants.AutoLayoutPadding;
_scrollablePanel.clipChildren = true;
_scrollablePanel.pivot = UIPivotPoint.TopLeft;
_scrollablePanel.AlignTo(_scrollablePanel.parent, UIAlignAnchor.TopLeft);
_scrollablePanel.relativePosition = new Vector3(5, 0);
UIScrollbar scrollbar = _mainPanel.AddUIComponent<UIScrollbar>();
scrollbar.width = scrollbar.parent.width - _scrollablePanel.width;
scrollbar.height = scrollbar.parent.height;
scrollbar.orientation = UIOrientation.Vertical;
scrollbar.pivot = UIPivotPoint.BottomLeft;
scrollbar.AlignTo(scrollbar.parent, UIAlignAnchor.TopRight);
scrollbar.minValue = 0;
scrollbar.value = 0;
scrollbar.incrementAmount = UIConstants.ScrollbarIncrementCount;
UISlicedSprite trackSprite = scrollbar.AddUIComponent<UISlicedSprite>();
trackSprite.relativePosition = Vector2.zero;
trackSprite.autoSize = true;
trackSprite.size = trackSprite.parent.size;
trackSprite.fillDirection = UIFillDirection.Vertical;
trackSprite.spriteName = UIConstants.ScrollbarTrackSprite;
scrollbar.trackObject = trackSprite;
UISlicedSprite thumbSprite = trackSprite.AddUIComponent<UISlicedSprite>();
thumbSprite.relativePosition = Vector2.zero;
thumbSprite.fillDirection = UIFillDirection.Vertical;
thumbSprite.autoSize = true;
thumbSprite.width = thumbSprite.parent.width;
thumbSprite.spriteName = UIConstants.ScrollbarThumbSprite;
scrollbar.thumbObject = thumbSprite;
_scrollablePanel.verticalScrollbar = scrollbar;
_scrollablePanel.eventMouseWheel += (component, param) =>
{
var sign = Math.Sign(param.wheelDelta);
_scrollablePanel.scrollPosition += new Vector2(0, sign * (-1) * UIConstants.ScrollbarMouseWheelOffset);
};
ModLogger.Debug("Scroll panel set up");
}
示例7: addCheckbox
private UICheckBox addCheckbox(UIPanel panel, int yPos, int xPos, string text, string tooltip, bool hidden)
{
var cb = panel.AddUIComponent<UICheckBox>();
cb.relativePosition = new Vector3(xPos, yPos);
cb.height = 0;
cb.width = 80;
var label = panel.AddUIComponent<UILabel>();
label.relativePosition = new Vector3(xPos + 25, yPos + 3);
cb.label = label;
cb.label.tabIndex = cb.GetInstanceID();
cb.text = text;
UISprite uncheckSprite = cb.AddUIComponent<UISprite>();
uncheckSprite.height = 20;
uncheckSprite.width = 20;
uncheckSprite.relativePosition = new Vector3(0, 0);
uncheckSprite.spriteName = "check-unchecked";
UISprite checkSprite = cb.AddUIComponent<UISprite>();
checkSprite.height = 20;
checkSprite.width = 20;
checkSprite.relativePosition = new Vector3(0, 0);
checkSprite.spriteName = "check-checked";
cb.checkedBoxObject = checkSprite;
cb.disabledColor = new Color(127.0f / 255.0f, 127.0f / 255.0f, 127.0f / 255.0f, 1.0f);
label.disabledColor = new Color(127.0f / 255.0f, 127.0f / 255.0f, 127.0f / 255.0f, 1.0f);
cb.tooltip = tooltip;
label.tooltip = cb.tooltip;
cb.isChecked = false;
cb.label.isVisible = hidden;
cb.isVisible = hidden;
return cb;
}
示例8: MakeCheckbox
private static UICheckBox MakeCheckbox(UIPanel panel, string name, string text, float y, bool value,
CheckboxSetValue setValue)
{
var label = panel.AddUIComponent<UILabel>();
label.name = name;
label.text = text;
label.relativePosition = new Vector3(4.0f, y);
label.textScale = 0.8f;
var checkbox = panel.AddUIComponent<UICheckBox>();
checkbox.AlignTo(label, UIAlignAnchor.TopLeft);
checkbox.relativePosition = new Vector3(checkbox.relativePosition.x + 332.0f, checkbox.relativePosition.y - 6.0f);
checkbox.size = new Vector2(20.0f, 20.0f);
checkbox.isVisible = true;
checkbox.canFocus = true;
checkbox.isInteractive = true;
checkbox.eventCheckChanged += (component, newValue) =>
{
setValue(newValue);
};
var uncheckSprite = checkbox.AddUIComponent<UISprite>();
uncheckSprite.size = new Vector2(20.0f, 20.0f);
uncheckSprite.relativePosition = new Vector3(0, 0);
uncheckSprite.spriteName = "check-unchecked";
uncheckSprite.isVisible = true;
var checkSprite = checkbox.AddUIComponent<UISprite>();
checkSprite.size = new Vector2(20.0f, 20.0f);
checkSprite.relativePosition = new Vector3(0, 0);
checkSprite.spriteName = "check-checked";
checkbox.isChecked = value;
checkbox.checkedBoxObject = checkSprite;
return checkbox;
}
示例9: AddThemesTab
public static void AddThemesTab()
{
if (container != null)
{
return;
}
UITabstrip tabstrip = ToolsModifierControl.policiesPanel.Find("Tabstrip") as UITabstrip;
// Add a custom tab
tab = tabstrip.AddTab("Themes");
tab.stringUserData = "Themes";
tab.textScale = 0.875f;
// recalculate the width of the tabs
for (int i = 0; i < tabstrip.tabCount; i++)
{
tabstrip.tabs[i].width = tabstrip.width / ((float)tabstrip.tabCount - 1);
}
// The container for the policies was created by the game when we added the tab
var pageIndex = tabstrip.tabPages.childCount - 1;
container = (UIPanel)tabstrip.tabPages.components[pageIndex];
container.autoLayout = true;
container.autoLayoutDirection = LayoutDirection.Vertical;
container.autoLayoutPadding.top = 5;
// Only make the container visible if our tab was selected when the panel was closed last time
container.isVisible = tabstrip.selectedIndex == pageIndex;
// Theme buttons
themePolicyButtons = UIFastList.Create<UIThemePolicyItem>(container);
themePolicyButtons.width = 364f;
themePolicyButtons.rowHeight = 49f;
themePolicyButtons.autoHideScrollbar = true;
// The panel holding the controls
controls = container.AddUIComponent<UIPanel>();
controls.width = container.width;
controls.height = 100f;
controls.autoLayout = true;
controls.autoLayoutDirection = LayoutDirection.Vertical;
controls.autoLayoutPadding.top = 5;
// Add a checkbox to toggle "Blacklist Mode"
UICheckBox blacklistModeCheckBox = CreateCheckBox(controls);
blacklistModeCheckBox.name = "Blacklist Mode Checkbox";
blacklistModeCheckBox.gameObject.AddComponent<BlacklistModeCheckboxContainer>();
blacklistModeCheckBox.text = "Allow buildings which are not in any theme";
blacklistModeCheckBox.isChecked = false;
blacklistModeCheckBox.eventCheckChanged += delegate(UIComponent component, bool isChecked)
{
lock (component)
{
var districtId1 = ToolsModifierControl.policiesPanel.targetDistrict;
Singleton<BuildingThemesManager>.instance.ToggleBlacklistMode(districtId1, isChecked);
}
};
// Add a checkbox to "Enable Theme Management for this district"
UICheckBox enableThemeManagementCheckBox = CreateCheckBox(controls);
enableThemeManagementCheckBox.name = "Theme Management Checkbox";
enableThemeManagementCheckBox.gameObject.AddComponent<ThemeManagementCheckboxContainer>();
enableThemeManagementCheckBox.text = "Enable Theme Management for this district";
enableThemeManagementCheckBox.isChecked = false;
enableThemeManagementCheckBox.eventCheckChanged += delegate(UIComponent component, bool isChecked)
{
lock (component)
{
var districtId1 = ToolsModifierControl.policiesPanel.targetDistrict;
Singleton<BuildingThemesManager>.instance.ToggleThemeManagement(districtId1, isChecked);
}
};
// Add a button to show the Building Theme Manager
UIButton showThemeManager = GUI.UIUtils.CreateButton(controls);
showThemeManager.width = controls.width;
showThemeManager.text = "Theme Manager";
showThemeManager.eventClick += (c, p) => GUI.UIThemeManager.instance.Toggle();
RefreshThemesContainer();
}
示例10: GenerateplDelete
private void GenerateplDelete(UIPanel panel, int ply, int plx)
{
//Show the road type option
plDelete = panel.AddUIComponent<UIPanel>();
plDelete.relativePosition = new Vector3(1, ply);
plDelete.isVisible = false;
plDelete.tooltip = "Select the type of items to delete.";
int cb = 0;
int x = 15;
int y = 1;
//load the bulldoze road type options
addLabel(plDelete, y, 5, "Select your delete options.", true);
y += 20;
foreach (string s in m_deletes)
{
if (s == "Label Lines")
{
lLines = addLabel(plDelete, y, 10, "Lines", true);
y += 20;
}
else if (s == "Label Properties")
{
lProperties = addLabel(plDelete, y, 10, "Properties", true);
y += 20;
}
else
{
string t = "These items will be deleted.";
if (s.StartsWith("B "))
{
deletes.Add(addCheckbox(plDelete, y, x + 210, s.Replace("B ", ""), t, true));
y += 25;
}
else
{
deletes.Add(addCheckbox(plDelete, y, x, s, t, true));
if (s == "Buildings" || s == "Trees" || s == "Props") { y += 25; }
}
deletes[cb].eventCheckChanged += DeleteTypes_eventCheckChanged;
cb += 1;
}
}
plDelete.size = new Vector2(panel.width, y + 25);
}
示例11: MakeButton
private static UIButton MakeButton(UIPanel panel, string name, string text, float y, ButtonClicked clicked)
{
var button = panel.AddUIComponent<UIButton>();
button.name = name;
button.text = text;
button.relativePosition = new Vector3(200.0f, y - 6.0f);
button.size = new Vector2(100.0f, 24.0f);
button.normalBgSprite = "ButtonMenu";
button.disabledBgSprite = "ButtonMenuDisabled";
button.hoveredBgSprite = "ButtonMenuHovered";
button.focusedBgSprite = "ButtonMenu";
button.pressedBgSprite = "ButtonMenuPressed";
button.eventClick += (component, param) =>
{
clicked();
};
return button;
}
示例12: addTextBox
private UITextField addTextBox(UIPanel panel, string name, string text, int y, int x, int width, int height, string tooltip, bool numeric, bool allowFloats)
{
UITextField tf = panel.AddUIComponent<UITextField>();
tf.relativePosition = new Vector3(x, y);
tf.size = new Vector3(width, height);
tf.name = name;
tf.text = text;
tf.width = width;
tf.height = height;
tf.tooltip = tooltip;
tf.numericalOnly = numeric;
tf.allowFloats = allowFloats;
tf.textScale = 0.8f;
tf.color = Color.black;
tf.cursorBlinkTime = 0.45f;
tf.cursorWidth = 1;
tf.horizontalAlignment = UIHorizontalAlignment.Left;
tf.selectionBackgroundColor = new Color(233, 201, 148, 255);
tf.selectionSprite = "EmptySprite";
tf.verticalAlignment = UIVerticalAlignment.Middle;
tf.padding = new RectOffset(5, 0, 5, 0);
tf.foregroundSpriteMode = UIForegroundSpriteMode.Fill;
tf.normalBgSprite = "TextFieldPanel";
tf.hoveredBgSprite = "TextFieldPanelHovered";
tf.focusedBgSprite = "TextFieldPanel";
tf.isInteractive = true;
tf.enabled = true;
tf.readOnly = false;
tf.builtinKeyNavigation = true;
return tf;
}
示例13: GenerateOptions
private int GenerateOptions(UIPanel panel, int ply, int plx)
{
ARUT.WriteLog("Entering GenerateOptions");
plOptions = panel.AddUIComponent<UIPanel>();
plOptions.relativePosition = new Vector3(plx, ply);
plOptions.isVisible = true;
plOptions.tooltip = "Select the type of updates and options to perform.";
int y = 1;
lSelectable = addLabel(plOptions, y, plx, m_updatetool + m_unavailable, true);
y += 25;
lInformation = addLabel(plOptions, y, 1, m_defaultInfo, true);
y += 25;
int cb = 0;
foreach (string s in m_options)
{
bool enable = true;
string t = String.Format("Select to display the {0} options", s);
options.Add(addCheckbox(plOptions, y, plx, s, t, true));
//Space out the options (We may add building, trees, and props)
plx += 100;
switch (s)
{
case "Update":
enable = ARUT.ShowUpdate;
break;
case "Delete":
enable = ARUT.ShowDelete;
break;
case "Districts":
enable = (ARUT.ShowDistricts == (mode != LoadMode.LoadMap && mode != LoadMode.NewMap));
break;
case "Terrain":
enable = (ARUT.ShowTerrain == (mode == LoadMode.LoadMap || mode == LoadMode.NewMap));
break;
case "Services":
enable = (ARUT.ShowServices == (mode != LoadMode.LoadMap && mode != LoadMode.NewMap));
break;
default:
break;
}
options[cb].enabled = enable;
options[cb].eventCheckChanged += Options_eventCheckChanged;
cb += 1;
}
y += 25;
//set the panal size (two rows, 50)
plOptions.size = new Vector2(panel.width, y);
return (int)plOptions.height + 20;
}
示例14: addSlider
private UISlider addSlider(UIPanel panel, string name, int y, int x, int w, int h, float min, float max, float step, float defaultValue, string tooltip)
{
UISlider sl = panel.AddUIComponent<UISlider>();
sl.relativePosition = new Vector3(x, y);
sl.name = name;
sl.width = w;
sl.height = h;
sl.tooltip = tooltip;
sl.minValue = min;
sl.maxValue = max;
sl.stepSize = step;
sl.value = defaultValue;
sl.isVisible = true;
sl.color = Color.blue;
sl.BringToFront();
if (mode == LoadMode.LoadMap || mode == LoadMode.NewMap)
sl.backgroundSprite = "SubcategoriesPanel";
else
sl.backgroundSprite = "GenericPanel";
return sl;
}
示例15: addLabel
private UILabel addLabel(UIPanel panel, int yPos, int xPos, string text, string t, bool hidden)
{
UILabel lb = panel.AddUIComponent<UILabel>();
lb.relativePosition = new Vector3(xPos, yPos);
lb.height = 0;
lb.width = 80;
lb.text = text;
lb.tooltip = t;
lb.isVisible = hidden;
return lb;
}