#encoding:utf-8 #============================================================================== # ■ Window_MenuStatus #------------------------------------------------------------------------------ # 菜单画面中,显示队伍成员状态的窗口 #============================================================================== class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # ● 定义实例变量 #-------------------------------------------------------------------------- attr_reader :pending_index # 保留位置(整队用) #-------------------------------------------------------------------------- # ● 初始化对象 #-------------------------------------------------------------------------- def initialize(x, y) super(x-160, y+300, window_width, window_height) @pending_index = -1 refresh end #-------------------------------------------------------------------------- # ● 获取窗口的宽度 #-------------------------------------------------------------------------- def window_width Graphics.width end #-------------------------------------------------------------------------- # ● 获取窗口的高度 #-------------------------------------------------------------------------- def window_height Graphics.height - 300 end #-------------------------------------------------------------------------- # ● 获取列数 #-------------------------------------------------------------------------- def col_max return 4.2 end #-------------------------------------------------------------------------- # ● 获取项目数 #-------------------------------------------------------------------------- def item_max $game_party.members.size end #-------------------------------------------------------------------------- # ● 获取项目的高度 #-------------------------------------------------------------------------- def item_height (height - standard_padding * 2) / 4 end def draw_current_and_max_values(x, y, width, current, max, color1, color2) change_color(color1) xr = x + width if width < 96 draw_text(xr - 40, y, 42, line_height, current, 2) else draw_text(xr - 92, y, 42, line_height, current, 2) change_color(color2) draw_text(xr - 52, y, 12, line_height, "/", 2) draw_text(xr - 42, y, 42, line_height, max, 2) end end #-------------------------------------------------------------------------- # ● 绘制 HP #-------------------------------------------------------------------------- def draw_actor_hp(actor, x, y, width = 100) #draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2) change_color(normal_color) draw_text(x, y-2, 30, line_height, Vocab::hp_a) draw_current_and_max_values(x+15, y-2, width, actor.hp, actor.mhp, hp_color(actor), normal_color) draw_text(x, y-15, 30, line_height, "—") draw_text(x+20, y-15, 30, line_height, "—") draw_text(x+40, y-15, 30, line_height, "—") draw_text(x+60, y-15, 30, line_height, "—") draw_text(x+80, y-15, 30, line_height, "—") draw_text(x+100, y-15, 30, line_height, "—") end #-------------------------------------------------------------------------- # ● 绘制 MP #-------------------------------------------------------------------------- def draw_actor_mp(actor, x, y, width = 100) # draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2) change_color(normal_color) draw_text(x, y-2, 30, line_height, Vocab::mp_a) draw_current_and_max_values(x+15, y-2, width, actor.mp, actor.mmp, hp_color(actor), normal_color) end def draw_actor_simple_status(actor, x, y) contents.font.size = 20 draw_actor_name(actor, x, y-15) draw_actor_icons(actor, x, y + 50) draw_actor_level(actor, x+60, y+55) # draw_actor_class(actor, x, y) draw_actor_hp(actor, x, y + 10) draw_actor_mp(actor, x, y + 30) end #-------------------------------------------------------------------------- def draw_item(index) actor = $game_party.members[index] enabled = $game_party.battle_members.include?(actor) rect = item_rect(index) draw_item_background(index) # draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled) draw_actor_simple_status(actor, rect.x , rect.y + line_height / 2) end #-------------------------------------------------------------------------- # ● 绘制项目的背景 #-------------------------------------------------------------------------- def draw_item_background(index) if index == @pending_index contents.fill_rect(item_rect(index), pending_color) end end #-------------------------------------------------------------------------- # ● 按下确定键时的处理 #-------------------------------------------------------------------------- def process_ok super $game_party.menu_actor = $game_party.members[index] end #-------------------------------------------------------------------------- # ● 返回上一个选择的位置 #-------------------------------------------------------------------------- def select_last select($game_party.menu_actor.index || 0) end class Window_MenuStatus < Window_Selectable attr_accessor :on_formation #-------------------------------------------------------------------------- # ● 按下确定键时的处理 #-------------------------------------------------------------------------- alias t_151116_process_ok process_ok def process_ok #~ if @on_formation && self.index == 0 if @on_formation && actor_now.id == 1 Sound.play_buzzer return end t_151116_process_ok end def actor_now return $game_party.members[self.index] end end #-------------------------------------------------------------------------- # ● 设置保留位置(整队用) #-------------------------------------------------------------------------- def pending_index=(index) last_pending_index = @pending_index @pending_index = index redraw_item(@pending_index) redraw_item(last_pending_index) end end
QQ截图20241202225717.png (62.8 KB, 下载次数: 12)
#encoding:utf-8 #============================================================================== # ■ Window_MenuStatus #------------------------------------------------------------------------------ # 菜单画面中,显示队伍成员状态的窗口 #============================================================================== class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # ● 定义实例变量 #-------------------------------------------------------------------------- attr_reader :pending_index # 保留位置(整队用) #-------------------------------------------------------------------------- # ◆ 初始化对象 #-------------------------------------------------------------------------- def initialize(x, y) super(0, y+fitting_height(7), window_width, window_height) @pending_index = -1 refresh end #-------------------------------------------------------------------------- # ● 获取窗口的宽度 #-------------------------------------------------------------------------- def window_width Graphics.width end #-------------------------------------------------------------------------- # ◆ 获取窗口的高度 #-------------------------------------------------------------------------- def window_height return fitting_height(5) end #-------------------------------------------------------------------------- # ◆ 获取列间距的宽度 #-------------------------------------------------------------------------- def spacing return 10 end #-------------------------------------------------------------------------- # ◆获取列数 #-------------------------------------------------------------------------- def col_max return 4 end #-------------------------------------------------------------------------- # ● 获取项目数 #-------------------------------------------------------------------------- def item_max $game_party.members.size end #-------------------------------------------------------------------------- #◆ 获取项目的高度 #-------------------------------------------------------------------------- def item_height return line_height*5 end #-------------------------------------------------------------------------- #◆文字显示部分 #-------------------------------------------------------------------------- def draw_actor_simple_status(actor, x, y) contents.font.size = 20 draw_actor_name(actor, x, y) draw_actor_class(actor, x, y+line_height) draw_actor_level(actor, x+item_width/2, y+line_height) draw_actor_icons(actor, x, y +line_height*4) draw_actor_hp(actor, x, y +line_height*2,item_width) draw_actor_mp(actor, x, y +line_height*3,item_width) end #-------------------------------------------------------------------------- #◆ #-------------------------------------------------------------------------- def draw_item(index) actor = $game_party.members[index] enabled = $game_party.battle_members.include?(actor) rect = item_rect(index) draw_item_background(index) # draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled) draw_actor_simple_status(actor, rect.x , rect.y) end #-------------------------------------------------------------------------- # ● 绘制项目的背景 #-------------------------------------------------------------------------- def draw_item_background(index) if index == @pending_index contents.fill_rect(item_rect(index), pending_color) end end #-------------------------------------------------------------------------- # ● 按下确定键时的处理 #-------------------------------------------------------------------------- def process_ok super $game_party.menu_actor = $game_party.members[index] end #-------------------------------------------------------------------------- # ● 返回上一个选择的位置 #-------------------------------------------------------------------------- def select_last select($game_party.menu_actor.index || 0) end class Window_MenuStatus < Window_Selectable attr_accessor :on_formation #-------------------------------------------------------------------------- # ● 按下确定键时的处理 #-------------------------------------------------------------------------- alias t_151116_process_ok process_ok def process_ok #~ if @on_formation && self.index == 0 if @on_formation && actor_now.id == 1 Sound.play_buzzer return end t_151116_process_ok end def actor_now return $game_party.members[self.index] end end #-------------------------------------------------------------------------- # ● 设置保留位置(整队用) #-------------------------------------------------------------------------- def pending_index=(index) last_pending_index = @pending_index @pending_index = index redraw_item(@pending_index) redraw_item(last_pending_index) end end
345912390 发表于 2024-12-3 09:33
不知道你要什么样的效果。
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |