Skip to content

SUDRTGameUserManager ​

以下为完整接口声明,包含参数键及回调。 通过 getManager 获取实例。

global.sud.op.runtime.core.SUDRTGameUserManager

方法说明 ​

方法说明
setGameInfo(userId, gameId, info)写入指定用户与游戏的信息,返回 boolean;info 的键见下方常量。
getGameInfo(userId, gameId)查询指定用户与游戏的信息,返回 Bundle。
removeGame(userId, gameId, listener)发起用户游戏移除操作,通过 onSuccess/onFailure 接收结果。
removeGameInfo(userId, gameId)移除指定用户与游戏的信息,返回 boolean。
cancelRemoveGameRequest()取消移除用户游戏的请求。
listGameInfo()返回游戏信息 Bundle 数组。
getGameDataPaths(userId, gameId)返回用户游戏数据路径 Bundle;键为 KEY_USER_GAME_DATA_PATH、KEY_USER_GAME_TEMP_PATH、KEY_USER_GAME_LOCAL_STORAGE_PATH。

声明、参数键及回调 ​

java
public interface SUDRTGameUserManager {
    int KEY_USER_GAME_AUTH_GRANTED = 1;
    int KEY_USER_GAME_AUTH_DENIED = 2;
    String KEY_USER_ID = "rt_user_id";
    String KEY_USER_GAME_ID = "rt_user_game_id";
    String KEY_USER_GAME_RESERVE = "rt_user_game_reserve";
    String KEY_USER_GAME_EXTRA_INFO = "rt_user_game_extra_info";
    String KEY_USER_GAME_LAST_PLAY_TIME = "rt_user_game_last_play_time";
    String KEY_USER_GAME_PLAYED = "rt_user_game_played";
    String KEY_USER_GAME_REMOVED = "rt_user_game_removed";
    String KEY_PERMISSION_CAMERA = "scope.camera";
    String KEY_PERMISSION_LOCATION = "scope.userLocation";
    String KEY_PERMISSION_RECORD = "scope.record";
    String KEY_PERMISSION_SAVE_TO_ALBUM = "scope.writePhotosAlbum";
    
    @Deprecated
    String KEY_PERMISSION_USER_INFO = "scope.userInfo";
    String KEY_USER_GAME_DATA_PATH = "rt_user_game_data_path";
    String KEY_USER_GAME_TEMP_PATH = "rt_user_game_temp_path";
    String KEY_USER_GAME_LOCAL_STORAGE_PATH = "rt_user_game_local_storage_path";

    boolean setGameInfo(@NonNull String userId, @NonNull String gameId, @NonNull Bundle info);

    Bundle getGameInfo(@NonNull String userId, @NonNull String gameId);

    void removeGame(@NonNull String userId, @NonNull String gameId, @NonNull UserRemoveGameListener listener);

    boolean removeGameInfo(@NonNull String userId, @NonNull String gameId);

    void cancelRemoveGameRequest();

    Bundle[] listGameInfo();

    Bundle getGameDataPaths(@NonNull String userId, @NonNull String gameId);

    public interface UserRemoveGameListener {
        void onFailure(Throwable var1);

        void onSuccess();
    }
}