赞 | 1 |
VIP | 246 |
好人卡 | 87 |
积分 | 1 |
经验 | 34142 |
最后登录 | 2015-1-15 |
在线时间 | 323 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 55
- 在线时间
- 323 小时
- 注册时间
- 2010-8-21
- 帖子
- 666
|
再试试,可删除
健康游戏忠告
4个选项
作者
可搜索相应文字进行修改- #==============================================================================
- # ■ Scene_Title
- #------------------------------------------------------------------------------
- # 处理标题画面的类。
- #==============================================================================
- class Rect
- def include?(ary)
- return false if !ary.is_a?(Array) || ary.size != 2
- ary[0] >= self.x && ary[1] >= self.y && ary[0] < self.x + self.width &&
- ary[1] < self.y + self.height
- end
- end
- class Scene_Title
- TITLE_SIZE = 4
- TITLE_RECT = Rect.new(0,280, 292, 32)
- @@title_rect = []
- TITLE_SIZE.times{|i|@@title_rect << TITLE_RECT.dup;@@title_rect[-1].y += TITLE_RECT.height*i}
- def initialize(skip = false)
- @skip = skip
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 战斗测试的情况下
- if $BTEST
- battle_test
- return
- end
- # 载入数据库
- $data_actors = load_data("Data/Actors.rxdata")
- $data_classes = load_data("Data/Classes.rxdata")
- $data_skills = load_data("Data/Skills.rxdata")
- $data_items = load_data("Data/Items.rxdata")
- $data_weapons = load_data("Data/Weapons.rxdata")
- $data_armors = load_data("Data/Armors.rxdata")
- $data_enemies = load_data("Data/Enemies.rxdata")
- $data_troops = load_data("Data/Troops.rxdata")
- $data_states = load_data("Data/States.rxdata")
- $data_animations = load_data("Data/Animations.rxdata")
- $data_tilesets = load_data("Data/Tilesets.rxdata")
- $data_common_events = load_data("Data/CommonEvents.rxdata")
- $data_system = load_data("Data/System.rxdata")
- $data_mapnames = load_data("Data/MapInfos.rxdata")
- $game_system = Game_System.new
- @wait_count = 0
- @index = 0
- # 判定继续的有效性
- # 存档文件一个也不存在的时候也调查
- # 有効为 @continue_enabled 为 true、無効为 false
- @continue_enabled = false
- for i in 0..3
- if FileTest.exist?("Save#{i+1}.rxdata")
- @continue_enabled = true
- end
- end
- if @skip
- acting(4)
- else
- start
- end
- # 停止演奏 ME、BGS
- Audio.me_stop
- Audio.bgs_stop
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面被切换就中断循环
- if $scene != self
- break
- end
- end
- # 装备过渡
- Graphics.freeze
- 5.times do |i|@pic[i].bitmap.dispose; @pic[i].dispose end
- @chooser.dispose
- #@chooser.bitmap.dispose
- Quarcy::Cache.clear
- end
- #--------------------------------------------------------------------------
- # ● 刷新鼠标
- #--------------------------------------------------------------------------
- def update_mouse
- pos = Mouse.get_mouse_pos
- @@title_rect.each_with_index{|rect, index|return refresh_index(index)if rect.include?(pos)}
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标
- #--------------------------------------------------------------------------
- def refresh_index(index=@index)
- return if @index == index
- refresh_index!(index)
- $game_system.se_play($data_system.cursor_se)
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标!
- #--------------------------------------------------------------------------
- def refresh_index!(index)
- @index = index
- @chooser.y = @@title_rect[@index].y
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- @chooser.opacity = @pic[3].opacity if @pic.is_a?(Array)
- return @wait_count -= 1 if @wait_count > 0
- return if acting(@step)
- update_mouse
- return refresh_index((@index - 1)%TITLE_SIZE) if Input.repeat?(Input::UP) || Input.trigger?(Input::UP)
- return refresh_index((@index + 1)%TITLE_SIZE) if Input.repeat?(Input::DOWN) || Input.trigger?(Input::DOWN)
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 命令窗口的光标位置的分支
- case @index
- when 0 # 新游戏
- command_new_game
- when 1 # 继续
- command_continue
- when 2 # 制作人员
- $scene = Scene_Reference.new
- when 3 # 退出
- command_shutdown
- end
- end
- end
- #----------------------------------------------------------------------------
- def start
- @wait_count = 20
- @step = 1
- end
- def acting(step)
- case step
- when 8
- return false
- when 1
- @pic = Sprite.new
- @pic.bitmap = make_logo
- @pic.opacity = 0
- @duration = 20
- @step = 2
- return true
- when 2
- if @duration > 0
- d = @duration
- @pic.opacity = (@pic.opacity * (d - 1) + 255) / d
- @duration -= 1
- else
- @step = 3
- @wait_count = 60
- @duration = 20
- end
- return true
- when 3
- if @duration > 0
- d = @duration
- @pic.opacity = (@pic.opacity * (d - 1) + 0) / d
- @duration -= 1
- else
- @step = 4
- @wait_count = 25
- end
- return true
- when 4
- if @pic !=nil
- @pic.bitmap.dispose
- @pic.dispose
- end
- @wait_count = 20
- @duration = 60
- $game_system.bgm_play($data_system.title_bgm)
- @pic = []
- 5.times do @pic << Sprite.new end
- i = rand(3) + 1
- @pic[0].bitmap = loadbitmap("Graphics/Title/背景#{i}")
- @pic[1].bitmap = loadbitmap("Graphics/Title/LOGO")
- actor = %w[莉德露一 莉德露二 莉德露三][rand(3)]
- @pic[2].bitmap = loadbitmap("Graphics/Title/#{actor}")
- @pic[3].bitmap = make_title
- @chooser = Sprite.new
- @chooser.z = @pic[3].z + 10
- @chooser.bitmap = make_chooser
- @chooser.opacity = 0
- refresh_index!(@continue_enabled ? 1 : 0)
- @pic[3].x = -15
- @pic[3].y = 280
- @pic[4].bitmap = make_author#loadbitmap("Graphics/Title/66RPG")
- @pic[4].y = 460
- 5.times do |i|@pic[i].opacity = 0 end
- @step = 5
- return true
- when 5
- if @duration > 40
- d = @duration - 40
- @pic[0].opacity = (@pic[0].opacity * (d - 1) + 255) / d
- @pic[4].opacity = (@pic[3].opacity * (d - 1) + 255) / d
- @duration -= 1
- return true
- elsif @duration > 25
- d = @duration - 25
- @pic[1].opacity = (@pic[1].opacity * (d - 1) + 255) / d
- @pic[2].opacity = (@pic[2].opacity * (d - 1) + 255) / d
- @duration -= 1
- return true
- elsif @duration > 0
- d = @duration
- @pic[3].opacity = (@pic[3].opacity * (d - 1) + 255) / d
- @duration -= 1
- return true
- else
- @step = 8
- @wait_count = 3
- end
- return true
- when 6
- if @duration > 0
- d = @duration
- @pic[0].opacity = (@pic[0].opacity * (d - 1) + 0) / d
- @duration -= 1
- else
- @step = 7
- @duration = 20
- @pic[0].x = 0
- end
- return true
- when 7
- if @duration > 0
- d = @duration
- @pic[0].opacity = (@pic[0].opacity * (d - 1) + 255) / d
- @duration -= 1
- else
- @step = 8
- end
- else
- return true
- end
-
- end
- #--------------------------------------------------------------------------
- # ● 生成光标
- #--------------------------------------------------------------------------
- def make_chooser
- bmp = Bitmap.new(TITLE_RECT.width, TITLE_RECT.height)
- bmp.fill_rect(bmp.rect, Color.new(255, 248,168, 128))
- bmp.fill_rect(2,2,bmp.width-4,bmp.height-8,Color.new(251, 229,151, 128))
- 5.times{|i|bmp.fill_rect(0,bmp.height-i,bmp.width,1,Color.new(0, 0,0, 16*(i+1)))}
- 4.times{|i|bmp.fill_rect(bmp.width-i,0,1,bmp.height,Color.new(0, 0,0, 16*(i+1)))}
- bmp
- end
- #--------------------------------------------------------------------------
- # ● 載入圖片并放置于緩存區
- #--------------------------------------------------------------------------
- def loadbitmap(path)
- return Quarcy::Cache.loadbitmap(path)
- end
- #--------------------------------------------------------------------------
- # ● 生成标题cmd
- #--------------------------------------------------------------------------
- def make_title
- text = ["新的开始", "继续旅程", "制作名单", "离开游戏"]
- bmp = Bitmap.new(TITLE_RECT.width, TITLE_RECT.height * TITLE_SIZE)
- bmp.font.name = ["方正粗活意简体", "楷体"]
- tx = 64
- text.each_with_index{|s,i|
- tmp_x = tx + i * 32
- s.split(//).each{|char|
- bmp.font.size = 32
- bmp.font.color = Color.new(0,0,0,100)
- bmp.font.bold = true
- t_r = bmp.text_size(char)
- bmp.draw_text(tmp_x+2,TITLE_RECT.height*i+3,t_r.width,t_r.height,char,1)
- bmp.font.color = Color.new(255,255,255)
- bmp.draw_text(tmp_x,TITLE_RECT.height*i,t_r.width,t_r.height,char,1)
- bmp.font.size = 28
- bmp.font.color = Color.new(0,0,0)
- bmp.font.bold = false
- t2_r = bmp.text_size(char)
- t2_r.x += tmp_x + (t_r.width-t2_r.width)/2
- t2_r.y += TITLE_RECT.height*i + (t_r.height-t2_r.height)/2
- bmp.draw_text(t2_r,char,1)
- tmp_x += t_r.width
- }
- }
- bmp.font.color = Color.new(0,0,0,128)
- bmp
- end
- #--------------------------------------------------------------------------
- # ● 生成作者
- #--------------------------------------------------------------------------
- def make_author
- bmp = Bitmap.new(22*7, 32)
- bmp.font.name = "宋体"
- bmp.draw_text(bmp.rect, "作者: 美丽晨露", 1)
- bmp
- end
- #--------------------------------------------------------------------------
- # ● 生成logo
- #--------------------------------------------------------------------------
- def make_logo
- bmp = Bitmap.new(640, 480)
- bmp.font.size = 26
- bmp.draw_text(0,96,640,32, "健康游戏公告", 1)
- con = ["抵制不良游戏,拒绝盗版游戏。", "注意自我保护,谨防受骗上当。",
- "适度游戏益脑,沉迷游戏伤身。", "合理安排时间,享受健康生活。"]
- bmp.font.size = 22
- con.each_with_index{|s,i| bmp.draw_text(0,166+i*38,640,32, s, 1)}
- bmp
- end
- end
- class Scene_Reference
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- bg_sprite = Sprite.new()
- bg_sprite.bitmap = Quarcy::Cache.loadbitmap("Graphics/Pictures/制作人员")
- # 执行过渡
- Graphics.transition(20, "Graphics/Transitions/标题过度.png")
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- if Input.trigger?(Input::C) or Input.trigger?(Input::B)
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Title.new(true)
- end
- # 如果画面被切换就中断循环
- if $scene != self
- break
- end
- end
- bg_sprite.dispose()
- # 准备过渡
- Graphics.freeze
- Quarcy::Cache.clear
- end
- end
复制代码 |
评分
-
查看全部评分
|