OSDN Git Service

PCDSLEditorのアップデートとゲームのポータブル実行の対応
[h58pcdgame/GameScriptCoreLibrary.git] / www / corelib / classes / UserStateWidgetClass.js
1 var UserStateWidgetClass = function(manager, args)
2 {
3         UserStateWidgetClass.base.apply(this, arguments);
4         this.manager = manager;
5         this.wCanvas = null;
6         this.gContext = null;
7         
8 }.extend(WidgetClass, {
9         attach: function(){
10                 this.wCanvas = createCanvas("UserStateWidgetCanvas", 240, 80, 395, 5, 8, this.manager.mainArea);
11                 this.gContext = this.wCanvas.getContext('2d');
12                 this.gContext.globalAlpha = 0.25;
13                 this.gContext.fillStyle = "rgba(255,240,200,0.5)";
14                 this.gContext.strokeStyle = "rgba(128, 128, 128, 0.5)";
15                 this.gContext.font = "normal 20px sans-serif";
16         },
17         detach: function(){
18                 this.wCanvas = null;
19                 this.gContext = null;
20                 destroyDOMObjectByID("UserStateWidgetCanvas");
21         },
22         tick : function(){
23                 return true;
24         },
25         
26         draw : function(){
27                 strokeRect(this.gContext, 0, 0, this.wCanvas.width, this.wCanvas.height);
28                 fillRect(this.gContext, 0, 0, this.wCanvas.width, this.wCanvas.height);
29                 if(this.manager.userID != 0){
30                         drawText(this.gContext, this.manager.userManager.getUserNameByUID(this.manager.userID), 2, 2);
31                 }
32         },
33 });