赞 | 7 |
VIP | 358 |
好人卡 | 31 |
积分 | 30 |
经验 | 110750 |
最后登录 | 2023-1-30 |
在线时间 | 3547 小时 |
Lv3.寻梦者 伴侣:北岛谜烟
- 梦石
- 0
- 星屑
- 3042
- 在线时间
- 3547 小时
- 注册时间
- 2012-8-7
- 帖子
- 12181
|
本帖最后由 delv25 于 2012-8-28 15:16 编辑
CG鉴赏菜单-脚本1- #==============================================================================
- # ** Scene_CG
- #------------------------------------------------------------------------------
- # 这个类用来执行CG鉴赏的程式。
- #==============================================================================
- class Scene_CG < Scene_Base
- #--------------------------------------------------------------------------
- # * 对象初始化
- # card_num : 命令光标的起始位置
- # @cg_num :各项目的图片数
- # @hang_shu :行数
- # @lie_shu :列数(每行的图片数)
- #--------------------------------------------------------------------------
- def initialize(card_num)
- @card_num = card_num
- @pic = []
- @switch_pic = true
- @hang_shu = 2
- @lie_shu = 4
- @cg_num = [8, 8, 8]
- $temp_height = 0
- end
- #--------------------------------------------------------------------------
- # * 程式开始
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- refresh
- end
- #--------------------------------------------------------------------------
- # * 程式终止
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @command_window.dispose
- for i in 0...@hang_shu
- for j in 0...@lie_shu
- break if (@lie_shu * i + j) >= @cg_num[@card_num]
- @pic[@lie_shu * i + j].dispose
- end
- end
- end
- #--------------------------------------------------------------------------
- # * 返回之前的画面
- #--------------------------------------------------------------------------
- def return_scene
- $scene = Scene_Read_CG.new(@card_num)
- end
- #--------------------------------------------------------------------------
- # * 更新内容显示
- #--------------------------------------------------------------------------
- def refresh
- #-------------------------窗口初始化--------------------------
- @command_window = Window_CG.new(576,["", "", "", "", "", "", "", ""],@lie_shu,0,0)
- @command_window.x = -16
- @command_window.y = -16
- @command_window.height = 448
- @command_window.opacity = 0
- @command_window.index = 0
- #----------------------显示图片初始化-------------------------
- @picture = Sprite.new
- @picture.z = 500
- for i in 0...@hang_shu
- for j in 0...@lie_shu
- break if (@lie_shu * i + j) >= @cg_num[@card_num]
- @pic[@lie_shu * i + j] = Sprite.new
- @pic[@lie_shu * i + j].bitmap = Cache.load_bitmap("Graphics/Pictures/", "CG_#{@card_num}_#{@lie_shu * i + j}")
- @pic[@lie_shu * i + j].x = 544 / @lie_shu * j
- @pic[@lie_shu * i + j].y = 416 / @hang_shu * i
- @pic[@lie_shu * i + j].zoom_x = 0.3
- @pic[@lie_shu * i + j].zoom_y = 0.3
- end
- end
- $temp_height = @pic[@command_window.index].bitmap.height * 0.3
- end
- #--------------------------------------------------------------------------
- # * 更新帧
- #--------------------------------------------------------------------------
- def update
- super
- @command_window.update
- #----------------图片移动判定---------------------------------
- if Input.dir4 != 0
- $temp_height = @pic[@command_window.index].bitmap.height * 0.3
- if @switch_pic == false
- step_y = [0, 1, 2, 1, 0, 0, 0, -1 ,-2, -1]#移动阵列
- step_x = [0, -1, 0, 1, -2, 0, 2, -1, 0, 1]
- @picture.x += step_x[Input.dir8]
- @picture.y += step_y[Input.dir8]
- end
- #-----------------退出判定---------------------------------------
- elsif Input.trigger?(Input::B)
- if @switch_pic
- return_scene
- else
- dis_pic
- end
- #-------------------选中判定--------------------------
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- if @switch_pic
- @command_window.active = false
- @switch_pic = false
- @picture.bitmap = Bitmap.new("Graphics/Pictures/CG_#{@card_num}_#{@command_window.index}")
- @picture.x = 0
- @picture.y = 0
- @picture.zoom_x =0.7
- @picture.zoom_y =0.7
- else
- dis_pic
- end
- #-------------------缩放判定------------------------
- elsif Input.trigger?(Input::L)#每次缩放 变动 0.1
- @picture.zoom_x +=0.1
- @picture.zoom_y +=0.1
- elsif Input.trigger?(Input::R)
- @picture.zoom_x -=0.1
- @picture.zoom_y -=0.1
- end
- end
- #----------------------关闭图片方法----------------------
- def dis_pic
- @picture.bitmap.dispose
- @switch_pic = true
- @command_window.active = true
- end
- end
- #==============================================================================
- # ** Window_CG
- #------------------------------------------------------------------------------
- # 为修改光标高度而定义
- #==============================================================================
- class Window_CG < Window_Command
-
- def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
- super(width, commands, column_max, row_max, spacing)
- end
- #--------------------------------------------------------------------------
- # * 更新光标绘制
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = Rect.new(0, 0, 0, 0)
- rect.width = (contents.width + @spacing) / @column_max - @spacing
- rect.height = $temp_height #######
- rect.x = index % @column_max * (rect.width + @spacing)
- rect.y = index / @column_max * 416 / 2 #除行数
- return rect
- end
- end
复制代码 脚本2- #==============================================================================
- # ** Scene_Read_CG
- #------------------------------------------------------------------------------
- # 这个类用来执行CG鉴赏的人物选择程式。
- #==============================================================================
- class Scene_Read_CG < Scene_Base
- #--------------------------------------------------------------------------
- # * 对象初始化
- # menu_index : 命令光标的起始位置["灵梦", "蕾米", "阿求"] #项目名
- #--------------------------------------------------------------------------
- def initialize(menu_index = 1)
- @menu_index = menu_index
- @card_size = 3 #项目数
- @card_name = ["情侣头像_女", "版本号1.0.0", "情侣头像_男"] #项目名
- @card = []
- @gow_x = []
- @ji_shu_qi = 0
- @fu_hao = 1
- @temp_y = 0
- end
- #--------------------------------------------------------------------------
- # * 程式开始
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- refresh
- end
- #--------------------------------------------------------------------------
- # * 程式终止
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @command_window.dispose
- @name_window.dispose
- for i in 0...@card_size
- @card[i].dispose
- end
- end
- #--------------------------------------------------------------------------
- # * 返回之前的画面
- #--------------------------------------------------------------------------
- def return_scene
- $scene = Scene_Title.new
- end
- #--------------------------------------------------------------------------
- # * 更新内容显示
- #--------------------------------------------------------------------------
- def refresh
- #-------------------窗口初始化------------------------------------
- @name_window = Window_Base.new(0, 0, 544, 416)
- @name_window.opacity = 0
- @command_window = Window_Command.new(544, @card_name, @card_size)
- @command_window.x = 0
- @command_window.y = 350
- @command_window.opacity = 0
- @command_window.contents_opacity = 0
- @command_window.index = @menu_index
- #-------------------图片初始化---------------------------------------
- for i in 0...@card_size
- @card[i] = Sprite.new
- @card[i].bitmap = Bitmap.new("Graphics/Pictures/card#{i}")#读取对应项目图片
- @card[i].ox = @card[i].bitmap.width / 2
- @card[i].oy = @card[i].bitmap.height / 2
- @gow_x[i]=544 / @card_size /2 * (2 * i + 1) #分配x
- @card[i].x = @gow_x[i]
- @card[i].y = 250
- @card[i].z = 100
- @card[i].zoom_x = 0.5
- @card[i].zoom_y = 0.5
- end
- #--------------------描绘选中项目名------------------------------
- @name_window.contents.draw_text(0, 270, 500, 50, @card_name[@command_window.index],1)
- end
- #--------------------------------------------------------------------------
- # * 更新帧
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @name_window.update
- @command_window.update
- #----------------描绘动态图片效果--------------------------------
- @ji_shu_qi = @ji_shu_qi % 100 + 1
- if(@ji_shu_qi <= 49)
- @ji_shu_qi % 3 == 0 ? @fu_hao = 1 : @fu_hao = 0
- elsif(@ji_shu_qi > 53)
- @ji_shu_qi % 3 == 0 ? @fu_hao = -1 : @fu_hao = 0
- end
- for i in 0...@card_size
- pian_yi = (@card_size - @command_window.index + i +1) % @card_size #计算偏移量
- if(i == @command_window.index)
- @card[i].x = @gow_x[pian_yi]
- @temp_y += @fu_hao
- @card[i].y = 150 + @temp_y
- @card[i].zoom_x = 1
- @card[i].zoom_y = 1
- else
- @card[i].x = @gow_x[pian_yi]
- @card[i].y = 250
- @card[i].zoom_x = 0.5
- @card[i].zoom_y = 0.5
- end
- end
- #-----------------------update选中项目名------------------------
- if Input.dir4 != 0
- @name_window.contents.clear
- @name_window.contents.draw_text(222, 270, 544, 50, @card_name[@command_window.index])
- end
- #----------------------按键判定---------------------------
- if Input.trigger?(Input::B)
- return_scene
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- $scene = Scene_CG.new(@command_window.index)
- end
- end
- end
复制代码 标题界面的改造- #==========================================================
- #用语重定义 无关紧要
- #==========================================================
- module Vocab
- # 新的剧情
- def self.new_game
- return "新的旅程"#$data_system.terms.new_game
- end
- # 读取存档
- def self.continue
- return '旧的回忆'#$data_system.terms.continue
- end
- # 退出游戏
- def self.shutdown
- return "退出游戏"#$data_system.terms.shutdown
- end
- end
- #========================================================
- #增加选单
- #========================================================
- class Scene_Title < Scene_Base
- def create_command_window
- s1 = Vocab::new_game
- s2 = Vocab::continue
- s4 = Vocab::shutdown
- @command_window = Window_Command.new(172, [s1, s2, "CG鉴赏", s4])
- @command_window.x = (544 - @command_window.width) / 2
- @command_window.y = 288
- if @continue_enabled # 如果[读取存档]可用
- @command_window.index = 1 # 移动光标至该命令项目上
- else # 如果[读取存档]不可用
- @command_window.draw_item(1, false) # 半透明显示该命令项目
- end
- @command_window.openness = 0
- @command_window.open
- end
- def update
- super
- @command_window.update
- if Input.trigger?(Input::C)
- case @command_window.index
- when 0 #新的旅程≈
- command_new_game
- when 1 # 读取存档
- command_continue
- when 2 #人物鉴赏≈
- command_Read_CG
- when 3 #退出游戏≈
- command_shutdown
- end
- end
- end
- # ------------定义方法----------------
- def command_Read_CG
- Sound.play_decision
- close_command_window
- $scene = Scene_Read_CG.new
- end
- end
复制代码 在\Graphics\Pictures。加入鉴赏图片总概括图(文件名)card 0\1\2 三张
然后确定后会显示八张鉴赏图片-这里需要添加CG_0_0~7 CG_1_0~7 CG_2_0~7
的文件名图片。card0对应的是CG_0_0到7的图片,其余一样。
还有别大神大神的叫= =,怪怪的……
在Main前植入这三个脚本开始游戏时就可以发现新的标题选项了,别忘了添加card0到2和CG_0(到2)_0(到7)
就是这样。喵。
附加效果图:
|
|