From a5c2e6f50ba39aee73319ef8898e6b591a94f6af Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Wed, 14 Oct 2015 23:09:10 -0600 Subject: [PATCH] * Work on area change + theme * Work on msg menu + theme --- mods/abracadabra.js | 8 +- mods/menu.hjson | 114 ++++++++++--------- mods/msg_area_list.js | 53 +++++---- mods/themes/luciano_blocktronics/CHANGE.ANS | Bin 0 -> 2059 bytes mods/themes/luciano_blocktronics/MMENU.ANS | Bin 3316 -> 3316 bytes mods/themes/luciano_blocktronics/MSGMNU.ANS | Bin 0 -> 3383 bytes mods/themes/luciano_blocktronics/theme.hjson | 13 +++ 7 files changed, 107 insertions(+), 81 deletions(-) create mode 100644 mods/themes/luciano_blocktronics/CHANGE.ANS create mode 100644 mods/themes/luciano_blocktronics/MSGMNU.ANS diff --git a/mods/abracadabra.js b/mods/abracadabra.js index c25edfad..47ffdadc 100644 --- a/mods/abracadabra.js +++ b/mods/abracadabra.js @@ -119,7 +119,7 @@ function AbracadabraModule(options) { function complete(err) { if(err) { self.lastError = err; - self.fallbackModule(); + self.client.fallbackMenuModule(); } else { self.finishedLoading(); } @@ -147,17 +147,13 @@ function AbracadabraModule(options) { var doorInstance = new door.Door(this.client, exeInfo); doorInstance.on('finished', function doorFinished() { - self.fallbackModule(); + self.client.fallbackMenuModule(); }); self.client.term.write(ansi.resetScreen()); doorInstance.run(); }; - - this.fallbackModule = function() { - self.client.gotoMenuModule( { name : self.menuConfig.fallback } ); - }; } require('util').inherits(AbracadabraModule, MenuModule); diff --git a/mods/menu.hjson b/mods/menu.hjson index 98ff2646..2f59f333 100644 --- a/mods/menu.hjson +++ b/mods/menu.hjson @@ -309,7 +309,7 @@ MT1: { width: 79 height: 14 - argName: message + argName: ` mode: edit } } @@ -426,12 +426,16 @@ "action" : "@menu:doorLORD" }, */ + { + value: { command: "E" } + action: @menu:doorTestExample + } { "value" : { "command" : "L" }, "action" : "@menu:mainMenuLastCallers" }, { - "value" : { "command" : "U" }, + "value" : { "command" : "Y" }, "action" : "@menu:mainMenuUserStats" }, { @@ -490,71 +494,60 @@ /////////////////////////////////////////////////////////////////////// // Message Area Related /////////////////////////////////////////////////////////////////////// - "messageArea" : { - "module" : "msg_area", - "art" : "MSGAREA", - "desc" : "Message Area", - "prompt" : "menuCommand", - "submit" : [ + messageArea: { + module: msg_area + art: MSGMNU + desc: Message Area + prompt: menuCommand + submit: [ { - "value" : { "command" : "N" }, - "action" : "@menu:messageAreaNewPost"//, - //"extraArgs" : { "messageAreaId" : 123 } - }, + value: { command: "P" } + action: @menu:messageAreaNewPost + } { - "value" : { "command" : "C" }, - "action" : "@menu:messageAreaChangeCurrentArea" - }, + value: { command: "C" } + action: @menu:messageAreaChangeCurrentArea + } { - "value" : { "command" : "L" }, - "action" : "@menu:messageAreaMessageList" - }, - /*{ - "value" : { "command" : "A" }, - "action" : "@method:changeArea" - }, - */ + value: { command: "L" } + action: @menu:messageAreaMessageList + } { - "value" : { "command" : "Q" }, - "action" : "@menu:mainMenu" - }, + value: { command: "Q" } + action: @menu:mainMenu + } { - "value" : 1, - "action" : "@menu:messageArea" + value: 1 + action: @menu:messageArea } ] - }, - "messageAreaChangeCurrentArea" : { - "art" : "msg_area_list.ans", - "module" : "msg_area_list", - "fallback" : "messageArea", + } + messageAreaChangeCurrentArea: { + art: CHANGE + module: msg_area_list "form" : { "0" : { - "VM" : { - "mci" : { - "VM1" : { - "widht" : 30, - "height" : 10, - "focus" : true, - "submit" : true, - "argName" : "area" - } - }, - "submit" : { - "*" : [ - { - "value" : { "area" : null }, - "action" : "@method:changeArea" - } - ] - }, - "actionKeys" : [ + "mci" : { + "VM1" : { + "focus" : true, + "submit" : true, + "argName" : "area" + } + }, + "submit" : { + "*" : [ { - "keys" : [ "escape" ], - "action" : "@menu:messageArea" + "value" : { "area" : null }, + "action" : "@method:changeArea" } ] - } + }, + "actionKeys" : [ + { + keys: [ "escape", "q", "shift + q" ] + action: @systemMethod:fallbackMenu + } + ] } } }, @@ -584,7 +577,7 @@ actionKeys: [ { keys: [ "escape", "q", "shift + q" ] - action: @menu:messageArea + action: @systemMethod:fallbackMenu } ] } @@ -1008,6 +1001,15 @@ ] } }, + doorTestExample: { + module: abracadabra + config: { + name: example + dropFileType: DOOR + cmd: "/usr/bin/dosemu" + args: [ "-quiet", "-f", "/home/nuskooler/DOS/X/LORD/dosemu.conf", "X:\\SLOWMO.EXE 1 120 X:\\LORD\\LAIRANS.ANS"] + } + } //////////////////////////////////////////////////////////////////////// // Mods //////////////////////////////////////////////////////////////////////// diff --git a/mods/msg_area_list.js b/mods/msg_area_list.js index 50335257..6a119e74 100644 --- a/mods/msg_area_list.js +++ b/mods/msg_area_list.js @@ -33,6 +33,11 @@ exports.moduleInfo = { |TI Current time */ +var MciCodesIds = { + AreaList : 1, + CurrentArea : 2, +}; + function MessageAreaListModule(options) { MenuModule.call(this, options); @@ -40,44 +45,36 @@ function MessageAreaListModule(options) { this.messageAreas = messageArea.getAvailableMessageAreas(); - if(_.isObject(this.menuConfig.config)) { - if(_.isString(this.menuConfig.config.entryFormat)) { - this.entryFormat = this.menuConfig.config.entryFormat; - } - } - - this.entryFormat = this.entryFormat || '( {index} ) - {desc}'; - this.menuMethods = { changeArea : function(formData, extraArgs) { if(1 === formData.submitId) { var areaName = self.messageAreas[formData.value.area].name; - messageArea.changeMessageArea(self.client, areaName, function areaChanged(err) { + messageArea.changeMessageArea(self.client, areaName, function areaChanged(err) { if(err) { self.client.term.pipeWrite('\n|00Cannot change area: ' + err.message + '\n'); setTimeout(function timeout() { - self.client.gotoMenuModule( { name : self.menuConfig.fallback } ); + self.client.fallbackMenuModule(); }, 1000); } else { - self.client.gotoMenuModule( { name : self.menuConfig.fallback } ); + self.client.fallbackMenuModule(); } }); } } }; + this.setViewText = function(id, text) { + var v = self.viewControllers.areaList.getView(id); + if(v) { + v.setText(text); + } + }; + } require('util').inherits(MessageAreaListModule, MenuModule); -/* -MessageAreaListModule.prototype.enter = function(client) { - this.messageAreas = messageArea.getAvailableMessageAreas(); - - MessageAreaListModule.super_.prototype.enter.call(this, client); -}; -*/ MessageAreaListModule.prototype.mciReady = function(mciData, cb) { var self = this; @@ -102,16 +99,34 @@ MessageAreaListModule.prototype.mciReady = function(mciData, cb) { }); }, function populateAreaListView(callback) { + var listFormat = self.menuConfig.config.listFormat || '{index} ) - {desc}'; + var focusListFormat = self.menuConfig.config.focusListFormat || listFormat; + var areaListItems = []; + var focusListItems = []; for(var i = 0; i < self.messageAreas.length; ++i) { - areaListItems.push(self.entryFormat.format( + areaListItems.push(listFormat.format( + { index : i, name : self.messageAreas[i].name, desc : self.messageAreas[i].desc } ) + ); + focusListItems.push(focusListFormat.format( { index : i, name : self.messageAreas[i].name, desc : self.messageAreas[i].desc } ) ); } var areaListView = vc.getView(1); + areaListView.setItems(areaListItems); + areaListView.setFocusItems(focusListItems); + areaListView.redraw(); + + callback(null); + }, + function populateTextViews(callback) { + // :TODO: populate current message area desc! + //self.setViewText(MciCodesIds.CurrentArea, + + callback(null); } ], function complete(err) { diff --git a/mods/themes/luciano_blocktronics/CHANGE.ANS b/mods/themes/luciano_blocktronics/CHANGE.ANS new file mode 100644 index 0000000000000000000000000000000000000000..22cd22d80d7e82023decfa409afbbc1b135932df GIT binary patch literal 2059 zcmb_d%We}f6iru1k-B12$i|zl@yw)?LRMiE6(ov)LN{4OQFgdU74Q-K4gH-l^`BIn zbFMuTp)P6F8GC$v&*NUZvyETQ{j%|4wyAtK+cb5Eake?@@Oat9N;x9g9(-XW9uY%)YrBM4^DiI*kg0kh*PzkW6<}#GVwL{fzO4OF##YRh7es$WDg}^llT$4iOMX<3b2OT`C$oa z5vil4BW4>CUbZBx1?d_Bmg~@CTuW9PPOmR3WontpW0R{=b zh83J~07ju8;q$@*YOzg*(QOz8%MXfSs(=JV1*#}Dm<&Y47DgX!f@jTAXpM@PqJ7NG%5|e4s3P>lHkdfac zfGTaQ!WMzh)u-Ny13~0|hF+Dk*;Z>K(n!$8wni=nvTKHlVWfqOS@P%d5t){98#|RE z1{59`_Na7WGy>unA&fcHykjNlJ^Hnz02eeYEunDi(2Nzu#H*DFE-SHWrG<2cf|vGS zI@(~s<^pq6H1E6^gOkNtn zfSgmwS%Pw~%R*@e96qZHZ?sGRHsvsi$TsFy&|x(TTUh~4_AQet_DcUj9=iw-ePErk zk7%&c>HazIc=uT5CX+#NSc>IPR}?_5scIl!YRTKI5EOsohan|cJM+5Ef~<_v&Q@X@ zEpUelA6Goj$Cx~)%KoP6tRt@B*3p({k${r*}RiiK9EfyXpYkuVm zTGuFwXsKD{(te5Us63=>HB|om|EZCcB4#aF&`4eFVqFi{iqL%PlA1E{{}DQfr5S%I ziOmd}yC1i=`d%NFeF0X9m^z*x#febUbbvSv3nGcK*+wkq@UUG(Ww7x8JM9S>>zwuP2kq(b0#=$wWU--@d+d*B2|B G4bQ*(&%Rdx literal 0 HcmV?d00001 diff --git a/mods/themes/luciano_blocktronics/MMENU.ANS b/mods/themes/luciano_blocktronics/MMENU.ANS index 2cdc20e1796f5911defe812a1c18d212c605a503..4b7045c96a452def5a0f7e5f1f081c47e2b10532 100644 GIT binary patch delta 14 Vcmew&`9*RA2RCEoW=`(ci~uVp1q%QG delta 16 Xcmew&`9*RA2lr%OF22oT-1is(HcSPH diff --git a/mods/themes/luciano_blocktronics/MSGMNU.ANS b/mods/themes/luciano_blocktronics/MSGMNU.ANS new file mode 100644 index 0000000000000000000000000000000000000000..7e0ab8c8a317d34a457bca25878d29189c6c7f62 GIT binary patch literal 3383 zcmb_e!EPHj5OuCbeG1S+bzu($+S{%quNvs22u9FDilRny(Md2A$AD=kk%Rn}?L&WN z7vP@+eecbXyK5*x4^a_!Ne*Y;dovtzvZ4ZPz>|6+cJ2S*R0N08W40_cV*RWNzMn%V8f!dbBS_Z#A~fKFBBV%h2u*+XWktsCLpl3HO!;a}S55<306WLec`FabGzP6oJ)dLZ}MsIWyLHtAxR1Go7z- zh+a?uzdA?+_f@%K96;|nSiwl+#za2AT-e-KkITUf_NuMwCNtgaLbnX&o(w$b?gXDZ zpS6GAfhuN&*6K?Q?|Sg|4B%TsB0*I4JXnaLqtXzOnk9n5R%=Wn4-V^)y+Vh=+-km~ zwD6o)ipZQH4g;FIo}uBZWaxvNJuHGQ^k%W9EEJp&80D4g290sy&~O~`0W;&6x1?+i z4+yy+Q+ygjVe>hEHD!hD6+@j+K47fkF$PFe$Kp26RF=2AtwF2`%Bhzs#xN{H;OEh` zLfuUO5tLIf;K4EmjZ+UJGtq>Dtem|1S;0Q8@L0$Uz6=SaC=$5Ix3ny7oV>RHJ?QKk zew{vxh2Fs)N?=ri>Pe(DK8>BpKJpH-m(2*f<*3iHi;^qD*$?+-zE0j8D9kXnsWH?- zX@MeI0et7Oh;}C;-zl){WswsOd-e{U6y8rd5LVMvS{OV9_jXw;mq4Q9R#I$mFy!Sl zST*#bWYVHkxQPwnbj|#kT4n!WuhoV2VvBi_lM>r@xi&0uz%TDaRWvR^JbhSqx;0Uh zOgf*pcrV~nANHWM??mBb(5$h@Cn?Jtr=e@p$?;F;tAEyKRRx>x^_y1pX