Mô hình mẫu cấu hình dữ liệu trò chơi cục bộ phục vụ kiểm thử giao diện.
{ } gameConfig.js{ } gameConfig.json
Sao chép mã
JavaScript
// Cấu hình cục bộ danh sách trò chơi slot cho giao diện mcw
const localGameConfig = {
platform: 'mcw' ,
locale: 'vi-VN' ,
defaultGameId: '119' ,
games: [
{ id: '119' , name: 'Speed Winner' , category: 'Slot game' },
{ id: '075' , name: 'Sct Cleopatra' , category: 'Slot game' },
{ id: '165' , name: 'Rio Fantasia' , category: 'Slot game' },
{ id: '038' , name: 'Emperors Favour' , category: 'Slot game' },
{ id: '047' , name: 'Ninja Vs Samurai' , category: 'Slot game' }
]
};
function getFeaturedGame(config) {
return config.games.find(g => g.id === config.defaultGameId);
}
console.log('Tro choi mac dinh:' , getFeaturedGame(localGameConfig)); JSON
{
"platform" : "mcw" ,
"locale" : "vi-VN" ,
"defaultGameId" : "119" ,
"games" : [
{ "id" : "119" , "name" : "Speed Winner" , "category" : "Slot game" },
{ "id" : "075" , "name" : "Sct Cleopatra" , "category" : "Slot game" },
{ "id" : "165" , "name" : "Rio Fantasia" , "category" : "Slot game" },
{ "id" : "038" , "name" : "Emperors Favour" , "category" : "Slot game" },
{ "id" : "047" , "name" : "Ninja Vs Samurai" , "category" : "Slot game" }
]
}