Mẫu thiết lập cấu hình danh mục trò chơi cục bộ.
{ } gameConfig.js{ } gameConfig.json
Sao chép mã
JavaScript
// Cấu hình danh mục game mẫu cho giao diện thử nghiệm
const clientGameCatalog = {
brand: "hi886game" ,
featuredGameId: "135" ,
catalog: [
{ id: "135" , name: "Spr Golf Drive" , category: "Trò chơi trực tuyến" },
{ id: "102" , name: "Buffalo Win" , category: "Trò chơi trực tuyến" },
{ id: "180" , name: "Majestic Emp" , category: "Trò chơi trực tuyến" }
],
defaultVolume: 80 ,
enableVisualHints: true
};
function getGameInfo(gameId) {
return clientGameCatalog.catalog.find(item => item.id === gameId) || null ;
}
console.log("Trò chơi khởi đầu:" , getGameInfo(clientGameCatalog.featuredGameId)); JSON
{
"brand" : "hi886game" ,
"featuredGameId" : "135" ,
"catalog" : [
{
"id" : "135" ,
"name" : "Spr Golf Drive" ,
"category" : "Trò chơi trực tuyến"
},
{
"id" : "102" ,
"name" : "Buffalo Win" ,
"category" : "Trò chơi trực tuyến"
},
{
"id" : "180" ,
"name" : "Majestic Emp" ,
"category" : "Trò chơi trực tuyến"
}
],
"defaultVolume" : 80 ,
"enableVisualHints" : true
}