OSDN Git Service

辛夷祭当日の変更を含む最終コミット
[h58pcdgame/GameScriptCoreLibrary.git] / www / corelib / classes / MessageWidgetClass.js
index aea0b36..7677f94 100644 (file)
-var MessageWidgetClass = function(manager, args)
-{
-       MessageWidgetClass.base.apply(this, arguments);
-       
-       this.downKeyPushed = false;
-       this.message = args[0];
-       this.origin = new Point2D(10,240);
-       this.size = new Point2D(620, 230);
-       
-       //\89ü\8ds\82ª\93ü\82Á\82Ä\82¢\82é\82Æ\82±\82ë\82Å\88ê\8e\9e\92â\8e~\82µ\81«\83L\81[\82Ì\89\9f\89º\82ð\91Ò\82Â
-       
-       this.messageIndex = 0;
-       this.interval = 5;
-       this.intervalCount = 0;
-       
-       this.wBox = null;
-       this.isPaused = false;
-       
-}.extend(WidgetClass, {
-       attach : function(){
-               
-               this.wBox = createMessageBox("MessageBoxWidghetMessageBox-" + this.manager.tickCount,
-                                               this.size.x, this.size.y, this.origin.x, this.origin.y,
-                                               this.manager.mainArea, undefined, undefined, 5);
-               var w = this;
-               this.manager.pauseStage(function()
-               {
-                       // pauseStage\82É\92¼\90Útick\82ð\90Ý\92u\82·\82é\82Ætick\93à\82Ìthis\82Åmanager\82ª\8eæ\93¾\82³\82ê\82Ä\82µ\82Ü\82¤
-                       return w.tick();
-               });
-       },
-       detach : function(){
-               this.manager.mainArea.removeChild(this.wBox);
-       },
-       tick : function(){
-               if(!this.manager.UIManager.keyState.cursorDown) this.downKeyPushed = false;
-               if(this.intervalCount >= this.interval)
-               {
-                       if(this.message[this.messageIndex] == '\n')
-                       {
-                               if(!this.downKeyPushed)
-                               {
-                                       if(this.manager.UIManager.keyState.cursorDown)
-                                       {
-                                               this.downKeyPushed = true;
-                                               this.messageIndex++;
-                                               this.isPaused = false;
-                                       }else
-                                       {
-                                               this.isPaused = true;
-                                       }
-                               }
-                       }else
-                       {
-                               this.messageIndex++;
-                               this.isPaused = false;
-                       }
-                       
-                       if(this.messageIndex >= this.message.length)
-                       {
-                               //\83\81\83b\83Z\81[\83W\82ð\95Â\82\82é
-                               this.manager.resumeStage();
-                               return false;
-                       }
-                       this.intervalCount = 0;
-               }else
-               {
-                       this.intervalCount++;
-               }
-               
-               if(this.wBox != null)
-               {
-                       changeMessageBox(this.wBox, this.message.slice(0, this.messageIndex), this.isPaused);
-               }
-               return true;
-       },
-       draw : function(){
-       }
-});
+// \r
+// MessageWidgetClass : \83\82\81[\83_\83\8b\82È\83\81\83b\83Z\81[\83W\83_\83C\83A\83\8d\83O\82ð\95\\8e¦\82·\82é\81B\r
+// args[0] : \83\81\83b\83Z\81[\83W\82Ì\93à\97e(string)\r
+//             \89ü\8ds\82ð\93ü\82ê\82é\82Æ\81A\82»\82Ì\88Ê\92u\82Å\83L\81[\82Ì\93ü\97Í\82ð\91Ò\82Â\81B\r
+//             \83\81\83b\83Z\81[\83W\82Ì\8fI\92[\82É\89ü\8ds\82ð\93ü\82ê\82È\82¢\82Æ\81A\8dÅ\8cã\82Ì\95\8e\9a\82ª\95\\8e¦\82³\82ê\82½\92¼\8cã\82É\8f\9f\8eè\82É\83E\83B\83W\83F\83b\83g\82ª\95Â\82\82Ä\82µ\82Ü\82¤\81B\r
+// args[1] : \8e\9f\82Ì\83E\83B\83W\83F\83b\83g (\8fÈ\97ª\89Â)\r
+//             \82±\82±\82É\83E\83B\83W\83F\83b\83g\82Ì\83C\83\93\83X\83^\83\93\83X\82ð\8ew\92è\82·\82é\82Æ\81AMessage\82ª\95Â\82\82½\82Æ\82«\82É\8e\9f\82ÌWidget\82ð\95\\8e¦\82Å\82«\82é\81B\r
+//             MessageWidget\82Å\82à\81A\82»\82Ì\91¼\82Ì\94ñ\83\82\81[\83_\83\8b\82È\83E\83B\83W\83F\83b\83g\82Å\82à\8ew\92è\89Â\81B\r
+\r
+var MessageWidgetClass = function(manager, args)\r
+{\r
+       MessageWidgetClass.base.apply(this, arguments);\r
+       \r
+       this.downKeyPushed = true;\r
+       this.upKeyPushed = true;\r
+       this.message = args[0];\r
+       this.origin = new Point2D(10,240);\r
+       this.size = new Point2D(620, 230);\r
+       \r
+       //\89ü\8ds\82ª\93ü\82Á\82Ä\82¢\82é\82Æ\82±\82ë\82Å\88ê\8e\9e\92â\8e~\82µ\81«\83L\81[\82Ì\89\9f\89º\82ð\91Ò\82Â\r
+       \r
+       this.messageIndex = 0;\r
+       this.interval = 5;\r
+       this.intervalCount = 0;\r
+       \r
+       //\82±\82Ì\83\81\83b\83Z\81[\83W\82ª\95\\8e¦\82µ\8fI\82í\82Á\82½\8cã\82É\8eÀ\8ds\82·\82é\83E\83B\83W\83F\83b\83g\r
+       this.nextWidget = args[1];\r
+       \r
+       this.wBox = null;\r
+       this.isPaused = false;\r
+       this.closed = args[2];\r
+       \r
+       this.modalFunc = null;\r
+       this.cancelKeyEnabled = true;\r
+}.extend(WidgetClass, {\r
+       attach : function(){\r
+               var that = this;\r
+               this.modalFunc = function()\r
+               {\r
+                       // pauseStage\82É\92¼\90Útick\82ð\90Ý\92u\82·\82é\82Ætick\93à\82Ìthis\82Åmanager\82ª\8eæ\93¾\82³\82ê\82Ä\82µ\82Ü\82¤\r
+                       return that.tick();\r
+               };\r
+               this.manager.pauseStage(this.modalFunc, function(){\r
+                       that.wBox = createMessageBox("MessageBoxWidghetMessageBox-" + MessageWidgetClass.attachedCount,\r
+                                               that.size.x, that.size.y, that.origin.x, that.origin.y,\r
+                                               that.manager.mainArea, undefined, undefined, 5);\r
+                       MessageWidgetClass.attachedCount++;\r
+               });\r
+       },\r
+       detach : function(){\r
+               if(this.wBox)\r
+               {\r
+                       this.manager.mainArea.removeChild(this.wBox);\r
+                       this.wBox = null;\r
+               }\r
+               if(this.closed){\r
+                       this.closed(this);\r
+               }\r
+       },\r
+       tick : function(){\r
+               if(!this.wBox) return true;\r
+               if(this.manager.UIManager.keyState.cursorUp)\r
+               {\r
+                       if(!this.upKeyPushed && this.cancelKeyEnabled)\r
+                       {\r
+                               this.upKeyPushed = true;\r
+                               //\83\81\83b\83Z\81[\83W\82ð\95Â\82\82é\r
+                               if(this.wBox)\r
+                               {\r
+                                       this.manager.mainArea.removeChild(this.wBox);\r
+                                       this.wBox = null;\r
+                               }\r
+                               if(this.modalFunc)\r
+                               {\r
+                                       this.manager.resumeStage(this.modalFunc);\r
+                               }\r
+                               return false;\r
+                       }\r
+               }else\r
+               {\r
+                       this.upKeyPushed = false;\r
+               }\r
+               if(!this.manager.UIManager.keyState.cursorDown && !this.manager.UIManager.keyState.select) this.downKeyPushed = false;\r
+               if(this.intervalCount >= this.interval)\r
+               {\r
+                       if(this.message[this.messageIndex] == '\n')\r
+                       {\r
+                               if(!this.downKeyPushed)\r
+                               {\r
+                                       if(this.manager.UIManager.keyState.cursorDown || this.manager.UIManager.keyState.select)\r
+                                       {\r
+                                               this.downKeyPushed = true;\r
+                                               this.messageIndex++;\r
+                                               this.isPaused = false;\r
+                                       }else\r
+                                       {\r
+                                               this.isPaused = true;\r
+                                       }\r
+                               }\r
+                       }else\r
+                       {\r
+                               this.messageIndex++;\r
+                               this.isPaused = false;\r
+                       }\r
+                       \r
+                       if(this.messageIndex >= this.message.length)\r
+                       {\r
+                               //\83\81\83b\83Z\81[\83W\82ð\95Â\82\82é\r
+                               if(this.modalFunc)\r
+                               {\r
+                                       this.manager.resumeStage(this.modalFunc);\r
+                               }\r
+                               if(this.nextWidget)\r
+                               {\r
+                                       this.manager.addWidget(this.nextWidget);\r
+                               }\r
+                               return false;\r
+                       }\r
+                       this.intervalCount = 0;\r
+               }else\r
+               {\r
+                       this.intervalCount++;\r
+               }\r
+               \r
+               if(this.wBox != null)\r
+               {\r
+                       changeMessageBox(this.wBox, this.message.slice(0, this.messageIndex), this.isPaused);\r
+               }\r
+               return true;\r
+       },\r
+       draw : function(){\r
+       }\r
+});\r
+\r
+MessageWidgetClass.attachedCount = 0;\r