查看: 3333|回复: 8

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

[复制链接]
梦石
0
星屑
2578
在线时间
63 小时
注册时间
2016-3-19
回帖
6
发表于 2018-12-3 13:25:49 | 显示全部楼层 |阅读模式

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

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

×
我用了立绘脚本,自己稍微修改了下,但窗口位置不知道在哪改,求指教
QQ截图20181203132012.png
梦石
0
星屑
2578
在线时间
63 小时
注册时间
2016-3-19
回帖
6
 楼主| 发表于 2018-12-3 13:26:24 | 显示全部楼层
本帖最后由 VIPArcher 于 2019-1-8 23:59 编辑

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

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


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

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



  228. #==============================================================================
  229. # ■ Scene_Menu
  230. #==============================================================================

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

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



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

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

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

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

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

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

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

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

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

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


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

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

  715. #----------------------立绘部分结束----------------------#
复制代码

回复

使用道具 举报

梦石
10
星屑
39550
在线时间
1919 小时
注册时间
2010-11-14
回帖
3214

R考场第七期纪念奖

发表于 2018-12-3 13:26:49 | 显示全部楼层
麻烦贴一下脚本。
一般窗口的位置是初始化的时候就有了
用头画头像,用脚写脚本
回复

使用道具 举报

梦石
0
星屑
2578
在线时间
63 小时
注册时间
2016-3-19
回帖
6
 楼主| 发表于 2018-12-3 13:28:29 | 显示全部楼层
KB.Driver 发表于 2018-12-3 13:26
麻烦贴一下脚本。
一般窗口的位置是初始化的时候就有了

贴了,麻烦大佬了

点评

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

使用道具 举报

梦石
0
星屑
2578
在线时间
63 小时
注册时间
2016-3-19
回帖
6
 楼主| 发表于 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. #----------------------立绘部分结束----------------------#
复制代码
回复

使用道具 举报

梦石
10
星屑
39550
在线时间
1919 小时
注册时间
2010-11-14
回帖
3214

R考场第七期纪念奖

发表于 2018-12-3 14:14:57 | 显示全部楼层
本帖最后由 KB.Driver 于 2018-12-3 14:17 编辑

改了一下窗口位置。

QQ截图20181203141422.png

QQ截图20181203141354.png

把这段脚本复制了插入就行
  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

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部