Cấu hình danh mục trò chơi tg8 và bộ lọc kiểm tra trạng thái cục bộ.
{ } tg8_catalog_config.js{ } tg8_catalog_config.json
Sao chép mã
JavaScript
/**
* Cau hinh cuc bo danh muc tro choi tg8
* Khong gui yeu cau mang thuc te
*/
const tg8GameCatalog = {
platform: 'android' ,
locale: 'vi-VN' ,
defaultGameId: '187' ,
catalog: [
{ id: '187' , title: 'Forbid Alchemy' , enabled: true },
{ id: '100' , title: 'Sprmkt Spree' , enabled: true },
{ id: '082' , title: 'Gdn Ice Fire' , enabled: false },
{ id: '130' , title: 'Rave Party Fvr' , enabled: true },
{ id: '184' , title: 'Alibaba Cave' , enabled: true }
],
validateGame: function (gameId) {
const item = this.catalog.find(g => g.id === gameId);
return item ? item.enabled : false ;
}
};
// Kiem tra thu nghiem
const isPlayable = tg8GameCatalog.validateGame('187' );JSON
{
"platform" : "android" ,
"locale" : "vi-VN" ,
"defaultGameId" : "187" ,
"catalog" : [
{ "id" : "187" , "title" : "Forbid Alchemy" , "enabled" : true },
{ "id" : "100" , "title" : "Sprmkt Spree" , "enabled" : true },
{ "id" : "082" , "title" : "Gdn Ice Fire" , "enabled" : false },
{ "id" : "130" , "title" : "Rave Party Fvr" , "enabled" : true },
{ "id" : "184" , "title" : "Alibaba Cave" , "enabled" : true }
]
}