| 赞 | 46 |
| VIP | |
| 好人卡 | |
| 积分 | 97 |
| 经验 | |
| 最后登录 | 2026-10-27 |
| 在线时间 | 2775 小时 |
梦石0
星屑9726
在线时间2775 小时
注册时间2008-9-5
回帖3458
   
|
发表于 2022-9-30 22:02:26
|
显示全部楼层
稍微弄了一下,应该勉强能行(……?)
首先是更改了人名列表的设置样式:
【资料ID => ["人名", 对应的进度变量ID]】
其中【资料ID】需要保证一人一个ID,它将影响获取人物的各项对应资料以及在左边人名窗口中的上下排序位置。
【人名】就是显示在左边窗口的选项名字,
【对应的进度变量ID】就是影响解锁内容的变量ID,该变量为0时则对应的人物不会出现在人名列表中。
顺便就是我稍微更改了一下【rwxx_detal】方法的内容,让它自动兼容上述的【对应的进度变量ID】,而不需要在这里给每个角色都手动填一个变量ID。
然后是人物图像,我设定成图像使用【RWSC_ + 人物名字】作为图片命名,比如【RWSC_小明.png】,它会在人物解锁之后自动显示在右侧资料窗的右上角。
代码如下- module RWSC
- # 这里设定人物名称
- CharaList = {
- # 格式参考:
- # 资料ID => ["人名", 对应的进度变量ID]
- 1 => ["小明", 1],
- 2 => ["小红", 2],
- 3 => ["小黄", 3],
- 4 => ["大狗", 4],
- } # CharaList
-
- end
-
- class Window_rwxx < Window_Base
- #----------------------------------------------------------------------------
- # * 初始化
- #----------------------------------------------------------------------------
- def initialize
- super(120, 0, Graphics.width - 120, Graphics.height)
- deactivate
- end
- #----------------------------------------------------------------------------
- # * 更新内容
- #----------------------------------------------------------------------------
- def refresh(chara_data = nil)
- contents.clear
- return unless chara_data
- # 获取人物数据ID
- chara_data_id = chara_data[0]
- # 绘制人物图像(右上角)
- draw_char_image(chara_data_id)
- # 显示人物资料
- rwxx_list = rwxx_detal(chara_data_id)
- rwxx_list.each_with_index do |text, i|
- cx = 0
- cy = line_height * i
- draw_text(cx, cy, contents.width, line_height, text, 0)
- end
- end
- #------------------------------------------
- # ○ 在窗口右上角绘制人物图像
- #------------------------------------------
- def draw_char_image(chara_data_id)
- chara_name = RWSC::CharaList[chara_data_id][0]
- filename = "RWSC_" + chara_name
- bitmap = (Cache.picture(filename) rescue nil)
- return unless bitmap
- cx = contents.width - bitmap.width
- contents.blt(cx, 0, bitmap, bitmap.rect)
- end
- #------------------------------------------
- # ○ 设置词条明细内容
- #------------------------------------------
- def rwxx_detal(chara_data_id)
- # 根据人物资料ID获取对应的变量ID
- chara_var_id = RWSC::CharaList[chara_data_id][1]
-
- list = []
- case chara_data_id
- when 1
- # 明细1--------------------------------------
- if $game_variables[chara_var_id] < 30
- list.push(" --未解锁---")
- else
- list.push("手段sad发送到方式打发沙发上打发斯蒂阿斯顿发送")
- list.push("芬阿斯蒂芬sad发送到发达发达但是发多少")
- end
- list.push(" ")
- if $game_variables[chara_var_id] < 80
- list.push(" --未解锁---")
- else
- list.push("士大夫十大发收到")
- end
- when 2
- list.push("123123123")
- when 3
- list.push("123123123123")
- when 4
- list.push("123123123")
- #...以此格式往下添加
- end # 明细设定结束
- return list
- end
- end
-
-
-
- class Window_Rwmcleft < Window_Selectable
- # 设定公开变量
- attr_accessor :old_index
- # 初始化
- def initialize
- make_list_data
- super(0, 0, 120, Graphics.height)#Graphics.width, 48)
- refresh
- self.activate.select(0)
- end
- # 高度
- def window_height
- fitting_height(visible_line_number)#return 48#
- end
- # 最大项目数
- def item_max
- command_list.size#return 8#
- end
- # 可见列数
- def visible_line_number
- command_list.size#return 8#
- end
- #------------------------------------------
- # ○ 生成已解锁的人物资料列表 [资料ID,人名]
- #------------------------------------------
- def make_list_data
- @data = []
- for id in 1..RWSC::CharaList.size
- data = RWSC::CharaList[id]
- if data[1].nil? or data[1] <= 0
- @data.push([id, data[0]])
- else
- if $game_variables[data[1]] > 0
- @data.push([id, data[0]])
- end
- end
- end
- end
- #------------------------------------------
- # ○ 获取指定index位置的项目数据
- #------------------------------------------
- def item(index = self.index)
- return (@data ? @data[index] : nil)
- end
-
- #------------------------------------------
- # ○ 获取选项列表(从资料表中提取人名)
- #------------------------------------------
- def command_list
- list = @data.collect{|data| data[1]}
- return list
- end
- # 绘制项目
- def draw_item(index)
- rect = item_rect_for_text(index)
- draw_text(rect, command_list[index])
- end
- end
-
-
-
-
-
- class Rwsc < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ● 场景开始
- #--------------------------------------------------------------------------
- def start
- super
- create_list_window
- create_right_window
- end
- #--------------------------------------------------------------------------
- # ● 创建列表
- #--------------------------------------------------------------------------
- def create_list_window
- @list_window = Window_Rwmcleft.new
- @list_window.set_handler(:cancel, method(:return_scene))
- end
- #--------------------------------------------------------------------------
- # ● 创建内容窗口
- #--------------------------------------------------------------------------
- def create_right_window
- @right_window = Window_rwxx.new
- end
- # 更新所有窗口
- def update_all_windows
- super
- update_left_right
- end
- # 更新左右窗口关联
- def update_left_right
- return unless @list_window.old_index != @list_window.index
- @list_window.old_index = @list_window.index
- @right_window.refresh(@list_window.item)
- end
- end
复制代码 |
评分
-
查看全部评分
|