コード例 #1
0
    // Remove popup from opening list
    public void ClosePopup(Popup popup)
    {
        openingPopup.Remove(popup);
        switch (popup.type)
        {
        case Popup.Type.POPUP_RESULT:
            popupResult = null;
            break;

        case Popup.Type.POPUP_LEAVE_GAME:
            popupLeaveGame = null;
            break;

        case Popup.Type.POPUP_CREATE_ROOM:
            popupCreateRoom = null;
            break;

        case Popup.Type.POPUP_USER_INFO:
            popupUserInfo = null;
            break;

        case Popup.Type.POPUP_FRIENDS:
            popupFriends = null;
            break;

        case Popup.Type.POPUP_INVITE_TO_GAME:
            popupInviteToGame = null;
            break;

        case Popup.Type.POPUP_INVITE_TO_GAME_CONFIRM:
            popupInviteGameConfirm = null;
            break;

        case Popup.Type.POPUP_RELOAD_GAME:
            popupReloadGame = null;
            break;

        case Popup.Type.POPUP_SETTING:
            popupSetting = null;
            break;

        case Popup.Type.POPUP_INBOX:
            popupInbox = null;
            break;

        case Popup.Type.POPUP_PAYOUT:
            popupPayout = null;
            break;
        }
    }
コード例 #2
0
  // Remove popup from opening list
  public void ClosePopup(Popup popup) {
    openingPopup.Remove(popup);
    switch(popup.type) {
	    case Popup.Type.POPUP_RESULT:
	      popupResult = null;
	    break;
	    case Popup.Type.POPUP_LEAVE_GAME:
	      popupLeaveGame = null;
	    break;
	    case Popup.Type.POPUP_CREATE_ROOM:
	      popupCreateRoom = null;
	    break;
	    case Popup.Type.POPUP_USER_INFO:
	      popupUserInfo = null;
	    break;
	    case Popup.Type.POPUP_FRIENDS:
	      popupFriends = null;
	    break;
	    case Popup.Type.POPUP_INVITE_TO_GAME:
	      popupInviteToGame = null;
	    break;
	    case Popup.Type.POPUP_INVITE_TO_GAME_CONFIRM:
	      popupInviteGameConfirm = null;
	    break;
	    case Popup.Type.POPUP_RELOAD_GAME:
	      popupReloadGame = null;
	    break;
	    case Popup.Type.POPUP_SETTING:
	      popupSetting = null;
	    break;
	    case Popup.Type.POPUP_INBOX:
	      popupInbox = null;
	    break;
	    case Popup.Type.POPUP_PAYOUT:
	      popupPayout = null;
	    break;
	  }
  }
コード例 #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);
        }
    }
コード例 #4
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);
	  }
  }