Closed vuejspyf closed 11 months ago
please wait
Thank you for your response.
this is my code
this is my show
this my data( long)
var dataJson = { "levellist": [{ "level": 1, "gridMap": [ 00, 00, 21, 21, 21, 21, 00, 00, 00, 21, 21, 21, 21, 00, 00, 00, 23, 00, 00, 00, 00, 23, 00, 23, 00, 00, 00, 00, 23, 00, 22, 00, 03, 02, 02, 09, 00, 00, 00, 03, 02, 02, 09, 00, 22, 22, 03, 01, 01, 01, 01, 09, 00, 03, 01, 01, 01, 01, 09, 22, 22, 04, 01, 01, 01, 01, 01, 02, 01, 01, 01, 01, 01, 08, 22, 22, 05, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 07, 22, 00, 23, 05, 01, 01, 01, 01, 01, 01, 01, 01, 01, 07, 23, 00, 00, 00, 23, 04, 01, 01, 01, 01, 01, 01, 01, 08, 23, 00, 00, 00, 23, 03, 01, 01, 01, 01, 01, 01, 01, 01, 01, 09, 23, 00, 22, 03, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 08, 09, 22, 22, 04, 01, 01, 01, 01, 01, 06, 01, 01, 01, 01, 08, 08, 22, 22, 05, 01, 01, 01, 01, 07, 00, 05, 01, 01, 01, 01, 07, 22, 22, 00, 05, 06, 06, 07, 00, 00, 00, 05, 06, 06, 07, 00, 22, 00, 23, 00, 00, 00, 00, 23, 00, 23, 00, 00, 00, 00, 23, 00, 00, 00, 21, 21, 21, 21, 00, 00, 00, 21, 21, 21, 21, 00, 00, ], //生成方格 "gridScale": 0.35, "gemCount": 4, //宝石的类型数量 "time": 160, //限定时间 160 "goalCount": 3, //碎片数量 "goalMinRow": 10, //碎片在第几行会消除 "spidersCount": 1, //蜘蛛数量 "propsCount": 3, // "propsType": 1, //道具种类 "initGoalCount": 4 //初始化添加多少个碎片 , "tipText": "", //"Tip\n \nred spider will \nget you special Gems. ", "goalIndex": 2, "spiderGrow": 1, //过关后那只蜘蛛成长 "spiderLevel": [2, 1, 1, 1, 1] //当前蜘蛛等级 }, { "level": 2, "gridScale": 0.35, "gridMap": [ 00, 00, 21, 21, 21, 21, 00, 00, 00, 21, 21, 21, 21, 00, 00, 00, 23, 00, 00, 00, 00, 23, 00, 23, 00, 00, 00, 00, 23, 00, // 00, 23, 01, 01, 01, 01, 23, 00, 23, 01, 01, 01, 01, 23, 00, 22, 00, 00, 00, 00, 03, 02, 02, 02, 09, 00, 00, 00, 00, 22, 22, 00, 00, 00, 00, 04, 01, 01, 01, 08, 00, 00, 00, 00, 22, 22, 00, 00, 00, 03, 01, 01, 01, 01, 01, 09, 00, 00, 00, 22, 22, 00, 03, 02, 01, 01, 01, 01, 01, 01, 01, 02, 09, 00, 22, 00, 03, 01, 01, 01, 01, 01, 00, 01, 01, 01, 01, 01, 09, 00, 00, 04, 01, 01, 01, 01, 00, 00, 00, 01, 01, 01, 01, 08, 00, 00, 05, 01, 01, 01, 01, 00, 00, 00, 01, 01, 01, 01, 07, 00, 22, 00, 05, 06, 01, 01, 01, 01, 01, 01, 01, 06, 07, 00, 22, 22, 00, 00, 00, 05, 01, 01, 01, 01, 01, 07, 00, 00, 00, 22, 22, 00, 00, 00, 00, 04, 01, 01, 01, 08, 00, 00, 00, 00, 22, 22, 00, 00, 00, 00, 05, 06, 06, 06, 07, 00, 00, 00, 00, 22, 00, 23, 00, 00, 00, 00, 23, 00, 23, 00, 00, 00, 00, 23, 00, 00, 00, 21, 21, 21, 21, 00, 00, 00, 21, 21, 21, 21, 00, 00, ], //生成方格 "gemCount": 4, //宝石的类型数量 "time": 160, //240, //限定时间 "goalCount": 3, //碎片数量 "goalMinRow": 7, //碎片在第几行会消除 "spidersCount": 2, //蜘蛛数量 "propsCount": 4, "propsType": 1 //道具种类 , "initGoalCount": 2 //初始化添加多少个碎片 , "tipText": "", "goalIndex": 1, "spiderGrow": 2, //过关后那只蜘蛛成长 "spiderLevel": [3, 2, 1, 1, 1] //当前蜘蛛等级 },...............................]} i have may level(obj) to show
As per my data structure, I need to load multiple objects. How can I achieve this? I have been trying for a long time but haven't been successful. It is possible that there is already an API for this, but I might have missed it. If not, could this functionality be added? Thank you very much.
i want
Click to toggle objects (levels) in the dropdown menu. Click 'New' to create a new object .
thank u very much
click the "Default”button to change(switch) object ,click "New button to create Object
I already know how to do it,Thanks
let levelInfo = {}; for (let index = 0; index < dataJson.levellist.length; index++) { const element = dataJson.levellist[index]; levelInfo[levelArr[index]] = {}; levelInfo[levelArr[index]]["0"] = element; }
const gui = new dat.GUI({
load: {
"preset": "level1", // 默认展示kkkks选项
"closed": false,
"remembered": levelInfo,
}
});
But this is not easy to discover.
It seems to be a specific term or function that you want to use to switch between objects. Once you provide more information about "prest" and the platform or programming language you are using, I can assist you further in implementing the functionality to load and switch between multiple objects.