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

Project1

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

[已经解决] 怎么修改窗口位置?

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2578
在线时间
63 小时
注册时间
2016-3-19
帖子
8
跳转到指定楼层
1
发表于 2018-12-3 13:25:49 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我用了立绘脚本,自己稍微修改了下,但窗口位置不知道在哪改,求指教

QQ截图20181203132012.png (151.37 KB, 下载次数: 19)

QQ截图20181203132012.png

Lv3.寻梦者

梦石
0
星屑
2578
在线时间
63 小时
注册时间
2016-3-19
帖子
8
2
 楼主| 发表于 2018-12-3 13:26:24 | 只看该作者
本帖最后由 VIPArcher 于 2019-1-8 23:59 编辑

脚本如下
RUBY 代码复制
  1. =begin
  2. ===============================================================================
  3.   【使用说明】
  4.  
  5.   一个简单的解谜游戏菜单,基本都是默认的窗口,
  6.   至于坐标宽度和列数之类的设置,请自行修改。
  7.  
  8.   直接main前insert可用。
  9.   与其他菜单类脚本冲突可能性极大,
  10.   不提供整合和兼容服务。
  11.  
  12.  
  13.   脚本中搜索:
  14.   ·“设置部分”开始设定各个项目
  15.     你可以在这里设定包含字号,立绘等一系列有关的项目。
  16.     
  17.   ·“脚本部分-Scene”查看Scene的修改内容
  18.     这里可以调整一部分窗口的坐标和宽度等。
  19.     
  20.   ·“脚本部分-Window”查看各个窗口的修改内容
  21.     这里只是对某些窗口内容的重新定义。
  22.     
  23.   ·“脚本部分-立绘”为新增的显示立绘脚本
  24.     立绘的窗口,默认设定是滑动和淡入,关闭滑动不淡入。
  25.     你也可以通过在这里设定坐标来达到从下方滑入画面的效果。
  26.  
  27.  
  28.   发现BUG欢迎随时回报。
  29.  
  30. =end
  31.  
  32.  
  33. #####################################
  34. # 设置部分
  35. #####################################
  36.  
  37. module SHIINA
  38.   # 调整字号
  39.   FONT_SIZE = 18
  40.  
  41.   # 是否显示立绘
  42.   IMAGE = true
  43.  
  44.   # 固定的立绘(为false时立绘滚动和淡入效果)
  45.   LOCK_IMAGE = false
  46.  
  47.   # 立绘左右翻转(没错这是窝偷懒用的)(← ←结果偷懒不成。。但是还是留着吧)
  48.   IMAGE_MIRROR = false
  49.  
  50.   # 立绘的滑动速度(立绘不固定时生效)
  51.   IMAGE_SLIDE_SPD = 10
  52.  
  53.   # 立绘文件名(放在picture文件夹内,赋值nil的话将使用菜单当前角色的名字为名的图片)
  54.   IMAGE_NAME = nil
  55.  
  56.   # 是否使用物品分类选择
  57.   ITEM_TYPE = false
  58.  
  59.   # 加入武器和防具分类?(使用物品分类为true时生效)
  60.   WEAPON_ARMOR = false
  61.  
  62.   # 是否可以整队
  63.   FORMATION = false
  64.  
  65.   # 是否显示金钱窗口
  66.   GOLD = true
  67.  
  68.   # 是否显示人物的状态窗口
  69.   STATUS = true
  70.  
  71.   # 状态窗口内容高度(设置为false则返回默认高度)
  72.   STATUS_HEIGHT = 98
  73.  
  74.   # 状态窗口的显示项目,不显示的项目改为false或者nil,
  75.   STATUS_ITEM = [true,   # 脸图
  76.                  true,   # 名字
  77.                  true,   # 等级
  78.                  true,   # 状态图标
  79.                  true,   # 职业
  80.                  true,   # HP
  81.                  true    # MP
  82.                  ]
  83. end
  84.  
  85. # 重置整体字号
  86. Font.default_size = SHIINA::FONT_SIZE
  87.  
  88. #----------------------设置部分结束----------------------#
  89.  
  90.  
  91. #####################################
  92. # 脚本部分-Scene
  93. #####################################
  94. #==============================================================================
  95. # ■ Scene_MenuBase
  96. #==============================================================================
  97.  
  98. class Scene_MenuBase < Scene_Base
  99.   #--------------------------------------------------------------------------
  100.   # ● 生成帮助窗口
  101.   #--------------------------------------------------------------------------
  102.   def create_help_window
  103.     @help_window = Window_Help.new
  104.     @help_window.visible = false
  105.     @help_window.viewport = @viewport
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● 生成角色窗口
  109.   #--------------------------------------------------------------------------
  110.   def create_actor_window
  111.     @actor_window = Window_MenuActor.new
  112.     @actor_window.set_handler(:ok,     method(:on_actor_ok))
  113.     @actor_window.set_handler(:cancel, method(:on_actor_cancel))
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● 获取当前选中的物品
  117.   #--------------------------------------------------------------------------
  118.   def item
  119.     @item_window.item
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ● 获取物品的使用者(直接指向当前角色)
  123.   #--------------------------------------------------------------------------
  124.   def user
  125.     return @actor
  126. #~     $game_party.movable_members.max_by {|member| member.pha }
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # ● 显示子窗口
  130.   #--------------------------------------------------------------------------
  131.   def show_sub_window(window)
  132.     width_remain = Graphics.width - window.width
  133.     window.x = 0
  134.     @viewport.rect.x = window.width
  135.     @viewport.rect.width = Graphics.width - window.width
  136.     window.show.activate
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● 隐藏子窗口
  140.   #--------------------------------------------------------------------------
  141.   def hide_sub_window(window)
  142.     @viewport.rect.x = @viewport.ox = 0
  143.     @viewport.rect.width = Graphics.width
  144.     window.hide.deactivate
  145.     activate_item_window
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 角色“确定”
  149.   #--------------------------------------------------------------------------
  150.   def on_actor_ok
  151.     if item_usable?
  152.       use_item
  153.     else
  154.       Sound.play_buzzer
  155.     end
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● 角色“取消”
  159.   #--------------------------------------------------------------------------
  160.   def on_actor_cancel
  161.     hide_sub_window(@actor_window)
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 确定物品
  165.   #--------------------------------------------------------------------------
  166.   def determine_item
  167.     if item.for_friend?
  168.       show_sub_window(@actor_window)
  169.       @actor_window.select_for_item(item)
  170.     else
  171.       use_item
  172.       activate_item_window
  173.     end
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ● 启用物品窗口
  177.   #--------------------------------------------------------------------------
  178.   def activate_item_window
  179.     @item_window.refresh
  180.     @item_window.activate
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # ● 获取物品的使用目标数组
  184.   #--------------------------------------------------------------------------
  185.   def item_target_actors
  186.     if !item.for_friend?
  187.       []
  188.     elsif item.for_all?
  189.       $game_party.members
  190.     else
  191.       [$game_party.members[@actor_window.index]]
  192.     end
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # ● 判定物品是否可以使用
  196.   #--------------------------------------------------------------------------
  197.   def item_usable?
  198.     user.usable?(item) && item_effects_valid?
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ● 判定物品的效果是否有效
  202.   #--------------------------------------------------------------------------
  203.   def item_effects_valid?
  204.     item_target_actors.any? do |target|
  205.       target.item_test(user, item)
  206.     end
  207.   end
  208.   #--------------------------------------------------------------------------
  209.   # ● 对角色使用物品
  210.   #--------------------------------------------------------------------------
  211.   def use_item_to_actors
  212.     item_target_actors.each do |target|
  213.       item.repeats.times { target.item_apply(user, item) }
  214.     end
  215.   end
  216.   #--------------------------------------------------------------------------
  217.   # ● 使用物品
  218.   #--------------------------------------------------------------------------
  219.   def use_item
  220.     play_se_for_item
  221.     user.use_item(item)
  222.     use_item_to_actors
  223.     check_common_event
  224.     check_gameover
  225.     @actor_window.refresh
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ● 公共事件预定判定
  229.   #    如果预约了事件的调用,则切换到地图画面。
  230.   #--------------------------------------------------------------------------
  231.   def check_common_event
  232.     SceneManager.goto(Scene_Map) if $game_temp.common_event_reserved?
  233.   end
  234. end
  235.  
  236.  
  237.  
  238. #==============================================================================
  239. # ■ Scene_Menu
  240. #==============================================================================
  241.  
  242. class Scene_Menu < Scene_MenuBase
  243.   #--------------------------------------------------------------------------
  244.   # ● 开始处理
  245.   #--------------------------------------------------------------------------
  246.   def start
  247.     super
  248.     create_image
  249.     create_gold_window if SHIINA::GOLD
  250.     create_command_window
  251.     create_status_window if SHIINA::STATUS
  252.     create_help_window
  253.     create_category_window
  254.     create_item_window
  255.     create_actor_window
  256.   end
  257.  
  258.   #--------------------------------------------------------------------------
  259.   # ● 生成立绘
  260.   #--------------------------------------------------------------------------
  261.   def create_image
  262.     @image = Image.new(@actor)
  263.   end
  264.  
  265.   #--------------------------------------------------------------------------
  266.   # ● 生成指令窗口
  267.   #--------------------------------------------------------------------------
  268.   def create_command_window
  269.     @command_window = Window_MenuCommand.new
  270.     @command_window.y = SHIINA::GOLD ?
  271.                         @gold_window.y - @command_window.height :
  272.                         Graphics.height - @command_window.height
  273.  
  274.     @command_window.set_handler(:item,      method(:command_item))
  275.     @command_window.set_handler(:formation, method(:command_formation)) if SHIINA::FORMATION
  276.     @command_window.set_handler(:save,      method(:command_save))
  277.     @command_window.set_handler(:game_end,  method(:command_game_end))
  278.     @command_window.set_handler(:cancel,    method(:return_scene))
  279.     @command_window.set_handler(:pageup,    method(:prev_actor))
  280.     @command_window.set_handler(:pagedown,  method(:next_actor))
  281.     # 立绘塞进指令窗口
  282.     @command_window.image = @image
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # ● 生成金钱窗口
  286.   #--------------------------------------------------------------------------
  287.   def create_gold_window
  288.     @gold_window = Window_Gold.new
  289.     @gold_window.x = 0
  290.     @gold_window.y = Graphics.height - @gold_window.height
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ● 生成状态窗口
  294.   #--------------------------------------------------------------------------
  295.   def create_status_window
  296.     @status_window = Window_MenuStatus.new(@command_window.width, 0)
  297.     @status_window.refresh_nanikore(@actor)
  298.     @status_window.y = Graphics.height - @status_window.height
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ● 生成分类窗口
  302.   #--------------------------------------------------------------------------
  303.   def create_category_window
  304.     @category_window = Window_ItemCategory.new
  305.     @category_window.viewport = @viewport
  306.     @category_window.help_window = @help_window
  307.     @category_window.y = @help_window.height
  308.     @category_window.deactivate
  309.     @category_window.visible = false
  310.     @category_window.set_handler(:ok,     method(:on_category_ok))
  311.     @category_window.set_handler(:cancel, method(:on_category_cancel))
  312.   end
  313.   #--------------------------------------------------------------------------
  314.   # ● 生成物品窗口
  315.   #--------------------------------------------------------------------------
  316.   def create_item_window
  317.     item_window_y      = @category_window.y + (SHIINA::ITEM_TYPE ? @category_window.height : 0)
  318.     item_window_height = Graphics.height - item_window_y - (Graphics.height - @command_window.y)
  319.     @item_window = Window_ItemList.new(@category_window.x, item_window_y, @command_window.width, item_window_height)
  320.     @item_window.viewport = @viewport
  321.     @item_window.help_window = @help_window
  322.     @item_window.deactivate
  323.     @item_window.visible = false
  324.     @item_window.set_handler(:ok,     method(:on_item_ok))
  325.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  326.     @category_window.item_window = @item_window
  327.   end
  328.   #--------------------------------------------------------------------------
  329.   # ● 指令“物品”
  330.   #--------------------------------------------------------------------------
  331.   def command_item
  332.     if SHIINA::ITEM_TYPE
  333.       @category_window.activate
  334.       @category_window.visible = true
  335.       @item_window.visible = true
  336.     else
  337.       @item_window.category = :item
  338.       @item_window.activate
  339.       @item_window.select_last
  340.       @item_window.visible = true
  341.       @help_window.visible = @item_window.visible
  342.     end
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ● 指令“整队”
  346.   #--------------------------------------------------------------------------
  347.   def command_formation
  348.     return unless SHIINA::STATUS
  349.     @status_window.select_last
  350.     @status_window.activate
  351.     @status_window.set_handler(:ok,     method(:on_formation_ok))
  352.     @status_window.set_handler(:cancel, method(:on_formation_cancel))
  353.   end
  354.   #--------------------------------------------------------------------------
  355.   # ● 指令“存档”
  356.   #--------------------------------------------------------------------------
  357.   def command_save
  358.     SceneManager.call(Scene_Save)
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # ● 指令“结束游戏”
  362.   #--------------------------------------------------------------------------
  363.   def command_game_end
  364.     SceneManager.call(Scene_End)
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # ● 整队“确定”
  368.   #--------------------------------------------------------------------------
  369.   def on_formation_ok
  370.     if @status_window.pending_index >= 0
  371.       $game_party.swap_order(@status_window.index,
  372.                              @status_window.pending_index)
  373.       @status_window.pending_index = -1
  374.       @status_window.redraw_item(@status_window.index)
  375.     else
  376.       @status_window.pending_index = @status_window.index
  377.     end
  378.     @status_window.activate
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # ● 整队“取消”
  382.   #--------------------------------------------------------------------------
  383.   def on_formation_cancel
  384.     if @status_window.pending_index >= 0
  385.       @status_window.pending_index = -1
  386.       @status_window.activate
  387.     else
  388.       @status_window.unselect
  389.       @command_window.activate
  390.     end
  391.   end
  392.   #--------------------------------------------------------------------------
  393.   # ● 分类“确定”
  394.   #--------------------------------------------------------------------------
  395.   def on_category_ok
  396.     @item_window.activate
  397.     @item_window.select_last
  398.     @help_window.visible = @item_window.visible
  399.   end
  400.   #--------------------------------------------------------------------------
  401.   # ● 分类“取消”
  402.   #--------------------------------------------------------------------------
  403.   def on_category_cancel
  404.     @category_window.deactivate
  405.     @category_window.visible = false
  406.     @item_window.visible = false
  407.     @help_window.visible = @item_window.visible
  408.     @command_window.activate
  409.   end
  410.   #--------------------------------------------------------------------------
  411.   # ● 物品“确定”
  412.   #--------------------------------------------------------------------------
  413.   def on_item_ok
  414.     $game_party.last_item.object = item
  415.     determine_item
  416.   end
  417.   #--------------------------------------------------------------------------
  418.   # ● 物品“取消”
  419.   #--------------------------------------------------------------------------
  420.   def on_item_cancel
  421.     @item_window.unselect
  422.     if SHIINA::ITEM_TYPE
  423.       @category_window.activate
  424.       @help_window.visible = false
  425.     else
  426.       @item_window.visible = false
  427.       @help_window.visible = @item_window.visible
  428.       @command_window.activate
  429.     end
  430.   end
  431.   #--------------------------------------------------------------------------
  432.   # ● 播放使用物品声效
  433.   #--------------------------------------------------------------------------
  434.   def play_se_for_item
  435.     Sound.play_use_item
  436.   end
  437.   #--------------------------------------------------------------------------
  438.   # ● 使用物品
  439.   #--------------------------------------------------------------------------
  440.   def use_item
  441.     super
  442.     @item_window.redraw_current_item
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ● 添加切换角色定义(刷新立绘和人物信息窗口)
  446.   #--------------------------------------------------------------------------
  447.   # 上一个角色
  448.   alias image_prev_actor prev_actor
  449.   def prev_actor
  450.     image_prev_actor
  451.     @command_window.activate
  452.     @command_window.select_last
  453.     @command_window.refresh_image(@actor)
  454.     @status_window.refresh_nanikore(@actor)
  455.   end
  456.   # 下一个角色
  457.   alias image_next_actor next_actor
  458.   def next_actor
  459.     image_next_actor
  460.     @command_window.activate
  461.     @command_window.select_last
  462.     @command_window.refresh_image(@actor)
  463.     @status_window.refresh_nanikore(@actor)
  464.   end
  465. end
  466.  
  467. #----------------------Scene部分结束----------------------#
  468.  
  469.  
  470.  
  471. #####################################
  472. # 脚本部分-Window
  473. #####################################
  474. #==============================================================================
  475. # ■ Window_MenuCommand
  476. #------------------------------------------------------------------------------
  477. #  菜单画面中显示指令的窗口
  478. #==============================================================================
  479.  
  480. class Window_MenuCommand < Window_Command
  481.   # 立绘图像
  482.   attr_accessor  :image
  483.   #--------------------------------------------------------------------------
  484.   # ● 向指令列表添加主要的指令
  485.   #--------------------------------------------------------------------------
  486.   def add_main_commands
  487.     add_command(Vocab::item,   :item,   main_commands_enabled)
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # ● 添加整队指令
  491.   #--------------------------------------------------------------------------
  492.   def add_formation_command
  493.     return unless SHIINA::FORMATION
  494.     add_command(Vocab::formation, :formation, formation_enabled)
  495.   end
  496.   #--------------------------------------------------------------------------
  497.   # ● 刷新立绘
  498.   #--------------------------------------------------------------------------
  499.   def refresh_image(actor)
  500.     @image.refresh(actor)
  501.   end
  502.   #--------------------------------------------------------------------------
  503.   # ● 更新立绘
  504.   #--------------------------------------------------------------------------
  505.   alias image_update update
  506.   def update
  507.     image_update
  508.     @image.update if @image
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # ● 释放里立绘
  512.   #--------------------------------------------------------------------------
  513.   alias image_dispose dispose
  514.   def dispose
  515.     image_dispose
  516.     @image.dispose
  517.   end
  518. end
  519.  
  520. #==============================================================================
  521. # ■ Window_ItemCategory
  522. #------------------------------------------------------------------------------
  523. #  物品画面和商店画面中,显示装备、所持物品等项目列表的窗口。
  524. #==============================================================================
  525.  
  526. class Window_ItemCategory < Window_HorzCommand
  527.   #--------------------------------------------------------------------------
  528.   # ● 生成指令列表
  529.   #--------------------------------------------------------------------------
  530.   def make_command_list
  531.     add_command(Vocab::item,     :item)
  532.     add_command(Vocab::weapon,   :weapon) if SHIINA::WEAPON_ARMOR
  533.     add_command(Vocab::armor,    :armor) if SHIINA::WEAPON_ARMOR
  534.     add_command(Vocab::key_item, :key_item)
  535.   end
  536. end
  537.  
  538. #==============================================================================
  539. # ■ Window_ItemList
  540. #------------------------------------------------------------------------------
  541. #  物品画面中,显示持有物品的窗口。
  542. #==============================================================================
  543.  
  544. class Window_ItemList < Window_Selectable
  545.   #--------------------------------------------------------------------------
  546.   # ● 获取列数
  547.   #--------------------------------------------------------------------------
  548.   def col_max
  549.     return 1
  550.   end
  551. end
  552.  
  553. #==============================================================================
  554. # ■ Window_MenuStatus
  555. #------------------------------------------------------------------------------
  556. #  菜单画面中,显示队伍成员状态的窗口
  557. #==============================================================================
  558.  
  559. class Window_MenuStatus < Window_Selectable
  560.   #--------------------------------------------------------------------------
  561.   # ● 获取窗口的宽度
  562.   #--------------------------------------------------------------------------
  563.   def window_width
  564.     Graphics.width - 160
  565.   end
  566.   #--------------------------------------------------------------------------
  567.   # ● 最大数目
  568.   #--------------------------------------------------------------------------
  569.   def item_max
  570.     return 1
  571.   end
  572.   #--------------------------------------------------------------------------
  573.   # ● 获取窗口的高度
  574.   #--------------------------------------------------------------------------
  575.   def window_height
  576.     item_max * item_height + standard_padding * 2
  577.   end
  578.   #--------------------------------------------------------------------------
  579.   # ● 刷新角色(为了位置refresh的结构只能另外写个了呢)
  580.   #--------------------------------------------------------------------------
  581.   def refresh_nanikore(actor)
  582.     @actor = actor
  583.     refresh
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # ● 刷新(直接描绘当前角色信息)
  587.   #--------------------------------------------------------------------------
  588.   def refresh
  589.     contents.clear
  590.     return unless @actor
  591.     index = 0
  592.     rect = item_rect(index)
  593.     draw_item_background(index)
  594.     draw_actor_face(@actor, rect.x + 1, rect.y + 1) if SHIINA::STATUS_ITEM[0]
  595.     draw_actor_simple_status(@actor, rect.x + 108, rect.y + line_height / 2)
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # ● 绘制项目(没用了呢)
  599.   #--------------------------------------------------------------------------
  600.   def draw_item(index); ; end
  601.   #--------------------------------------------------------------------------
  602.   # ● 绘制简单的状态
  603.   #--------------------------------------------------------------------------
  604.   def draw_actor_simple_status(actor, x, y)
  605.     draw_actor_name(actor, x, y)                       if SHIINA::STATUS_ITEM[1]
  606.     draw_actor_level(actor, x, y + line_height * 1)    if SHIINA::STATUS_ITEM[2]
  607.     draw_actor_icons(actor, x, y + line_height * 2)    if SHIINA::STATUS_ITEM[3]
  608.     draw_actor_class(actor, x + 120, y)                if SHIINA::STATUS_ITEM[4]
  609.     draw_actor_hp(actor, x + 120, y + line_height * 1) if SHIINA::STATUS_ITEM[5]
  610.     draw_actor_mp(actor, x + 120, y + line_height * 2) if SHIINA::STATUS_ITEM[6]
  611.   end
  612.   #--------------------------------------------------------------------------
  613.   # ● 获取项目的高度
  614.   #--------------------------------------------------------------------------
  615.   def item_height
  616.     if SHIINA::STATUS_HEIGHT
  617.       return SHIINA::STATUS_HEIGHT
  618.     else
  619.       return (Graphics.height - standard_padding * 2) / 4
  620.     end
  621.   end
  622. end
  623.  
  624. #==============================================================================
  625. # ■ Window_MenuActor
  626. #------------------------------------------------------------------------------
  627. #  显示物品使用或技能使用的选择目标的窗口
  628. #==============================================================================
  629.  
  630. class Window_MenuActor < Window_MenuStatus
  631.   #--------------------------------------------------------------------------
  632.   # ● 刷新(父上已经走上奇怪的路线,只能从爷爷那边搬过来→_→)
  633.   #--------------------------------------------------------------------------
  634.   def refresh
  635.     contents.clear
  636.     draw_all_items
  637.   end
  638.   #--------------------------------------------------------------------------
  639.   # ● 获取项目数
  640.   #--------------------------------------------------------------------------
  641.   def item_max
  642.     $game_party.members.size
  643.   end
  644.   #--------------------------------------------------------------------------
  645.   # ● 绘制项目
  646.   #--------------------------------------------------------------------------
  647.   def draw_item(index)
  648.     actor = $game_party.members[index]
  649.     enabled = $game_party.battle_members.include?(actor)
  650.     rect = item_rect(index)
  651.     draw_item_background(index)
  652.     draw_actor_face(actor, rect.x + 1, rect.y + 1) if SHIINA::STATUS_ITEM[0]
  653.     draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
  654.   end
  655. end
  656. #----------------------Window部分结束----------------------#
  657.  
  658.  
  659. #####################################
  660. # 脚本部分-立绘
  661. #####################################
  662.  
  663. class Image < Sprite
  664.  
  665.   def initialize(actor, x=get_x, y=Graphics.height)
  666.     super(nil)
  667.     @actor = actor
  668.     self.mirror = SHIINA::IMAGE_MIRROR
  669.     self.bitmap = Cache.picture(get_pic_name)
  670.     self.oy = self.height
  671.     self.opacity = 0 unless SHIINA::LOCK_IMAGE
  672.     self.x = x
  673.     self.y = y
  674.     set
  675.     setn(0)
  676.   end
  677.  
  678.   def get_pic_name
  679.     actor_name = @actor ? @actor.name : $game_party.members[0].name
  680.     return SHIINA::IMAGE_NAME.nil? ? actor_name : SHIINA::IMAGE_NAME
  681.   end
  682.  
  683.   def refresh(actor)
  684.     @actor = actor
  685.     self.bitmap = Cache.picture(get_pic_name)
  686.     return if SHIINA::LOCK_IMAGE
  687.     self.opacity = 0
  688.     set(get_x)
  689.     setn(0)
  690.   end
  691.  
  692.   def get_x
  693.     SHIINA::LOCK_IMAGE ? 0 : 32 * 4
  694.   end
  695.  
  696.   def spd
  697.     SHIINA::IMAGE_SLIDE_SPD
  698.   end
  699.  
  700.   def set(x=self.x, y=self.y)
  701.     self.x = x
  702.     self.y = y
  703.     @nx = x
  704.     @ny = y
  705.   end
  706.  
  707.   def setn(x=self.x, y=self.y)
  708.     @nx = x
  709.     @ny = y
  710.   end
  711.  
  712.   def update
  713.     super
  714.     return if SHIINA::LOCK_IMAGE
  715.     update_slide
  716.   end
  717.  
  718.   def slide_over?
  719.     return (self.x==@nx && self.y=@ny)
  720.   end
  721.  
  722.   def update_slide
  723.     self.opacity += 20 unless SHIINA::LOCK_IMAGE
  724.     return if slide_over?
  725.     if self.x + spd < @nx
  726.       self.x += spd
  727.     elsif self.x - spd > @nx
  728.       self.x -= spd
  729.     elsif self.x != @nx
  730.       self.x = @nx
  731.     end
  732.     if self.y + spd < @ny
  733.       self.y += spd
  734.     elsif self.y - spd > @ny
  735.       self.y -= spd
  736.     elsif self.y != @ny
  737.       self.y = @ny
  738.     end
  739.   end
  740.  
  741. end
  742.  
  743. #----------------------立绘部分结束----------------------#

回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
10
星屑
39440
在线时间
1914 小时
注册时间
2010-11-14
帖子
3315

R考场第七期纪念奖

3
发表于 2018-12-3 13:26:49 | 只看该作者
麻烦贴一下脚本。
一般窗口的位置是初始化的时候就有了
用头画头像,用脚写脚本
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2578
在线时间
63 小时
注册时间
2016-3-19
帖子
8
4
 楼主| 发表于 2018-12-3 13:28:29 | 只看该作者
KB.Driver 发表于 2018-12-3 13:26
麻烦贴一下脚本。
一般窗口的位置是初始化的时候就有了

贴了,麻烦大佬了

点评

要改到怎样的位置?  发表于 2018-12-3 13:50
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2578
在线时间
63 小时
注册时间
2016-3-19
帖子
8
5
 楼主| 发表于 2018-12-3 13:29:15 | 只看该作者

  1. ===============================================================================
  2.   【使用说明】
  3.   
  4.   一个简单的解谜游戏菜单,基本都是默认的窗口,
  5.   至于坐标宽度和列数之类的设置,请自行修改。
  6.   
  7.   直接main前insert可用。
  8.   与其他菜单类脚本冲突可能性极大,
  9.   不提供整合和兼容服务。
  10.   
  11.   
  12.   脚本中搜索:
  13.   ·“设置部分”开始设定各个项目
  14.     你可以在这里设定包含字号,立绘等一系列有关的项目。
  15.    
  16.   ·“脚本部分-Scene”查看Scene的修改内容
  17.     这里可以调整一部分窗口的坐标和宽度等。
  18.    
  19.   ·“脚本部分-Window”查看各个窗口的修改内容
  20.     这里只是对某些窗口内容的重新定义。
  21.    
  22.   ·“脚本部分-立绘”为新增的显示立绘脚本
  23.     立绘的窗口,默认设定是滑动和淡入,关闭滑动不淡入。
  24.     你也可以通过在这里设定坐标来达到从下方滑入画面的效果。
  25.   
  26.   
  27.   发现BUG欢迎随时回报。
  28.   
  29. =end


  30. #####################################
  31. # 设置部分
  32. #####################################

  33. module SHIINA
  34.   # 调整字号
  35.   FONT_SIZE = 18
  36.   
  37.   # 是否显示立绘
  38.   IMAGE = true
  39.   
  40.   # 固定的立绘(为false时立绘滚动和淡入效果)
  41.   LOCK_IMAGE = false
  42.   
  43.   # 立绘左右翻转(没错这是窝偷懒用的)(← ←结果偷懒不成。。但是还是留着吧)
  44.   IMAGE_MIRROR = false
  45.   
  46.   # 立绘的滑动速度(立绘不固定时生效)
  47.   IMAGE_SLIDE_SPD = 10
  48.   
  49.   # 立绘文件名(放在picture文件夹内,赋值nil的话将使用菜单当前角色的名字为名的图片)
  50.   IMAGE_NAME = nil
  51.   
  52.   # 是否使用物品分类选择
  53.   ITEM_TYPE = false
  54.   
  55.   # 加入武器和防具分类?(使用物品分类为true时生效)
  56.   WEAPON_ARMOR = false
  57.   
  58.   # 是否可以整队
  59.   FORMATION = false
  60.   
  61.   # 是否显示金钱窗口
  62.   GOLD = true
  63.   
  64.   # 是否显示人物的状态窗口
  65.   STATUS = true
  66.   
  67.   # 状态窗口内容高度(设置为false则返回默认高度)
  68.   STATUS_HEIGHT = 98
  69.   
  70.   # 状态窗口的显示项目,不显示的项目改为false或者nil,
  71.   STATUS_ITEM = [true,   # 脸图
  72.                  true,   # 名字
  73.                  true,   # 等级
  74.                  true,   # 状态图标
  75.                  true,   # 职业
  76.                  true,   # HP
  77.                  true    # MP
  78.                  ]
  79. end
  80.                
  81. # 重置整体字号
  82. Font.default_size = SHIINA::FONT_SIZE

  83. #----------------------设置部分结束----------------------#


  84. #####################################
  85. # 脚本部分-Scene
  86. #####################################
  87. #==============================================================================
  88. # ■ Scene_MenuBase
  89. #==============================================================================

  90. class Scene_MenuBase < Scene_Base
  91.   #--------------------------------------------------------------------------
  92.   # ● 生成帮助窗口
  93.   #--------------------------------------------------------------------------
  94.   def create_help_window
  95.     @help_window = Window_Help.new
  96.     @help_window.visible = false
  97.     @help_window.viewport = @viewport
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ● 生成角色窗口
  101.   #--------------------------------------------------------------------------
  102.   def create_actor_window
  103.     @actor_window = Window_MenuActor.new
  104.     @actor_window.set_handler(:ok,     method(:on_actor_ok))
  105.     @actor_window.set_handler(:cancel, method(:on_actor_cancel))
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● 获取当前选中的物品
  109.   #--------------------------------------------------------------------------
  110.   def item
  111.     @item_window.item
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 获取物品的使用者(直接指向当前角色)
  115.   #--------------------------------------------------------------------------
  116.   def user
  117.     return @actor
  118. #~     $game_party.movable_members.max_by {|member| member.pha }
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 显示子窗口
  122.   #--------------------------------------------------------------------------
  123.   def show_sub_window(window)
  124.     width_remain = Graphics.width - window.width
  125.     window.x = 0
  126.     @viewport.rect.x = window.width
  127.     @viewport.rect.width = Graphics.width - window.width
  128.     window.show.activate
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● 隐藏子窗口
  132.   #--------------------------------------------------------------------------
  133.   def hide_sub_window(window)
  134.     @viewport.rect.x = @viewport.ox = 0
  135.     @viewport.rect.width = Graphics.width
  136.     window.hide.deactivate
  137.     activate_item_window
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● 角色“确定”
  141.   #--------------------------------------------------------------------------
  142.   def on_actor_ok
  143.     if item_usable?
  144.       use_item
  145.     else
  146.       Sound.play_buzzer
  147.     end
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● 角色“取消”
  151.   #--------------------------------------------------------------------------
  152.   def on_actor_cancel
  153.     hide_sub_window(@actor_window)
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 确定物品
  157.   #--------------------------------------------------------------------------
  158.   def determine_item
  159.     if item.for_friend?
  160.       show_sub_window(@actor_window)
  161.       @actor_window.select_for_item(item)
  162.     else
  163.       use_item
  164.       activate_item_window
  165.     end
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● 启用物品窗口
  169.   #--------------------------------------------------------------------------
  170.   def activate_item_window
  171.     @item_window.refresh
  172.     @item_window.activate
  173.   end
  174.   #--------------------------------------------------------------------------
  175.   # ● 获取物品的使用目标数组
  176.   #--------------------------------------------------------------------------
  177.   def item_target_actors
  178.     if !item.for_friend?
  179.       []
  180.     elsif item.for_all?
  181.       $game_party.members
  182.     else
  183.       [$game_party.members[@actor_window.index]]
  184.     end
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● 判定物品是否可以使用
  188.   #--------------------------------------------------------------------------
  189.   def item_usable?
  190.     user.usable?(item) && item_effects_valid?
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ● 判定物品的效果是否有效
  194.   #--------------------------------------------------------------------------
  195.   def item_effects_valid?
  196.     item_target_actors.any? do |target|
  197.       target.item_test(user, item)
  198.     end
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ● 对角色使用物品
  202.   #--------------------------------------------------------------------------
  203.   def use_item_to_actors
  204.     item_target_actors.each do |target|
  205.       item.repeats.times { target.item_apply(user, item) }
  206.     end
  207.   end
  208.   #--------------------------------------------------------------------------
  209.   # ● 使用物品
  210.   #--------------------------------------------------------------------------
  211.   def use_item
  212.     play_se_for_item
  213.     user.use_item(item)
  214.     use_item_to_actors
  215.     check_common_event
  216.     check_gameover
  217.     @actor_window.refresh
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ● 公共事件预定判定
  221.   #    如果预约了事件的调用,则切换到地图画面。
  222.   #--------------------------------------------------------------------------
  223.   def check_common_event
  224.     SceneManager.goto(Scene_Map) if $game_temp.common_event_reserved?
  225.   end
  226. end



  227. #==============================================================================
  228. # ■ Scene_Menu
  229. #==============================================================================

  230. class Scene_Menu < Scene_MenuBase
  231.   #--------------------------------------------------------------------------
  232.   # ● 开始处理
  233.   #--------------------------------------------------------------------------
  234.   def start
  235.     super
  236.     create_image
  237.     create_gold_window if SHIINA::GOLD
  238.     create_command_window
  239.     create_status_window if SHIINA::STATUS
  240.     create_help_window
  241.     create_category_window
  242.     create_item_window
  243.     create_actor_window
  244.   end
  245.   
  246.   #--------------------------------------------------------------------------
  247.   # ● 生成立绘
  248.   #--------------------------------------------------------------------------
  249.   def create_image
  250.     @image = Image.new(@actor)
  251.   end
  252.   
  253.   #--------------------------------------------------------------------------
  254.   # ● 生成指令窗口
  255.   #--------------------------------------------------------------------------
  256.   def create_command_window
  257.     @command_window = Window_MenuCommand.new
  258.     @command_window.y = SHIINA::GOLD ?
  259.                         @gold_window.y - @command_window.height :
  260.                         Graphics.height - @command_window.height
  261.    
  262.     @command_window.set_handler(:item,      method(:command_item))
  263.     @command_window.set_handler(:formation, method(:command_formation)) if SHIINA::FORMATION
  264.     @command_window.set_handler(:save,      method(:command_save))
  265.     @command_window.set_handler(:game_end,  method(:command_game_end))
  266.     @command_window.set_handler(:cancel,    method(:return_scene))
  267.     @command_window.set_handler(:pageup,    method(:prev_actor))
  268.     @command_window.set_handler(:pagedown,  method(:next_actor))
  269.     # 立绘塞进指令窗口
  270.     @command_window.image = @image
  271.   end
  272.   #--------------------------------------------------------------------------
  273.   # ● 生成金钱窗口
  274.   #--------------------------------------------------------------------------
  275.   def create_gold_window
  276.     @gold_window = Window_Gold.new
  277.     @gold_window.x = 0
  278.     @gold_window.y = Graphics.height - @gold_window.height
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # ● 生成状态窗口
  282.   #--------------------------------------------------------------------------
  283.   def create_status_window
  284.     @status_window = Window_MenuStatus.new(@command_window.width, 0)
  285.     @status_window.refresh_nanikore(@actor)
  286.     @status_window.y = Graphics.height - @status_window.height
  287.   end
  288.   #--------------------------------------------------------------------------
  289.   # ● 生成分类窗口
  290.   #--------------------------------------------------------------------------
  291.   def create_category_window
  292.     @category_window = Window_ItemCategory.new
  293.     @category_window.viewport = @viewport
  294.     @category_window.help_window = @help_window
  295.     @category_window.y = @help_window.height
  296.     @category_window.deactivate
  297.     @category_window.visible = false
  298.     @category_window.set_handler(:ok,     method(:on_category_ok))
  299.     @category_window.set_handler(:cancel, method(:on_category_cancel))
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ● 生成物品窗口
  303.   #--------------------------------------------------------------------------
  304.   def create_item_window
  305.     item_window_y      = @category_window.y + (SHIINA::ITEM_TYPE ? @category_window.height : 0)
  306.     item_window_height = Graphics.height - item_window_y - (Graphics.height - @command_window.y)
  307.     @item_window = Window_ItemList.new(@category_window.x, item_window_y, @command_window.width, item_window_height)
  308.     @item_window.viewport = @viewport
  309.     @item_window.help_window = @help_window
  310.     @item_window.deactivate
  311.     @item_window.visible = false
  312.     @item_window.set_handler(:ok,     method(:on_item_ok))
  313.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  314.     @category_window.item_window = @item_window
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● 指令“物品”
  318.   #--------------------------------------------------------------------------
  319.   def command_item
  320.     if SHIINA::ITEM_TYPE
  321.       @category_window.activate
  322.       @category_window.visible = true
  323.       @item_window.visible = true
  324.     else
  325.       @item_window.category = :item
  326.       @item_window.activate
  327.       @item_window.select_last
  328.       @item_window.visible = true
  329.       @help_window.visible = @item_window.visible
  330.     end
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # ● 指令“整队”
  334.   #--------------------------------------------------------------------------
  335.   def command_formation
  336.     return unless SHIINA::STATUS
  337.     @status_window.select_last
  338.     @status_window.activate
  339.     @status_window.set_handler(:ok,     method(:on_formation_ok))
  340.     @status_window.set_handler(:cancel, method(:on_formation_cancel))
  341.   end
  342.   #--------------------------------------------------------------------------
  343.   # ● 指令“存档”
  344.   #--------------------------------------------------------------------------
  345.   def command_save
  346.     SceneManager.call(Scene_Save)
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● 指令“结束游戏”
  350.   #--------------------------------------------------------------------------
  351.   def command_game_end
  352.     SceneManager.call(Scene_End)
  353.   end
  354.   #--------------------------------------------------------------------------
  355.   # ● 整队“确定”
  356.   #--------------------------------------------------------------------------
  357.   def on_formation_ok
  358.     if @status_window.pending_index >= 0
  359.       $game_party.swap_order(@status_window.index,
  360.                              @status_window.pending_index)
  361.       @status_window.pending_index = -1
  362.       @status_window.redraw_item(@status_window.index)
  363.     else
  364.       @status_window.pending_index = @status_window.index
  365.     end
  366.     @status_window.activate
  367.   end
  368.   #--------------------------------------------------------------------------
  369.   # ● 整队“取消”
  370.   #--------------------------------------------------------------------------
  371.   def on_formation_cancel
  372.     if @status_window.pending_index >= 0
  373.       @status_window.pending_index = -1
  374.       @status_window.activate
  375.     else
  376.       @status_window.unselect
  377.       @command_window.activate
  378.     end
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # ● 分类“确定”
  382.   #--------------------------------------------------------------------------
  383.   def on_category_ok
  384.     @item_window.activate
  385.     @item_window.select_last
  386.     @help_window.visible = @item_window.visible
  387.   end
  388.   #--------------------------------------------------------------------------
  389.   # ● 分类“取消”
  390.   #--------------------------------------------------------------------------
  391.   def on_category_cancel
  392.     @category_window.deactivate
  393.     @category_window.visible = false
  394.     @item_window.visible = false
  395.     @help_window.visible = @item_window.visible
  396.     @command_window.activate
  397.   end
  398.   #--------------------------------------------------------------------------
  399.   # ● 物品“确定”
  400.   #--------------------------------------------------------------------------
  401.   def on_item_ok
  402.     $game_party.last_item.object = item
  403.     determine_item
  404.   end
  405.   #--------------------------------------------------------------------------
  406.   # ● 物品“取消”
  407.   #--------------------------------------------------------------------------
  408.   def on_item_cancel
  409.     @item_window.unselect
  410.     if SHIINA::ITEM_TYPE
  411.       @category_window.activate
  412.       @help_window.visible = false
  413.     else
  414.       @item_window.visible = false
  415.       @help_window.visible = @item_window.visible
  416.       @command_window.activate
  417.     end
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # ● 播放使用物品声效
  421.   #--------------------------------------------------------------------------
  422.   def play_se_for_item
  423.     Sound.play_use_item
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   # ● 使用物品
  427.   #--------------------------------------------------------------------------
  428.   def use_item
  429.     super
  430.     @item_window.redraw_current_item
  431.   end
  432.   #--------------------------------------------------------------------------
  433.   # ● 添加切换角色定义(刷新立绘和人物信息窗口)
  434.   #--------------------------------------------------------------------------
  435.   # 上一个角色
  436.   alias image_prev_actor prev_actor
  437.   def prev_actor
  438.     image_prev_actor
  439.     @command_window.activate
  440.     @command_window.select_last
  441.     @command_window.refresh_image(@actor)
  442.     @status_window.refresh_nanikore(@actor)
  443.   end
  444.   # 下一个角色
  445.   alias image_next_actor next_actor
  446.   def next_actor
  447.     image_next_actor
  448.     @command_window.activate
  449.     @command_window.select_last
  450.     @command_window.refresh_image(@actor)
  451.     @status_window.refresh_nanikore(@actor)
  452.   end
  453. end

  454. #----------------------Scene部分结束----------------------#



  455. #####################################
  456. # 脚本部分-Window
  457. #####################################
  458. #==============================================================================
  459. # ■ Window_MenuCommand
  460. #------------------------------------------------------------------------------
  461. #  菜单画面中显示指令的窗口
  462. #==============================================================================

  463. class Window_MenuCommand < Window_Command
  464.   # 立绘图像
  465.   attr_accessor  :image
  466.   #--------------------------------------------------------------------------
  467.   # ● 向指令列表添加主要的指令
  468.   #--------------------------------------------------------------------------
  469.   def add_main_commands
  470.     add_command(Vocab::item,   :item,   main_commands_enabled)
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ● 添加整队指令
  474.   #--------------------------------------------------------------------------
  475.   def add_formation_command
  476.     return unless SHIINA::FORMATION
  477.     add_command(Vocab::formation, :formation, formation_enabled)
  478.   end
  479.   #--------------------------------------------------------------------------
  480.   # ● 刷新立绘
  481.   #--------------------------------------------------------------------------
  482.   def refresh_image(actor)
  483.     @image.refresh(actor)
  484.   end
  485.   #--------------------------------------------------------------------------
  486.   # ● 更新立绘
  487.   #--------------------------------------------------------------------------
  488.   alias image_update update
  489.   def update
  490.     image_update
  491.     @image.update if @image
  492.   end
  493.   #--------------------------------------------------------------------------
  494.   # ● 释放里立绘
  495.   #--------------------------------------------------------------------------
  496.   alias image_dispose dispose
  497.   def dispose
  498.     image_dispose
  499.     @image.dispose
  500.   end
  501. end

  502. #==============================================================================
  503. # ■ Window_ItemCategory
  504. #------------------------------------------------------------------------------
  505. #  物品画面和商店画面中,显示装备、所持物品等项目列表的窗口。
  506. #==============================================================================

  507. class Window_ItemCategory < Window_HorzCommand
  508.   #--------------------------------------------------------------------------
  509.   # ● 生成指令列表
  510.   #--------------------------------------------------------------------------
  511.   def make_command_list
  512.     add_command(Vocab::item,     :item)
  513.     add_command(Vocab::weapon,   :weapon) if SHIINA::WEAPON_ARMOR
  514.     add_command(Vocab::armor,    :armor) if SHIINA::WEAPON_ARMOR
  515.     add_command(Vocab::key_item, :key_item)
  516.   end
  517. end

  518. #==============================================================================
  519. # ■ Window_ItemList
  520. #------------------------------------------------------------------------------
  521. #  物品画面中,显示持有物品的窗口。
  522. #==============================================================================

  523. class Window_ItemList < Window_Selectable
  524.   #--------------------------------------------------------------------------
  525.   # ● 获取列数
  526.   #--------------------------------------------------------------------------
  527.   def col_max
  528.     return 1
  529.   end
  530. end

  531. #==============================================================================
  532. # ■ Window_MenuStatus
  533. #------------------------------------------------------------------------------
  534. #  菜单画面中,显示队伍成员状态的窗口
  535. #==============================================================================

  536. class Window_MenuStatus < Window_Selectable
  537.   #--------------------------------------------------------------------------
  538.   # ● 获取窗口的宽度
  539.   #--------------------------------------------------------------------------
  540.   def window_width
  541.     Graphics.width - 160
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # ● 最大数目
  545.   #--------------------------------------------------------------------------
  546.   def item_max
  547.     return 1
  548.   end
  549.   #--------------------------------------------------------------------------
  550.   # ● 获取窗口的高度
  551.   #--------------------------------------------------------------------------
  552.   def window_height
  553.     item_max * item_height + standard_padding * 2
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # ● 刷新角色(为了位置refresh的结构只能另外写个了呢)
  557.   #--------------------------------------------------------------------------
  558.   def refresh_nanikore(actor)
  559.     @actor = actor
  560.     refresh
  561.   end
  562.   #--------------------------------------------------------------------------
  563.   # ● 刷新(直接描绘当前角色信息)
  564.   #--------------------------------------------------------------------------
  565.   def refresh
  566.     contents.clear
  567.     return unless @actor
  568.     index = 0
  569.     rect = item_rect(index)
  570.     draw_item_background(index)
  571.     draw_actor_face(@actor, rect.x + 1, rect.y + 1) if SHIINA::STATUS_ITEM[0]
  572.     draw_actor_simple_status(@actor, rect.x + 108, rect.y + line_height / 2)
  573.   end
  574.   #--------------------------------------------------------------------------
  575.   # ● 绘制项目(没用了呢)
  576.   #--------------------------------------------------------------------------
  577.   def draw_item(index); ; end
  578.   #--------------------------------------------------------------------------
  579.   # ● 绘制简单的状态
  580.   #--------------------------------------------------------------------------
  581.   def draw_actor_simple_status(actor, x, y)
  582.     draw_actor_name(actor, x, y)                       if SHIINA::STATUS_ITEM[1]
  583.     draw_actor_level(actor, x, y + line_height * 1)    if SHIINA::STATUS_ITEM[2]
  584.     draw_actor_icons(actor, x, y + line_height * 2)    if SHIINA::STATUS_ITEM[3]
  585.     draw_actor_class(actor, x + 120, y)                if SHIINA::STATUS_ITEM[4]
  586.     draw_actor_hp(actor, x + 120, y + line_height * 1) if SHIINA::STATUS_ITEM[5]
  587.     draw_actor_mp(actor, x + 120, y + line_height * 2) if SHIINA::STATUS_ITEM[6]
  588.   end
  589.   #--------------------------------------------------------------------------
  590.   # ● 获取项目的高度
  591.   #--------------------------------------------------------------------------
  592.   def item_height
  593.     if SHIINA::STATUS_HEIGHT
  594.       return SHIINA::STATUS_HEIGHT
  595.     else
  596.       return (Graphics.height - standard_padding * 2) / 4
  597.     end
  598.   end
  599. end

  600. #==============================================================================
  601. # ■ Window_MenuActor
  602. #------------------------------------------------------------------------------
  603. #  显示物品使用或技能使用的选择目标的窗口
  604. #==============================================================================

  605. class Window_MenuActor < Window_MenuStatus
  606.   #--------------------------------------------------------------------------
  607.   # ● 刷新(父上已经走上奇怪的路线,只能从爷爷那边搬过来→_→)
  608.   #--------------------------------------------------------------------------
  609.   def refresh
  610.     contents.clear
  611.     draw_all_items
  612.   end
  613.   #--------------------------------------------------------------------------
  614.   # ● 获取项目数
  615.   #--------------------------------------------------------------------------
  616.   def item_max
  617.     $game_party.members.size
  618.   end
  619.   #--------------------------------------------------------------------------
  620.   # ● 绘制项目
  621.   #--------------------------------------------------------------------------
  622.   def draw_item(index)
  623.     actor = $game_party.members[index]
  624.     enabled = $game_party.battle_members.include?(actor)
  625.     rect = item_rect(index)
  626.     draw_item_background(index)
  627.     draw_actor_face(actor, rect.x + 1, rect.y + 1) if SHIINA::STATUS_ITEM[0]
  628.     draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
  629.   end
  630. end
  631. #----------------------Window部分结束----------------------#


  632. #####################################
  633. # 脚本部分-立绘
  634. #####################################

  635. class Image < Sprite
  636.   
  637.   def initialize(actor, x=get_x, y=Graphics.height)
  638.     super(nil)
  639.     @actor = actor
  640.     self.mirror = SHIINA::IMAGE_MIRROR
  641.     self.bitmap = Cache.picture(get_pic_name)
  642.     self.oy = self.height
  643.     self.opacity = 0 unless SHIINA::LOCK_IMAGE
  644.     self.x = x
  645.     self.y = y
  646.     set
  647.     setn(0)
  648.   end
  649.   
  650.   def get_pic_name
  651.     actor_name = @actor ? @actor.name : $game_party.members[0].name
  652.     return SHIINA::IMAGE_NAME.nil? ? actor_name : SHIINA::IMAGE_NAME
  653.   end
  654.   
  655.   def refresh(actor)
  656.     @actor = actor
  657.     self.bitmap = Cache.picture(get_pic_name)
  658.     return if SHIINA::LOCK_IMAGE
  659.     self.opacity = 0
  660.     set(get_x)
  661.     setn(0)
  662.   end
  663.   
  664.   def get_x
  665.     SHIINA::LOCK_IMAGE ? 0 : 32 * 4
  666.   end
  667.   
  668.   def spd
  669.     SHIINA::IMAGE_SLIDE_SPD
  670.   end
  671.   
  672.   def set(x=self.x, y=self.y)
  673.     self.x = x
  674.     self.y = y
  675.     @nx = x
  676.     @ny = y
  677.   end
  678.   
  679.   def setn(x=self.x, y=self.y)
  680.     @nx = x
  681.     @ny = y
  682.   end
  683.   
  684.   def update
  685.     super
  686.     return if SHIINA::LOCK_IMAGE
  687.     update_slide
  688.   end
  689.   
  690.   def slide_over?
  691.     return (self.x==@nx && self.y=@ny)
  692.   end
  693.   
  694.   def update_slide
  695.     self.opacity += 20 unless SHIINA::LOCK_IMAGE
  696.     return if slide_over?
  697.     if self.x + spd < @nx
  698.       self.x += spd
  699.     elsif self.x - spd > @nx
  700.       self.x -= spd
  701.     elsif self.x != @nx
  702.       self.x = @nx
  703.     end
  704.     if self.y + spd < @ny
  705.       self.y += spd
  706.     elsif self.y - spd > @ny
  707.       self.y -= spd
  708.     elsif self.y != @ny
  709.       self.y = @ny
  710.     end
  711.   end
  712.   
  713. end

  714. #----------------------立绘部分结束----------------------#
复制代码
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
10
星屑
39440
在线时间
1914 小时
注册时间
2010-11-14
帖子
3315

R考场第七期纪念奖

6
发表于 2018-12-3 14:14:57 | 只看该作者
本帖最后由 KB.Driver 于 2018-12-3 14:17 编辑

改了一下窗口位置。





把这段脚本复制了插入就行
RUBY 代码复制
  1. class Scene_Menu < Scene_MenuBase  #--------------------------------------------------------------------------
  2.   # ● 生成指令窗口
  3.   #--------------------------------------------------------------------------
  4.   def create_command_window
  5.     @command_window = Window_MenuCommand.new
  6.     @command_window.y = SHIINA::GOLD ?
  7.                         @gold_window.y - @command_window.height :
  8.                         Graphics.height - @command_window.height
  9.     #==================================================================改动
  10.     @command_window.y -= 0
  11.     @command_window.x = @command_window.width
  12.     #==================================================================
  13.     @command_window.set_handler(:item,      method(:command_item))
  14.     @command_window.set_handler(:formation, method(:command_formation)) if SHIINA::FORMATION
  15.     @command_window.set_handler(:save,      method(:command_save))
  16.     @command_window.set_handler(:game_end,  method(:command_game_end))
  17.     @command_window.set_handler(:cancel,    method(:return_scene))
  18.     @command_window.set_handler(:pageup,    method(:prev_actor))
  19.     @command_window.set_handler(:pagedown,  method(:next_actor))
  20.     # 立绘塞进指令窗口
  21.     @command_window.image = @image
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ● 生成金钱窗口
  25.   #--------------------------------------------------------------------------
  26.   def create_gold_window
  27.     @gold_window = Window_Gold.new
  28.     @gold_window.x = 0
  29.     @gold_window.y = Graphics.height - @gold_window.height
  30.     #==================================================================改动
  31.     @gold_window.y -= 200
  32.     @gold_window.x = 160
  33.     #==================================================================
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 生成物品窗口
  37.   #--------------------------------------------------------------------------
  38.   def create_item_window
  39.     item_window_y      = @category_window.y + (SHIINA::ITEM_TYPE ? @category_window.height : 0)
  40.     item_window_height = Graphics.height - item_window_y - (Graphics.height - @command_window.y)
  41.     #==================================================================改动
  42.     item_window_height = Graphics.height - item_window_y
  43.     #==================================================================
  44.     @item_window = Window_ItemList.new(@category_window.x, item_window_y, @command_window.width, item_window_height)
  45.     @item_window.viewport = @viewport
  46.     @item_window.help_window = @help_window
  47.     @item_window.deactivate
  48.     @item_window.visible = false
  49.     @item_window.set_handler(:ok,     method(:on_item_ok))
  50.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  51.     @category_window.item_window = @item_window
  52.   end
  53. end

点评

有用就好w  发表于 2018-12-3 19:39
谢谢大佬  发表于 2018-12-3 19:28

评分

参与人数 2星屑 +20 +1 收起 理由
VIPArcher + 20 认可答案
864942354 + 1 认可答案

查看全部评分

用头画头像,用脚写脚本
回复 支持 1 反对 0

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-19 11:25

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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