本文整理汇总了C#中UIView.AddUIComponent方法的典型用法代码示例。如果您正苦于以下问题:C# UIView.AddUIComponent方法的具体用法?C# UIView.AddUIComponent怎么用?C# UIView.AddUIComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIView
的用法示例。
在下文中一共展示了UIView.AddUIComponent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: SetupGui
public static void SetupGui()
{
//if(Mod.IsEnabled && Mod.IsGuiEnabled)
if (Mod.DEBUG_LOG_ON) Helper.dbgLog(" Setting up Gui panel.");
try
{
parentGuiView = null;
parentGuiView = UIView.GetAView();
if (guiPanel == null)
{
guiPanel = (CSLShowMoreLimitsGUI)parentGuiView.AddUIComponent(typeof(CSLShowMoreLimitsGUI));
if (Mod.DEBUG_LOG_ON) Helper.dbgLog(" GUI Setup.");
//guiPanel.Hide();
}
isGuiRunning = true;
}
catch (Exception ex)
{
Helper.dbgLog("Error: \r\n", ex,true);
}
}
示例3: CreateUIDialog
public static UIDialog CreateUIDialog(UIView view, string title, string details, OptionClicked accept, OptionClicked decline, bool destroyOnOption)
{
UIDialog dialog = (UIDialog)view.AddUIComponent (typeof(UIDialog));
dialog.Start ();
dialog.m_title.text = title;
Vector2 screenRes = view.GetScreenResolution();
dialog.m_details.text = details;
dialog.m_title.relativePosition = new Vector3(WIDTH/2 - dialog.m_title.width/2,HEAD/2 - dialog.m_title.height/2);
if (destroyOnOption) {
dialog.eventAccept += () => {GameObject.DestroyImmediate(dialog.gameObject);};
dialog.eventDecline += () => {GameObject.DestroyImmediate(dialog.gameObject);};
}
dialog.eventAccept += accept;
dialog.eventDecline += decline;
dialog.relativePosition = new Vector3(screenRes.x/2 - dialog.width/2,screenRes.y/2 - dialog.height/2);
return dialog;
}
示例4: AddToolbarButton
private void AddToolbarButton(UIView view)
{
_toolbar_Button = (UICheckButton)view.AddUIComponent(typeof(UICheckButton));
_toolbar_Button.atlas = _atlas;
_toolbar_Button.normalBgSprite = "OptionBase";
_toolbar_Button.hoveredBgSprite = "OptionBaseFocused";
_toolbar_Button.pressedBgSprite = "OptionBasePressed";
_toolbar_Button.normalFgSprite = "Music";
_toolbar_Button.width = 36;
_toolbar_Button.height = 36;
Vector2 screenResolution = view.GetScreenResolution();
_toolbar_Button.relativePosition = new Vector3(screenResolution.x - _toolbar_Button.width - 10 - 20 - 40, screenResolution.y - _toolbar_Button.height / 2 - 120 + 7);
_toolbar_Button.eventClick += delegate
{
_toolbar_Button_MouseDown_Timer = -1;
_current_Settings_Panel.isVisible = !_current_Settings_Panel.isVisible;
};
//Drag,drop
_toolbar_Button.eventMouseDown += (component, eventParam) =>
{
_toolbar_Button_MouseDown_Timer = 60;
};
_toolbar_Button.eventMouseUp += (component, eventParam) =>
{
if (_toolbar_Button_dragging)
{
gameObject.GetComponent<SettingsManager>().SaveModSettings();
_toolbar_Button_dragging = false;
}
_toolbar_Button_dragging = false;
_toolbar_Button_MouseDown_Timer = -1;
};
}
示例5: AddListPanel
private void AddListPanel(UIView view)
{
_current_Settings_Panel = (UIMusicListPanel)view.AddUIComponent(typeof(UIMusicListPanel));
_current_Settings_Panel.Hide();
_current_Settings_Panel.AudioWatcher = AudioWatcher;
_current_Settings_Panel.SettingsManager = gameObject.GetComponent<SettingsManager>();
_current_Settings_Panel.MusicManager = gameObject.GetComponent<MusicManager>();
}
示例6: SetupGui
/// <summary>
/// Our private little function to do whatever we need to setup and initialize our Gui screen object.
/// </summary>
private static void SetupGui()
{
if (SomeModName.DEBUG_LOG_ON) Logger.dbgLog(" Setting up Gui panel.");
try
{
parentGuiView = null; //make sure we start fresh, even though we could just assume that was set during the last map unload.
parentGuiView = UIView.GetAView(); //go get the root screen\view object from Unity via Colosalframework.ui function.
//if our object is null (it should be) then lets create one, have the game ADD it, and store it and set our isGUIrunning flag.
if (guiPanel == null)
{
guiPanel = (SomeModNameGUI)parentGuiView.AddUIComponent(typeof(SomeModNameGUI));
if (SomeModName.DEBUG_LOG_ON) Logger.dbgLog(" GUI Created.");
}
isGuiRunning = true;
}
catch (Exception ex)
{
Logger.dbgLog("Error: \r\n", ex,true);
}
}