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


C# UIPanel.GetComponentsInChildren方法代码示例

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


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

示例1: Repostion

    public static void Repostion(UIPanel panel, int levelDepth)
    {
        panel.depth = levelDepth * 80;
        List<UIPanel> panels = new List<UIPanel>();
        panels.AddRange(panel.GetComponentsInChildren<UIPanel>(true));
        panels.Remove(panel);
        if (panels.Count >= 80)
        {
            throw new UnityException("too many panels!");
        }

        panels.Sort((x, y) => { return x.depth - y.depth; });
        int temp = panel.depth;
        foreach (var p in panels)
        {
            if (panel == p)
            {
                continue;
            }
            p.depth = ++temp;
        }
    }
开发者ID:xiaozhuzhaoge,项目名称:QinCloudSuper,代码行数:22,代码来源:ManagedUI.cs

示例2: GetPanelWidgets

 public static UIWidget[] GetPanelWidgets(UIPanel panel, bool includeInactive)
 {
     return panel.GetComponentsInChildren<UIWidget>(includeInactive)
         .Where(w => w.GetType() != typeof(UIWidget) && GetWidgetPanel(w) == panel)
         .ToArray();
 }
开发者ID:GHScan,项目名称:DailyProjects,代码行数:6,代码来源:DepthCalculator.cs

示例3: SetDepth

    void SetDepth(UIPanel panel, int depth)
    {
        if (panel == null) return;

        UIPanel[] sprites = panel.GetComponentsInChildren<UIPanel>();

        string widgetName = null;
        int questionCount = 0;
        for (int i = 0; i < sprites.Length; i++)
        {
            UIPanel widget = sprites[i];
            widgetName = widget.name;
            if (widgetName.Contains(BACKGROUND_NAME))
            {
                widget.depth = depth - 2;
            }
            else if (widgetName.Contains(BTN_NAME))
            {
                widget.depth = depth - 1;
            }
            else if (widgetName.Contains(TOGGLE_NAME) || widgetName.Contains(UI_NAME))
            {
                widget.depth = depth + 1;
            }
            else if (widget.name.Contains(QUESTION))
            {
                widget.depth = depth + questionCount;
                questionCount++;
            }
            else 
            {
                widget.depth = depth;
            }
        }
    }
开发者ID:imlovee,项目名称:WatchRemember_Final,代码行数:35,代码来源:PageFlip.cs

示例4: UpdateClip

    void UpdateClip(UIPanel panel)
    {
        if (panel && panel.hasClipping)
        {
            var soft = panel.clipSoftness;
            var sharpness = new Vector2(1000.0f, 1000.0f);

            if (soft.x > 0f)
            {
                sharpness.x = panel.baseClipRegion.z / soft.x;
            }
            if (soft.y > 0f)
            {
                sharpness.y = panel.baseClipRegion.w / soft.y;
            }

            Vector4 panelCenterAndSharpness;

            //var uiCamera = NGUIUtil.GetCamera();
            Debug.Assert(uiCamera != null);
            var panelWorldCorners = m_panel.worldCorners;
            var leftBottom = uiCamera.WorldToViewportPoint(panelWorldCorners[0]);
            var topRight = uiCamera.WorldToViewportPoint(panelWorldCorners[2]);
            var center = Vector3.Lerp(leftBottom, topRight, 0.5f);

            panelCenterAndSharpness.x = center.x;
            panelCenterAndSharpness.y = center.y;
            panelCenterAndSharpness.z = sharpness.x;
            panelCenterAndSharpness.w = sharpness.y;

            // Set shader properties
            var pss = panel.GetComponentsInChildren<ParticleSystem>();
            foreach (var ps in pss)
            {
                var render = ps.GetComponent<Renderer>();
                if(render == null)
                {
                    continue;
                }
                if(render.material != null)
                {
                    //Shader.FindObjectOfType()
                    if(render.material.shader.name.Equals(need_Change_Shader_Additive))
                    {
                        render.material.shader = shader_Additive_ClipByUI;
                    }
                    else if(render.material.shader.name.Equals(need_Change_Shader_Blend_Additive))
                    {
                        render.material.shader = shader_Additive_Blend_ClipByUI;
                    }
                    else
                    {
                        continue;
                    }

                    render.material.SetFloat(m_panelSizeXProperty, topRight.x - leftBottom.x);
                    render.material.SetFloat(m_panelSizeYProperty, topRight.y - leftBottom.y);
                    render.material.SetVector(m_panelCenterAndSharpnessProperty, panelCenterAndSharpness);
                }
            }
        }
    }
开发者ID:hzy125060691,项目名称:apple,代码行数:62,代码来源:UIParticleClip.cs


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