Ejemplo n.º 1
0
    public static WGItemView CreateItemView(bool _isMonster = false)
    {
        if (mObj == null)
        {
            mObj = Resources.Load("pbWGItemView");
        }
        isMonster = _isMonster;
        if (mObj != null)
        {
            GameObject go = Instantiate(mObj) as GameObject;
            WGItemView iv = go.GetComponent <WGItemView>();
            curItemView = iv;
            return(iv);
        }
//		if(isMonster){
//			this.OnBtnMonster();
//		}
        return(null);
    }
Ejemplo n.º 2
0
    public void ViewControllerDoAct(BTN_ACT act, System.Action <MDAlertBehaviour, VIEW_STATE> myCallBack = null)
    {
        switch (act)
        {
        case BTN_ACT.ITEM:
            mViewState      = VIEW_STATE.ITEM;
            currentViewCtrl = WGItemView.CreateItemView();
            break;

        case BTN_ACT.MONSTER:
            mViewState      = VIEW_STATE.ITEM;
            currentViewCtrl = WGItemView.CreateItemView(true);
            break;

        case BTN_ACT.SHOP:
            mViewState      = VIEW_STATE.SHOP;
            currentViewCtrl = WGShopView.CreateShopView();
            break;

        case BTN_ACT.Achievement:
            mViewState      = VIEW_STATE.Achievement;
            currentViewCtrl = WGAchievementView.CreateAchievementView();
            break;

        case BTN_ACT.OTHER:
            mViewState      = VIEW_STATE.OTHER;
            currentViewCtrl = WGHelpView.CreateHelpView();
            break;

        case BTN_ACT.HuaFei:
            mViewState      = VIEW_STATE.HuaFei;
            currentViewCtrl = V2DuiHuaFeiView.CreateDuiHuaFeiView();
            break;
//		case BTN_ACT.Sign:
//			mViewState = VIEW_STATE.Sign;
//			currentViewCtrl = WGDailyRewardView.CreateDailyView();
//			break;
        }

        mTempViewState = mViewState;


        SDK.AddChild(currentViewCtrl.gameObject, WGRootManager.Self.goRootGameUI);

        currentViewCtrl.showView();

        currentViewCtrl.alertViewBehavriour = (ab, view) => {
            if (myCallBack != null)
            {
                myCallBack(ab, mViewState);
            }
            freshMenuButton();
            switch (ab)
            {
            case MDAlertBehaviour.DID_SHOW:

                break;

            case MDAlertBehaviour.DID_HIDDEN:

                if (mTempViewState != VIEW_STATE.HuaFei)
                {
                    if (YeHuoSDK.bShowLuckGift)                     //close window lucky
                    {
                        WGGameWorld.Instance.ShowLuckyDaLiBao();
                    }
                }
                if (currentViewCtrl == view)
                {
                    currentViewCtrl = null;
                }
                Destroy(view.gameObject);
                mTempViewState = VIEW_STATE.NONE;
                break;

            case MDAlertBehaviour.CLICK_OK:
                mViewState = VIEW_STATE.NONE;
                view.hiddenView();
                break;
            }
        };
    }