/
domahes
/
Arcade
Обзор
Документация
Войти
/
domahes
/
Arcade
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
js/window/WMessageBox.js
65 строк
2 KB
domahes
Initial commit with game files
01 июн 2026, 09:31
01 июн 2026, 09:31
0f50ffb
Код
Авторство
О чём код?
/** * Created by YewMoon on 2019/4/25. * Interface·Inquiry Box * @param ui * @param msgData | text data */ function WMessageBox(ui,msgData){ //==================================== Private Attributes =================================== var _sf = this; //==================================== Public Attributes =================================== this.msg = ""; this.confirmText = ""; this.cancelText = ""; this.endDo = null; //==================================== Public Function =================================== /** * Execute on Initialization */ this.init = function(){ var temp = msgData.split("||"); _sf.msg = temp[0]; _sf.confirmText = temp[1]; _sf.cancelText = temp[2]; }; /** * Execute After Initialization */ this.initAfter = function(){ _sf.backMain.width = _sf.textMsg.width + _sf.textMsg.data.x * 2 + 80; _sf.backMain.height = _sf.textMsg.height + _sf.textMsg.data.y * 2 + _sf.buttonConfirm.height + 20; if(_sf.backMain.width <= 200)_sf.backMain.width = 200; _sf.backMain.x = (IVal.GWidth - _sf.backMain.width)/ 2; _sf.backMain.y = (IVal.GHeight - _sf.backMain.height)/ 2; _sf.textMsg.x = _sf.backMain.x + (_sf.backMain.width - _sf.textMsg.width) / 2; _sf.textMsg.y = _sf.backMain.y + _sf.textMsg.data.y; if(_sf.cancelText == ""){ _sf.buttonConfirm.x = _sf.backMain.x + (_sf.backMain.width - _sf.buttonConfirm.width) / 2; }else{ _sf.buttonConfirm.x = _sf.backMain.x + (_sf.backMain.width/ 2 - _sf.buttonConfirm.width) / 2; _sf.buttonCancel.x = _sf.backMain.x + _sf.backMain.width/ 2 + (_sf.backMain.width/ 2 - _sf.buttonCancel.width) / 2; _sf.buttonCancel.y = _sf.backMain.y + _sf.backMain.height - _sf.buttonCancel.height - 10; } _sf.buttonConfirm.y = _sf.backMain.y + _sf.backMain.height - _sf.buttonConfirm.height - 10; }; /** * update this interface */ this.update = function(){ if(IInput.isKeyDown(RC.Key.ok)){ RV.GameSet.playEnterSE(); _sf.dispose(0) } if(IInput.isKeyDown(RC.Key.cancel)){ RV.GameSet.playCancelSE(); _sf.dispose(1); } }; /** * dispose this interface */ this.dispose = function(message){ if (_sf.endDo != null) _sf.endDo(message); LUI.DisposeCtrl(_sf.ctrlItems); } }