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


C# UIView.FindUIComponent方法代码示例

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


在下文中一共展示了UIView.FindUIComponent方法的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();
        }
开发者ID:iUltimateLP,项目名称:skylines-autosave-countdown,代码行数:30,代码来源:Main.cs

示例2: Start

        public void Start()
        {
            m_view = UIView.GetAView();

            m_selectAIPanel = m_view.FindUIComponent<SelectAIPanel>("SelectAIPanel");
            m_uiContainer = m_view.FindUIComponent("FullScreenContainer");
            m_propPanel = m_uiContainer.Find<UIPanel>("DecorationProperties");

            m_toolController = ToolsModifierControl.toolController;
            m_selectAIPanel.eventValueChanged += OnAIFieldChanged;
            m_toolController.eventEditPrefabChanged += OnEditPrefabChanged;
        }
开发者ID:dluechoy,项目名称:BuildingAIChanger,代码行数:12,代码来源:EditorController.cs

示例3: Start

        /// <summary>
        /// Creates all panels on game start
        /// </summary>
        public override void Start()
        {
            // check and create standard save file
            checkForSaveFile();

            // load panels and settings
            BBSettings saveData = loadSettings();

            // load UI and attach the BetterBudget object to its origin (top left)
            view = UIView.GetAView();
            this.transform.parent = view.transform;
            relativePosition = new Vector3(0, 0);

            //UIView.FullScreenContainer.EconomyPanel isVisible
            _expensePanel = view.FindUIComponent("FullScreenContainer").Find<UIPanel>("EconomyPanel");

            // detect opening of button container
            _buttonContainer = view.FindUIComponent<UIPanel>("InfoViewsPanel");

            // create list for extended panels
            _containerPanels = new List<UIExtendedBudgetPanel>();

            // Set visible, so child objects/panels are shown.
            isVisible = true;
            isInteractive = false; // maybe set to true?

            // Search for Slider Containers
            _budgetContainer = view.FindUIComponent<UIComponent>("ServicesBudgetContainer");
            _budgetTransportContainer = view.FindUIComponent<UIComponent>("SubServicesBudgetContainer");

            // open custom panel creator
            _customPanelCreator = AddUIComponent<BBCustomPanelCreator>();
            _customPanelCreator._main = this;
            _customPanelCreator.start(saveData.customPanelCreatorSettings);

            // set automatic expense updating and load panel settings
            _expenseUpdateActive = saveData.expenseUpdateActive;
            List<BBPanelSettings> settings = saveData.panelSettings;

            // create extended panels based on the saved information (settings)
            foreach (BBPanelSettings data in settings) {
                createExtendedPanel(data);
            }

            //Debug.Log("Better Budget Mod loaded! Have fun :)");
        }
开发者ID:LazyFiL,项目名称:BetterBudget,代码行数:49,代码来源:BetterBudget.cs

示例4: AttemptToReEnableWorkshop

        private static bool AttemptToReEnableWorkshop(UIView rootView)
        {
            WorkshopAdPanel tmpWAP;
             try
             {
                 if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("Attempting to Renable WorkshopAdPanel"); }
                 List<WorkshopAdPanel> WAPList = new List<WorkshopAdPanel>();
                 rootView.GetComponentsInChildren<WorkshopAdPanel>(true, WAPList);
                 if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 2) { Helper.dbgLog("Got the list"); }
                 if (WAPList.Count > 0)
                 {
                     if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("Found " + WAPList.Count.ToString() + " WorkshopAdPanels"); }
                     tmpWAP = WAPList[0];
                     if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 2) { Helper.dbgLog("0= n=" + tmpWAP.component.name + "  cn=" + tmpWAP.component.cachedName + "  pn=" + tmpWAP.component.parent.name + "  pcn=" + tmpWAP.component.parent.cachedName); }
                     typeof(WorkshopAdPanel).GetField("dontInitialize", BindingFlags.NonPublic | BindingFlags.Static).SetValue(tmpWAP, false);
                     if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("WorkshopAdPanel.dontInitialize= set"); }
                     bool retb = (bool)typeof(WorkshopAdPanel).GetField("dontInitialize", BindingFlags.NonPublic | BindingFlags.Static).GetValue(tmpWAP);
                     if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("WorkshopAdPanel.dontInitialize=" + retb.ToString()); }
                     if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("Now going to play with components - WorkshopAdPanels"); }
                     UIScrollablePanel usptmp = tmpWAP.Find<UIScrollablePanel>("Container");
                     if (usptmp != null)
                     {
                         if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("Found scrollablePanel 'Container' "); }
                         typeof(WorkshopAdPanel).GetField("m_ScrollContainer", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(tmpWAP, usptmp);
                         if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("inserted it into base panel object."); }
                     }

                     UIScrollablePanel usp = (UIScrollablePanel)typeof(WorkshopAdPanel).GetField("m_ScrollContainer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(tmpWAP);
                     if (usp != null)
                     {
                         if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("Scrollable was not null"); }
                         usp.isEnabled = true;
                         usp.isVisible = true;
                         usp.Awake();
                     }
                     tmpWAP.m_AutoScroll = true;
                     tmpWAP.m_AutoScrollInterval = 20;
                     tmpWAP.enabled = true;
                     tmpWAP.component.isEnabled = true;
                     tmpWAP.component.isVisible = true;
                     tmpWAP.component.Awake();
                     PlatformService.workshop.QueryItems();
                     typeof(WorkshopAdPanel).GetField("m_LastTime", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(tmpWAP, Time.realtimeSinceStartup);
                     UILabel tl = rootView.FindUIComponent<UILabel>("DisabledLabel");
                     if (tl != null)
                     {
                         tl.text = orgNoWorkshopText;
                         tl.isVisible = false;
                     }
                     if (DEBUG_LOG_ON) { Helper.dbgLog("re-enabled WorkshopAdPanel"); }
                     return true;
                 }
                 else
                 {
                     if (DEBUG_LOG_ON) { Helper.dbgLog("No Panels were found to reset. We are likely quiting app from inside an active game."); }
                 }
             }
             catch (Exception ex)
             { Helper.dbgLog("Error: ", ex, true); }

             try
             {
                 if (!Singleton<LoadingManager>.instance.m_applicationQuitting)
                 {
                     tmpWAP = new WorkshopAdPanel();
                     typeof(WorkshopAdPanel).GetField("dontInitialize", BindingFlags.NonPublic | BindingFlags.Static).SetValue(tmpWAP, false);
                     UILabel dl = rootView.FindUIComponent<UILabel>("DisabledLabel");
                     if (dl != null)
                     {
                         dl.text = orgNoWorkshopText;
                     }
                 }
             }
             catch (Exception ex)
             { if (Mod.DEBUG_LOG_ON) { Helper.dbgLog("Error: Most likey panel was destroyed already during exit\\quit game action", ex, true); } }

             return false;
        }
开发者ID:Knighth,项目名称:Telemetry-Control,代码行数:78,代码来源:Mod.cs

示例5: AttemptToDisableWorkshop

        internal static bool AttemptToDisableWorkshop(UIView rootView)
        {
            WorkshopAdPanel tmpWAP;
             try
             {
                 if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("Attempting to Disable WorkshopAdPanel"); }

                 List<WorkshopAdPanel> WAPList = new List<WorkshopAdPanel>();
                 rootView.GetComponentsInChildren<WorkshopAdPanel>(true, WAPList);
                 if (DEBUG_LOG_LEVEL > 2) { Helper.dbgLog("Got the list"); }
                 if (WAPList.Count > 0)
                 {
                     if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("Found " + WAPList.Count.ToString() + " WorkshopAdPanels"); }
                     tmpWAP = WAPList[0];
                     if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 2) { Helper.dbgLog("0= n=" + tmpWAP.component.name + "  cn=" + tmpWAP.component.cachedName + "  pn=" + tmpWAP.component.parent.name + "  pcn=" + tmpWAP.component.parent.cachedName); }
                     typeof(WorkshopAdPanel).GetField("dontInitialize", BindingFlags.NonPublic | BindingFlags.Static).SetValue(tmpWAP, true);
                     if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("WorkshopAdPanel.dontInitialize= set"); }
                     bool retb = (bool)typeof(WorkshopAdPanel).GetField("dontInitialize", BindingFlags.NonPublic | BindingFlags.Static).GetValue(tmpWAP);
                     if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("WorkshopAdPanel.dontInitialize=" + retb.ToString()); }
                     if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("now going to play with components - WorkshopAdPanels"); }

                     UIScrollablePanel usp = (UIScrollablePanel)typeof(WorkshopAdPanel).GetField("m_ScrollContainer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(tmpWAP);
                     if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("grabbed Scrollable ref via reflection."); }
                     if (usp != null)
                     {
                         if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("Scrollable was not null."); }
                         usp.isEnabled = false;
                         usp.isVisible = false;
                         usp.Awake();
                     }
                     tmpWAP.m_AutoScroll = false;
                     tmpWAP.m_AutoScrollInterval = 3600;
                     //tmpWAP.component.isEnabled = false;
                     //tmpWAP.component.isVisible = false;
                     tmpWAP.component.Awake();
                     UILabel tl = rootView.FindUIComponent<UILabel>("DisabledLabel");
                     if (tl != null)
                     {
                         orgNoWorkshopText = tl.text;
                         tl.text = WORKSHOPADPANEL_REPLACE_TEXT;
                         tl.isVisible = true;
                         if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("DisabledLabel set to " + tl.text + "  orginal=" + orgNoWorkshopText); }

                     }
                     return true;
                 }

             }
             catch (Exception ex)
             { Helper.dbgLog("Error: ", ex, true); }

             try
             {
                 tmpWAP = new WorkshopAdPanel();
                 typeof(WorkshopAdPanel).GetField("dontInitialize", BindingFlags.NonPublic | BindingFlags.Static).SetValue(tmpWAP, true);
                 UILabel dl = rootView.FindUIComponent<UILabel>("DisabledLabel");
                 if (dl != null)
                 {
                     orgNoWorkshopText = dl.text;
                     dl.text = WORKSHOPADPANEL_REPLACE_TEXT;
                     if (DEBUG_LOG_ON && DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("fallthrough - DisabledLabel set to " + dl.text + "  orginal=" + orgNoWorkshopText); }
                 }
             }
             catch (Exception ex)
             { Helper.dbgLog("Error: trying to set disabledLabel component during fallthrough", ex, true); }

             return false;
        }
开发者ID:Knighth,项目名称:Telemetry-Control,代码行数:68,代码来源:Mod.cs


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