Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #####頻出動作を管理するクラスソースファイル#####
- ##キャラ立ち絵描写用クラス##
- class Class_chara
- def initialize
- @body , @face= [],[]
- @body << @sample_body1 = Image.load('sample_pass/body_sample1.png')
- @body << @sample_body2 = Image.load('sample_pass/body_sample2.png')
- @body << @sample_body3 = Image.load('sample_pass/body_sample3.png')
- @face << @sample_face1 = Image.load('sample_pass/face_sample1.png')
- @face << @sample_face2 = Image.load('sample_pass/face_sample2.png')
- @face << @sample_face3 = Image.load('sample_pass/face_sample3.png')
- end
- def draw(x,y,body,face,calp,centeredx,centeredy)
- body = @body.length + body if body < 0
- face = @face.length + face if face < 0
- calp = 255 if alp > 255
- calp = 0 if alp < 0
- x += @body[body].width / 2 if centeredx == true
- y += @body[body].width / 2 if centeredy == true
- Window.draw_ex(x,y,@face[body],:alpha=>calp)
- Window.draw_ex(x,y,@face[face],:alpha=>calp)
- end
- end
- ##背景、オブジェクト画像描写用クラス##
- class Class_image
- def initialize
- @background , @object = [] , []
- @background << @sample_background1 = Image.load('sample_pass/background_sample1.png')
- @background << @sample_background2 = Image.load('sample_pass/background_sample2.png')
- @background << @sample_background3 = Image.load('sample_pass/background_sample3.png')
- @object << @sample_object = Image.load('sample_pass/object_sample1.png')
- @object << @sample_object = Image.load('sample_pass/object_sample2.png')
- @object << @sample_object = Image.load('sample_pass/object_sample3.png')
- end
- def draw_background(background)
- Window.draw_ex(0,0, @background[background])
- end
- def draw_object(x,y,object,falp)
- Window.draw_ex(x,y,@objects[object],:alpha=>falp)}
- end
- end
- ##文章、ボタン描写用クラス##
- class Class_sentence
- def initialize
- end
- def draw_sentence(x,y,sentence,font_size,font_type,effect,color_ary,edge_color_ary)
- b_bold,b_itaric,b_edge = false,false,false
- b_bold = true if effect.include("b")
- b_itaric = true if effect.include("i")
- b_edge = true if effect.include("e")
- hashs = {color:color_ary,bold:b_bold,itaric:b_itaric,edge:b_edge,edge_color:edge_color_ary}
- Window.draw_font(x,y,sentence,Font.new(font_size,font_type),hash=hashs)
- end
- def draw_button(x,y,sentence,font_size,font_type)
- button_size = [x..x + font.getWidth(sentence) , y..y + font.size]
- if button_size[0].include?($xpoint) && button_size[1].include?($ypoint)
- color_ary , pushed = [255,122,122] , true
- else
- color_ary , pushed = [0,0,0] , false
- end
- hashs = {color: [255,255,255] ,edge: true , edge_color: color_ary}
- Window.draw_font_ex(x,y, sentence ,Font.new(font_size,font_type), hash=hashs)
- if pushed == true
- return true
- else
- return false
- end
- end
- end
- ##サウンド処理クラス##
- class Class_sound
- def initialize
- @music , @sound = [] , []
- @music << @sample_music1 = Ayame.new('sample_pass/music_sample1.png')
- @music << @sample_music2 = Ayame.new('sample_pass/music_sample2.png')
- @music << @sample_music3 = Ayame.new('sample_pass/music_sample3.png')
- @sound << @sample_sound1 = Sound.new('sample_pass/sound_sample1.png')
- @sound << @sample_sound2 = Sound.new('sample_pass/sound_sample2.png')
- @sound << @sample_sound3 = Sound.new('sample_pass/sound_sample3.png')
- end
- def music_play(music,vol)
- music = @music.length + music if music < 0
- @music[music].play(0,0)
- @music[music].set_volume(vol,0)
- end
- def music_stop(music)
- music = @music.length + music if music < 0
- @music[music].stop(0)
- end
- def music_pause(music)
- @music[music].pause
- end
- def music_resume(music)
- @music[music].resume
- end
- def music_onoff(music,vol)
- music = @music.length + music if music < 0
- if @music[music].finished?
- @music[music].play(0,0)
- @music[music].set_volume(vol,0)
- else
- @music[music].stop(0)
- end
- end
- def music_change(newmusic,vol)
- newmusic = @music.length + newmusic if newmusic < 0]
- t = @music.length
- num.times do |t|
- unless t == newmusic
- @music[t].stop(0)
- else
- @music[newmusic].play(0,0) if @music[newmusic].finished?
- @music[newmusic].set_volume(vol,0)
- end
- end
- def silent
- t = @music.length
- num.times{|t| @music[t].stop(0)}
- end
- def sound(sound)
- @sound[sound].play
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement