| 赞 | 1 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2019-12-2 |
| 在线时间 | 219 小时 |
- 梦石
- 0
- 星屑
- 129
- 在线时间
- 219 小时
- 注册时间
- 2011-1-19
- 回帖
- 92
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
我想要做一个诗词系统, 先写了一个选诗词的界面,大致的效果是这样的:(选项框应该要把两行字都包进去)
我是几乎模仿着Window_Item写的,只不过它里面获取物品信息的部分我是直接用常量来搞的,但是不知道为什么,它的光标不能动。一直在闪烁但是不移动,感觉好像是项目数量的问题,貌似这个选项窗口的选项数量被默认成了1(我的猜测)。
请大神帮忙看一看怎么解决。(下面把源代码贴上。有些比较蠢的地方,多多指教= =)
- module Poem
- # 诗词的标题
- POEM_TOPIC = ["登高", "行路难","","","","","","","","","","","","","","","","","","","","11","","","22","22","22","","11","","","22","22","22","","11","","","22","22","22","","11","","","22","22","22"]
- # 诗词的作者
- POEM_AUTHOR = ["[唐]杜甫", "[唐]李白","","","","","","","","","","","","","","","","","","","","11","","","22"]
- # 诗词的内容
- POEM_CONTENT = []
- POEM_CONTENT[0] = "风急天高猿啸哀,渚清沙白鸟飞回。
- 无边落木萧萧下,不尽长江滚滚来。
- 万里悲秋常作客,百年多病独登台。
- 艰难苦恨繁霜鬓,潦倒新停浊酒杯。"
- POEM_CONTENT[1] = "金樽清酒斗十千,玉盘珍羞直万钱。
- 停杯投箸不能食,拔剑四顾心茫然。
- 欲渡黄河冰塞川,将登太行雪满山。
- 闲来垂钓碧溪上,忽复乘舟梦日边。
- 行路难!行路难!多歧路,今安在?
- 长风破浪会有时,直挂云帆济沧海。"
- # 用于出题的句子
- POEM_TESTSEN1 = ["万里悲秋常作客","长风破浪会有时"] # 每首诗词用于出题的句子上半句
- POEM_TESTSEN2 = ["百年多病独登台","直挂云帆济沧海"] # 每首诗词用于出题的句子下半句
- end
- class Game_Party
- attr_accessor :poem_get # 诗词的拥有状态
- attr_accessor :poem_use # 诗词的使用状态
- alias old_initialize initialize
- def initialize
- old_initialize
- @poem_get = []
- @poem_use = []
- num = Poem::POEM_TOPIC.size
- for i in 0...num
- @poem_get.push false
- @poem_use.push false
- end
- end
- end
- class Window_PoemSel < Window_Selectable
- def initialize
- super(0, 0, 640, 480)
- @column_max = 3
- @poem_max = Poem::POEM_TOPIC.size
- refresh
- self.index = 0
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- self.contents = Bitmap.new(640 - 32, 480 - 32)
- #@title = []
- #@author = []
- for i in 0...Poem::POEM_TOPIC.size
- if $game_party.poem_get[i] == true
- @title = Poem::POEM_TOPIC[i]
- @author = Poem::POEM_AUTHOR[i]
- end
- if $game_party.poem_get[i] == false
- @title = "???"
- @author = "[?]???"
- end
- draw_poem(i)
- end
- end
-
- def draw_poem(index)
- # 颜色 选中为系统色,拥有但未选中为普通色,未拥有为无效色
- if $game_party.poem_use[index] == true
- self.contents.font.color = system_color
- end
- if $game_party.poem_use[index] == false
- if $game_party.poem_get[index] == true
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- end
- x = 4 + (index % 3) * 213
- y = (index / 3) * 64
- rect = Rect.new(x, y, self.width / @poem_max - 32, 60)
- self.contents.fill_rect(rect, Color.new(0,0,0,0))
- self.contents.draw_text(x, y, 197, 32, @title,1)
- self.contents.draw_text(x, y+32, 197, 32, @author,1)
- end
- end
- # 四 选诗词场景
- class Scene_PoemSel
- def main
- @poem_window = Window_PoemSel.new
- @poem_window.active = true
- #================================================
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- #================================================
- @poem_window.dispose
- end
-
- def update
- if Input.trigger?(Input::B)
- $scene = Scene_Map.new
- end
- @poem_window.update
-
- end
- end
复制代码
请大家看一下,为什么不会动= =谢谢! |
|