PageSourceSearch

https://yyc-git.github.io/lianliankan/Scripts/LianLianKan/ViewLayer/UI_Page.js

js yyc-git.github.io collected 2026-10-03 10:16:48 UTC 11,589 bytes, 278 lines download raw bytes

1//游戏界面
2//显示对应的页面
3
4var Interface_UI_Page = MyInterface("InitMenu", "InitButton", "GetWindow", "Dispose");
5
6var UI_Page = MyClass({ Interface: Interface_UI_Page }, {
7    Init: function (ui) {
8        this._operate_ui = ui;
9    },
10    Private: {
11        _operate_ui: null,
12        //窗体容器(单例模式)
13        _window: {},
14        //按键
15        _button_start: null,
16        _button_boss: null,
17        _button_setting: null,
18        _button_end: null,
19
20
21        //游戏设置窗体。
22        //复用同一个窗体。
23        _InitSetting: function () {
24            var dlg = null,
25                self = this;
26
27            //            //暂停游戏
28            //            this._operate_ui.Pause();
29
30            if (this._window.setting) {
31                //暂停
32                this._operate_ui.Pause();
33                //重定位到视窗中间
34                this._window.setting.ResizeTo(300, 200);
35                //显示
36                this._window.setting.Show();
37                return;
38            }
39            else {
40                dlg = new YYC.Window({
41                    title: "游戏设置",
42                    isShow: false,
43                    isClear: false,
44                    opacity: 0.4,
45                    url: "View/GameSetting.html",
46                    onLoad: MyGameEngine.Event.Bind(this._operate_ui, this._operate_ui.Pause),
47                    onClose: MyGameEngine.Event.Bind(this._operate_ui, this._operate_ui.Continue),
48                    id: "iframe_gameSetting"
49                });
50                //                    dlg.SetTitle("用户信息设置");
51                //                    dlg.LoadUrl("Scripts/SelectMap.html");    //加载页面成功后,会触发页面的js
52                dlg.ResizeTo(300, 200);
53                //                    dlg.AddToolBar({ menu: menu });
54
55                this._window.setting = dlg;
56            }
57        },
58        //选图窗体
59        //每次调用都创建一个新的窗体(因为要刷新窗体,如刷新自定义地图等)。
60        _InitSelectMap: function () {
61            var dlg = null;
62
63            //            //未开始游戏时,可以选图
64            //            if (LianLianKan.gameStatus === LianLianKan.Status.Stop || LianLianKan.gameStatus === LianLianKan.Status.None) {
65            //            //暂停游戏
66            //            this._operate_ui.Pause();
67
68            //            if (this._window.selectMap) {
69            //                //                this._window.selectMap.Show();
70            //                //                return;
71
72            ////                this._window.selectMap.Dispose();
73            //            }
74            //            else {
75            dlg = new YYC.Window({
76                title: "选择地图",
77                isShow: false,
78                isClear: true,
79                opacity: 0.4,
80                url: "View/SelectMap.html",
81                onLoad: MyGameEngine.Event.Bind(this._operate_ui, this._operate_ui.Pause),
82                //                onUnLoad: MyGameEngine.Event.Bind(this, function () {
83                //                    this._window.selectMap.Dispose();
84                //                }),
85                onClose: MyGameEngine.Event.Bind(this._operate_ui, this._operate_ui.Continue),
86
87                id: "iframe_selectMap"
88            });
89            //                    dlg.SetTitle("用户信息设置");
90            //                    dlg.LoadUrl("Scripts/SelectMap.html");    //加载页面成功后,会触发页面的js
91            dlg.ResizeTo(650, 400);
92            //                    dlg.AddToolBar({ menu: menu });
93
94            this._window.selectMap = dlg;
95            //            }
96            //            }
97        },
98        //自定义地图窗体。
99        //每次调用都创建一个新的窗体(因为要刷新窗体,如刷新自定义地图等)。
100        _InitMapEditor: function () {
101            var dlg = null;
102
103            //            //暂停游戏
104            //            this._operate_ui.Pause();
105
106            //            if (this._window.mapEditor) {
107            //                //                this._window.mapEditor.Show();
108            //                //                return;
109
110            //                this._window.mapEditor.Dispose();   //销毁之前的窗体,创建新的窗体
111            //            }
112
113            dlg = new YYC.Window({
114                title: "自定义地图",
115                isShow: false,
116                isClear: true,
117                opacity: 0.4,
118                url: "View/MapEditor.html",
119                onLoad: MyGameEngine.Event.Bind(this._operate_ui, this._operate_ui.Pause),
120                onClose: MyGameEngine.Event.Bind(this._operate_ui, this._operate_ui.Continue),
121                id: "iframe_mapEditor"
122            });
123            dlg.ResizeTo(800, 500);
124
125            this._window.mapEditor = dlg;
126        },
127        //挑战Boss窗体。
128        //每次调用都创建一个新的窗体(因为要刷新窗体,如刷新已挑战的Boss情况等)。
129        _InitBoss: function () {
130            var dlg = null;
131
132            //未开始游戏时或者单人游戏时,可以挑战boss
133            if (LianLianKan.pattern === LianLianKan.Pattern.Single || LianLianKan.gameStatus === LianLianKan.Status.Stop || LianLianKan.gameStatus === LianLianKan.Status.None) {
134                //                //暂停游戏
135                //                this._operate_ui.Pause();
136
137                //                if (this._window.boss) {
138                //                    this._window.boss.Dispose();   //销毁之前的窗体,创建新的窗体
139                //                }
140                dlg = new YYC.Window({
141                    title: "挑战Boss",
142                    isShow: false,
143                    isClear: true,
144                    opacity: 0.4,
145                    url: "View/Boss.html",
146                    onLoad: MyGameEngine.Event.Bind(this._operate_ui, this._operate_ui.Pause),
147                    onClose: MyGameEngine.Event.Bind(this._operate_ui, this._operate_ui.Continue),
148                    id: "iframe_boss"
149                });
150                dlg.ResizeTo(800, 610);
151
152                this._window.boss = dlg;
153            }
154            else {
155                //                alert("游戏进行期间不能挑战Boss");
156                if (confirm("游戏进行期间不能挑战Boss。是否结束游戏?")) {
157                    this._operate_ui.EndGame();
158                }
159                else {
160                }
161            }
162        }
163    },
164    Public: {
165        //菜单
166        menu: null,
167
168        //初始化菜单
169        InitMenu: function () {
170            //            var this._operate_ui = LianLianKan.Operate_UI;
171            //            this._operate_ui.Pause();
172            this.menu = new YYC.MENU.Menu({ id: "menuContainer", items: [
173            		    {
174            		        text: '系统',
175            		        menu: {
176            		            items: [
177            					    {
178            					        //指向LianLianKan.Operate_UI
179            					        text: '开始单人游戏', handler: MyGameEngine.Event.BindEvent(this._operate_ui, this._operate_ui.Start_Single, LianLianKan.Operate_Single)
180            					    }, {
181            					        text: '暂停', handler: MyGameEngine.Event.BindEvent(this._operate_ui, this._operate_ui.Pause, LianLianKan.Operate_Single)
182            					    }, {
183            					        text: '保存', handler: MyGameEngine.Event.BindEvent(this._operate_ui, this._operate_ui.SaveInfo, LianLianKan.Operate_Single, LianLianKan.Operate_Boss)
184            					    }, {
185            					        text: '退出游戏', handler: MyGameEngine.Event.BindEvent(this._operate_ui, this._operate_ui.Exit)
186            					    }, {
187            					        text: '设置', handler: MyGameEngine.Event.Bind(this, this._InitSetting)   //此处要绑定到this
188            					    }, {
189            					        text: '重置玩家信息', handler: MyGameEngine.Event.BindEvent(this._operate_ui, this._operate_ui.ResetPlayInfo)
190            					    }
191            				    ]
192            		        }
193            		    }, {
194            		        text: '地图',
195            		        menu: {
196            		            items: [
197            					    {
198            					        text: '选择地图', handler: MyGameEngine.Event.Bind(this, this._InitSelectMap)   //此处要绑定到this
199            					    }, {
200            					        text: '自定义地图', handler: MyGameEngine.Event.Bind(this, this._InitMapEditor)   //此处要绑定到this
201            					    }
202            				    ]
203            		        }
204            		    }, {
205            		        text: 'Boss',
206            		        menu: {
207            		            items: [
208            					    {
209            					        text: '挑战Boss', handler: MyGameEngine.Event.Bind(this, this._InitBoss)   //此处要绑定到this
210            					    }, {
211            					        text: '重置Boss', handler: MyGameEngine.Event.BindEvent(this._operate_ui, this._operate_ui.ResetBoss)
212            					    }
213            				    ]
214            		        }
215            		    }
216            		    ]
217            });
218
219            this.menu.RenderTo("lianliankan_menu");
220
221
222
223            //                        menu.SetHandle([1, 2], function () {
224            //                            alert("new!");
225            //                        });
226        },
227        //初始化按钮
228        InitButton: function () {
229            var self = this;
230
231            //模式为None或单人模式下,点击开始单人游戏
232            this._button_start = new YYC.Button({ text: "开始",
233                onClick: function (e) {
234                    //
235                    if (LianLianKan.pattern === LianLianKan.Pattern.Single || LianLianKan.pattern === LianLianKan.Pattern.None) {
236                        self._operate_ui.Start_Single();
237                    }
238                    else if (LianLianKan.pattern === LianLianKan.Pattern.Boss) {
239                        self._operate_ui.Start_Boss();
240                    }
241                }
242            });
243
244            this._button_start.RenderTo("index_button1");
245
246            this._button_boss = new YYC.Button({ text: "挑战Boss",
247                onClick: function (e) {
248                    self._InitBoss();
249                }
250            });
251
252            this._button_boss.RenderTo("index_button2");
253
254            this._button_setting = new YYC.Button({ text: "设置",
255                onClick: function (e) {
256                    self._InitSetting();
257                }
258            });
259
260            this._button_setting.RenderTo("index_button3");
261
262            this._button_end = new YYC.Button({ text: "结束游戏",
263                onClick: function (e) {
264                    if (confirm("确定要结束游戏吗?")) {
265                        self._operate_ui.EndGame();
266                    }
267                }
268            });
269
270            this._button_end.RenderTo("index_button4");
271        },
272        GetWindow: function () {
273            return this._window;
274        },
275        Dispose: function () {
276        }
277    }
278});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.