Files
LonaRPG-Online-Games/Data/Scripts/Frames/173_menu_01mainstats.rb
T

213 lines
8.9 KiB
Ruby
Raw Normal View History

2026-10-29 21:59:06 +04:00
#==============================================================================
# This script has been altered by Kslander for the need of LonaRPG
#==============================================================================
# Menu MainStats
#==============================================================================
# ** Menu_MainStats
#==============================================================================
class Menu_MainStats < Menu_ContentBase
# 原設計基準(640x360)
ORIGINAL_WIDTH = 640
ORIGINAL_HEIGHT = 360
def initialize
super()
# 不再用Cache圖片,直接用Bitmap畫
@main_stats_layout = Sprite.new(@viewport)
@main_stats_layout.bitmap = Bitmap.new(Graphics.width, Graphics.height)
@main_stats_layout.z = 1
@main_stats_layout.y = -17
draw_layout_blocks
@info = Sprite.new(@viewport)
@info.bitmap = Bitmap.new(Graphics.width, Graphics.height)
@info.z = 2
@info.y = -17
refresh
hide
end
# 畫兩個黑塊
def draw_layout_blocks
bmp = @main_stats_layout.bitmap
bmp.clear
# 右側起始x(原設計157)
#start_x = 157
start_x = @menu.bounding_rect.x + @menu.bounding_rect.width + 2 #157
# 右邊留38px
block_width = Graphics.width - start_x - 38
# 上下各留24px
top_margin = 24
bottom_margin = 24
# 上方黑塊固定高度(從原圖+文字位置估計,約85px,包含名字區)
top_block_height = 70
# 間隙(兩個黑塊之間的縫隙,從原圖看約5-10px)
top_down_gap = 8
# 半透明黑塊顏色(原圖大概alpha 180左右,邊框白線可選加)
block_color = Color.new(0, 0, 0, 180)
broder_color = Color.new(0, 0, 0, 100) # 邊框,模仿你編輯的圖
# 上方黑塊(固定高度,從y=24開始)
top_y = top_margin
top_h = top_block_height
bmp.fill_rect(start_x, top_y, block_width, top_h, block_color)
# 下方黑塊(從上方結束 + GAP開始,到底 - 24px)
bottom_y = top_y + top_h + top_down_gap
bottom_h = Graphics.height - bottom_y - bottom_margin
bmp.fill_rect(start_x, bottom_y, block_width, bottom_h, block_color)
# === 加邊框(1px細線)===
line_color = broder_color
line_thick = 1
# 上方黑塊邊框
bmp.fill_rect(start_x, top_y, block_width, line_thick, line_color) # 上
bmp.fill_rect(start_x, top_y + top_h - line_thick, block_width, line_thick, line_color) # 下
bmp.fill_rect(start_x, top_y, line_thick, top_h, line_color) # 左
bmp.fill_rect(start_x + block_width - line_thick, top_y, line_thick, top_h, line_color) # 右
# 下方黑塊邊框
bmp.fill_rect(start_x, bottom_y, block_width, line_thick, line_color) # 上
bmp.fill_rect(start_x, bottom_y + bottom_h - line_thick, block_width, line_thick, line_color) # 下
bmp.fill_rect(start_x, bottom_y, line_thick, bottom_h, line_color) # 左
bmp.fill_rect(start_x + block_width - line_thick, bottom_y, line_thick, bottom_h, line_color) # 右
# ================================
end
def refresh
base_x = 175
base_y = 115
dy = 14
bmp = @info.bitmap
bmp.clear #避免重複繪製,與記憶體crash無關。
bmp.font.outline = false
bmp.font.size = 54
bmp.font.color=Color.new(255,255,255,255)
bmp.draw_text(157+5,18 ,160,60,$game_text["menu:main_stats/name"],0)
bmp.font.size = 24
bmp.draw_text(157+8,47,300,60,$game_text["DataTitle:#{$game_player.actor.record_lona_title}"],0)
bmp.font.color=Color.new(0,255,0,255)
bmp.font.size = 15
bmp.font.outline = false
bmp.font.color=Color.new(20,255,20,255)
draw_hash = make_menu_hash
draw_hash.each{|stat,args|;bmp.draw_text(*args) if args != nil}
end
def make_menu_hash
draw_hash = {
"race" => [157+8,0+85 ,160,60, "#{$game_text["menu:main_stats/race"]} : #{GetText.lona_race}",0],
"persona" => [157+8,24+85 ,160,60, "#{$game_text["menu:main_stats/persona"]} : #{GetText.lona_persona}",0],
"level" => [157+8,36+85 ,160,60, "#{$game_text["menu:main_stats/level"]} : #{$game_player.actor.level}",0],
#set2 combat
"atk" => [157+8,72+85 ,160,60, "#{$game_text["menu:main_stats/atk"]}: #{$game_player.actor.atk.round(2)}",0],
"def" => [157+8,84+85 ,160,60, "#{$game_text["menu:main_stats/def"]} : #{$game_player.actor.def.round(2)}",0],
"Dodge" => [157+8,96+85 ,160,60, "#{$game_text["DataSkill:BasicDodge/item_name"]} : #{$game_player.actor.dodge_frame}",0],
"move_speed" => [157+8,108+85 ,160,60, "#{$game_text["menu:main_stats/move_speed"]} : #{$game_player.actor.move_speed.round(2)}",0],
#set3 needed
"mood" => [157+8,0+221 ,160,60, "#{$game_text["menu:main_stats/mood"]} : #{$game_player.actor.mood.round(2)}",0],
"dirt" => [157+8,12+221 ,160,60, "#{$game_text["menu:main_stats/dirt"]} : #{$game_player.actor.dirt.round(2)}",0],
"arousal" => [157+8,24+221 ,160,60, "#{$game_text["menu:main_stats/arousal"]} : #{$game_player.actor.arousal.round(2)}",0],
#set4 other
"date" => [157+130,0+85 ,160,60, "#{$game_text["menu:main_stats/date"]} : #{$game_date.date[0]}.#{$game_date.date[1]}.#{$game_date.date[2]}.#{GetText.time}",0],
#bmp.draw_text(157+130,24+85 ,160,60, "#{$game_text["menu:main_stats/carrying_capacity"]} : #{$game_player.actor.weight_carried} :#{(2*$game_player.actor.attr_dimensions["sta"][2]).round(2)} ",0)
"trade_point" => [157+130,12+85 ,160,60, "#{$game_text["menu:main_stats/trade_point"]} : #{$game_party.gold}",0],
#set4 looking
"morality" => [157+130,72+85 ,160,60, "#{$game_text["menu:main_stats/morality"]} : #{$game_player.actor.morality.round(2)}",0],
"sexy" => [157+130,84+85 ,160,60, "#{$game_text["menu:main_stats/sexy"]} : #{$game_player.actor.sexy.round(2)}",0],
"weak" => [157+130,96+85 ,160,60, "#{$game_text["menu:main_stats/weak"]} : #{$game_player.actor.weak.round(2)}",0]
}
draw_hash["exp_need"] = [157+8,48+85 ,160,60, "#{$game_text["menu:main_stats/exp_need"]} : #{$game_player.actor.exp - $game_player.actor.exp_for_level($game_player.actor.level)} : #{$game_player.actor.exp_for_level($game_player.actor.level + 1) - $game_player.actor.exp_for_level($game_player.actor.level)}",0] if $game_player.actor.level !=99
#draw_hash["baby_health"] = [157+130,24+85 ,160,60, "#{$game_text["menu:main_stats/baby_health"]} : #{$game_player.actor.baby_health.round(1)}/#{$game_player.actor.attr_dimensions['baby_health'][2]}",0] if $game_player.actor.stat["displayBabyHealth"] == 1 || $TEST
draw_hash["baby_health"] = [157+130,24+85 ,160,60, "#{$game_text["menu:main_stats/baby_health"]} : #{$game_player.actor.baby_health.round(1)}",0] if $game_player.actor.stat["displayBabyHealth"] == 1 || $TEST
draw_hash["micturition_need"] = [157+8,36+221 ,160,60, "#{$game_text["menu:main_stats/micturition_need"]} : #{$game_player.actor.urinary_level}",0] if $TEST || ($game_player.actor.urinary_level >0 && $game_player.actor.allow_pee_function?)
draw_hash["breast_swelling"] = [157+8,48+221 ,160,60, "#{$game_text["menu:main_stats/breast_swelling"]} : #{$game_player.actor.lactation_level.round(1)}",0] if $TEST || ($game_player.actor.lactation_level >0)
draw_hash["stomach_upset"] = [157+8,60+221 ,160,60, "#{$game_text["menu:main_stats/stomach_upset"]} : #{$game_player.actor.puke_value_normal.round(1)}",0] if $TEST || ($game_player.actor.puke_value_normal >0)
draw_hash["defecation_need"] = [157+8,72+221 ,160,60, "#{$game_text["menu:main_stats/defecation_need"]} : #{$game_player.actor.defecate_level.round(1)}",0] if $TEST || ($game_player.actor.defecate_level >0 && $game_player.actor.allow_poo_function?)
return draw_hash
end
#def show
# super
# $game_player.actor.stat["EventMouth"] = nil
# $game_player.actor.prtmood("normal")
# lonaprt=$game_portraits.getPortrait("Lona")
# lonaprt.update
# lonaprt.show
# lonaprt.focus
# lonaprt.portrait.x-=25
# lonaprt.portrait.y-=45
#end
def show
super
$game_player.actor.stat["EventMouth"] = nil
$game_player.actor.prtmood("normal")
lonaprt = $game_portraits.getPortrait("Lona")
lonaprt.update
lonaprt.show
lonaprt.focus
# === 比例調整:最新需求版 ===
# 640x360 → x: -25, y: -45
# 544x416 → x: +10, y: +10
# X軸偏移(寬度變化 -96px 時,從 -25 變到 +10,總差 +35)
dx = -25.0 + (Graphics.width - 640) * (35.0 / -96.0)
# Y軸偏移(高度變化 +56px 時,從 -45 變到 +10,總差 +55)
dy = -45.0 + (Graphics.height - 360) * (55.0 / 56.0)
lonaprt.portrait.x += dx.round.to_i
lonaprt.portrait.y += dy.round.to_i
end
def mouse_no_need_update
true
end
def hide
super
prt = $game_portraits.getPortrait("Lona")
prt.hide
prt.skip_animation
end
def dispose
@main_stats_layout.bitmap.dispose if @main_stats_layout.bitmap
@main_stats_layout.dispose
@info.dispose
super
end
end