Exemplo n.º 1
0
    /// <summary>
    /// @brief 設定メニューの表示非表示切り替え
    /// </summary>
    public void ActiveMenu()
    {
        if (Singleton <GameInstance> .Instance.IsShipMove || SceneManager.GetActiveScene().name == "Setting")
        {
            // メニューをアクティブ化
            activeMenuFlag = ChengeBool(activeMenuFlag);
            // メニューボタンを非アクティブ化
            settingButton.SetActive(!activeMenuFlag);
            // メニューポップアップをアクティブ化
            settingPopup.SetActive(activeMenuFlag);

            // ポーズフラグの切り替え 設定画面を開いているときはポーズ中 閉じればプレイ中の状態
            BaseObjectSingleton <GameInstance> .Instance.IsPorse = !BaseObjectSingleton <GameInstance> .Instance.IsPorse;

            // ポップアップの開閉
            if (activeMenuFlag)
            {
                Singleton <SoundPlayer> .Instance.PauseBGM();

                setting.Open();
            }
            else
            {
                setting.Close();
                Singleton <SoundPlayer> .Instance.PlayBGM();
            }
        }
    }
Exemplo n.º 2
0
    public void OpenPopup(Popup.Type type, object[] data = null, bool shouldAnimate = true)
    {
        Popup tempPopup = null;

        switch (type)
        {
        case Popup.Type.POPUP_RESULT:
            if (popupResult == null)
            {
                GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupResult/PopupResult", typeof(GameObject)) as GameObject);
                tempGameObject.name = "PopupResult";
                popupResult         = tempGameObject.GetComponent <PopupResult>();
                tempPopup           = popupResult as Popup;
                popupResult.Init(data);
                if (shouldAnimate)
                {
                    popupResult.Open();
                }
                else
                {
                    popupResult.OpenPopupNoAnimation();
                }
            }
            break;

        case Popup.Type.POPUP_LEAVE_GAME:
            if (popupLeaveGame == null)
            {
                GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupLeaveGame", typeof(GameObject)) as GameObject);
                tempGameObject.name = "PopupResult";
                popupLeaveGame      = tempGameObject.GetComponent <PopupLeaveGame>();
                tempPopup           = popupLeaveGame as Popup;
                popupLeaveGame.Init(data);
                if (shouldAnimate)
                {
                    popupLeaveGame.Open();
                }
                else
                {
                    popupLeaveGame.OpenPopupNoAnimation();
                }
            }
            break;

        case Popup.Type.POPUP_CREATE_ROOM:
            if (popupCreateRoom == null)
            {
                GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupCreateRoom/PopupCreateRoom", typeof(GameObject)) as GameObject);
                tempGameObject.name = "PopupCreateRoom";
                popupCreateRoom     = tempGameObject.GetComponent <PopupCreateRoom>();
                tempPopup           = popupCreateRoom as Popup;
                popupCreateRoom.Init(data);
                if (shouldAnimate)
                {
                    popupCreateRoom.Open();
                }
                else
                {
                    popupCreateRoom.OpenPopupNoAnimation();
                }
            }
            break;

        case Popup.Type.POPUP_USER_INFO:
            if (popupUserInfo == null)
            {
                GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupUserInfo", typeof(GameObject)) as GameObject);
                tempGameObject.name = "PopupUserInfo";
                popupUserInfo       = tempGameObject.GetComponent <PopupUserInfo>();
                tempPopup           = popupUserInfo as Popup;
                popupUserInfo.Init(data);
                if (shouldAnimate)
                {
                    popupUserInfo.Open();
                }
                else
                {
                    popupUserInfo.OpenPopupNoAnimation();
                }
            }
            break;

        case Popup.Type.POPUP_FRIENDS:
            if (popupFriends == null)
            {
                GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupFriends/PopupFriends", typeof(GameObject)) as GameObject);
                tempGameObject.name = "PopupFriends";
                popupFriends        = tempGameObject.GetComponent <PopupFriends>();
                tempPopup           = popupFriends as Popup;
                popupFriends.Init(data);
                if (shouldAnimate)
                {
                    popupFriends.Open();
                }
                else
                {
                    popupFriends.OpenPopupNoAnimation();
                }
            }
            break;

        case Popup.Type.POPUP_INBOX:
            if (popupFriends == null)
            {
                GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupInbox/PopupInbox", typeof(GameObject)) as GameObject);
                tempGameObject.name = "PopupInbox";
                popupInbox          = tempGameObject.GetComponent <PopupInbox>();
                tempPopup           = popupInbox as Popup;
                popupInbox.Init(data);
                if (shouldAnimate)
                {
                    popupInbox.Open();
                }
                else
                {
                    popupInbox.OpenPopupNoAnimation();
                }
            }
            break;

        case Popup.Type.POPUP_INVITE_TO_GAME:
            if (popupInviteToGame == null)
            {
                GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupInviteToGame/PopupInviteToGame", typeof(GameObject)) as GameObject);
                tempGameObject.name = "PopupInviteToGame";
                popupInviteToGame   = tempGameObject.GetComponent <PopupInviteToGame>();
                tempPopup           = popupInviteToGame as Popup;
                popupInviteToGame.Init(data);
                if (shouldAnimate)
                {
                    popupInviteToGame.Open();
                }
                else
                {
                    popupInviteToGame.OpenPopupNoAnimation();
                }
            }
            break;

        case Popup.Type.POPUP_INVITE_TO_GAME_CONFIRM:
            if (popupInviteGameConfirm == null)
            {
                GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupInviteGameConfirm", typeof(GameObject)) as GameObject);
                tempGameObject.name    = "PopupInviteGameConfirm";
                popupInviteGameConfirm = tempGameObject.GetComponent <PopupInviteGameConfirm>();
                tempPopup = popupInviteGameConfirm as Popup;
                popupInviteGameConfirm.Init(data);
                if (shouldAnimate)
                {
                    popupInviteGameConfirm.Open();
                }
                else
                {
                    popupInviteGameConfirm.OpenPopupNoAnimation();
                }
            }
            break;

        case Popup.Type.POPUP_RELOAD_GAME:
            if (popupReloadGame == null)
            {
                GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupReloadGame", typeof(GameObject)) as GameObject);
                tempGameObject.name = "PopupReloadGame";
                popupReloadGame     = tempGameObject.GetComponent <PopupReloadGame>();
                tempPopup           = popupReloadGame as Popup;
                popupReloadGame.Init(data);
                if (shouldAnimate)
                {
                    popupReloadGame.Open();
                }
                else
                {
                    popupReloadGame.OpenPopupNoAnimation();
                }
            }
            break;

        case Popup.Type.POPUP_SETTING:
            if (popupReloadGame == null)
            {
                GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupSetting", typeof(GameObject)) as GameObject);
                tempGameObject.name = "PopupSetting";
                popupSetting        = tempGameObject.GetComponent <PopupSetting>();
                tempPopup           = popupSetting as Popup;
                popupSetting.Init(data);
                if (shouldAnimate)
                {
                    popupSetting.Open();
                }
                else
                {
                    popupSetting.OpenPopupNoAnimation();
                }
            }
            break;

        case Popup.Type.POPUP_PAYOUT:
            if (popupPayout == null)
            {
                GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupPayout", typeof(GameObject)) as GameObject);
                tempGameObject.name = "PopupPayout";
                popupPayout         = tempGameObject.GetComponent <PopupPayout>();
                tempPopup           = popupPayout as Popup;
                popupPayout.Init(data);
                if (shouldAnimate)
                {
                    popupPayout.Open();
                }
                else
                {
                    popupPayout.OpenPopupNoAnimation();
                }
            }
            break;
        }
        if (tempPopup != null)
        {
            openingPopup.Add(tempPopup);
        }
    }
Exemplo n.º 3
0
  public void OpenPopup(Popup.Type type, object[] data = null, bool shouldAnimate = true) {
    Popup tempPopup = null;
		switch(type) {
	    case Popup.Type.POPUP_RESULT:
	    	if (popupResult == null) {
	      	GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupResult/PopupResult", typeof(GameObject)) as GameObject);
	       	tempGameObject.name = "PopupResult";
	       	popupResult = tempGameObject.GetComponent<PopupResult>();
	       	tempPopup = popupResult as Popup;
	       	popupResult.Init(data);
	       	if (shouldAnimate) {
	       	  popupResult.Open();
	       	} else {
	       	  popupResult.OpenPopupNoAnimation();
	       	}
	     	}
	    break;
	    case Popup.Type.POPUP_LEAVE_GAME:
	    	if (popupLeaveGame == null) {
	      	GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupLeaveGame", typeof(GameObject)) as GameObject);
	       	tempGameObject.name = "PopupResult";
	       	popupLeaveGame = tempGameObject.GetComponent<PopupLeaveGame>();
	       	tempPopup = popupLeaveGame as Popup;
	       	popupLeaveGame.Init(data);
	       	if (shouldAnimate) {
	       	  popupLeaveGame.Open();
	       	} else {
	       	  popupLeaveGame.OpenPopupNoAnimation();
	       	}
	     	}
	    break;
	    case Popup.Type.POPUP_CREATE_ROOM:
	    	if (popupCreateRoom == null) {
	      	GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupCreateRoom/PopupCreateRoom", typeof(GameObject)) as GameObject);
	       	tempGameObject.name = "PopupCreateRoom";
	       	popupCreateRoom = tempGameObject.GetComponent<PopupCreateRoom>();
	       	tempPopup = popupCreateRoom as Popup;
	       	popupCreateRoom.Init(data);
	       	if (shouldAnimate) {
	       	  popupCreateRoom.Open();
	       	} else {
	       	  popupCreateRoom.OpenPopupNoAnimation();
	       	}
	     	}
	    break;
	    case Popup.Type.POPUP_USER_INFO:
	    	if (popupUserInfo == null) {
	      	GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupUserInfo", typeof(GameObject)) as GameObject);
	       	tempGameObject.name = "PopupUserInfo";
	       	popupUserInfo = tempGameObject.GetComponent<PopupUserInfo>();
	       	tempPopup = popupUserInfo as Popup;
	       	popupUserInfo.Init(data);
	       	if (shouldAnimate) {
	       	  popupUserInfo.Open();
	       	} else {
	       	  popupUserInfo.OpenPopupNoAnimation();
	       	}
	     	}
	    break;
	    case Popup.Type.POPUP_FRIENDS:
	    	if (popupFriends == null) {
	      	GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupFriends/PopupFriends", typeof(GameObject)) as GameObject);
	       	tempGameObject.name = "PopupFriends";
	       	popupFriends = tempGameObject.GetComponent<PopupFriends>();
	       	tempPopup = popupFriends as Popup;
	       	popupFriends.Init(data);
	       	if (shouldAnimate) {
	       	  popupFriends.Open();
	       	} else {
	       	  popupFriends.OpenPopupNoAnimation();
	       	}
	     	}
	    break;
	    case Popup.Type.POPUP_INBOX:
	    	if (popupFriends == null) {
	      	GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupInbox/PopupInbox", typeof(GameObject)) as GameObject);
	       	tempGameObject.name = "PopupInbox";
	       	popupInbox = tempGameObject.GetComponent<PopupInbox>();
	       	tempPopup = popupInbox as Popup;
	       	popupInbox.Init(data);
	       	if (shouldAnimate) {
	       	  popupInbox.Open();
	       	} else {
	       	  popupInbox.OpenPopupNoAnimation();
	       	}
	     	}
	    break;
	    case Popup.Type.POPUP_INVITE_TO_GAME:
	    	if (popupInviteToGame == null) {
	      	GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupInviteToGame/PopupInviteToGame", typeof(GameObject)) as GameObject);
	       	tempGameObject.name = "PopupInviteToGame";
	       	popupInviteToGame = tempGameObject.GetComponent<PopupInviteToGame>();
	       	tempPopup = popupInviteToGame as Popup;
	       	popupInviteToGame.Init(data);
	       	if (shouldAnimate) {
	       	  popupInviteToGame.Open();
	       	} else {
	       	  popupInviteToGame.OpenPopupNoAnimation();
	       	}
	     	}
	    break;
	    case Popup.Type.POPUP_INVITE_TO_GAME_CONFIRM:
	    	if (popupInviteGameConfirm == null) {
	      	GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupInviteGameConfirm", typeof(GameObject)) as GameObject);
	       	tempGameObject.name = "PopupInviteGameConfirm";
	       	popupInviteGameConfirm = tempGameObject.GetComponent<PopupInviteGameConfirm>();
	       	tempPopup = popupInviteGameConfirm as Popup;
	       	popupInviteGameConfirm.Init(data);
	       	if (shouldAnimate) {
	       	  popupInviteGameConfirm.Open();
	       	} else {
	       	  popupInviteGameConfirm.OpenPopupNoAnimation();
	       	}
	     	}
	    break;
	    case Popup.Type.POPUP_RELOAD_GAME:
	    	if (popupReloadGame == null) {
	      	GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupReloadGame", typeof(GameObject)) as GameObject);
	       	tempGameObject.name = "PopupReloadGame";
	       	popupReloadGame = tempGameObject.GetComponent<PopupReloadGame>();
	       	tempPopup = popupReloadGame as Popup;
	       	popupReloadGame.Init(data);
	       	if (shouldAnimate) {
	       	  popupReloadGame.Open();
	       	} else {
	       	  popupReloadGame.OpenPopupNoAnimation();
	       	}
	     	}
	    break;
	    case Popup.Type.POPUP_SETTING:
	    	if (popupReloadGame == null) {
	      	GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupSetting", typeof(GameObject)) as GameObject);
	       	tempGameObject.name = "PopupSetting";
	       	popupSetting = tempGameObject.GetComponent<PopupSetting>();
	       	tempPopup = popupSetting as Popup;
	       	popupSetting.Init(data);
	       	if (shouldAnimate) {
	       	  popupSetting.Open();
	       	} else {
	       	  popupSetting.OpenPopupNoAnimation();
	       	}
	     	}
	    break;
	    case Popup.Type.POPUP_PAYOUT:
	    	if (popupPayout == null) {
	      	GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.POPUP_PATH + "/PopupPayout", typeof(GameObject)) as GameObject);
	       	tempGameObject.name = "PopupPayout";
	       	popupPayout = tempGameObject.GetComponent<PopupPayout>();
	       	tempPopup = popupPayout as Popup;
	       	popupPayout.Init(data);
	       	if (shouldAnimate) {
	       	  popupPayout.Open();
	       	} else {
	       	  popupPayout.OpenPopupNoAnimation();
	       	}
	     	}
	    break;
	  }
	  if (tempPopup != null) {
	    openingPopup.Add(tempPopup);
	  }
  }