コード例 #1
0
        protected override void OnInit(IUIData uiData = null)
        {
            for (var i = 0; i < mButtons.Length; i++)
            {
                mButtons[i] = SectionBtn
                              .Instantiate()
                              .Parent(SectionBtn.transform.parent)
                              .LocalScaleIdentity()
                              .LocalPositionIdentity()
                              .Name("Section" + (i + 1))
                              .Show()
                              .ApplySelfTo(selfBtn => selfBtn.GetComponentInChildren <Text>().text = selfBtn.name)
                              .ApplySelfTo(selfBtn =>
                {
                    var index = i;
                    selfBtn.onClick.AddListener(() => { ChoiceSection(index); });
                });
            }

            SettingBtn.onClick.AddListener(() =>
            {
                UIKit.OpenPanel <UISettingPanel>(UILevel.PopUI, prefabName: "Resources/UISettingPanel");
            });

            BackBtn.onClick.AddListener(() =>
            {
                CloseSelf();
                UIKit.OpenPanel <UIMenuPanel>(UILevel.Common, prefabName: "Resources/UIMenuPanel");
            });
        }
コード例 #2
0
ファイル: UISectionPanel.cs プロジェクト: bookong/QFramework
 protected override void InitUI(IUIData uiData = null)
 {
     for (var i = 0; i < mButtons.Length; i++)
     {
         mButtons[i] = SectionBtn
                       .Instantiate()
                       .Parent(SectionBtn.transform.parent)
                       .LocalScaleIdentity()
                       .LocalPositionIdentity()
                       .Name("Section" + (i + 1))
                       .Show()
                       .ApplySelfTo(selfBtn => selfBtn.GetComponentInChildren <Text>().text = selfBtn.name)
                       .ApplySelfTo(selfBtn =>
         {
             var index = i;
             selfBtn.onClick.AddListener(() => { ChoiceSection(index); });
         });
     }
 }