Project1
标题: 【已解决】如何实现一个等级多重名称 [打印本页]
作者: l734273398 时间: 2020-11-12 20:01
标题: 【已解决】如何实现一个等级多重名称
本帖最后由 l734273398 于 2020-11-13 15:17 编辑
如题,看题目可能会有点糊涂,
打个比方:当1号开关打开时,使用【1号系列的等级名称】,当2号开关打开时,使用【2系列的等级名称】以此类推
【当打开1号开关】【1级名称=菜鸡】【2级名称=小菜鸡】
【当打开2号开关】【1级名称=勇士】【2级名称=小勇士】
LEVEL_LIST = {
1=>"菜鸡",
2=>"小菜鸡",
}
class Window_Base < Window
def draw_actor_level(actor, x, y)
if LEVEL_LIST.has_key?(actor.level)
self.contents.draw_text(x, y, 128, 32, LEVEL_LIST[actor.level])
else
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
end
end
LEVEL_LIST = {
1=>"菜鸡",
2=>"小菜鸡",
}
class Window_Base < Window
def draw_actor_level(actor, x, y)
if LEVEL_LIST.has_key?(actor.level)
self.contents.draw_text(x, y, 128, 32, LEVEL_LIST[actor.level])
else
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
end
end
LEVEL_LIST = {
1=>"勇士",
2=>"小勇士",
}
class Window_Base < Window
def draw_actor_level(actor, x, y)
if LEVEL_LIST.has_key?(actor.level)
self.contents.draw_text(x, y, 128, 32, LEVEL_LIST[actor.level])
else
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
end
end
LEVEL_LIST = {
1=>"勇士",
2=>"小勇士",
}
class Window_Base < Window
def draw_actor_level(actor, x, y)
if LEVEL_LIST.has_key?(actor.level)
self.contents.draw_text(x, y, 128, 32, LEVEL_LIST[actor.level])
else
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
end
end
作者: soulsaga 时间: 2020-11-12 21:28
LEVEL_LIST = {
1=>"菜鸡",
2=>"小菜鸡",
}
LEVEL_LIST2 = {
1=>"勇士",
2=>"小勇士",
}
class Window_Base < Window
def draw_actor_level(actor, x, y)
if LEVEL_LIST.has_key?(actor.level) or LEVEL_LIST2.has_key?(actor.level)
self.contents.draw_text(x, y, 128, 32, LEVEL_LIST[actor.level]) if $game_switches[1]
self.contents.draw_text(x, y, 128, 32, LEVEL_LIST2[actor.level]) if $game_switches[2]
else
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
end
end
LEVEL_LIST = {
1=>"菜鸡",
2=>"小菜鸡",
}
LEVEL_LIST2 = {
1=>"勇士",
2=>"小勇士",
}
class Window_Base < Window
def draw_actor_level(actor, x, y)
if LEVEL_LIST.has_key?(actor.level) or LEVEL_LIST2.has_key?(actor.level)
self.contents.draw_text(x, y, 128, 32, LEVEL_LIST[actor.level]) if $game_switches[1]
self.contents.draw_text(x, y, 128, 32, LEVEL_LIST2[actor.level]) if $game_switches[2]
else
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
end
end
作者: enghao_lim 时间: 2020-11-12 21:38
我更建议用变量,如下是当变量10为1的话会使用菜鸡,2会使用勇士,不设定时返回默认。
- class Window_Base
- alias cool_alias_draw_actor_level draw_actor_level
- def draw_actor_level(actor, x, y)
- varId = 10 #变量号
- #变量值 => { 等级 => 名称 }
- list = {
- 1 => {
- 1 => "菜鸡",
- 2 => "小菜鸡",
- },
- 2 => {
- 1 => "勇士",
- 2 => "小勇士",
- }
- }
- set = list[$game_variables[varId]]
- if set and set[actor.level]
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y, 64, 32, set[actor.level])
- else
- cool_alias_draw_actor_level(actor, x, y)
- end
- end
- end
复制代码
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |