GLT master READ ONLY 0
  • explorer
  • search
a [App]
a CG.GLT
a README.md
a app.ts
a [Test]
a test
  • README.md

GLT

One Paragraph of the game description goes here

Getting Started

Auth (Login)

// All action must wait until auth system is ready.
CG.GLT.auth.onReady(user => {
    if(user.isLocalGuest()) {
        // not login yet
    } else {
        // logged in user
    }
});

// auth event listener, triggered when auth user changed
let authListener = CG.GLT.auth.onAuth(user => {
    if(user.isLocalGuest()) {
        // logged out
    } else {
        // logged in user
    }
});

// auth event listener, triggered when validating a new auth action
// a following onAuth event is expected.
this.validatingListener = onAuthValidating(() => {
    // show loading animation
});

API

The CG.GLT.api is responsible to communicate with glt.gamelet.online.

CG.GLT.commands includes all comments to query/submit data from glt.gamelet.online. The commands has a function submit() that uses CG.GLT.api.submitCommand(), so most of the time, you don't need to call the api to submit.

CG.GLT.commands.scoreService.submitScore(
    'challenge', // the name of the score to submit
    10, // the score
    SubmitType.KEEP_HIGHEST, // submit only when the new score is greater than the one on server
    TimeRange.ALL // submit to all time-ranges (history and weekly)
)
.submit();

// to receive the weekly high score list
CG.GLT.commands.scoreService.listScores(
    'challenge', // the name of the scores to get
    TimeRange.WEEKLY, // in which time range
    OrderType.HIGH_TO_LOW, // how to order the scores
    CG.GLT.api.lastUpdatedServerTimestamp, // tell the server which week to see
    0, // start index
    10, // how many to get
    (list: UserScoreList) => {
        // do something with the scorelist
    },
    (error) => {
        // deal with error
    }
)

Authors

Haskasu

READ ONLY
  • problem
  • console
No problems have been detected so far.
Ln 1, Col 1, Sel 0
Markdown