Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Examples

Cocos Creator GDK Examples

You can check outthe example code in the package at negdk/assets/negdk/sample/NEGdkSample.ts

Initialize the GDK

export class ExampleInit extends Component {
    protected onLoad(): void {
        const config: NEGdkConfig = {
            gameKey: "eternal",
            platformSource: "ETERNAL",
            ramperAppId: "vgzjondflu",
            scheme: "negdkcc",
            subPlatform: "",
            environment: NEEnvironment.DEV,
            loginCacheEnabled: true
        }
        NEGdk.getInstance().initialize(config, (errorCode) => {
            const success = errorCode === NEErrorCode.SUCCESS;
            if (success) {
                conslose.log("GDK initialize successfully!");
            } else {
                conslose.error(`GDK initialize failed, errorCode = ${errorCode}`);
                // Check if already login in case you are using login cache
                if (negdk.isLoggedIn()) {
                    // already login 
                } else {
                    // not login yet
                }
            }
        });
    }
}

Login

Social Login

Create/Restore Wallet

Get User Pets Data

Get User Balances Data

Get Shop Data

Buy a Pack in Shop

Last updated