设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1784|回复: 4
打印 上一主题 下一主题

[已经过期] Window_BattleResul 的问题

[复制链接]

Lv3.寻梦者

双子人

梦石
0
星屑
3165
在线时间
3616 小时
注册时间
2009-4-4
帖子
4154

开拓者

1
发表于 2012-8-19 10:00:11 | 显示全部楼层
  1. def refresh
  2.     self.contents.clear
  3.     x = 4
  4.     self.contents.font.color = normal_color
  5.     cx = contents.text_size(@exp.to_s).width
  6.     self.contents.draw_text(x, 0, cx, 32, @exp.to_s,对齐方式)
  7.     x += cx + 4
  8.     self.contents.font.color = system_color
  9.     cx = contents.text_size("EXP").width
  10.     self.contents.draw_text(x, 0, 64, 32, "EXP",对齐方式)
  11.     x += cx + 16
  12.     self.contents.font.color = normal_color
  13.     cx = contents.text_size(@gold.to_s).width
  14.     self.contents.draw_text(x, 0, cx, 32, @gold.to_s,对齐方式)
  15.     x += cx + 4
  16.     self.contents.font.color = system_color
  17.     self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold,对齐方式)
  18.     y = 32
  19.     for item in @treasures
  20.       draw_item_name(item, 4, y)
  21.       y += 32
  22.     end
  23.   end
复制代码
对齐方式:水平方向默认为左对齐,但是当 align 指定为 1 时为居中对齐,指定为 2 时为右对齐。垂直方向则总为居中对齐。

点评

@exp.to_s 和 @gold.to_s 似乎不会动哪 只有字会动  发表于 2012-8-19 13:18

评分

参与人数 1星屑 +40 收起 理由
hcm + 40 感谢回答

查看全部评分

回复

使用道具 举报

Lv3.寻梦者

双子人

梦石
0
星屑
3165
在线时间
3616 小时
注册时间
2009-4-4
帖子
4154

开拓者

2
发表于 2012-8-19 15:46:30 | 显示全部楼层
ms0688987 发表于 2012-8-19 13:25
我想像的是 :

假如窗口长320 , 经验值和金钱整条假如长160

draw_text(x, y, width, height, str[, align])
那你还需要调整一下它的宽度。因为这个也决定着它居中的位置。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-6 23:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表