Mẫu cấu hình tham số trò chơi cục bộ trên môi trường thử nghiệm.
{ } example.js{ } example.json
Sao chép mã
JavaScript
// Cấu hình khởi tạo danh mục trò chơi cục bộ
const localGameConfig = {
platform: "android" ,
locale: "vi-VN" ,
defaultCategory: "Trò chơi quay số" ,
featuredGames: [
{ id: "071" , name: "Circus Delight" },
{ id: "092" , name: "Wild Bandito" },
{ id: "199" , name: "Farmstead Fort" },
{ id: "028" , name: "Gem Saviour Sword" },
{ id: "114" , name: "Rooster Rbl" }
],
storageKey: "github_local_session"
};
function validateGameSession(gameId) {
const game = localGameConfig.featuredGames.find(g => g.id === gameId);
if (!game) {
return { valid: false , message: "Trò chơi không tồn tại trong danh mục" };
}
return { valid: true , target: game.name };
}
// Kiểm tra cục bộ cho tựa game Circus Delight
const checkResult = validateGameSession("071" );JSON
{
"platform" : "android" ,
"locale" : "vi-VN" ,
"defaultCategory" : "Trò chơi quay số" ,
"featuredGames" : [
{ "id" : "071" , "name" : "Circus Delight" },
{ "id" : "092" , "name" : "Wild Bandito" },
{ "id" : "199" , "name" : "Farmstead Fort" },
{ "id" : "028" , "name" : "Gem Saviour Sword" },
{ "id" : "114" , "name" : "Rooster Rbl" }
],
"storageKey" : "github_local_session"
}