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
| #==============================================================================
# Emoticon on Face
#------------------------------------------------------------------------------
# By Nechigawara Sanzenin
# WARNING!! : This script can use on RPG Maker VX Only!! (XP Not Support)
=begin
How to Use:
Add "\E[Number Of Emoticon]" To text in message control
You can see Number of Emoticon on "Balloon.png" in "Graphics\System" or
"%programfiles%\Common Files\Enterbrain\RGSS2\RPGVX\Graphics\System".
when the line number of emoticonset is 1 , Number of Emoticon is 1.
when the line number of emoticonset is 2 , Number of Emoticon is 2.
Max of Number of Emoticon is 10.
You can set Emoticon's Position at EMO_X and EMO_y.
You can set frame rate at BALLOON_WAIT.
if the message window don't have face,Noting happen.
=end
#==============================================================================
class Window_Message < Window_Selectable
#--------------------------------------------------------------------------
BALLOON_WAIT = 12
EMO_X = 93
EMO_Y = 15
#--------------------------------------------------------------------------
alias inc_initialize initialize
def initialize
inc_initialize
@viewport = Viewport.new(0, 0, 544, 416)
@viewport.z = z + 50
@balloon_face = 0
create_balloon
end
#--------------------------------------------------------------------------
alias inc_dispose dispose
def dispose
inc_dispose
dispose_balloon
@viewport.dispose
end
#--------------------------------------------------------------------------
def update
super
update_gold_window
update_number_input_window
update_back_sprite
update_show_fast
update_balloon
unless @opening or @closing # ウィンドウの開閉中以外
if @wait_count > 0 # 文章内ウェイト中
@wait_count -= 1
elsif self.pause # 文章送り待機中
input_pause
elsif self.active # 選択肢入力中
input_choice
elsif @number_input_window.visible # 数値入力中
input_number
elsif @text != nil # 残りの文章が存在
update_message # メッセージの更新
elsif continue? # 続ける場合
start_message # メッセージの開始
open # ウィンドウを開く
$game_message.visible = true
else # 続けない場合
close # ウィンドウを閉じる
$game_message.visible = @closing
end
end
end
#--------------------------------------------------------------------------
def create_balloon
dispose_balloon
@balloon_duration = 8 * 8 + BALLOON_WAIT
@balloon_sprite = ::Sprite.new(@viewport)
@balloon_sprite.bitmap = Cache.system("Balloon")
@balloon_sprite.ox = 16
@balloon_sprite.oy = 32
@balloon_sprite.visible = false
update_balloon
end
#--------------------------------------------------------------------------
def refresh_balloon
if @balloon_face == 0 or @balloon_face > 10
@balloon_sprite.visible = false
else
@balloon_sprite.visible = true
end
update_balloon
end
#--------------------------------------------------------------------------
def update_balloon
if @balloon_duration > 0
@balloon_duration -= 1
if @balloon_duration == 0
@balloon_duration = 8 * 8 + BALLOON_WAIT
@balloon_duration -= 1
else
@balloon_sprite.x = x + EMO_X
@balloon_sprite.y = y + EMO_Y
@balloon_sprite.z = z + 50
if @balloon_duration < BALLOON_WAIT
sx = 7 * 32
else
sx = (7 - (@balloon_duration - BALLOON_WAIT) / 8) * 32
end
sy = (@balloon_face - 1) * 32
@balloon_sprite.src_rect.set(sx, sy, 32, 32)
end
end
end
#--------------------------------------------------------------------------
def dispose_balloon
if @balloon_sprite != nil
@balloon_sprite.dispose
@balloon_sprite = nil
end
end
#--------------------------------------------------------------------------
alias inc_terminate_message terminate_message
def terminate_message
inc_terminate_message
@balloon_sprite.visible = false
end
#--------------------------------------------------------------------------
alias inc_convert_special_characters convert_special_characters
def convert_special_characters
inc_convert_special_characters
@text.gsub!(/\\E\[([0-9]+)\]/i) { "\x09[#{$1}]" }
end
#--------------------------------------------------------------------------
def update_message
loop do
c = @text.slice!(/./m) # 次の文字を取得
case c
when nil # 描画すべき文字がない
finish_message # 更新終了
break
when "\x00" # 改行
new_line
if @line_count >= MAX_LINE # 行数が最大のとき
unless @text.empty? # さらに続きがあるなら
self.pause = true # 入力待ちを入れる
break
end
end
when "\x01" # \C[n] (文字色変更)
@text.sub!(/\[([0-9]+)\]/, "")
contents.font.color = text_color($1.to_i)
next
when "\x02" # \G (所持金表示)
@gold_window.refresh
@gold_window.open
when "\x03" # \. (ウェイト 1/4 秒)
@wait_count = 15
break
when "\x04" # \| (ウェイト 1 秒)
@wait_count = 60
break
when "\x05" # \! (入力待ち)
self.pause = true
break
when "\x06" # \> (瞬間表示 ON)
@line_show_fast = true
when "\x07" # \< (瞬間表示 OFF)
@line_show_fast = false
when "\x08" # \^ (入力待ちなし)
@pause_skip = true
when "\x09"
@text.sub!(/\[([0-9]+)\]/, "")
unless $game_message.face_name.empty?
@balloon_face = $1.to_i
refresh_balloon
end
else # 普通の文字
contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
c_width = contents.text_size(c).width
@contents_x += c_width
end
break unless @show_fast or @line_show_fast
end
end
end |