alexncf125 发表于 2022-5-12 20:11
XP的大佬们是不是太宠这LZ了?
怎么次次都有大佬肯当工具人的?
guoxiaomi 发表于 2022-5-13 14:16
有没有一种可能性,你已经写好了一个满足以上所有条件的版本,但是不肯拿出来让大家看看? ...
#==============================================================================
class Scene_Skisele < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize(id,limit=[])
@id = id
@limit = limit
@skill_lv = 0
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
@screen = Spriteset_Map.new
#技能选择窗口上面部分
@skill_list_upper = Skill_list_upper.new
@skill_list_upper.draw_text
@skill_list_upper.active = true
@skill_list_upper.visible = true
@skill_list_upper.x = 137
@skill_list_upper.y = 90
@skill_list_upper.opacity = 120
#技能选择窗口
@skill_list_window = Window_Skill_List.new(@id,@limit)
@skill_list_window.active = true
@skill_list_window.visible = true
@skill_list_window.opacity = 120
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@skill_list_upper.dispose
@skill_list_window.dispose
@screen.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@screen.update
@skill_list_window.update
if Input.trigger?(Input::B)
@skill_list_upper.active = false
@skill_list_upper.visible = false
@skill_list_window.active = false
@skill_list_window.visible = false
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
@skill_list_upper.active = false
@skill_list_upper.visible = false
@skill_list_window.active = false
@skill_list_window.visible = false
for i in 0...$game_party.actors.size
$game_party.actors.learn_skill(@skill_list_window.learn_content[@skill_list_window.index])
end
p "恭喜全队都学会了技能 #{$data_skills[@skill_list_window.learn_content[@skill_list_window.index]].name}"
$scene = Scene_Map.new
return
end
end
end
#================================文字提示===================================
class Skill_list_upper < Window_Base
def initialize
super(0, 0, 366, 72)
self.contents = Bitmap.new(width - 32, height - 32)
end
def draw_text
self.contents.clear
self.contents.font.size = 23
self.contents.font.color = system_color
self.contents.draw_text(40, 5, self.width - 32, 32, "现在想学习哪个技能呢?")
end
end
#==============================================================================
class Window_Skill_List < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize(id,limit)
super(137, 50, 366, 360)
@id = id
@limit = limit
@column_max = 1
@item_max = @id.size
if @item_max>=8
self.height = 288
else
self.height = @item_max*32+32
end
self.y = 162
self.opacity = 160
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 给对象调用参数用的
#--------------------------------------------------------------------------
def learn_content
return @id
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data=[]
for i in @id
skill_id = $data_skills
@data.push(skill_id)
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘羡慕
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
self.contents.font.color = normal_color
if @limit[index] != nil
lv = @limit[index]
else
lv = 10
end
x = 2
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
case skill.name.size
when 0..18
self.contents.font.size = 20
when 19..24
self.contents.font.size = 16
when 25..30
self.contents.font.size = 12
end
self.contents.draw_text(x + 28, y, 212, 32, skill.name, 0)
end
end
189.5 KB, 下载次数: 5
技能选择窗口
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |