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


C# UIPanel.SetRect方法代码示例

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


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

示例1: initialize


//.........这里部分代码省略.........
            

            // ボタンはgoProfileTabをコピー
            GameObject goProfileTabCopy = UnityEngine.Object.Instantiate( FindChild(goUIRoot.transform.Find("ProfilePanel").Find("Comment").gameObject, "ProfileTab") ) as GameObject;
            EventDelegate.Remove(goProfileTabCopy.GetComponent<UIButton>().onClick, new EventDelegate.Callback(ProfileMgr.Instance.ChangeCommentTab));
            goProfileTabCopy.SetActive(false);


            #region createPanel
            
            // ModsSliderPanel作成
            Vector3 originAMSPanel = new Vector3(UIRootWidth / 2f - 15f - ScrollViewWidth / 2f - 50f, 40f, 0f);
            int systemUnitHeight = 30;

            // 親Panel
            uiAMSPanel = NGUITools.AddChild<UIPanel>(goUIRoot);
            uiAMSPanel.name = "ModsSliderPanel";
            uiAMSPanel.transform.localPosition = originAMSPanel;
            goAMSPanel = uiAMSPanel.gameObject;

            // 背景
            UISprite uiBGSprite = NGUITools.AddChild<UISprite>(goAMSPanel);
            uiBGSprite.name       = "BG";
            uiBGSprite.atlas      = uiAtlasSceneEdit;
            uiBGSprite.spriteName = "cm3d2_edit_window_l";
            uiBGSprite.type       = UIBasicSprite.Type.Sliced;
            uiBGSprite.SetDimensions(ScrollViewWidth, ScrollViewHeight);

            // ScrollViewPanel
            uiScrollPanel = NGUITools.AddChild<UIPanel>(goAMSPanel);
            uiScrollPanel.name         = "ScrollView";
            uiScrollPanel.sortingOrder = uiAMSPanel.sortingOrder + 1;
            uiScrollPanel.clipping     = UIDrawCall.Clipping.SoftClip;
            uiScrollPanel.SetRect(0f, 0f, uiBGSprite.width, uiBGSprite.height - 110 - systemUnitHeight);
            uiScrollPanel.transform.localPosition = new Vector3(-25f, - systemUnitHeight, 0f);
            goScrollView = uiScrollPanel.gameObject;

            uiScrollView = goScrollView.AddComponent<UIScrollView>();
            uiScrollView.contentPivot = UIWidget.Pivot.Center;
            uiScrollView.movement = UIScrollView.Movement.Vertical;
            uiScrollView.scrollWheelFactor = 1.5f;

            uiBGSprite.gameObject.AddComponent<UIDragScrollView>().scrollView = uiScrollView;
            uiBGSprite.gameObject.AddComponent<BoxCollider>();
            NGUITools.UpdateWidgetCollider(uiBGSprite.gameObject);
            
            // ScrollBar
            uiScrollBar = NGUITools.AddChild<UIScrollBar>(goAMSPanel);
            uiScrollBar.value = 0f;
            uiScrollBar.gameObject.AddComponent<BoxCollider>();
            uiScrollBar.transform.localPosition = new Vector3(uiBGSprite.width / 2f-10, 0f, 0f);
            uiScrollBar.transform.localRotation *= Quaternion.Euler(0f, 0f, -90f);

            UIWidget uiScrollBarFore = NGUITools.AddChild<UIWidget>(uiScrollBar.gameObject);
            uiScrollBarFore.name   = "DummyFore";
            uiScrollBarFore.height = 15;
            uiScrollBarFore.width  = uiBGSprite.height;

            UISprite uiScrollBarThumb = NGUITools.AddChild<UISprite>(uiScrollBar.gameObject);
            uiScrollBarThumb.name       = "Thumb";
            uiScrollBarThumb.depth      = uiBGSprite.depth + 1;
            uiScrollBarThumb.atlas      = uiAtlasSceneEdit;
            uiScrollBarThumb.spriteName = "cm3d2_edit_slidercursor";
            uiScrollBarThumb.type       = UIBasicSprite.Type.Sliced;
            uiScrollBarThumb.SetDimensions(15, 15);
            uiScrollBarThumb.gameObject.AddComponent<BoxCollider>();
开发者ID:neguse11,项目名称:CM3D2.AddModsSlider.Plugin,代码行数:67,代码来源:CM3D2.AddModsSlider.Plugin.cs


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