Project1

标题: 怎样实现显示地名? [打印本页]

作者: 颠倒的彩虹    时间: 2006-5-23 20:40
标题: 怎样实现显示地名?

作者: 颠倒的彩虹    时间: 2006-5-23 20:40
标题: 怎样实现显示地名?

作者: luo8828959    时间: 2009-8-13 08:10
  1. class Floating_Location < Window_Base
  2. def initialize
  3. @map_name = get_name
  4. @size = Win_Size.new(@map_name)
  5. width = @size[0]
  6. height = @size[1]
  7. super(0, 0, width+32, height+32)
  8. self.contents = Bitmap.new(width, height)
  9. self.opacity = 240
  10. self.back_opacity = 240
  11. self.contents_opacity = 240
  12. @frame_wait = Graphics.frame_count + 60
  13. refresh
  14. end
  15. def refresh
  16. self.contents.font.color = Color.new(217,87,0,255)
  17. self.contents.draw_text(0, 0, @size[0]+32, @size[1], @map_name)
  18. end
  19. def update
  20. if get_name != @map_name
  21. self.dispose
  22. return
  23. end
  24. if @frame_wait <= Graphics.frame_count
  25. if self.opacity > 0
  26. self.opacity -= 20
  27. self.back_opacity -= 20
  28. self.contents_opacity -= 20
  29. else
  30. self.dispose
  31. return
  32. end
  33. end
  34. end
  35. def get_name
  36. data = load_data("Data/MapInfos.rxdata")
  37. data[$game_map.map_id].name
  38. end
  39. end
  40. class Win_Size < Window_Base
  41. def initialize(text)
  42. super(0, 0, 640, 480)
  43. self.contents = Bitmap.new(640 - 32, 480 - 32)
  44. @w = contents.text_size(text).width
  45. @h = contents.text_size(text).height
  46. self.dispose
  47. end
  48. def [](value)
  49. if value == 0
  50. return @w
  51. else
  52. return @h
  53. end
  54. end
  55. end
  56. class Scene_Map
  57. alias :main_orig :main
  58. alias :update_orig :update
  59. alias :transfer_player_orig :transfer_player
  60. def main
  61. @floating_location.dispose unless @floating_location.nil?
  62. @floating_location = Floating_Location.new
  63. main_orig
  64. @floating_location.dispose unless (@floating_location.disposed? or
  65. @floating_location.nil?)
  66. end
  67. def update
  68. @floating_location.update unless (@floating_location.disposed? or
  69. @floating_location.nil?)
  70. update_orig
  71. end
  72. def transfer_player
  73. transfer_player_orig
  74. @floating_location.dispose unless (@floating_location.disposed? or
  75. @floating_location.nil?)
  76. @floating_location = Floating_Location.new
  77. end
  78. end
复制代码

作者: ProfesstionR    时间: 2009-8-13 08:17
↑ LS挖坟- -




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1