赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 378 |
最后登录 | 2013-2-9 |
在线时间 | 33 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 33 小时
- 注册时间
- 2013-1-25
- 帖子
- 10
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 slient叶枫 于 2013-1-31 20:20 编辑
RT,我用了纵版文字系统,代码如下class Bitmap def draw_text2(x, y, width, height, text, align = 0) case align when 0 then y = 0 when 1 then y = (self.height - height) / 2 when 2 then y = self.height - height - 10 end y = 0 if align > 2 if text.nil? then return end for i in 0..text.length / 3 self.draw_text(x, i * self.font.size + y, 32, 32, text[i * 3, 3]) end end end
class Bitmap
def draw_text2(x, y, width, height, text, align = 0)
case align
when 0 then y = 0
when 1 then y = (self.height - height) / 2
when 2 then y = self.height - height - 10
end
y = 0 if align > 2
if text.nil? then return end
for i in 0..text.length / 3
self.draw_text(x, i * self.font.size + y, 32, 32, text[i * 3, 3])
end
end
end
然后自行修改时间系统如下:class Scene_Map def main @spriteset = Spriteset_Map.new @message_window = Window_Message.new @time_date_window = Window_Time_Date.new Graphics.transition loop do Graphics.update Input.update update if $scene != self break end # end if $scene != self end # end loop do Graphics.freeze @spriteset.dispose @message_window.dispose @time_date_window.dispose if $scene.is_a?(Scene_Title) Graphics.transition Graphics.freeze end # end if $scene.is_a?(Scene_Title) end # end def main end # end class Scene_Map class Window_Time_Date < Window_Base def initialize super(0, 0, 100, 250) self.contents = Bitmap.new(width - 33, height - 33) if $scene.is_a?(Scene_Map) self.opacity = 0 self.back_opacity = 0 end refresh end # end def initialize def refresh self.contents.clear self.contents.font.color = system_color self.contents.font.size = 19 @total_sec = Graphics.frame_count if $game_variables[2] >= 3 + 0 $game_variables[2] = 0 $game_variables[3] += 1 end # end if $game_variables[2] >= 23 + 1 if $game_variables[3] >= 2 + 1 $game_variables[3] = 0 $game_variables[4] += 1 end # end if $game_variables[3] >= 30 + 1 if $game_variables[4] >= 11 + 1 $game_variables[4] = 0 $game_variables[5] += 1 end # end if $game_variables[4] >= 12 + 1 text_day = ["上旬", "中旬", "下旬"][$game_variables[3]] text_month = ["正月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"][$game_variables[4]] text_year = ["第一年", "第二年", "第三年","第四年","第五年","2013年","2014年", "2015年","2016年","2017年","2018年","2019年","2020年"][$game_variables[5]] self.contents.clear self.contents.draw_text2(20, 0, 32, 128,text_year) self.contents.draw_text2(5, 0, 32, 128, text_month) self.contents.draw_text2(5, 0, 32, 128, text_day) def update super refresh end end end
class Scene_Map
def main
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
@time_date_window = Window_Time_Date.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end # end if $scene != self
end # end loop do
Graphics.freeze
@spriteset.dispose
@message_window.dispose
@time_date_window.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end # end if $scene.is_a?(Scene_Title)
end # end def main
end # end class Scene_Map
class Window_Time_Date < Window_Base
def initialize
super(0, 0, 100, 250)
self.contents = Bitmap.new(width - 33, height - 33)
if $scene.is_a?(Scene_Map)
self.opacity = 0
self.back_opacity = 0
end
refresh
end # end def initialize
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.font.size = 19
@total_sec = Graphics.frame_count
if $game_variables[2] >= 3 + 0
$game_variables[2] = 0
$game_variables[3] += 1
end # end if $game_variables[2] >= 23 + 1
if $game_variables[3] >= 2 + 1
$game_variables[3] = 0
$game_variables[4] += 1
end # end if $game_variables[3] >= 30 + 1
if $game_variables[4] >= 11 + 1
$game_variables[4] = 0
$game_variables[5] += 1
end # end if $game_variables[4] >= 12 + 1
text_day = ["上旬", "中旬",
"下旬"][$game_variables[3]]
text_month = ["正月", "二月", "三月", "四月", "五月", "六月",
"七月", "八月", "九月", "十月", "十一月", "十二月"][$game_variables[4]]
text_year = ["第一年", "第二年", "第三年","第四年","第五年","2013年","2014年",
"2015年","2016年","2017年","2018年","2019年","2020年"][$game_variables[5]]
self.contents.clear
self.contents.draw_text2(20, 0, 32, 128,text_year)
self.contents.draw_text2(5, 0, 32, 128, text_month)
self.contents.draw_text2(5, 0, 32, 128, text_day)
def update
super
refresh
end
end
end
于是问题出现了,draw_text2的X坐标可以任意调整,而y坐标不论怎样调都没有用,能否在保证可使用纵版文字的前提下,能够有效调整字符串的Y坐标。顺便加上一个变量开关作为条件,多谢各位大。 |
|