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

Project1

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

[已经解决] 更改窗口

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
94 小时
注册时间
2016-10-21
帖子
48
跳转到指定楼层
1
发表于 2017-4-30 21:59:42 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 RyanBern 于 2017-5-1 16:39 编辑

怎么把这个图上的窗口改为4x5样式的
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
这种样式排布的

这是脚本
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4.  
  5. # 自定义内容解释:
  6. # TOWNS[编号]=["地名,可以随便写",开关编号,[传送去的地图id,传送去的地图x,
  7. #              传送去的地图y],角色朝向]
  8. #
  9. # 编号请按照0、1、2、3……顺序往下排布
  10. # 当编号的开关打开的时候,才可以选择这个传送地点
  11. # 角色朝向,2为下,4为左,6为右,8为上,具体可以参考自己数字小键盘的方向和数字关系
  12. # 如果是其他方向请自己改。
  13. #
  14. # 需要制作脚本,请点击66rpg.com最底部的QQ交谈
  15. #
  16. # 使用方法:在需要传送的传送门、传送石、传送羽毛、传送旅店一类的地方使用公共事件:
  17. #           呼叫脚本:$scene = Scene_Teleport.new
  18. #
  19. # 制作者:柳柳
  20. #==============================================================================
  21. TOWNS=[]
  22. TOWNS[0]=["古德城堡东门",1,[1,2,3],2]
  23. TOWNS[1]=["古德城堡西门",2,[1,2,5],4]
  24. TOWNS[2]=["修道院门口",3,[3,3,6],4]
  25. TOWNS[3]=["女神遗迹南口",4,[4,2,6],4]
  26. TOWNS[4]=["圣天城骑士团练兵场",5,[5,2,6],4]
  27. TOWNS[5]=["许愿之塔",6,[6,9,6],4]
  28. #==============================================================================
  29. # ■ Window_Teleport
  30. #------------------------------------------------------------------------------
  31. #  处理传送的窗口
  32. #==============================================================================
  33. class Window_Teleport < Window_Selectable
  34.   #--------------------------------------------------------------------------
  35.   # ● 初始化对像
  36.   #--------------------------------------------------------------------------
  37.   def initialize
  38.     super(640,640,64,64)
  39.     self.contents = Bitmap.new(width, height)
  40.     self.opacity = 180
  41.     get_towns
  42.     draw_towns
  43.     @column_max = 1
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 获取可到达的城镇和窗口大小
  47.   #--------------------------------------------------------------------------
  48.   def get_towns
  49.     @carol3_towns = []
  50.     @width_temp = 0
  51.     @cont_use = false
  52.     for town in TOWNS
  53.       if $game_switches[town[1]]==true
  54.         @carol3_towns.push(town)
  55.         if contents.text_size(town[0]).width >= @width_temp
  56.           @width_temp = contents.text_size(town[0]).width
  57.         end
  58.       end
  59.     end
  60.     @item_max = @carol3_towns.size
  61.     if @item_max == 0
  62.       @carol3_towns[0] = ["没有可以传送的地方",1,[1,1,1]]
  63.       @width_temp = contents.text_size(@carol3_towns[0][0]).width
  64.       @item_max = 1
  65.       @cont_use = true
  66.     end
  67.     self.width = [@width_temp+32,480].min
  68.     self.height = [(@item_max+1)*32,360].min
  69.     self.x = (640-self.width)/2
  70.     self.y = (480-self.height)/2
  71.     self.contents = Bitmap.new(width-32,row_max*32)
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 描绘城镇名称
  75.   #--------------------------------------------------------------------------
  76.   def draw_towns
  77.     for i in [email]0...@carol3_towns.size[/email]
  78.       self.contents.draw_text(0,i*32,@width_temp,32,@carol3_towns[i][0],1)
  79.     end
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● 返回的内容
  83.   #========================================================================
  84.   # ● 地图编号
  85.   #--------------------------------------------------------------------------
  86.   def map_id
  87.     return @carol3_towns[self.index][2][0]
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ● 地图x坐标
  91.   #--------------------------------------------------------------------------
  92.   def map_x
  93.     return @carol3_towns[self.index][2][1]
  94.   end      
  95.   #--------------------------------------------------------------------------
  96.   # ● 地图y坐标
  97.   #--------------------------------------------------------------------------
  98.   def map_y
  99.     return @carol3_towns[self.index][2][2]
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ● 角色朝向
  103.   #--------------------------------------------------------------------------
  104.   def map_direction
  105.     return @carol3_towns[self.index][2][3]
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● 判断是否一个城市都没有
  109.   #--------------------------------------------------------------------------
  110.   def cant_use?
  111.     return @cont_use
  112.   end
  113. end
  114. #==============================================================================
  115. # ■ Scene_Teleport
  116. #------------------------------------------------------------------------------
  117. #  处理传送执行的类
  118. #==============================================================================
  119. class Scene_Teleport
  120.   #--------------------------------------------------------------------------
  121.   # ● 主处理
  122.   #--------------------------------------------------------------------------
  123.   def main
  124.     $game_system.se_play($data_system.decision_se)
  125.     @carol3_trans_white = false
  126.     @carol3_map_sprite = Spriteset_Map.new
  127.     @carol3_teleport_window = Window_Teleport.new
  128.     if @carol3_teleport_window.cant_use?
  129.       @carol3_teleport_window.index = -1
  130.     else
  131.       @carol3_teleport_window.index = 0
  132.     end
  133.     @carol3_teleport_window.active = true
  134.     Graphics.transition
  135.     loop do
  136.       Graphics.update
  137.       Input.update
  138.       carol3_update
  139.       if $scene != self
  140.         break
  141.       end
  142.     end   
  143.     if @carol3_trans_white==true
  144.       @carol3_white_sprite = Sprite.new
  145.       @carol3_white_sprite.bitmap = Bitmap.new(640,480)
  146.       @carol3_white_sprite.opacity = 0
  147.       @carol3_white_sprite.bitmap.fill_rect(0, 0, 640, 480, Color.new(255,255,255,255))
  148.       for i in 0..20
  149.         @carol3_white_sprite.opacity += 15
  150.         @carol3_teleport_window.opacity -= 12
  151.         @carol3_teleport_window.contents_opacity -= 12
  152.         Graphics.update
  153.       end
  154.       Graphics.freeze
  155.       Graphics.transition(0)
  156.       Graphics.update
  157.       @carol3_map_sprite.dispose
  158.       $game_map.setup($game_temp.player_new_map_id)
  159.       $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
  160.       $game_player.turn_down
  161.       $game_player.straighten
  162.       $game_map.autoplay      
  163.       Graphics.frame_reset
  164.       for i in 0..20
  165.         @carol3_white_sprite.opacity -= 15
  166.         Graphics.update
  167.       end
  168.       @carol3_white_sprite.dispose
  169.       @carol3_teleport_window.dispose
  170.       Graphics.freeze
  171.     else
  172.       Graphics.freeze
  173.       @carol3_teleport_window.dispose
  174.       @carol3_map_sprite.dispose
  175.     end   
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ● 刷新画面
  179.   #--------------------------------------------------------------------------
  180.   def carol3_update
  181.     @carol3_teleport_window.update
  182.     if Input.trigger?(Input::B)
  183.       $game_system.se_play($data_system.cancel_se)
  184.       $scene = Scene_Map.new
  185.       return
  186.     end
  187.     if Input.trigger?(Input::C)
  188.       if @carol3_teleport_window.index == -1
  189.         $game_system.se_play($data_system.cancel_se)
  190.         $scene = Scene_Map.new
  191.         return
  192.       else        
  193.         $game_temp.player_new_map_id = @carol3_teleport_window.map_id
  194.         $game_temp.player_new_x = @carol3_teleport_window.map_x
  195.         $game_temp.player_new_y = @carol3_teleport_window.map_y
  196.         $game_temp.player_new_direction = @carol3_teleport_window.map_direction
  197.         $game_temp.player_transferring = true
  198.         $game_temp.transition_processing = true
  199.         $game_temp.transition_name = ""
  200.         $scene = Scene_Map.new
  201.         @carol3_trans_white = true
  202.         Audio.se_play("Audio/SE/" + "018-Teleport01",100,100)
  203.         return
  204.       end
  205.     end   
  206.   end
  207. end
  208.  
  209. #==============================================================================
  210. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  211. #==============================================================================

捕获.PNG (143.79 KB, 下载次数: 10)

捕获.PNG

Lv1.梦旅人

梦石
0
星屑
125
在线时间
171 小时
注册时间
2014-4-14
帖子
151
2
发表于 2017-5-1 08:55:16 | 只看该作者
本帖最后由 2357691704 于 2017-5-1 09:00 编辑


弄好了。因窗口大小限制,脚本里面地图的名字请限制4个字数(长度128)
如有需要增添选项数量 或修改窗口坐标等 请自行对照修改。

注意:97行的“[email]和[/ email]字样请删去,这是论坛发贴自己加上去的(将脚本误以为是邮箱链接)。

.
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4.  
  5. # 自定义内容解释:
  6. # TOWNS[编号]=["地名,可以随便写",开关编号,[传送去的地图id,传送去的地图x,
  7. #              传送去的地图y],角色朝向]
  8. #
  9. # 编号请按照0、1、2、3……顺序往下排布
  10. # 当编号的开关打开的时候,才可以选择这个传送地点
  11. # 角色朝向,2为下,4为左,6为右,8为上,具体可以参考自己数字小键盘的方向和数字关系
  12. # 如果是其他方向请自己改。
  13. #
  14. # 需要制作脚本,请点击66rpg.com最底部的QQ交谈
  15. #
  16. # 使用方法:在需要传送的传送门、传送石、传送羽毛、传送旅店一类的地方使用公共事件:
  17. #           呼叫脚本:$scene = Scene_Teleport.new
  18. #
  19. # 制作者:柳柳
  20. #==============================================================================
  21. TOWNS=[]
  22. TOWNS[0]=["古德城堡",1,[1,2,3],2]
  23. TOWNS[1]=["古德城堡",1,[1,2,5],4]
  24. TOWNS[2]=["修道院一",1,[3,3,6],4]
  25. TOWNS[3]=["女神遗址",1,[4,2,6],4]
  26. TOWNS[4]=["圣天城堡",1,[5,2,6],4]
  27. TOWNS[5]=["许愿之塔",2,[6,9,6],4]
  28. TOWNS[6]=["古德城堡",2,[1,2,3],2]
  29. TOWNS[7]=["古德城堡",2,[1,2,5],4]
  30. TOWNS[8]=["修道院一",2,[3,3,6],4]
  31. TOWNS[9]=["女神遗址",2,[4,2,6],4]
  32. TOWNS[10]=["圣天城堡",3,[5,2,6],4]
  33. TOWNS[11]=["许愿之塔",3,[6,9,6],4]
  34. TOWNS[12]=["古德城堡",3,[1,2,3],2]
  35. TOWNS[13]=["古德城堡",3,[1,2,5],4]
  36. TOWNS[14]=["修道院一",3,[3,3,6],4]
  37. TOWNS[15]=["女神遗址",4,[4,2,6],4]
  38. TOWNS[16]=["圣天城堡",4,[5,2,6],4]
  39. TOWNS[17]=["许愿之塔",4,[6,9,6],4]
  40. TOWNS[18]=["古德城堡",4,[1,2,3],2]
  41. TOWNS[19]=["古德城堡",4,[1,2,5],4]
  42. #==============================================================================
  43. # ■ Window_Teleport
  44. #------------------------------------------------------------------------------
  45. #  处理传送的窗口
  46. #==============================================================================
  47. class Window_Teleport < Window_Selectable
  48.   #--------------------------------------------------------------------------
  49.   # ● 初始化对像
  50.   #--------------------------------------------------------------------------
  51.   def initialize
  52.     super(0,0,640,166)
  53.     self.contents = Bitmap.new(width, height)
  54.     self.opacity = 180
  55.     get_towns
  56.     draw_towns
  57.     @column_max = 5
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● 获取可到达的城镇和窗口大小
  61.   #--------------------------------------------------------------------------
  62.   def get_towns
  63.     @carol3_towns = []
  64.     @width_temp = 0
  65.     @cont_use = false
  66.     for town in TOWNS
  67.       if $game_switches[town[1]]==true
  68.         @carol3_towns.push(town)
  69.         if contents.text_size(town[0]).width >= @width_temp
  70.           @width_temp = contents.text_size(town[0]).width
  71.         end
  72.       end
  73.     end
  74.     @item_max = @carol3_towns.size
  75.     if @item_max == 0
  76.       @carol3_towns[0] = ["没有可以传送的地方",1,[1,1,1]]
  77.       @width_temp = contents.text_size(@carol3_towns[0][0]).width
  78.       @item_max = 1
  79.       @cont_use = true
  80.     end
  81. =begin   
  82.     self.width = [@width_temp+32,480].min
  83.     self.height = [(@item_max+1)*32,360].min
  84.     self.x = (640-self.width)/2
  85.     self.y = (480-self.height)/2
  86.     self.contents = Bitmap.new(width-32,row_max*32)
  87.   end
  88. =end  
  89.     #self.x = (640-self.width)/2
  90.     #self.y = (480-self.height)/2
  91.     self.contents = Bitmap.new(width-32,height-32)
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 描绘城镇名称
  95.   #--------------------------------------------------------------------------
  96.   def draw_towns
  97.     for i in [email]0...@carol3_towns.size[/email]
  98.       #self.contents.draw_text(0,i*32,@width_temp,32,@carol3_towns[i][0],1)
  99.      if i<= 4
  100.         self.contents.draw_text(i*128,0,@width_temp,32,@carol3_towns[i][0],1)
  101.       elsif i>4 and i<= 9
  102.         self.contents.draw_text((i-5) * 128,32,@width_temp,32,@carol3_towns[i][0],1)
  103.         elsif i>9 and i<= 14
  104.         self.contents.draw_text((i-10) * 128,64,@width_temp,32,@carol3_towns[i][0],1)
  105.         elsif i>14 and i<= 19
  106.         self.contents.draw_text((i-15) * 128,96,@width_temp,32,@carol3_towns[i][0],1)
  107.       end
  108.       end
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● 返回的内容
  112.   #========================================================================
  113.   # ● 地图编号
  114.   #--------------------------------------------------------------------------
  115.   def map_id
  116.     return @carol3_towns[self.index][2][0]
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   # ● 地图x坐标
  120.   #--------------------------------------------------------------------------
  121.   def map_x
  122.     return @carol3_towns[self.index][2][1]
  123.   end      
  124.   #--------------------------------------------------------------------------
  125.   # ● 地图y坐标
  126.   #--------------------------------------------------------------------------
  127.   def map_y
  128.     return @carol3_towns[self.index][2][2]
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● 角色朝向
  132.   #--------------------------------------------------------------------------
  133.   def map_direction
  134.     return @carol3_towns[self.index][2][3]
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● 判断是否一个城市都没有
  138.   #--------------------------------------------------------------------------
  139.   def cant_use?
  140.     return @cont_use
  141.   end
  142. end
  143. #==============================================================================
  144. # ■ Scene_Teleport
  145. #------------------------------------------------------------------------------
  146. #  处理传送执行的类
  147. #==============================================================================
  148. class Scene_Teleport
  149.   #--------------------------------------------------------------------------
  150.   # ● 主处理
  151.   #--------------------------------------------------------------------------
  152.   def main
  153.     $game_system.se_play($data_system.decision_se)
  154.     @carol3_trans_white = false
  155.     @carol3_map_sprite = Spriteset_Map.new
  156.     @carol3_teleport_window = Window_Teleport.new
  157.     if @carol3_teleport_window.cant_use?
  158.       @carol3_teleport_window.index = -1
  159.     else
  160.       @carol3_teleport_window.index = 0
  161.     end
  162.     @carol3_teleport_window.active = true
  163.     Graphics.transition
  164.     loop do
  165.       Graphics.update
  166.       Input.update
  167.       carol3_update
  168.       if $scene != self
  169.         break
  170.       end
  171.     end   
  172.     if @carol3_trans_white==true
  173.       @carol3_white_sprite = Sprite.new
  174.       @carol3_white_sprite.bitmap = Bitmap.new(640,480)
  175.       @carol3_white_sprite.opacity = 0
  176.       @carol3_white_sprite.bitmap.fill_rect(0, 0, 640, 480, Color.new(255,255,255,255))
  177.       for i in 0..20
  178.         @carol3_white_sprite.opacity += 15
  179.         @carol3_teleport_window.opacity -= 12
  180.         @carol3_teleport_window.contents_opacity -= 12
  181.         Graphics.update
  182.       end
  183.       Graphics.freeze
  184.       Graphics.transition(0)
  185.       Graphics.update
  186.       @carol3_map_sprite.dispose
  187.       $game_map.setup($game_temp.player_new_map_id)
  188.       $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
  189.       $game_player.turn_down
  190.       $game_player.straighten
  191.       $game_map.autoplay      
  192.       Graphics.frame_reset
  193.       for i in 0..20
  194.         @carol3_white_sprite.opacity -= 15
  195.         Graphics.update
  196.       end
  197.       @carol3_white_sprite.dispose
  198.       @carol3_teleport_window.dispose
  199.       Graphics.freeze
  200.     else
  201.       Graphics.freeze
  202.       @carol3_teleport_window.dispose
  203.       @carol3_map_sprite.dispose
  204.     end   
  205.   end
  206.   #--------------------------------------------------------------------------
  207.   # ● 刷新画面
  208.   #--------------------------------------------------------------------------
  209.   def carol3_update
  210.     @carol3_teleport_window.update
  211.     if Input.trigger?(Input::B)
  212.       $game_system.se_play($data_system.cancel_se)
  213.       $scene = Scene_Map.new
  214.       return
  215.     end
  216.     if Input.trigger?(Input::C)
  217.       if @carol3_teleport_window.index == -1
  218.         $game_system.se_play($data_system.cancel_se)
  219.         $scene = Scene_Map.new
  220.         return
  221.       else        
  222.         $game_temp.player_new_map_id = @carol3_teleport_window.map_id
  223.         $game_temp.player_new_x = @carol3_teleport_window.map_x
  224.         $game_temp.player_new_y = @carol3_teleport_window.map_y
  225.         $game_temp.player_new_direction = @carol3_teleport_window.map_direction
  226.         $game_temp.player_transferring = true
  227.         $game_temp.transition_processing = true
  228.         $game_temp.transition_name = ""
  229.         $scene = Scene_Map.new
  230.         @carol3_trans_white = true
  231.         Audio.se_play("Audio/SE/" + "018-Teleport01",100,100)
  232.         return
  233.       end
  234.     end   
  235.   end
  236. end
  237.  
  238. #==============================================================================
  239. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  240. #==============================================================================

截图20170501084833.png (215.69 KB, 下载次数: 9)

截图20170501084833.png

评分

参与人数 1梦石 +1 收起 理由
RyanBern + 1 认可答案

查看全部评分

Vanyogin
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
94 小时
注册时间
2016-10-21
帖子
48
3
 楼主| 发表于 2017-5-1 11:48:20 | 只看该作者
2357691704 发表于 2017-5-1 08:55
弄好了。因窗口大小限制,脚本里面地图的名字请限制4个字数(长度128)
如有需要增添选项数量 或修改窗口 ...

嗯,谢了
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-22 02:02

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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