Exemple #1
0
    private void SwitchUI(MFUIID targetUIID, MFUIID baseUIID = MFUIID.None, uint pri = 0,bool isAttached = false,
        MFUISwitchAnim.MFUISwitchAnimType switchInType = MFUISwitchAnim.MFUISwitchAnimType.None,
        MFUISwitchAnim.MFUISwitchAnimType switchOutType = MFUISwitchAnim.MFUISwitchAnimType.None)
    {
        if (CurrentUI == targetUIID)
            return;

        if (!DictUIIDToOBj.ContainsKey(targetUIID))
        {
            MFUIUtils.MFUIDebug("MFUIID Dictionary not contain Obj");
            return;
        }

        if (switchOutType != MFUISwitchAnim.MFUISwitchAnimType.None)
        {
            MFUISwitchAnimNode[] animNodeArr = DictUIIDToOBj[CurrentUI].GetComponentsInChildren<MFUISwitchAnimNode>(true);

            if (animNodeArr.Length > 0)
            {
                animNodeArr[0].Play(switchOutType);
            }
            else
            {
                DictUIIDToOBj[CurrentUI].AddComponent<MFUISwitchAnimNode>().Play(switchOutType);
            }
        }

        if (switchInType != MFUISwitchAnim.MFUISwitchAnimType.None)
        {
            MFUISwitchAnimNode[] animNodeArr = DictUIIDToOBj[targetUIID].GetComponentsInChildren<MFUISwitchAnimNode>(true);

            if (animNodeArr.Length > 0)
            {
                animNodeArr[0].Play(switchInType);
            }
            else
            {
                DictUIIDToOBj[targetUIID].AddComponent<MFUISwitchAnimNode>().Play(switchInType);
            }
        }

        //DictUIIDToOBj[CurrentUI].MFUIgameObject.GetComponentsInChildren<MFUISwitchAnimNode>(true)[0].Play(switchOutType);
        //DictUIIDToOBj[targetUIID].MFUIgameObject.GetComponentsInChildren<MFUISwitchAnimNode>(true)[0].Play(switchInType);
        //Debug.LogError(CurrentUI);
        //if (DictUIIDToOBj.ContainsKey(CurrentUI) && !isAttached)
        //{
        //    DictUIIDToOBj[CurrentUI].GetComponentsInChildren<MFUIUnit>(true)[0].Hide();
        //    //Debug.LogError(CurrentUI + " Hide");
        //}



        if (DictUIIDToOBj[targetUIID].GetComponentsInChildren<MFUIUnit>(true)[0].IsUIDirty())
        {
            DictUIIDToOBj[targetUIID].GetComponentsInChildren<MFUIUnit>(true)[0].Show();
        }
        //Debug.LogError(targetUIID + " Show");
    }
Exemple #2
0
    public void SwitchUIWithLoad(MFUIID targetUIID, MFUIID baseUIID = MFUIID.None, uint pri = 0,bool isAttached = false,
        MFUISwitchAnim.MFUISwitchAnimType switchInType = MFUISwitchAnim.MFUISwitchAnimType.None,
        MFUISwitchAnim.MFUISwitchAnimType switchOutType = MFUISwitchAnim.MFUISwitchAnimType.None)
    {
        //Debug.LogError(targetUIID + " " + CurrentUI);
        if (m_bUICanChange == false)
            return;

        if (CurrentUI == targetUIID)
            return;

        if (DictUIIDToOBj.ContainsKey(CurrentUI) && !isAttached)
        { 
            DictUIIDToOBj[CurrentUI].GetComponentsInChildren<MFUIUnit>(true)[0].Hide();
            //Debug.LogError(CurrentUI + " Hide");
        }

        if (targetUIID == MFUIID.None)
        {
            MogoGlobleUIManager.Instance.ShowWaitingTip(false);
            CurrentUI = MFUIID.None;
            return;
        }

        MFUIQueueManager.Instance.PushOne(() =>
            {
                if (!DictUIIDToOBj.ContainsKey(targetUIID))
                {

                    List<MFUIResourceReqInfo> list = new List<MFUIResourceReqInfo>();

                    MFUIResourceReqInfo info = new MFUIResourceReqInfo();

                    info.path = DictUIIDToPathName[targetUIID];
                    info.goName = targetUIID.ToString();
                    info.id = targetUIID;

                    list.Add(info);

                    MFUIGameObjectPool.GetSingleton().RegisterGameObjectList(list, () =>
                    {
                        switch (targetUIID)
                        {
                            case MFUIID.DragonUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<DragonUIViewManager>();
                                break;

                            case MFUIID.RuneUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<RuneUIViewManager>();
                                break;

                            //case MFUIID.NewBattleRewardUI:
                            //    MFUIGameObjectPool.GetSingleton().GetGameObject("go~").AddComponent<NewBattleRewardUIViewManager>();
                            //    break;

                            case MFUIID.PassCountDownUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<PassCountDownUIViewManager>();
                                break;

                            case MFUIID.BattlePassUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<BattlePassUIViewManager>();
                                break;

                            case MFUIID.BattlePassCardListUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<BattlePassCardListUIViewManager>();
                                break;

                            case MFUIID.OgreMustDieTip:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<OgreMustDieTipViewManager>();
                                break;

                            case MFUIID.InvitFriendMessageBox:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<InvitFriendMessageBoxViewManager>();
                                break;

                            case MFUIID.InvitFriendListUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<InvitFriendListUIViewManager>();
                                break;

                            case MFUIID.EnterWaittingMessageBox:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<EnterWaittingMessageBoxViewManager>();
                                break;

                            case MFUIID.BattlePassUINoCard:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<BattlePassUINoCardUIViewManager>();
                                break;

                            case MFUIID.NewChallengeUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<NewChallengeUIViewManager>();
                                break;

                            case MFUIID.WingUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<WingUIViewManager>();
                                break;

                            case MFUIID.WingPreviewInMarketUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<WingUIPreviewInMarketUIViewManager>();
                                break;
                                
                            case MFUIID.ProtectGodressTip:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<ProtectGodressTipViewManager>();
                                break;

                            case MFUIID.EquipFXUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<EquipFXUIViewManager>();
                                break;

                            case MFUIID.WingUIUpgradeDialog:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<WingUIUpgradeDialogViewManager>();
                                break;

                            case MFUIID.WingUIBuyDialog:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<WingUIBuyDialogViewManager>();
                                break;

                            case MFUIID.RewardUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<RewardUIViewManager>();
                                break;

                            case MFUIID.ChargeReturnWingUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<ChargeReturnWingUIViewManager>();
                                break;

                            case MFUIID.ElfDiamondUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<ElfDiamondUIViewManager>();
                                break;

                            case MFUIID.NewChargeRewardUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<NewChargeRewardUIViewManager>();
                                break;

                            case MFUIID.NewLoginRewardUI:
                                MFUIGameObjectPool.GetSingleton().GetGameObject(targetUIID.ToString()).AddComponent<NewLoginRewardUIViewManager>();
                                break;

                        }
                        SwitchUI(targetUIID, baseUIID, pri, isAttached, switchInType, switchOutType);
                    });
                }
                else
                {

                    SwitchUI(targetUIID, baseUIID, pri, isAttached, switchInType, switchOutType);
                }
            }, baseUIID, pri, targetUIID.ToString());

    }
 public void Play(MFUISwitchAnim.MFUISwitchAnimType type)
 {
     Debug.LogError("Playing " + " type  == "+ type);
 }