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


C# UIView.GetComponentsInChildren方法代码示例

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


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

示例1: 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

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