Example #1
0
        /// <summary>
        /// 关闭,不允许子类调用
        /// </summary>
        void IPanel.Close(bool destroyed)
        {
            PanelInfo.UIData = mUIData;
            mOnClosed.InvokeGracefully();
            mOnClosed = null;

            OnClose();

            if (destroyed)
            {
                Destroy(gameObject);
            }

            mPanelLoader.Unload();
            mPanelLoader = null;
            mUIData      = null;

            mSubPanelInfos.ForEach(subPanelInfo => UIMgr.ClosePanel(subPanelInfo.PanelName));
            mSubPanelInfos.Clear();
        }
Example #2
0
        public static T OpenPanel <T>(PanelOpenType panelOpenType, UILevel canvasLevel = UILevel.Common,
                                      IUIData uiData         = null,
                                      string assetBundleName = null,
                                      string prefabName      = null) where T : UIPanel
        {
            var panelSearchKeys = PanelSearchKeys.Allocate();

            panelSearchKeys.OpenType        = panelOpenType;
            panelSearchKeys.Level           = canvasLevel;
            panelSearchKeys.PanelType       = typeof(T);
            panelSearchKeys.AssetBundleName = assetBundleName;
            panelSearchKeys.GameObjName     = prefabName;
            panelSearchKeys.UIData          = uiData;

            T retPanel = UIManager.Instance.OpenUI(panelSearchKeys) as T;

            panelSearchKeys.Recycle2Cache();

            return(retPanel);
        }
Example #3
0
        public IUIBehaviour CreateUI(string uiBehaviourName, int level, IUIData uiData = null)
        {
            IUIBehaviour ui;

            if (mAllUI.TryGetValue(uiBehaviourName, out ui))
            {
                Log.W("{0}: already exist", uiBehaviourName);
                return(ui);
            }
            GameObject uiObj = CreateUIObj(uiBehaviourName, (int)level);

            ui = uiObj.GetComponent <IUIBehaviour>();

            Log.I("QUIManager {0} Load Success", ui.Transform.name);

            mAllUI.Add(uiBehaviourName, ui);

            ui.Init(uiData);

            return(ui);
        }
        protected override void InitUI(IUIData uiData = null)
        {
            mData = uiData as UISectionPanelData;

            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); });
                });
            }
        }
Example #5
0
        /// <summary>
        /// 通用打开方法
        /// </summary>
        /// <param name="AssestPath">资产路径</param>
        /// <param name="UIData">UI数据</param>
        /// <param name="bMonoBehaviour">UI是否开启生命周期</param>
        public IBaseUI Open(string AssestPath, IUIData UIData, bool bMonoBehaviour = false)
        {
            IBaseUI UI = CheckCache(AssestPath, UIData);

            if (UI != null)
            {
                return(UI);
            }
            IAssurerLoader loader = VLoader.EasyGet();

            UI = CreateUISync(AssestPath, ref loader);
            if (UI == null)
            {
                return(UI);
            }

            Push(UI, UIData);
            UI.Init(AssestPath, UIData, loader, bMonoBehaviour);
            UI.Show();

            return(UI);
        }
Example #6
0
        protected override void OnInit(IUIData uiData = null)
        {
            ImageBg.color = "#FFFFFFFF".HtmlStringToColor();

            this.Delay(0.1f, () => { UIKit.GetPanel <UIMenuPanel>().LogInfo(); });

            // 注册事件
            RegisterEvent(UIEventID.MenuPanel.ChangeMenuColor);

            BtnPlay.onClick.AddListener(() =>
            {
                UIKit.OpenPanel <UISectionPanel>(UILevel.Common, prefabName: "resources://UISectionPanel");
                // this.DoTransition<UISectionPanel>(new FadeInOut(), UILevel.Common,
                // prefabName: "Resources/UISectionPanel");
            });

            BtnSetting.onClick.AddListener(() =>
            {
                UIKit.OpenPanel <UISettingPanel>(UILevel.PopUI,
                                                 prefabName: "Resources/UISettingPanel");
            });
        }
Example #7
0
 protected override void OnOpen(IUIData uiData = null)
 {
     BackBtn.onClick.AddListener(() => {
         FadeClose();
         UIKit.OpenPanel <UIMenu>();
     });
     if (GameDataManager.GetFloat("FirstFlag") != 1)
     {
         GameDataManager.SetFloat("MucisValue", 1);
         GameDataManager.SetFloat("SoundValue", 1);
         GameDataManager.SetFloat("FirstFlag", 1);
         GameDataManager.SetBool("NeedTips", false);
     }
     music_value.value = GameDataManager.GetFloat("MusicValue");
     music_value.onValueChanged.AddListener((float value) => {
         AudioKit.MusicPlayer.SetVolume(value);
     });
     sound_value.onValueChanged.AddListener((float value) => {
         MyAudioPlayer.Instance.PlayVoice("CoarseClick_Minimal");
         AudioKit.VoicePlayer.SetVolume(value);
     });
     sound_value.value = GameDataManager.GetFloat("SoundValue");
     need_tips.isOn    = GameDataManager.GetBool("NeedTips");
 }
Example #8
0
        protected override void InitUI(IUIData uiData = null)
        {
            mData = uiData as UIPopUpBoxData ?? new UIPopUpBoxData();
            //please add init code here

            Bg.gameObject.SetActive(mData.ShowBg);

            if (mData.BgImg != null)
            {
                PopUpBox.sprite = mData.BgImg;
            }

            ShowButton();

            if (!string.IsNullOrEmpty(mData.HintText))
            {
                Hint.text = mData.HintText;
            }

            if (!string.IsNullOrEmpty(mData.TitleText))
            {
                Title.text = mData.TitleText;
            }
        }
Example #9
0
 protected override void InitUI(IUIData uiData = null)
 {
     mData = uiData as UIMediaInfoPanelData ?? new UIMediaInfoPanelData();
     //please add init code here
 }
Example #10
0
 protected void OnInit(IUIData uiData = null)
 {
     Ctx._("mData = uiData as {0} ?? new {0}()", Ctx.Data.PanelName + "Data");
     Ctx._comment("please add init code here");
 }
Example #11
0
 protected override void OnOpen(IUIData uiData = null)
 {
 }
Example #12
0
 /// <summary>
 /// Create&ShowUI
 /// </summary>
 public T OpenUI <T>(UILevel canvasLevel = UILevel.Common, IUIData uiData = null, string assetBundleName = null,
                     string prefabName   = null) where T : UIPanel
 {
     return(OpenUI(prefabName ?? GetUIBehaviourName <T>(), canvasLevel, uiData, assetBundleName) as T);
 }
Example #13
0
 protected override void InitUI(IUIData uiData = null)
 {
     mData = uiData as WinPanelData ?? new WinPanelData();
     //please add init code here
 }
Example #14
0
        protected override void InitUI(IUIData uiData = null)
        {
            ImageBg.color = "#FFFFFFFF".HtmlStringToColor();

            Observable.NextFrame().Subscribe(_ => { UIMgr.GetPanel <UIMenuPanel>().LogInfo(); });
        }
Example #15
0
 protected override void InitUI(IUIData uiData = null)
 {
     mData = uiData as UIMenuPanelData;
     //please add init code here
     ImageBg.color = "#FFFFFFFF".HtmlStringToColor();
 }
Example #16
0
 protected virtual void OnOpen(IUIData uiData = null)
 {
 }
Example #17
0
 public void Open(IUIData uiData = null)
 {
     OnOpen(uiData);
 }
Example #18
0
 protected void OnOpen(IUIData uiData = null)
 {
     Ctx._("mData = uiData as {0} ?? mData", Ctx.Data.PanelName + "Data");
 }
Example #19
0
 protected virtual void OnInit(IUIData uiData = null)
 {
 }
Example #20
0
 /// <summary>
 /// 对应UIMgr里面的Open
 /// </summary>
 /// <param name="mUiData"></param>
 public override void OnOpen(IUIData mUiData = null)
 {
     this.mUiData = mUiData;
 }
Example #21
0
 protected virtual void InitUI(IUIData uiData = null)
 {
 }
Example #22
0
 /// <summary>
 /// Start
 /// </summary>
 /// <param name="uiData"></param>
 protected override void OnInit(IUIData uiData)
 {
 }
Example #23
0
 protected override void InitUI(IUIData uiData = null)
 {
     mData = uiData as UISettingPanelData;
     ShowLog("show");
     //please add init code here
 }
Example #24
0
 public void Open(IUIData uiData = null)
 {
     State = PanelState.Opening;
     OnOpen(uiData);
 }
Example #25
0
        public IPanel CreateUI(string uiBehaviourName, UILevel level = UILevel.Common, IUIData uiData = null,
                               string assetBundleName = null)
        {
            IPanel ui;

            if (mAllUI.TryGetValue(uiBehaviourName, out ui))
            {
                return(ui);
            }

            ui = UIPanel.Load(uiBehaviourName, assetBundleName);

            switch (level)
            {
            case UILevel.Bg:
                ui.Transform.SetParent(mBgTrans);
                break;

            case UILevel.AnimationUnderPage:
                ui.Transform.SetParent(mAnimationUnderTrans);
                break;

            case UILevel.Common:
                ui.Transform.SetParent(mCommonTrans);
                break;

            case UILevel.AnimationOnPage:
                ui.Transform.SetParent(mAnimationOnTrans);
                break;

            case UILevel.PopUI:
                ui.Transform.SetParent(mPopUITrans);
                break;

            case UILevel.Const:
                ui.Transform.SetParent(mConstTrans);
                break;

            case UILevel.Toast:
                ui.Transform.SetParent(mToastTrans);
                break;

            case UILevel.Forward:
                ui.Transform.SetParent(mForwardTrans);
                break;
            }

            var uiGoRectTrans = ui.Transform as RectTransform;

            uiGoRectTrans.offsetMin          = Vector2.zero;
            uiGoRectTrans.offsetMax          = Vector2.zero;
            uiGoRectTrans.anchoredPosition3D = Vector3.zero;
            uiGoRectTrans.anchorMin          = Vector2.zero;
            uiGoRectTrans.anchorMax          = Vector2.one;

            ui.Transform.LocalScaleIdentity();
            ui.Transform.gameObject.name = uiBehaviourName;

            ui.PanelInfo = new UIPanelInfo
            {
                AssetBundleName = assetBundleName, Level = level, PanelName = uiBehaviourName
            };

            mAllUI.Add(uiBehaviourName, ui);

            ui.Init(uiData);

            return(ui);
        }
Example #26
0
 protected override void OnInit(IUIData uiData = null)
 {
     mData = uiData as UIStageClearData ?? new UIStageClearData();
     // please add init code here
 }
Example #27
0
 internal static T OpenPanel <T>(IUIData uiData, string assetBundleName = null,
                                 string prefabName = null) where T : UIPanel
 {
     return(UIManager.Instance.OpenUI <T>(UILevel.Common, uiData, assetBundleName, prefabName));
 }
Example #28
0
 protected override void InitUI(IUIData uiData = null)
 {
 }
Example #29
0
 internal static T OpenPanel <T>(int canvasLevel   = UILevel.Common, IUIData uiData = null, string assetBundleName = null,
                                 string prefabName = null) where T : QUIBehaviour
 {
     return(QUIManager.Instance.OpenUI <T>(canvasLevel, uiData, assetBundleName, prefabName));
 }
Example #30
0
 protected override void OnInit(IUIData uiData = null)
 {
     mData = uiData as TestViewData ?? new TestViewData();
     //please add init code here
     BindLuaComponent();
 }