Minesweeper-2.0-test/scripts/game/manager.js

36 lines
1.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**************************************
文件名manager.js
功能:该模块用于处理游戏界面相关内容
版本2.0(23.01.08)
**************************************/
//新建Manager对象
new Manager();
/**************************************
对象名Manager
**************************************/
function Manager(){
//获取URL中“?”及后续部分
let url = location.search;
if (url.indexOf("?") != -1){
//截取1到url.length的部分
url = url.substring(1);
//若传入了多个参数,以&分隔,此处将参数分解为数组内多个元素
url = url.split('&');
}
//参数第0项是语言参数lang第一项是难度参数mode以等号分开取等号后内容
this.lang = url[0].split('=')[1];
this.mode = url[1].split('=')[1];
//Language对象实例化
this.language = new Language(this.lang);
this.language.langRender();
//Grid对象实例化
this.grid = new Grid(this.lang, this.mode);
this.grid.setMode();
//Listener对象实例化
this.listener = new Listener(this.lang, this.grid);
}