コード例 #1
0
 // from interface Context
 public String getEverythingURL(String vector, Page page, Object... args) {
   return _data.everythingURL + "?token=" + Args.createLinkToken(page, args) + "&vec=" + vector;
 }
コード例 #2
0
  // from interface ValueChangeHandler<String>
  public void onValueChange(ValueChangeEvent<String> event) {
    Args args = new Args(event.getValue());

    // if we have showing popups, clear them out
    _pstack.clear();

    // these are OK to view as a guest
    switch (args.page) {
      case ATTRACTOR:
        setContent(LandingPage.attractor(this, args.get(0, 0), args.get(1, 0)));
        return;
      case LANDING:
        setContent(LandingPage.news(this, _news));
        return;
      case CARD:
        setContent(LandingPage.card(this, args.get(0, 0), args.get(1, 0), args.get(2, 0L)));
        return;
      case CREDITS:
        setContent(new CreditsPage(this));
        return;
      case BROWSE:
        if (args.get(0, getMe().userId) != 0) {
          if (!(_content instanceof BrowsePage)) {
            setContent(new BrowsePage(this));
          }
          ((BrowsePage) _content)
              .setArgs(args.get(0, getMe().userId), args.get(1, 0), args.get(1, ""));
          return;
        }
        break;
      default:
        break; // keep going
    }

    // otherwise guests see the "add this app to play" button
    if (getMe().isGuest()) {
      setContent(LandingPage.news(this, _news));
      return;
    }

    // these are OK as a regular player
    switch (args.page) {
      case FLIP:
        setContent(new FlipPage(this));
        return;
      case SHOP:
        setContent(new ShopPage(this));
        return;
      case GET_COINS:
        setContent(new BuyCoinsPage(this, args.get(0, "")));
        return;
      case FRIENDS:
        if (!(_content instanceof FriendsPage)) {
          setContent(new FriendsPage(this));
        }
        ((FriendsPage) _content).setMode(args.get(0, ""));
        return;
      case EDIT_INTRO:
        setContent(new EditIntroPage(this));
        return;
      default:
        break; // keep going
    }

    // these are OK for editors
    if (isEditor()) {
      switch (args.page) {
        case EDIT_CATS:
          if (!(_content instanceof EditCatsPage)) {
            setContent(new EditCatsPage(this));
          }
          ((EditCatsPage) _content).setArgs(args);
          return;
        case EDIT_PENDING:
          setContent(new EditPendingPage(this));
          return;
        case EDIT_INDEV:
          if (!(_content instanceof InDevPage)) {
            setContent(new InDevPage(this));
          }
          ((InDevPage) _content).setMode(args.get(0, ""));
          return;
        case EDIT_FAQ:
          setContent(new EditFAQPage(this));
          return;
        case EDIT_SERIES:
          setContent(new EditSeriesPage(this, args.get(0, 0)));
          return;
        default:
          break; // keep going
      }
    }

    // these are OK for admins
    if (isAdmin()) {
      switch (args.page) {
        case ADMIN_STATS:
          setContent(new StatsPage(this));
          return;
        case ADMIN_NEWS:
          setContent(new EditNewsPage(this, _news));
          return;
        default:
          break; // keep going
      }
    }

    // otherwise default to displaying the landing panel
    setContent(LandingPage.news(this, _news));
  }