❤ 0 Auteur : Inconnu, Goldenshadow
Logiciel : RPG Maker XP
Nombre de scripts : 3
Source : (Cetais a dit : message original, je pense, de Séphiroth du forum RPG Creative)
Fonctionnalités
Quoi de mieux que d'avoir un menu qui vous fera penser à votre ordinateur ?
Vous voulez un ordi dans votre jeux ???
Vous pouvez lire vos mails déposez de l'argent (ok javoue c'est bizarre) déposez des objets (si vous avez un éléphant comme objet ^^" allez voir comment on mat sa la dedans ^^" on le scanne ^^""")
Installation
Remplacez le script Main par le script Main ci-présent.
Les deux scripts suivants sont à installer au-dessus de Main.
Vous devrez configurer plusieurs icônes, dans le dossier Graphics/Icon.
Utilisation
Pour ouvrir un ordinateur, faites un évenement avec en appel de scrîpt :
1
| $scene = Scene_Computer.new |
Pour ajouter des objets lorsque le joueur se connecte à l"ordi, toujours en appel de script :
1
| $itembank.deposit(1,4,false) |
Où 4 est l'id de l'objet à ajouter.
Dans le scripts, vous pouvez changer les termes de vocabulaire, sur ces lignes (entre guillemets) :
1
2
3
4
| s1 = "Item Storage"
s2 = "Mail"
s3 = "Bank"
s4 = "Theme" |
Et changer le nom des icônes des catégories (entre guillemets, sans extension) :
1
2
3
4
| ic_itm = RPG::Cache.icon("034-Item03")
ic_eml = RPG::Cache.icon("033-Item02")
ic_gld = RPG::Cache.icon("gold")
ic_bck = RPG::Cache.icon("backicon") |
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
| #==============================================================================
# ■ Main
#------------------------------------------------------------------------------
# 各クラスの定義が終わった後、ここから実際の処理が始まります。
#==============================================================================
begin
Font.default_name = "Arial"
Font.default_size = 24
# Change the $fontface variable to change the font style
$fontface = "Arial"
# Change the $fontsize variable to change the font size
$fontsize = 24
$defaultfonttype = $fontface
$defaultfontsize = $fontsize
Font.default_name = $fontface
Font.default_size = $fontsize
# トランジション準備
Graphics.freeze
# シーンオブジェクト (タイトル画面) を作成
$scene = Scene_Title.new
# $scene が有効な限り main メソッドを呼び出す
while $scene != nil
$scene.main
end
# フェードアウト
Graphics.transition(20)
rescue Errno::ENOENT
# 例外 Errno::ENOENT を補足
# ファイルがオープンできなかった場合、メッセージを表示して終了する
filename = $!.message.sub("No such file or directory - ", "")
print("File #{filename} was not found.")
end |
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
| class Itembank
attr_reader :items
def initialize
@items = {}
end
def deposit(item_id, n, lose_party = true)
if item_id > 0
@items[item_id] = [[item_number(item_id) + n, 0].max, 99].min
end
$game_party.lose_item(item_id, n) if lose_party == true
end
def withdraw(item_id, n)
deposit(item_id, -n)
end
def item_number(item_id)
return @items.include?(item_id) ? @items[item_id] : 0
end
end
class Scene_Title
alias itembank_title_new_game command_new_game
def command_new_game
itembank_title_new_game
$itembank = Itembank.new
end
end
#===================================================
# ▼ CLASS Scene_Save Additional Code Begins
#===================================================
class Scene_Save
alias itembank_write_save_data write_save_data
def write_save_data(file)
itembank_write_save_data(file)
Marshal.dump($itembank, file)
end
end
#===================================================
# ▲ CLASS Scene_Save Additional Code Ends
#===================================================
#===================================================
# ▼ CLASS Scene_Load Additional Code Begins
#===================================================
class Scene_Load
alias itembank_read_save_data read_save_data
def read_save_data(file)
itembank_read_save_data(file)
$itembank = Marshal.load(file)
end
end
#===================================================
# ▲ CLASS Scene_Load Additional Code Ends
#===================================================
class Items_Party_Window < Window_Selectable
def initialize
super(0, 0, 320, 480)
self.active = false
self.index = -1
refresh
self.index = 0 if @data.size > 0
self.back_opacity = 160
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
def size
return @data.size
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# アイテムを追加
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
self.contents.font.color = normal_color
x = 4
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end
class Items_Bank_Window < Window_Selectable
def initialize
super(320, 0, 320, 480)
self.active = false
self.index = -1
refresh
self.index = 0 if @data.size > 0
self.back_opacity = 160
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
def size
return @data.size
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# アイテムを追加
for i in 1...$data_items.size
if $itembank.item_number(i) > 0
@data.push($data_items[i])
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
number = $itembank.item_number(item.id)
self.contents.font.color = normal_color
x = 4
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end
class Scene_Item_Bank
def main
@left_window = Items_Party_Window.new
@right_window = Items_Bank_Window.new
@left_window.refresh
@right_window.refresh
@right_window.index = -1
@left_window.active = true
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@left_window.dispose
@right_window.dispose
end
# --------------------
def update
@left_window.update
@right_window.update
if @left_window.active
update_left
return
end
if @right_window.active
update_right
return
end
end
# --------------------
def update_left
if Input.trigger?(Input::B)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Computer.new
end
if Input.trigger?(Input::C)
if @left_window.size > 0
$game_system.se_play($data_system.decision_se)
$itembank.deposit(@left_window.item.id, 1)
@right_window.refresh
@left_window.refresh
@left_window.index = -1 if @left_window.size == 0
@left_window.index = @left_window.size - 1 if @left_window.index > @left_window.size - 1
else
$game_system.se_play($data_system.buzzer_se)
end
end
if Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@left_window.index = -1
@left_window.active = false
@right_window.refresh
@right_window.index = (@right_window.size > 0 ? 0 : -1)
@right_window.active = true
end
end
# --------------------
def update_right
if Input.trigger?(Input::B)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Computer.new
end
if Input.trigger?(Input::C)
if @right_window.size > 0
$game_system.se_play($data_system.decision_se)
$itembank.withdraw(@right_window.item.id, 1)
@left_window.refresh
@right_window.refresh
@right_window.index = -1 if @right_window.size == 0
@right_window.index = @right_window.size - 1 if @right_window.index > @right_window.size - 1
else
$game_system.se_play($data_system.buzzer_se)
end
end
if Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@right_window.index = -1
@right_window.active = false
@left_window.refresh
@left_window.index = (@left_window.size > 0 ? 0 : -1)
@left_window.active = true
end
end
end |
Et encore un au nom de Bank au-dessus de main :
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
| class Bank
attr_reader :money
def initialize
@money = 0
end
def deposit(n)
@money += n
$game_party.lose_gold(n)
end
def withdraw(n)
deposit(-n)
end
def can_deposit?(n)
if ($game_party.gold - n) < 0
return false
else
return true
end
end
def can_withdraw?(n)
if @money - n >= 0
if ($game_party.gold + n) > 9999999
return false
else
return true
end
else
return false
end
end
end
class Scene_Title
alias bank_title_new_game command_new_game
def command_new_game
bank_title_new_game
$bank = Bank.new
end
end
#===================================================
# ▼ CLASS Scene_Save Additional Code Begins
#===================================================
class Scene_Save
alias bank_write_save_data write_save_data
def write_save_data(file)
bank_write_save_data(file)
Marshal.dump($bank, file)
end
end
#===================================================
# ▲ CLASS Scene_Save Additional Code Ends
#===================================================
#===================================================
# ▼ CLASS Scene_Load Additional Code Begins
#===================================================
class Scene_Load
alias bank_read_save_data read_save_data
def read_save_data(file)
bank_read_save_data(file)
$bank = Marshal.load(file)
end
end
#===================================================
# ▲ CLASS Scene_Load Additional Code Ends
#=================================================== |
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
| #--------------------------------------------------------------------------------------------------------------------------
# * Created by: GoldenShadow
#=============================================================
module SC # don't delete module, it's ripping if done anyway!
RXSC_MAIL = "Mail Client Script: Ver.1.1"
MAIL_HEAR_SOUND = true # set to true to hear a sound on receive
end
class Mail
attr_accessor :mail # Mail
attr_accessor :msg # Content of mail
attr_accessor :account # Your e-mail account
attr_accessor :sender # The sender
attr_accessor :read # If it's read or new
attr_accessor :font # Contents font
def initialize # Define the variables we're going to use
# Why are they global variables you ask? So we can use 'em outside this class
@mail = [] # mail IDs
@msg = [] # mail msgs
@account = "#{$game_party.actors[0„.name}@RXSC.net" # This is the player's mail
@sender = [] # sender IDs
@read = [] # unread option IDs
@font = [] # font
end
def received_include?(string) # check if string is in mail or sender (can be number)
if @mail.include?(string)
return true
elsif @sender.include?(string)
return true
else
return false
end
end
def is_new?(id) # see if mail is unread
if @read[id] == true
return false
elsif @read[id] == false
return true
else
return false
end
end
def write_mail(topic = nil,from = nil,msg = [], type = nil, font = nil)
if SC::MAIL_HEAR_SOUND == true # Sound when receiving
Audio.se_play("Audio/SE/055-Right01", 100, 150) # You may change the soundfile
# In fact, you may even use Music Effects, BGM (not recommended) or BGS.
# Change the 'se_play' to 'me_play','bgm_play' or 'bgs_play' respectivly.
# You should also change the directory when something else than SE is used.
end
if topic == nil or topic == ""# Subject of message
@mail.push("(no subject)") # if no subject specified
else
@mail.push(topic)
end
if msg == nil # Write a message in array format, like: ["line1, "line2, "etc"]
@msg.push(["* AUTO MAIL*","No message specified by the sender."," ","Greetings from webmaster@mailserver.rxsc"])
else
@msg.push(msg)
end
if from == nil or from == "" # The sender of the mail
@sender.push("(unknown)") # if no sender specified
else
@sender.push(from)
end
if font != nil
@font.push(font)
else
@font.push(nil)
end
@read.push(false) # set it to unread
if type != nil # some cool stuff
if type == 1
# Type 1: Corrupted Mail
@msg[topic].push("","* AUTO MAIL *","The mail is corrupted.","Sorry for this inconvinience.","","Greetings from Webmaster")
elsif type == 2
# Type 2: Infected Mail
@msg[topic].push("","* AUTO MAIL *","This mail is infected.","Delete it immediately.","","Greetings from Webmaster")
elsif type == 3
# Type 3: Incomplete Mail
@msg[topic].push("","* AUTO MAIL *","Mail was not sent correctly.","Some parts may have been lost.","","Greetings from Webmaster")
elsif type == 4
# Add more if you like, see above for the examples
end
end
end
end
# This is the topic window or in other words the message window.
# So this is the window where the contents of a mail is shown.
# You may change it in how you want it actually.
# Screwing this up is your own fault... but then again, you can always repaste...
class Window_Topic < Window_Base
attr_reader :msg
def initialize(mail)
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.visible = false
@mail = mail # This is the index of the inbox and will be converted to the mail ID
refresh
end
def refresh
self.contents.clear
unless @mail == "none" # Just a block
self.contents.draw_text(4, 0, self.width - 40, 32, "Subject: #{$mail.mail[@mail]}")
self.contents.draw_text(4, 32, self.width - 40, 32, "From: #{$mail.sender[@mail]}")
rect = Rect.new(0, 68, self.width, 2)
self.contents.fill_rect(rect, Color.new(255, 255, 255)) # Modify the color as pleased
end
end
def show_msg(msg) # Show the mail message contents
@topic = $mail.mail[@mail].to_s
@msg = $mail.msg[@mail]
self.contents = Bitmap.new(width - 32, (@msg.size * 16) + 80)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
y = 53 # start line 1 at this y-position
unless @msg == nil or @mail == "none" # Also just a block
for line in 0...@msg.size
y += 16 # space between the lines
self.contents.font.size = 16 # font size
if $mail.font[@mail] != nil
self.contents.font.name = $mail.font[@mail] # own font
end
self.contents.draw_text(4, y, self.width, 32, @msg[line].to_s)
end
end
end
end
# This is the inbox
# When email is received it will be added at the end of the list.
# So that you can see, like the real one, which one's old or new.
class Window_Inbox < Window_Selectable
def initialize
super(0, 64, 640, 416)
@column_max = 1
self.index = -1
refresh
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...$mail.mail.size # This is the var for mails
@data.push($mail.mail[i])
end
@item_max = @data.size
if @item_max >= 0
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = 24
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
self.contents.font.color = normal_color
x = 4
y = index * 32 # 32 stands for space between lines
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(x, y, self.width - 40, 32, item.to_s) # mail topic (subject)
self.contents.draw_text(x + 400, y, self.width - 40, 32, $mail.sender[index].to_s) # Sender
if $mail.read[index] == false
self.contents.font.color = Color.new(130,225,89)
self.contents.draw_text(x + 300, y, self.width - 40, 32, "NEW") # if mail is unread
else
self.contents.font.color = normal_color
self.contents.draw_text(x + 300, y, self.width - 40, 32, "") # if mail is read, change as pleased
end
end
end
# This is the built-in mail client.
# You may modify it but try not to screw it too much up.
class Scene_Mail
def main
@help_window = Window_Help.new
if $mail.mail.size == 0 or $mail.mail == nil
@help_window.set_text("No mail.")
else
@help_window.set_text("You have #{$mail.mail.size} message" + ($mail.mail.size > 1 ? "s " : " ") + "in your inbox.")
end
@help_window.z = 100
@inbox = Window_Inbox.new
@inbox.index = 0 if $mail.mail.size > 0
@inbox.active = true
@inbox.visible = true
@inbox.z = 200
@topic_window = Window_Topic.new("none")
@topic_window.z = 100
@message_window = Window_Message.new # For msg's to show...
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@inbox.dispose
@topic_window.dispose
@message_window.dispose
@help_window.dispose
end
def update
@message_window.update
@inbox.update
@help_window.update
@topic_window.update
if $game_temp.message_window_showing
return
end
if @inbox.active == false
update_topic
return
end
if @inbox.active == true
update_inbox
return
end
end
def update_inbox
if $mail.mail.size == 0 or $mail.mail == nil
@inbox.index = -1
end
if Input.trigger?(Input::C) # selecting the topic at inbox
if @inbox.index == nil or $mail.mail.size == 0 # if no topics...
$game_system.se_play($data_system.buzzer_se) # errrr
return
end
$game_system.se_play($data_system.decision_se)
@topic_window.contents.clear
@topic_window = Window_Topic.new(@inbox.index)
@topic_window.show_msg(@inbox.index)
if $mail.read[@inbox.index] == false
$mail.read[@inbox.index] = true
@inbox.refresh
end
@topic_window.visible = true
@inbox.active = false
@inbox.visible = false
@help_window.visible = false
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Computer.new # This would be the previous scene
end
if Input.trigger?(Input::Z) # Deletes selected email
$mail.mail.delete_at(@inbox.index)
$mail.msg.delete_at(@inbox.index)
$mail.sender.delete_at(@inbox.index)
$mail.read.delete_at(@inbox.index)
$mail.font.delete_at(@inbox.index)
$game_system.se_play($data_system.decision_se)
@inbox.refresh
if $mail.mail.size == 0
@inbox.index = -1
@help_window.set_text("No mail.")
else
@help_window.set_text("You have #{$mail.mail.size} message" + ($mail.mail.size > 1 ? "s " : " ") + "in your inbox.")
end
if @inbox.index > $mail.mail.size - 1
@inbox.index -= 1
end
end
if Input.trigger?(Input::X) # Deletes all
$mail.mail.clear
$mail.msg.clear
$mail.sender.clear
$mail.read.clear
$mail.font.clear
$game_system.se_play($data_system.decision_se)
@inbox.refresh
@help_window.set_text("No mail.")
@inbox.index = -1 # this will make the cursor be hidden (cuz there arent any mails)
end
end
def update_topic # this command is for the topic window, add stuff if you like
if Input.trigger?(Input::B) # cancel button to return to inbox
$game_system.se_play($data_system.cancel_se)
@inbox.active = true
@inbox.visible = true
@help_window.visible = true
@topic_window.visible = false
end
if Input.repeat?(Input::DOWN)
@topic_window.oy += 16 if @topic_window.oy < ((@topic_window.msg.size * 16) + 80) - 448
end
if Input.repeat?(Input::UP)
@topic_window.oy -= 16 if @topic_window.oy > 0
end
end
end
# This is a example mail for you to learn from.
# Study this and you'll learn it in no time!
class Scene_Title
alias mail_title_new_game command_new_game
def command_new_game
mail_title_new_game
$mail = Mail.new
end
end
#===================================================
# ▼ CLASS Scene_Save Additional Code Begins
#===================================================
class Scene_Save
alias mail_write_save_data write_save_data
def write_save_data(file)
mail_write_save_data(file)
Marshal.dump($mail, file)
end
end
#===================================================
# ▲ CLASS Scene_Save Additional Code Ends
#===================================================
#===================================================
# ▼ CLASS Scene_Load Additional Code Begins
#===================================================
class Scene_Load
alias mail_read_save_data read_save_data
def read_save_data(file)
mail_read_save_data(file)
$mail = Marshal.load(file)
end
end
#===================================================
# ▲ CLASS Scene_Load Additional Code Ends
#=================================================== |
Et encore un du nom de Computer au-dessus de main (c'est le dernier) :
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
| #-----------------------------------------------------------------
# Slipknot Computer Menu System
# created by slipknot
#-----------------------------------------------------------------
class Game_Temp
attr_accessor :menubar
alias comp_menu_init initialize
def initialize
comp_menu_init
@menubar = "bar1"
end
end
class Scene_Computer
#-----------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#-----------------------------------------------------------------
def main
@g = Gold.new
@g.x = 80
@g.y = 80
@g.visible = false
@g.active = false
s1="Deposit"
s2="Withdraw"
s3="About"
s4="None"
s5="Blue"
s6="Olive"
s7="Silver"
@bank = Window_Command.new(132, [s1,s2])
@bank.x = 320-@bank.width/2
@bank.y = 240-@bank.height/2
@bank.visible = false
@bank.active = false
@back = Window_Command.new(100, [s5,s6,s7])
@back.x = 320-@back.width/2
@back.y = 240-@back.height/2
if @backso = nil
@backso = 1
end
@back.visible = false
@back.active = false
@imagen = Sprite.new
@imagen.bitmap=RPG::Cache.picture("back")
@bar = Sprite.new
@bar.bitmap=RPG::Cache.picture($game_temp.menubar)
@bar.y=449
@playtime = Playtime.new
@stname = Startname.new
@command = Computer.new
@command.index = @menu_index
@command.z = 100
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command.dispose
@playtime.dispose
@stname.dispose
@g.dispose
@bar.dispose
@imagen.dispose
end
#-----------------------------------------------------------------
def update
@command.update
@bar.update
@stname.update
@playtime.update
@imagen.update
if @backso==0
@bar.bitmap=RPG::Cache.picture("bar1")
$game_temp.menubar = "bar1"
elsif @backso==1
@bar.bitmap=RPG::Cache.picture("bar2")
$game_temp.menubar = "bar2"
elsif @backso==2
@bar.bitmap=RPG::Cache.picture("bar3")
$game_temp.menubar = "bar3"
end
@g.update
@bank.update
@banknum.update if @banknum != nil
@back.update
if @back.active
update_back
return
end
if @bank.active
update_g
return
end
if @banknum != nil
if @banknum.active
update_banknum
return
end
end
if @command.active
update_command
return
end
end
#-----------------------------------------------------------------
def delay(seconds)
for i in 0...(seconds * 1)
sleep 0.01
Graphics.update
end
end
#-----------------------------------------------------------------
def audiofade
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
end
#-----------------------------------------------------------------
def update_banknum
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@banknum.active = false
@banknum.visible = false
@banknum.dispose
@banknum = nil
@bank.active = true
@bank.visible = true
return
end
if Input.trigger?(Input::C)
n = @banknum.number
if @withdraw
if $bank.can_withdraw?(n)
$game_system.se_play($data_system.shop_se)
$bank.withdraw(n)
@g.refresh
bank_done
else
$game_system.se_play($data_system.buzzer_se)
end
else
if $bank.can_deposit?(n)
$game_system.se_play($data_system.shop_se)
$bank.deposit(n)
@g.refresh
bank_done
else
$game_system.se_play($data_system.buzzer_se)
end
end
return
end
end
def bank_done
@banknum.active = false
@banknum.visible = false
@banknum.dispose
@banknum = nil
@withdraw = nil
@bank.active = true
@bank.visible = true
end
def update_g
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@g.visible = false
@g.active = false
@bank.active = false
@bank.visible = false
@command.active = true
return
end
if Input.trigger?(Input::C)
case @bank.index
when 0
$game_system.se_play($data_system.decision_se)
bank_deposit
when 1
$game_system.se_play($data_system.decision_se)
bank_withdraw
end
return
end
end
def bank_deposit
@bank.active = false
@bank.visible = false
@withdraw = false
@banknum = Window_InputNumber.new(7)
@banknum.opacity = 255
@banknum.x = 320-@banknum.width/2
@banknum.y = 240-@banknum.height/2
@banknum.number = 0
@banknum.active = true
@banknum.visible = true
end
def bank_withdraw
@bank.active = false
@bank.visible = false
@withdraw = true
@banknum = Window_InputNumber.new(7)
@banknum.opacity = 255
@banknum.x = 320-@banknum.width/2
@banknum.y = 240-@banknum.height/2
@banknum.number = 0
@banknum.active = true
@banknum.visible = true
end
#-----------------------------------------------------------------
def update_back
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
acceptback
@back.index = -1
return
end
if Input.trigger?(Input::C)
case @back.index
when 0
$game_system.se_play($data_system.decision_se)
@backso = 0
acceptback
when 1
$game_system.se_play($data_system.decision_se)
@backso = 1
acceptback
when 2
$game_system.se_play($data_system.decision_se)
@backso = 2
acceptback
end
return
end
end
#-----------------------------------------------------------------
def acceptback
@back.active = false
@back.visible = false
@command.active = true
end
#-----------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item_Bank.new
when 1
$game_system.se_play($data_system.decision_se)
$scene = Scene_Mail.new
when 2
$game_system.se_play($data_system.decision_se)
@command.active=false
@g.visible=true
@bank.active=true
@bank.visible=true
return
when 3
$game_system.se_play($data_system.decision_se)
@command.active=false
@back.active=true
@back.visible=true
@back.index = 0
return
end
return
end
if Input.press?(Input::DOWN) or Input.press?(Input::RIGHT)
delay(2)
$game_system.se_play($data_system.cursor_se)
@command.setup_move(Computer::M_L)
delay(2)
return
end
if Input.press?(Input::UP) or Input.press?(Input::LEFT)
delay(2)
$game_system.se_play($data_system.cursor_se)
@command.setup_move(Computer::M_R)
delay(2)
return
end
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Computer < Window_Base
#-----------------------------------------------------------------
M_R=1
M_L=2
attr_accessor :index
#-----------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = $defaultfonttype
self.contents.font.color = text_color(0)
self.contents.font.size = 22
self.opacity = 0
s1 = "Item Storage"
s2 = "Mail"
s3 = "Bank"
s4 = "Theme"
@commands = [s1, s2, s3, s4]
@item_max = 4
@index = 0
ic_itm = RPG::Cache.icon("034-Item03")
ic_eml = RPG::Cache.icon("033-Item02")
ic_gld = RPG::Cache.icon("gold")
ic_bck = RPG::Cache.icon("backicon")
@items = [ic_itm, ic_eml, ic_gld, ic_bck]
@disabled = [false, false, false, false]
refresh
end
#-----------------------------------------------------------------
def update
super
refresh
end
#-----------------------------------------------------------------
def refresh
self.contents.clear
x=4
y=50
o=25
for i in 0...@item_max
ic_disable = RPG::Cache.icon("")
rect = Rect.new(0, 0, @items[i].width, @items[i].height)
if @index == i
self.contents.blt( x, y*i+1, @items[i], rect)
if @disabled[@index]
self.contents.blt( x, y*i+1, ic_disable, rect)
end
else
self.contents.blt( x, y*i+1, @items[i], rect, 128)
if @disabled[@index]
self.contents.blt(x, y*i+1, ic_disable, rect, 128)
end
end
end
self.contents.font.size = 18
self.contents.draw_text(4, o, 100, 24,"Item Storage")
self.contents.draw_text(4, o+y, 100, 24,"Mail")
self.contents.draw_text(4, o+y*2, 100, 24,"Bank")
self.contents.draw_text(4, o+y*3, 100, 24,"Theme")
end
#-----------------------------------------------------------------
def disable_item(index)
@disabled[index] = true
end
#-----------------------------------------------------------------
def setup_move(mode)
if mode == M_R
@index -= 1
@index = @items.size - 1 if @index < 0
elsif mode == M_L
@index += 1
@index = 0 if @index >= @items.size
else
return
end
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Gold < Window_Base
#-----------------------------------------------------------------
def initialize
super(0,0,160,156)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
def refresh
self.contents.clear
self.contents.draw_text(0,0,120,32,"You have:")
icon = RPG::Cache.icon("gold")
self.contents.draw_text (4,32,92,32,$game_party.gold.to_s,2)
self.contents.blt(103,37,icon,Rect.new(0,0,24,24))
self.contents.draw_text(0,64,128,32,"Bank contains:")
self.contents.draw_text (4,96,92,32,$bank.money.to_s,2)
self.contents.blt(103,101,icon,Rect.new(0,0,24,24))
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Playtime < Window_Base
#-----------------------------------------------------------------
def initialize
super(546,433,140,64)
self.contents = Bitmap.new(width-32,height-32)
self.opacity = 0
self.contents.font.name = $fontface
self.contents.font.size = 16
self.contents.font.color = Color.new(0, 0, 0)
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.draw_text(12, 0, 140, 32, text)
end
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Startname < Window_Base
#-----------------------------------------------------------------
def initialize
super(-12,432,112,64)
self.contents = Bitmap.new(width-32,height-32)
self.opacity = 0
self.contents.font.name = ["Franklin Gothic Medium", $defaultfonttype]
self.contents.font.size = 26
self.contents.font.bold = true
self.contents.font.italic = true
icon = RPG::Cache.icon("xp")
self.contents.blt(0,5,icon,Rect.new(0,0,24,24))
self.contents.font.color = Color.new(128, 128, 128, 160)
self.contents.draw_text(30,2,72,32,"start")
self.contents.font.color = normal_color
self.contents.draw_text(27,0,72,32,"start")
end
#-----------------------------------------------------------------
end |
Mis à jour le 11 juillet 2020.
|