当前位置: 首页>>代码示例>>C#>>正文


C# UILabel.Show方法代码示例

本文整理汇总了C#中UILabel.Show方法的典型用法代码示例。如果您正苦于以下问题:C# UILabel.Show方法的具体用法?C# UILabel.Show怎么用?C# UILabel.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UILabel的用法示例。


在下文中一共展示了UILabel.Show方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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";
                    }
//.........这里部分代码省略.........
开发者ID:erstrom,项目名称:Skylines-FPSCamera,代码行数:101,代码来源:FPSCameraUI.cs

示例2: 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();
     }
 }
开发者ID:Knighth,项目名称:Cities-Skyline-Proper-Hardness,代码行数:15,代码来源:BuildingInfoWindow.cs

示例3: DoToolTips


//.........这里部分代码省略.........
                            //case "Disable Machine Info":
                            //    cb[i].tooltip = "Disables telemetry sent for when you boot up the game exe.\n it includes information to id your specific computer spec & steamid or paradox login\n**Please Note: This setting does nothing atm, mods load too late to change this\n if you want to disable this you must use patched Assemembly-CSharp.dll";
                            //    cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableMachineInfo);
                            //    break;
                            case "Disable Custom Content":
                                cb[i].tooltip = "Disables telemetry about what custom content you load with a map.\n It includes information such has counts of building,props,trees,vehicles,mods, and details about every enabled mod.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableCustomContent );
                                break;
                            case "Disable Session Start":
                                cb[i].tooltip = "Disables telemetry about what Session Starts(loading a map).\n it includes information such has mapname,mapfilename,loadmode,environment,inverted traffic and map guid.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableStartSession);
                                break;
                            case "Disable Session Loaded":
                                cb[i].tooltip = "Disables telemetry about a Loaded Session (map loading completed).\n it includes information such has current time, time in your map, and how long part of the load took to execute.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableSessionLoaded );
                                break;
                            case "Disable Session End":
                                cb[i].tooltip = "Disables telemetry about a Session End (map unloaded).\n it includes data that a session has ended, and of what type it was (map,game,asset).";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableEndSession);
                                break;
                            case "Disable Exception Reporting":
                                cb[i].tooltip = "Disables telemetry about an Exception Error occuring.\n This only sends the 'type' of error and the basic error message, it does not send a stack trace.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableExceptionReporting);
                                break;
                            case "Disable OnAppQuit":
                                cb[i].tooltip = "Disables telemetry sent when you exit the game.\n This includes data that you exited the game and a timestamp.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableOnQuit);
                                break;
                            case "Disable Store Clicks":
                                cb[i].tooltip = "Disables telemetry sent when you click on a store item.\n This only sends that you clicked on the store button.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableOnStoreClick);
                                break;
                            case "Disable Feed Clicks":
                                cb[i].tooltip = "Disables telemetry sent when you click on a workshop feed\\news item \n This sends that you clicked on one and the target steamAppID or url upon which you clicked.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableOnClicks);
                                break;
                            case "Disable Paradox Login":
                                cb[i].tooltip = "Disables telemetry sent when the game logs you into your paradox account \n This sends data that you were auto-logged in and a timestamp.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableParadoxLogin);
                                break;
                            case "Enable All SendToFile Only":
                                cb[i].tooltip = "Enables all telemetry - but nothing will be sent to Paradox, only logged in your log file.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.EnableAllButLogToFileInstead);
                                break;
                            case "DisableWorkshopAdPanel":
                                cb[i].tooltip = "Disables the workshop 'feed' panel, does NOT disable Workshop in general.\n There is no telemetry directly associated with disabling this.\n I simply find the feeds a waste of bandwidth.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableWorkshopAdPanel);
                                break;
                            case "NoOpThePush":
                                cb[i].tooltip = "This is a master overide to make Telemetry.Push() (function that sends the data) do absolutely nothing.\n If set nothing will be sent OR even logged (if not in verbose logging mode).";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.NoOpThePush);
                                break;
                            case "SetURL To LocalHost":
                                cb[i].tooltip = "Sets the Paradox API URL to whatever you have in your config file.\n The default is 'https://localhost:49100/cities' if enabled.\n Can be used if you want to enable everything but send data your own web server.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.SetAPIUrlLocalHost);
                                break;

                            case "Disable All Telemetry":
                                cb[i].tooltip = "Disables all telemetry - Nothing will be sent to Paradox.\nYou do NOT have to select the individual options if this is set.\n *Please see note at bottom of options page about the OnAppStartup and MachineInfo telemetry events.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableAll);
                                break;
                            case "Enable All Telemetry":
                                cb[i].tooltip = "Enables all telemetry - The game's default behavior.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.EnableAll);
                                break;
                            default:
                                break;
                        }
                    }
                }

                List<UIButton> bb = new List<UIButton>();
                component.GetComponentsInChildren<UIButton>(true, bb);
                if ( bb.Count > 0)
                {
                    bb[0].tooltip = "Press this after making changes to ensure all changes are activated.\n ";

                    if (!isMsgLabelSetup)
                    {
                        uiMsg = component.AddUIComponent<UILabel>();
                        isMsgLabelSetup = true;
                        uiMsg.name = "TelemetryMessageText";
                        uiMsg.text = UILABEL_MSG_TEXT;
                        uiMsg.width = 350f;

                        //uiMsg.wordWrap = true;
                        uiMsg.relativePosition = new Vector3(bb[0].relativePosition.x, bb[0].relativePosition.y + 30f);
                        uiMsg.Show();
                    }

                }

                if (Mod.DEBUG_LOG_ON) { Helper.dbgLog("Tooltips set"); }
            }
            catch(Exception ex)
            {
                Helper.dbgLog("", ex, true);
            }
            yield break;
        }
开发者ID:Knighth,项目名称:Telemetry-Control,代码行数:101,代码来源:Mod.cs


注:本文中的UILabel.Show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。