Project1
标题:
Window_ShopCommand 的文字颜色如何修改呢?
[打印本页]
作者:
overpan
时间:
2009-10-28 19:54
提示:
作者被禁止或删除 内容自动屏蔽
作者:
Eienshinken
时间:
2009-10-28 20:02
本帖最后由 Eienshinken 于 2009-10-28 20:36 编辑
def initialize
super(0, 64, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 3
@column_max = 3
self.contents.font.color = Color.new(255,0,0)
s1 = "买"
s2 = "卖"
s3 = "取消"
@commands = [s1, s2, s3]
refresh
self.index = 0
end
这是在Window_ShopCommand里
错了..之前的变回普通颜色删掉就好了..更改一下..
貌似要每个都设置各自颜色有点难度
作者:
overpan
时间:
2009-10-28 20:49
提示:
作者被禁止或删除 内容自动屏蔽
作者:
Eienshinken
时间:
2009-10-28 20:57
稍微改了下 .分别定义选择项目的颜色成功了.
如果你是所有选择项目都一样颜色的话 用上面的就行了.如果眼分别定义每个选择项目的颜色.用下面的脚本
#==============================================================================
# ■ Window_ShopCommand
#------------------------------------------------------------------------------
# 商店画面、选择要做的事的窗口
#==============================================================================
class Window_ShopCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 64, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 3
@column_max = 3
@commands = ["买", "卖", "取消"]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
x = 4 + index * 160
for i in 0..index
# 买的字体颜色
if i == 0
self.contents.font.color = Color.new(255,0,0)
# 卖的字体颜色
elsif i == 1
self.contents.font.color = Color.new(0,255,0)
# 取消的字体颜色
elsif i == 2
self.contents.font.color = Color.new(0,0,255)
end
self.contents.draw_text(x, 0, 128, 32, @commands[index])
end
end
end
复制代码
作者:
overpan
时间:
2009-10-28 21:21
提示:
作者被禁止或删除 内容自动屏蔽
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1