本文整理汇总了C#中UILabel.Hide方法的典型用法代码示例。如果您正苦于以下问题:C# UILabel.Hide方法的具体用法?C# UILabel.Hide怎么用?C# UILabel.Hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UILabel
的用法示例。
在下文中一共展示了UILabel.Hide方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init()
{
uiView = UIView.GetAView();
UICheckBox autosaveCheckbox = uiView.FindUIComponent<UICheckBox>("AutoSave");
UITextField autosaveIntervalTextField = uiView.FindUIComponent<UITextField>("AutoSaveInterval");
autosaveCheckbox.eventClicked += new MouseEventHandler(CheckBoxChanged);
autosaveIntervalTextField.eventTextSubmitted += new PropertyChangedEventHandler<string>(IntervalChanged);
createLabel();
bAutosaveEnabled = autosaveCheckbox.isChecked;
autoSaveInterval = int.Parse(autosaveIntervalTextField.text);
timer = autoSaveInterval * 60;
label.Enable();
updateLabel(bAutosaveEnabled, (int)timer);
hintLabel = uiView.AddUIComponent(typeof(UILabel)) as UILabel;
hintLabel.name = "AutoSaveCountdownPlacementHint";
hintLabel.text = "Press ENTER to finish placement.";
hintLabel.textColor = Color.white;
hintLabel.relativePosition = new Vector2(0, 0);
hintLabel.anchor = UIAnchorStyle.Top;
hintLabel.textScale = 2f;
hintLabel.Hide();
}
示例2: Start
public override void Start()
{
base.Start();
//Debug.Print ("Starting UISearch");
this.name = NAME;
this.size = new Vector2(WIDTH, HEIGHT);
this.backgroundSprite = "GenericTabDisabled";
this.relativePosition = new Vector2(parent.width - width, -height);
//this.BringToFront();
//this.Show ();
m_countLabel = this.AddUIComponent<UILabel>();
m_countLabel.autoSize = false;
m_countLabel.backgroundSprite = "GenericTabDisabled";
m_countLabel.text = "Items";
m_countLabel.textScale = 0.75f;
m_countLabel.padding = new RectOffset(5, 5, 5, 0);
m_countLabel.size = new Vector2(65, 18);
m_countLabel.relativePosition = new Vector2(this.width - m_countLabel.width, -m_countLabel.height);
m_countLabel.textAlignment = UIHorizontalAlignment.Right;
m_countLabel.verticalAlignment = UIVerticalAlignment.Middle;
m_countLabel.Hide();
m_searchLabel = this.AddUIComponent<UILabel>();
m_searchLabel.text = "Search:";
m_searchLabel.autoSize = false;
m_searchLabel.size = new Vector2(60, height);
m_searchLabel.padding = new RectOffset(5, 0, 4, 0);
m_searchLabel.relativePosition = new Vector2(0, this.height / 2 - m_searchLabel.height / 2);
m_searchLabel.textAlignment = UIHorizontalAlignment.Center;
m_searchLabel.verticalAlignment = UIVerticalAlignment.Middle;
m_textField = this.AddUIComponent<UITextField>();
m_textField.eventEnterFocus += (component, eventParam) => { Debug.Print("Hello"); };
m_textField.builtinKeyNavigation = true;
m_textField.isInteractive = true;
m_textField.canFocus = true;
m_textField.bottomColor = Color.red;
m_textField.normalBgSprite = "TextFieldPanel";
m_textField.disabledBgSprite = "TextFieldPanelDisabled";
m_textField.focusedBgSprite = m_textField.normalBgSprite + "Focused";
m_textField.hoveredBgSprite = m_textField.normalBgSprite + "Hovered";
m_textField.size = new Vector2(this.width - m_searchLabel.width - 12, this.height - 10);
m_textField.relativePosition = new Vector2(8 + m_searchLabel.width, this.height / 2 - m_textField.height / 2);
m_textField.horizontalAlignment = UIHorizontalAlignment.Left;
m_textField.verticalAlignment = UIVerticalAlignment.Middle;
m_textField.padding = new RectOffset(5, 0, 4, 0);
//m_textField.submitOnFocusLost = false;
m_textField.selectOnFocus = true;
//Debug.Print ("Finsihed UISearch");
this.eventKeyPress += this.SearchConfirm;
this.m_textField.eventTextSubmitted += this.SearchConfirm;
}
示例3: SetPos
private void SetPos(UILabel title, UIProgressBar bar, float x, float y, bool visible)
{
bar.relativePosition = new Vector3(x + 120, y - 3);
title.relativePosition = new Vector3(x, y);
if (visible)
{
bar.Show();
title.Show();
}
else
{
bar.Hide();
title.Hide();
}
}
示例4: FPSCameraUI
private FPSCameraUI()
{
var uiView = FindObjectOfType<UIView>();
var fullscreenContainer = uiView.FindUIComponent("FullScreenContainer");
cameraModeButton = uiView.AddUIComponent(typeof(UIButton)) as UIButton;
cameraModeButton.name = "FPSCameraConfigurationButton";
cameraModeButton.gameObject.name = "FPSCameraConfigurationButton";
cameraModeButton.width = 36;
cameraModeButton.height = 36;
cameraModeButton.pressedBgSprite = "OptionBasePressed";
cameraModeButton.normalBgSprite = "OptionBase";
cameraModeButton.hoveredBgSprite = "OptionBaseHovered";
cameraModeButton.disabledBgSprite = "OptionBaseDisabled";
cameraModeButton.normalFgSprite = "InfoPanelIconFreecamera";
cameraModeButton.foregroundSpriteMode = UIForegroundSpriteMode.Scale;
cameraModeButton.scaleFactor = 1.0f;
cameraModeButton.tooltip = "FPS Camera configuration";
cameraModeButton.tooltipBox = uiView.defaultTooltipBox;
UIComponent escbutton = uiView.FindUIComponent("Esc");
cameraModeButton.relativePosition = new Vector2
(
escbutton.relativePosition.x + escbutton.width / 2.0f - cameraModeButton.width / 2.0f - escbutton.width - 8.0f,
escbutton.relativePosition.y + escbutton.height / 2.0f - cameraModeButton.height / 2.0f
);
cameraModeButton.eventClick += (component, param) => { panel.isVisible = !panel.isVisible; };
var labelObject = new GameObject();
labelObject.transform.parent = uiView.transform;
cameraModeLabel = labelObject.AddComponent<UILabel>();
cameraModeLabel.textColor = new Color32(255, 255, 255, 255);
cameraModeLabel.Hide();
FPSCamera.onCameraModeChanged = state =>
{
if (state)
{
cameraModeLabel.text = String.Format("Press ({0}) to exit first-person mode", FPSCamera.GetToggleUIKey());
cameraModeLabel.color = new Color32(255, 255, 255, 255);
cameraModeLabel.AlignTo(cameraModeButton, UIAlignAnchor.BottomRight);
cameraModeLabel.relativePosition += new Vector3(-38.0f, -8.0f);
cameraModeLabel.Show();
}
else
{
cameraModeLabel.Hide();
}
};
FPSCamera.onUpdate = () =>
{
if (cameraModeLabel.color.a > 0)
{
var c = cameraModeLabel.color;
cameraModeLabel.color = new Color32(c.r, c.g, c.b, (byte)(c.a - 1));
}
};
panel = fullscreenContainer.AddUIComponent<UIPanel>();
panel.size = new Vector2(400, 700);
panel.isVisible = false;
panel.backgroundSprite = "SubcategoriesPanel";
panel.relativePosition = new Vector3(cameraModeButton.relativePosition.x - panel.size.x, cameraModeButton.relativePosition.y + 60.0f);
panel.name = "FPSCameraConfigPanel";
var titleLabel = panel.AddUIComponent<UILabel>();
titleLabel.name = "Title";
titleLabel.text = "First-person camera configuration";
titleLabel.autoSize = false;
titleLabel.size = new Vector2(panel.size.x, 24.0f);
titleLabel.AlignTo(panel, UIAlignAnchor.TopLeft);
titleLabel.relativePosition = new Vector3(titleLabel.relativePosition.x, titleLabel.relativePosition.y + 2.0f);
titleLabel.textAlignment = UIHorizontalAlignment.Center;
float y = 48.0f;
var hotkeyToggleLabel = panel.AddUIComponent<UILabel>();
hotkeyToggleLabel.name = "ToggleFirstpersonLabel";
hotkeyToggleLabel.text = "Hotkey to toggle first-person";
hotkeyToggleLabel.relativePosition = new Vector3(4.0f, y);
hotkeyToggleLabel.textScale = 0.8f;
hotkeyToggleButton = MakeButton(panel, "ToggleFirstpersonButton",
FPSCamera.instance.config.toggleFPSCameraHotkey.ToString(), y,
() =>
{
if (!waitingForChangeCameraHotkey)
{
waitingForChangeCameraHotkey = true;
waitingForShowMouseHotkey = false;
waitingForGoFasterHotkey = false;
hotkeyToggleButton.text = "Waiting";
}
//.........这里部分代码省略.........
示例5: OnLevelLoaded
public override void OnLevelLoaded(LoadMode mode)
{
if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame)
{
base.OnLevelLoaded(mode);
return;
}
// Get a reference to the game's UI.
var uiView = UnityEngine.Object.FindObjectOfType<UIView>();
var button = uiView.AddUIComponent(typeof(UIButton));
_browserButton = button as UIButton;
// The object should *never* be null.
// We call this a "sanity check".
if (_browserButton == null) { return; }
// Create a drag handler and attach it to our button.
_browserButtonDragHandle = button.AddUIComponent<UIDragHandle>();
_browserButtonDragHandle.target = _browserButton;
_browserButton.width = 36;
_browserButton.height = 36;
_browserButton.pressedBgSprite = "OptionBasePressed";
_browserButton.normalBgSprite = "OptionBase";
_browserButton.hoveredBgSprite = "OptionBaseHovered";
_browserButton.disabledBgSprite = "OptionBaseDisabled";
_browserButton.normalFgSprite = "ToolbarIconZoomOutGlobe";
_browserButton.foregroundSpriteMode = UIForegroundSpriteMode.Scale;
_browserButton.scaleFactor = 1.0f;
_browserButton.tooltip = "Open Browser (Hold Shift to drag)";
_browserButton.tooltipBox = uiView.defaultTooltipBox;
// If the user has moved the button, load their saved position data.
if (Configuration.HasSetting(keyButtonPositionX) && Configuration.HasSetting(keyButtonPositionY))
{
var buttonPositionX = Configuration.GetFloat(keyButtonPositionX);
var buttonPositionY = Configuration.GetFloat(keyButtonPositionY);
_buttonPosition = new Vector2(buttonPositionX, buttonPositionY);
_useSavedPosition = true;
}
else
{
_useSavedPosition = false;
}
// Since we're on another thread, we can pretty safely spin until our object has been created.
//while (_browserButton == null) { System.Threading.Thread.Sleep(100); }
if (!_useSavedPosition)
{
// Get a reference to the game's UI.
//var uiView = UnityEngine.Object.FindObjectOfType<UIView>();
// The default position of the button is the middle of the screen.
var buttonPositionX = (uiView.fixedWidth / 2f) + (_browserButton.width / 2f);
var buttonPositionY = (uiView.fixedHeight / 2f) + (_browserButton.height / 2f);
_buttonPosition = new Vector2(buttonPositionX, buttonPositionY);
}
_browserButton.absolutePosition = _buttonPosition;
var labelObject = new GameObject();
labelObject.transform.parent = uiView.transform;
_browserButtonLabel = labelObject.AddComponent<UILabel>();
_browserButtonLabel.textColor = new Color32(255, 255, 255, 255);
_browserButtonLabel.transformPosition = new Vector3(1.15f, 0.90f);
_browserButtonLabel.Hide();
RegisterEvents();
base.OnLevelLoaded(mode);
}