forked from biud436/MV
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRS_MessageSystem.js
More file actions
2125 lines (1947 loc) · 58.6 KB
/
RS_MessageSystem.js
File metadata and controls
2125 lines (1947 loc) · 58.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*:
* RS_MessageSystem.js
* @plugindesc 한글 메시지 시스템 (v0.0.9, 2016.03.21)
* @author 러닝은빛(biud436)
*-------------------------------------------------------------------------------
* 버전 로그(Version Log)
*-------------------------------------------------------------------------------
* 2016.03.21 (v0.0.9) - \t (탭), \r (캐리지 리턴) 추가
* 2016.03.01 (v0.0.8) - 말풍선 모드에 페이스칩 표시, 플러그인 커맨드 및 버그 픽스
* 2016.02.27 (v0.0.7) - 통화 서식 추가
* 2016.02.15 (v0.0.6) - 가운데 정렬, 오른쪽 정렬 관련 텍스트 코드 추가
* 2016.01.18 (v0.0.5) - 버그 픽스 (updateNameWindow, calcBalloonRect)
* 2016.01.01 (v0.0.4) - 버그 픽스 (resizeMessageSystem)
* 2015.12.03 (v0.0.3) - 말풍선 기능 추가
* 2015.12.02 (v0.0.2) - 큰 페이스칩 기능 추가
* 2015.12.01 (v0.0.1) - 최초 작성
*-------------------------------------------------------------------------------
* 플러그인 매개변수
*-------------------------------------------------------------------------------
*
* @param 폰트 사이즈
* @desc 텍스트 기본 크기
* @default 28
*
* @param numVisibleRows
* @desc 라인 갯수
* @default 4
*
* @param gradientColor1
* @desc 그레디언트 시작 색상
* @default #FFFFFF
*
* @param gradientColor2
* @desc 그레디언트 중간 색상
* @default #F29661
*
* @param gradientColor3
* @desc 그레디언트 끝 색상
* @default #CC3D3D
*
* @param 텍스트 속도
* @desc 기본 텍스트 출력 속도
* @default 0
*
* @param 폰트 최소 크기
* @desc 폰트 최대 크기
* @default 24
*
* @param 폰트 최대 크기
* @desc 폰트 최소 크기
* @default 96
*
* @param 텍스트 시작 X
* @desc 텍스트 시작 X
* @default 256
*
* @param 이름 윈도우 X
* @desc 이름 윈도우 X
* @default 0
*
* @param 이름 윈도우 Y
* @desc 이름 윈도우 Y
* @default 0
*
* @param 이름 윈도우 안쪽 여백
* @desc 이름 윈도우 안쪽 여백
* @default 10
*
* @param 큰 페이스칩 OX
* @desc 큰 페이스칩 X
* @default 0
*
* @param 큰 페이스칩 OY
* @desc 큰 페이스칩 OY
* @default 0
*
* @param 큰 페이스칩 뒷면 표시
* @desc 큰 페이스칩을 메시지창의 뒷면에 표시합니다.
* @default false
*
* @param 탭 크기
* @desc 탭 크기
* @default 4
*
*-------------------------------------------------------------------------------
* 도움말
*-------------------------------------------------------------------------------
* @help
*
*
* - 플러그인 커맨드
* 이 플러그인은 아래와 같은 플러그인 커맨드를 제공합니다.
*
* 메시지 텍스트속도 number
* 메시지 폰트크기 number
* 메시지 폰트최소크기 number
* 메시지 폰트최대크기 number
* 메시지 그레디언트 color1 color2 color3
* 메시지 라인 number
* 메시지 시작위치 number
* 메시지 이름윈도우 x number
* 메시지 이름윈도우 y number
* 메시지 이름윈도우 padding number
* 메시지 큰페이스칩X number
* 메시지 큰페이스칩Y number
* 메시지 큰페이스칩Z number
* 메시지 탭크기 number
*
* - 큰 페이스칩 설정
* 페이스칩을 img/faces 에 넣고 페이스칩의 이름을 Big_ 으로 시작하게 합니다.
*
* - 텍스트 코드(명령어) 목록
* \색[색상명]
* \속도[값]
* \테두리색[색상명]
* \테두리크기[값]
* \들여쓰기[값]
* \굵게!
* \이탤릭!
* \이름<이벤트명>
* \그레디언트<텍스트>
* \파티원[번호]
* \주인공[번호]
* \변수[번호]
* \아이콘[번호]
* \확대
* \축소
* \골드
* \말풍선[이벤트의 ID]
* \말풍선[0]
* \말풍선[-1]
* \정렬자[1]
* \정렬자[2]
* \숫자[숫자]
* \t : 탭의 크기는 8 입니다.
* \r : X를 시작 위치로 되돌립니다.
*
* - 색상
* 청록, 청록색, c_aqua
* 검은색, 검정, c_black
* 파란색, 파랑, c_blue
* 짙은회색, c_dkgray
* 자홍색, 자홍, c_fuchsia
* 회색, c_gray
* 녹색, c_green
* 밝은녹색, 라임, c_lime
* 밝은회색, c_ltgray
* 밤색, 마룬, c_maroon
* 감청색, 네이비, c_navy
* 황록색, 올리브, c_olive
* 주황색, 주황, 오렌지, c_orange
* 보라색, 보라, c_purple
* 빨간색, 빨강, c_red
* 은색, 은, c_silver
* 민트색, c_teal
* 흰색, 흰, c_white
* 노란색, 노랑, c_yellow
* 기본, 기본색, c_normal
* AliceBlue
* AntiqueWhite
* Aqua
* Aquamarine
* Azure
* Beige
* Bisque
* Black
* BlanchedAlmond
* Blue
* BlueViolet
* Brown
* BurlyWood
* CadetBlue
* Chartreuse
* Chocolate
* Coral
* CornflowerBlue
* Cornsilk
* Crimson
* Cyan
* DarkBlue
* DarkCyan
* DarkGoldenRod
* DarkGray
* DarkGreen
* DarkKhaki
* DarkMagenta
* DarkOliveGreen
* DarkOrange
* DarkOrchid
* DarkRed
* DarkSalmon
* DarkSeaGreen
* DarkSlateBlue
* DarkSlateGray
* DarkTurquoise
* DarkViolet
* DeepPink
* DeepSkyBlue
* DimGray
* DodgerBlue
* FireBrick
* FloralWhite
* ForestGreen
* Fuchsia
* Gainsboro
* GhostWhite
* Gold
* GoldenRod
* Gray
* Green
* GreenYellow
* HoneyDew
* HotPink
* IndianRed
* Indigo
* Ivory
* Khaki
* Lavender
* LavenderBlush
* LawnGreen
* LemonChiffon
* LightBlue
* LightCoral
* LightCyan
* LightGoldenRodYellow
* LightGray
* LightGreen
* LightPink
* LightSalmon
* LightSeaGreen
* LightSkyBlue
* LightSlateGray
* LightSteelBlue
* LightYellow
* Lime
* LimeGreen
* Linen
* Magenta
* Maroon
* MediumAquaMarine
* MediumBlue
* MediumOrchid
* MediumPurple
* MediumSeaGreen
* MediumSlateBlue
* MediumSpringGreen
* MediumTurquoise
* MediumVioletRed
* MidnightBlue
* MintCream
* MistyRose
* Moccasin
* NavajoWhite
* Navy
* OldLace
* Olive
* OliveDrab
* Orange
* OrangeRed
* Orchid
* PaleGoldenRod
* PaleGreen
* PaleTurquoise
* PaleVioletRed
* PapayaWhip
* PeachPuff
* Peru
* Pink
* Plum
* PowderBlue
* Purple
* RebeccaPurple
* Red
* RosyBrown
* RoyalBlue
* SaddleBrown
* Salmon
* SandyBrown
* SeaGreen
* SeaShell
* Sienna
* Silver
* SkyBlue
* SlateBlue
* SlateGray
* Snow
* SpringGreen
* SteelBlue
* Tan
* Teal
* Thistle
* Tomato
* Turquoise
* Violet
* Wheat
* White
* WhiteSmoke
* Yellow
* YellowGreen
* #RRGGBB (예를 들면, 빨강색은 \색[#FF0000] 입니다. )
*
*/
var Imported = Imported || {};
Imported.RS_MessageSystem = true;
/**
* @namespace RS
*/
var RS = RS || {};
/**
* @class RS.Window_Name
* @constructor
*/
RS.Window_Name = function() {
this.initialize.apply(this, arguments);
};
/**
* @namespace Color
*/
var Color = Color || {};
(function () {
var parameters = PluginManager.parameters('RS_MessageSystem');
RS.__fontSize = Number(parameters['폰트 크기'] || 28);
RS.__textSpeed = Number(parameters['텍스트 속도'] || 0);
RS.__minFontSize = Number(parameters['폰트 최소 크기'] || 24);
RS.__maxFontSize = Number(parameters['폰트 최대 크기'] || 96);
/**
* 텍스트 시작 X
* @memberOf RS
* @property __textStartX
* @type Number
*/
RS.__textStartX = Number(parameters['텍스트 시작 X'] || 192);
/**
* 페이스칩이 설정되어있을 때 텍스트의 시작 지점
* @memberOf RS
* @property __faceStartOriginX
* @type Number
*/
RS.__faceStartOriginX = 168;
/**
* 표시 할 라인의 수
* @memberOf RS
* @property __numVisibleRows
* @type Number
*/
RS.__numVisibleRows = Number(parameters['numVisibleRows'] || 4);
/**
* 그레디언트 텍스트 시작 색상
* @memberOf RS
* @property __gradientColor1
* @type String
*/
RS.__gradientColor1 = String(parameters['gradientColor1'] || '#FFFFFF');
/**
* 그레디언트 텍스트 중간 색상
* @memberOf RS
* @property __gradientColor1
* @type String
*/
RS.__gradientColor2 = String(parameters['gradientColor2'] || '#F29661');
/**
* 그레디언트 텍스트 끝 색상
* @memberOf RS
* @property __gradientColor1
* @type String
*/
RS.__gradientColor3 = String(parameters['gradientColor3'] || '#CC3D3D');
/**
* 이름 윈도우 X
* @memberOf RS
* @property __nameWindowX
* @type Number
*/
RS.__nameWindowX = Number(parameters['이름 윈도우 X'] || 0);
/**
* 이름 윈도우 Y
* @private
* @memberOf RS
* @property __nameWindowX
* @type Number
*/
RS.__nameWindowY = Number(parameters['이름 윈도우 Y'] || 0);
/**
* 이름 윈도우 안쪽 여백
* @private
* @memberOf RS
* @property __nameWindowStdPadding
* @type Number
*/
RS.__nameWindowStdPadding = Number(parameters['이름 윈도우 안쪽 여백'] || 18);
/**
* 큰 페이스칩 OX
* @private
* @memberOf RS
* @property __faceOX
* @type Number
*/
RS.__faceOX = Number(parameters['큰 페이스칩 OX'] || 0);
/**
* 큰 페이스칩 OY
* @private
* @memberOf RS
* @property __faceOY
* @type Number
*/
RS.__faceOY = Number(parameters['큰 페이스칩 OY'] || 0);
/**
* 큰 페이스칩 사이드에 표시
* @private
* @memberOf RS
* @property __faceSide
* @type Boolean
*/
RS.__faceSide = Boolean(parameters['큰 페이스칩 뒷면 표시'] === 'true'|| false);
/**
* 말풍선의 폰트사이즈
* @memberOf RS
* @property __FONT_SIZE
* @type Number
*/
RS.__FONT_SIZE = 28;
/**
* 말풍선의 안쪽 여백
* @memberOf RS
* @property __STD_PADDING
* @type Number
*/
RS.__STD_PADDING = 18;
/**
* 말풍선의 폭
* @memberOf RS
* @property __WIDTH
* @type Number
*/
RS.__WIDTH = (RS.__FONT_SIZE * 6) + RS.__STD_PADDING;
/**
* 말풍선의 높이
* @memberOf RS
* @property __HEIGHT
* @type Number
*/
RS.__HEIGHT = RS.__FONT_SIZE + (RS.__STD_PADDING / 2);
/**
* 탭 크기
* @memberOf RS
* @property __TabSize
* @type Number
*/
RS.__TabSize = Number(parameters['탭 크기'] || 4);
/**
* int 형 정수값에서 CSS 색상 코드를 취득합니다
* @static
* @memberOf Color
* @method getColor
* @param n {Number} 정수값
* @returns {Number}
*/
Color.getColor = function(n) {
var r = (n) & 255;
var g = (n >> 8) & 255;
var b = (n >> 16) & 255;
var result = 'rgba(%1,%2,%3,1)'.format(r,g,b);
return result;
}
/**
* @static
* @memberOf Color
* @property baseColor
* @type String
*/
Color.baseColor = Color.getColor(16777215);
/**
* 기본 색상을 취득합니다.
* @static
* @memberOf Color
* @method getBaseColor
* @returns {Color.baseColor}
*/
Color.getBaseColor = function() {
return Color.baseColor;
}
/**
* 색상값을 int에서 javascript color로
* @static
* @memberOf Color
* @method gmColor
* @param string {String}
* @returns {Color.getColor|String}
*/
Color.gmColor = function(string) {
switch(string) {
case '청록': case '청록색': case 'c_aqua':
return Color.getColor(16776960);
case '검은색': case '검정': case 'c_black':
return Color.getColor(0);
case '파란색': case '파랑': case 'c_blue':
return Color.getColor(16711680);
case '짙은회색': case 'c_dkgray':
return Color.getColor(4210752);
case '자홍색': case '자홍': case 'c_fuchsia':
return Color.getColor(16711935);
case '회색': case 'c_gray':
return Color.getColor(8421504);
case '녹색': case 'c_green':
return Color.getColor(32768);
case '밝은녹색': case '라임': case 'c_lime':
return Color.getColor(65280);
case '밝은회색': case 'c_ltgray':
return Color.getColor(12632256);
case '밤색': case '마룬': case 'c_maroon':
return Color.getColor(128);
case '감청색': case '네이비': case 'c_navy':
return Color.getColor(8388608);
case '황록색': case '올리브': case 'c_olive':
return Color.getColor(32896);
case '주황색': case '주황': case '오렌지': case 'c_orange':
return Color.getColor(4235519);
case '보라색': case '보라': case 'c_purple':
return Color.getColor(8388736);
case '빨간색': case '빨강': case 'c_red':
return Color.getColor(255);
case '은색': case '은': case 'c_silver':
return Color.getColor(12632256);
case '민트색': case 'c_teal':
return Color.getColor(8421376);
case '흰색': case '흰': case 'c_white':
return Color.getColor(16777215);
case '노란색': case '노랑': case 'c_yellow':
return Color.getColor(65535);
case '기본': case '기본색': case 'c_normal':
return Color.getBaseColor();
default:
return string;
}
}
/**
* @class Window_Base
*/
/**
* 이스케이프 코드를 취득합니다
* @memberOf Window_Base
* @method obtainEscapeCode
* @param textState {textState} 텍스트 상태
* @returns {String}
*/
Window_Base.prototype.obtainEscapeCode = function(textState) {
textState.index++;
var regExp = /^[\$\.\|\^!><\{\}\\]|^[A-Z]+|^[가-핳]+[!]*/i;
var arr = regExp.exec(textState.text.slice(textState.index));
if (arr) {
textState.index += arr[0].length;
return arr[0].toUpperCase();
} else {
return '';
}
};
/**
* 텍스트 코드 추출( 글자 색상 변경 )
* @memberOf Window_Base
* @method obtainNameColor
* @param textState {textState} 텍스트 상태
* @returns {Color.gmColor|String}
*/
Window_Base.prototype.obtainNameColor = function(textState) {
var arr = /\[(.+?)\]/gi.exec(textState.text.slice(textState.index));
if (arr) {
textState.index += arr[0].length;
return Color.gmColor(arr[1]);
} else {
return this.textColor(0);
}
};
/**
* 이스케이프 코드값을 읽고 관련 명령 처리
* @memberOf Window_Base
* @method processEscapeCharacter
* @param code {Number} 텍스트 코드
* @param textState {textState} 텍스트 상태
*/
Window_Base.prototype.processEscapeCharacter = function(code, textState) {
switch (code) {
case 'C':
this.changeTextColor(this.textColor(this.obtainEscapeParam(textState)));
break;
case '색':
this.changeTextColor(this.obtainNameColor(textState));
break;
case 'I':
case '아이콘':
this.processDrawIcon(this.obtainEscapeParam(textState), textState);
break;
case '{':
case '확대':
this.makeFontBigger();
break;
case '}':
case '축소':
this.makeFontSmaller();
break;
}
};
/**
* 윈도우 스킨 로딩이 완료되면 기본 색상 설정
* @memberOf Window_Base
* @method loadWindowskin
*/
var alias_loadWindowskin = Window_Base.prototype.loadWindowskin;
Window_Base.prototype.loadWindowskin = function() {
alias_loadWindowskin.call(this);
this.windowskin.addLoadListener(function() {
Color.baseColor = this.textColor(0);
}.bind(this));
};
/**
* @memberOf Window_Base
* @method makeFontSmaller
*/
Window_Base.prototype.makeFontSmaller = function() {
if (this.contents.fontSize >= RS.__minFontSize) {
this.contents.fontSize -= 12;
}
};
/**
* @memberOf Window_Base
* @method makeFontBigger
*/
Window_Base.prototype.makeFontBigger = function() {
if (this.contents.fontSize <= RS.__maxFontSize) {
this.contents.fontSize += 12;
}
};
/**
* @memberOf Window_Base
* @method convertEscapeCharacters
* @param text {String}
* @return text {String}
*/
var alias_Window_Base_convertEscapeCharacters = Window_Base.prototype.convertEscapeCharacters;
Window_Base.prototype.convertEscapeCharacters = function(text) {
text = alias_Window_Base_convertEscapeCharacters.call(this, text);
text = text.replace(/\x1b변수\[(\d+)\]/gi, function() {
return $gameVariables.value(parseInt(arguments[1]));
}.bind(this));
text = text.replace(/\x1b변수\[(\d+)\]/gi, function() {
return $gameVariables.value(parseInt(arguments[1]));
}.bind(this));
text = text.replace(/\x1b주인공\[(\d+)\]/gi, function() {
return this.actorName(parseInt(arguments[1]));
}.bind(this));
text = text.replace(/\x1b파티원\[(\d+)\]/gi, function() {
return this.partyMemberName(parseInt(arguments[1]));
}.bind(this));
text = text.replace(/\x1b숫자\[(\d+)\]/gi, function() {
return arguments[1].toComma();
}.bind(this));
text = text.replace(/\x1b골드/gi, TextManager.currencyUnit);
return text;
};
/**
* @class Bitmap.prototype
*/
/**
* 윈도우 스킨 로딩이 완료되면 기본 색상 설정
* @constructs Bitmap
* @param width {Number} 폭
* @param height {Number} 높이
*/
var alias_Bitmap_initialize = Bitmap.prototype.initialize;
Bitmap.prototype.initialize = function(width, height) {
alias_Bitmap_initialize.call(this, width, height);
this.fontBold = false;
this.fontGradient = false;
}
/**
* 그레디언트 설정
* @memberOf Bitmap
* @method setGradient
* @param tWidth {Number} 텍스트의 폭을 지정하세요
* @param color1 {String} 시작 색상
* @param color2 {String} 중간 색상
* @param color3 {String} 끝 색상
* @return fillStyle {Object} 선형 그레디언트 객체를 반환합니다
*/
Bitmap.prototype.setGradient = function(tWidth, color1, color2, color3) {
var context = this._context;
var gradient = context.createLinearGradient(0, 0, tWidth, 0);
gradient.addColorStop('0', color1);
gradient.addColorStop('0.6', color2);
gradient.addColorStop('1', color3);
return gradient;
};
/**
* 폰트 정보 설정
* @private
* @memberOf Bitmap
* @method _makeFontNameText
* @return {String}
*/
Bitmap.prototype._makeFontNameText = function() {
return (this.fontItalic ? 'Italic ' : '') + (this.fontBold ? 'bold ' : '') +
this.fontSize + 'px ' + this.fontFace;
};
/**
* 텍스트 묘화
* @private
* @memberOf Bitmap
* @method _drawTextBody
* @param text {String} 텍스트
* @param tx {Number} 텍스트의 x좌표
* @param ty {Number} 텍스트의 y좌표
* @param maxWidth {Number} 최대 폭
*/
Bitmap.prototype._drawTextBody = function(text, tx, ty, maxWidth) {
var context = this._context;
if(this.fontGradient) {
var gradient = this.setGradient(this.measureTextWidth(text),
RS.__gradientColor1,
RS.__gradientColor2,
RS.__gradientColor3);
context.fillStyle = gradient;
} else {
context.fillStyle = this.textColor;
}
context.fillText(text, tx, ty, maxWidth);
context.fillStyle = this.textColor;
};
/**
* @class Game_Message
*/
/**
* 게임 메시지 초기화
* @memberOf Game_Message
* @method clear
*/
var alias_Game_Message_clear = Game_Message.prototype.clear;
Game_Message.prototype.clear = function() {
alias_Game_Message_clear.call(this);
this._waitTime = 0;
this._gradientText = '';
this._balloon = -2;
this._align = 0;
}
/**
* 대기 설정
* @memberOf Game_Message
* @method setWaitTime
*/
Game_Message.prototype.setWaitTime = function(time) {
this._waitTime = time;
};
/**
* 그레디언트 텍스트 설정 함수입니다.
* @memberOf Game_Message
* @method setGradientText
* @param text {String} 그레디언트로 그릴 텍스트를 설정합니다.
*/
Game_Message.prototype.setGradientText = function(text) {
this._gradientText = text;
};
/**
* 대기 시간을 반환합니다.
* @memberOf Game_Message
* @method getWaitTime
* @return {Number}
*/
Game_Message.prototype.getWaitTime = function() {
return this._waitTime || 0;
};
/**
* 그레디언트 텍스트를 반환합니다.
* @memberOf Game_Message
* @method getWaitTime
* @return {String}
*/
Game_Message.prototype.getGradientText = function() {
return this._gradientText;
};
/**
* @memberOf Game_Message
* @method getMaxLine
* @return {Number}
*/
Game_Message.prototype.getMaxLine = function() {
return this._maxLine;
};
/**
* @memberOf Game_Message
* @method setMaxLine
* @param n {Number}
*/
Game_Message.prototype.setMaxLine = function(n) {
this._maxLine = RS.__numVisibleRows = n;
};
/**
* @memberOf Game_Message
* @method setBalloon
* @param n {Number}
*/
Game_Message.prototype.setBalloon = function(n) {
this._balloon = n;
};
/**
* @memberOf Game_Message
* @method setBalloon
* @param n {Number}
*/
Game_Message.prototype.getBalloon = function(n) {
return this._balloon;
};
/**
* @memberOf Game_Message
* @method setAlign
* @param n {Number}
*/
Game_Message.prototype.setAlign = function(n) {
this._align = n;
}
/**
* @memberOf Game_Message
* @method getAlign
* @param n {Number}
*/
Game_Message.prototype.getAlign = function(n) {
return this._align;
}
/**
* @class Window_Message
*/
/**
* 텍스트 코드 추출( 글자 색상 변경 )
* @memberOf Window_Message
* @method obtainTextSpeed
* @param textState {textState}
* @return {Number}
*/
Window_Message.prototype.obtainTextSpeed = function(textState) {
var arr = /\[(\d+)\]/.exec(textState.text.slice(textState.index));
if (arr) {
textState.index += arr[0].length;
console.log(textState.text[textState.index]);
return parseInt(arr[1]);
} else {
return 0;
}
};
/**
* 텍스트 추출( 그레디언트 설정 )
* @memberOf Window_Message
* @method obtainGradientText
* @param textState {textState}
* @return {String}
*/
Window_Message.prototype.obtainGradientText = function(textState) {
var arr = /^<(.+)>/.exec(textState.text.slice(textState.index));
if (arr) {
textState.index += arr[0].length;
return String(arr[1]);
} else {
return 'Empty Text';
}
};
/**
* 이스케이프 코드 추가 정의
* @memberOf Window_Message
* @method processEscapeCharacter
* @param code {Number} 텍스트 코드
* @param textState {textState} 텍스트 상태
*/
var alias_Window_Message_processEscapeCharacter = Window_Message.prototype.processEscapeCharacter;
Window_Message.prototype.processEscapeCharacter = function(code, textState) {
switch (code) {
case '속도':
$gameMessage.setWaitTime(this.obtainEscapeParam(textState));
break;
case '크기':
this.setTextSize(this.obtainEscapeParam(textState));
break;
case '테두리색':
this.setStrokeColor(this.obtainNameColor(textState));
break;
case '들여쓰기':
this.setTextIndent(textState);
break;
case '테두리크기':
this.setStrokeWidth(this.obtainEscapeParam(textState));
break;
case '굵게!':
this.setTextBold(!this.contents.fontBold);
break;
case '이탤릭!':
this.setTextItalic(!this.contents.fontItalic);
break;
case '그레디언트':
this.setTextGradient(textState);
break;
case 'T':
textState.x += this.textWidth("A") * RS.__TabSize;
break;
case 'R':
textState.x = 0;
break;
default:
alias_Window_Message_processEscapeCharacter.call(this, code, textState);
}
};
/**
* 데이터베이스 항목의 이름을 반환합니다.
* @memberOf Window_Message
* @method getDBData
* @param ev {Array}
* @return text {String}
*/
Window_Message.prototype.getDBData = function(ev) {
try {
return ev.name;
} catch(e) {
return "";
}
};
/**
* @memberOf Window_Message
* @method setTextItalic
* @param value {Boolean}
*/
Window_Message.prototype.setTextItalic = function() {
this.contents.fontItalic = arguments[0];
};
/**
* @memberOf Window_Message
* @method setTextBold
* @param value {Boolean}
*/
Window_Message.prototype.setTextBold = function() {
this.contents.fontBold = arguments[0];
};
/**
* @memberOf Window_Message
* @method setTextSize