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

Project1

 找回密码
 注册会员
搜索
查看: 3459|回复: 6

[已经解决] 帮忙实现这些功能

[复制链接]

Lv4.逐梦者

【欧皇】

梦石
3
星屑
2021
在线时间
1004 小时
注册时间
2013-8-19
帖子
3486

开拓者

发表于 2016-2-29 12:35:06 | 显示全部楼层 |阅读模式
3星屑
本帖最后由 欧买歌 于 2016-3-6 11:10 编辑

1.可以更改人物色调,我想弄人物瞬移,瞬移之前人物变黑,瞬移之后人物色调恢复正常。
兼容角色换装脚本V3.2
2.角色换装脚本V3.2也显示装饰品
3.给人物描边,层数由某变量决定,每一层描边也都可以决定透明度
4.可以在脚本编辑器里,为地图添加事件(可选)



角色换装脚本V3.2
   

最佳答案

查看完整内容

需求1和2完成 [*]稍微优化了一下分割定义1的代码, 增加了饰品(鞋子)部位描绘(具体见分割定义1里面的【set_tyrn_z】方法的注释), 修正了装备没设定套装图片名字会弹错的BUG。 [*]增加了分割定义3,建议保留而不是搬运进前两个分割定义,方便以后做扩展啥的。 更改合成方式的话通过【事件》设置移动方式(主角)》脚本:change_blend(合成方式0~2)】具体见范例NPC。 此外,描边问题除了通过叠精灵的方式没想到其他办法,但是 ...

点评

http://rm.66rpg.com/thread-389949-1-1.html鞋子即装饰品  发表于 2016-3-6 13:10
提供一下图像资源或者最好提供一个工程吧……只有代码要自己弄图像心好累……  发表于 2016-3-6 12:51
QQ:2223942063
Q群:365819625
贪吃方1.4

Lv4.逐梦者

「Pemercyia」


Urhurrenna

梦石
0
星屑
9335
在线时间
2745 小时
注册时间
2008-9-5
帖子
3540

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

发表于 2016-2-29 12:35:07 | 显示全部楼层
本帖最后由 cinderelmini 于 2016-3-6 17:55 编辑

需求1和2完成
  • 稍微优化了一下分割定义1的代码,
    增加了饰品(鞋子)部位描绘(具体见分割定义1里面的【set_tyrn_z】方法的注释),
    修正了装备没设定套装图片名字会弹错的BUG。
  • 增加了分割定义3,建议保留而不是搬运进前两个分割定义,方便以后做扩展啥的。
    更改合成方式的话通过【事件》设置移动方式(主角)》脚本:change_blend(合成方式0~2)】具体见范例NPC。
此外,描边问题除了通过叠精灵的方式没想到其他办法,但是这个方式……(窝不说什么了……)
范例: 换装.zip (232.1 KB, 下载次数: 93)
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
200
在线时间
7 小时
注册时间
2016-2-27
帖子
9
发表于 2016-2-29 21:18:54 | 显示全部楼层
其实这里面的角色换装系统可以用公共事件代替的

评分

参与人数 1星屑 +20 收起 理由
欧买歌 + 20 我画了几十装,你告诉我用公共事件要多少条.

查看全部评分

回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
200
在线时间
7 小时
注册时间
2016-2-27
帖子
9
发表于 2016-3-2 19:25:12 | 显示全部楼层
霜炎寒冬 发表于 2016-2-29 21:18
其实这里面的角色换装系统可以用公共事件代替的

- -看自己的喜好
回复

使用道具 举报

Lv4.逐梦者

【欧皇】

梦石
3
星屑
2021
在线时间
1004 小时
注册时间
2013-8-19
帖子
3486

开拓者

 楼主| 发表于 2016-3-18 12:11:48 | 显示全部楼层
cinderelmini 发表于 2016-2-29 12:35
需求1和2完成
  • 稍微优化了一下分割定义1的代码,

  • 使用过程中发现问题
    1.     # 位置说明:0=行走图,1=武器,2=盾,3=帽,4=衣,5=饰品
    2.     # 描绘的z层次设置,数组里越往前叠在越底下
    3.     @turn_z << [0, 5, 4, 1, 3, 2]  # 面向下
    4.     @turn_z << [1, 0, 5, 4, 3, 2]  # 面向左
    5.     @turn_z << [0, 2, 5, 4, 3, 1]  # 面向右
    6.     @turn_z << [2, 1, 0, 5, 3, 4]  # 面向上
    复制代码
    我按此设置之后,向上时盾仍显示在行走图之上
    QQ:2223942063
    Q群:365819625
    贪吃方1.4
    回复

    使用道具 举报

    Lv4.逐梦者

    「Pemercyia」


    Urhurrenna

    梦石
    0
    星屑
    9335
    在线时间
    2745 小时
    注册时间
    2008-9-5
    帖子
    3540

    开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

    发表于 2016-3-18 13:33:34 | 显示全部楼层
    本帖最后由 cinderelmini 于 2016-3-18 13:35 编辑

    QQ截图20160318133235.png
    fghjnfgh.gif dsfsdfsdf.gif
    所以问题到底是?
    回复

    使用道具 举报

    Lv1.梦旅人

    梦石
    0
    星屑
    50
    在线时间
    133 小时
    注册时间
    2016-4-28
    帖子
    210
    发表于 2016-9-3 08:22:52 | 显示全部楼层
    大大 能不能看看这个问题
          设置的合成物品能不能不要每个事件都是设定好的那些合成商品  比如第一个城 合成只能合成小刀  第2个城市的合成商人 不是那些原来的东西
           01.#==============================================================================

    02.# ■ RGSS3 合成 ver 1.01

    03.#------------------------------------------------------------------------------

    04.#  配布元:

    05.#     白の魔 http://izumiwhite.web.fc2.com/

    06.#

    07.#  利用規約:

    08.#     RPGツクールVXの正規の登録者のみご利用になれます。

    09.#     利用報告・著作権表示とかは必要ありません。

    10.#     改造もご自由にどうぞ。

    11.#     何か問題が発生しても責任は持ちません。

    12.#==============================================================================

    13.

    14.

    15.#--------------------------------------------------------------------------

    16.# ★ 初期設定。

    17.#    设定合成配方等

    18.#--------------------------------------------------------------------------

    19.module WD_itemsynthesis_ini

    20.

    21.  Cost_view =  false # 是否显示合成费用(合成费用全部是0的情况推荐改成false)

    22.

    23.  Category_i = true # 分类窗口显示是否显示「物品」项目

    24.  Category_w = true # 分类窗口显示是否显示「武器」项目

    25.  Category_a = true # 分类窗口显示是否显示「防具」项目

    26.  Category_k = true # 分类窗口显示是否显示「贵重物品」项目

    27.

    28.  I_recipe = [] # 这行不能删

    29.  W_recipe = [] # 这行不能删

    30.  A_recipe = [] # 这行不能删

    31.

    32.  # 在这下面开始设置合成配方。

    33.  # 例: I_recipe[3] = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]

    34.  # 像↑这样设置的情况,合成ID为3的【物品】所需要的花费是:100G。

    35.  # 所需要的素材是:ID为1的【物品】一件、ID为2的【武器】1件、ID为2的【防具】2件、ID为3的【防具】1件。

    36.  

    37.  # 此外,等号左边的名词:I_recipe是【物品】,W_recipe是【武器】,A_recipe是【防具】

    38.  # 等号右边的数组里面,"I"是【物品】,"W"是【武器】,"A"【防具】

    39.

    40.  # 这里下面几个是默认的几个公式,可以删除或者修改。

    41.  # 【物品】合成配方在下方开始设定:

    42.  I_recipe[1]  = [10,  ["I",2,2]]

    43.  

    44.  # 【武器】合成配方在下方开始设定:

    45.  W_recipe[5]   =   [100, ["I",45,15],["I",48,1]]

    46.

    47.

    48.  # 【防具】合成配方在下方开始设定:

    49.  A_recipe[2]  = [40,   ["A",1,2]]

    50.

    51.  

    52.  

    53.  

    54.end # 全部配方设定在这行之上,请勿写在此行以下。

    55.

    56.

    57.#==============================================================================

    58.# ■ WD_itemsynthesis

    59.#------------------------------------------------------------------------------

    60.#  物品合成相关的通用方法。

    61.#==============================================================================

    62.

    63.module WD_itemsynthesis

    64.  def i_recipe_switch_on(id)

    65.    $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil

    66.    $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil

    67.    $game_system.i_rcp_sw[id] = true

    68.  end

    69.  def i_recipe_switch_off(id)

    70.    $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil

    71.    $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil

    72.    $game_system.i_rcp_sw[id] = false

    73.  end

    74.  def i_recipe_switch_on?(id)

    75.    $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil

    76.    $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil

    77.    return $game_system.i_rcp_sw[id]

    78.  end

    79.  def i_recipe_all_switch_on

    80.    for i in 1..$data_items.size

    81.      i_recipe_switch_on(i)

    82.    end

    83.  end

    84.  def i_recipe_all_switch_off

    85.    for i in 1..$data_items.size

    86.      i_recipe_switch_off(i)

    87.    end

    88.  end

    89.  def w_recipe_switch_on(id)

    90.    $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil

    91.    $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil

    92.    $game_system.w_rcp_sw[id] = true

    93.  end

    94.  def w_recipe_switch_off(id)

    95.    $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil

    96.    $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil

    97.    $game_system.w_rcp_sw[id] = false

    98.  end

    99.  def w_recipe_switch_on?(id)

    100.    $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil

    101.    $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil

    102.    return $game_system.w_rcp_sw[id]

    103.  end

    104.  def w_recipe_all_switch_on

    105.    for i in 1..$data_weapons.size

    106.      w_recipe_switch_on(i)

    107.    end

    108.  end

    109.  def w_recipe_all_switch_off

    110.    for i in 1..$data_weapons.size

    111.      w_recipe_switch_off(i)

    112.    end

    113.  end

    114.  def a_recipe_switch_on(id)

    115.    $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil

    116.    $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil

    117.    $game_system.a_rcp_sw[id] = true

    118.  end

    119.  def a_recipe_switch_off(id)

    120.    $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil

    121.    $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil

    122.    $game_system.a_rcp_sw[id] = false

    123.  end

    124.  def a_recipe_switch_on?(id)

    125.    $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil

    126.    $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil

    127.    return $game_system.a_rcp_sw[id]

    128.  end

    129.  def a_recipe_all_switch_on

    130.    for i in 1..$data_armors.size

    131.      a_recipe_switch_on(i)

    132.    end

    133.  end

    134.  def a_recipe_all_switch_off

    135.    for i in 1..$data_armors.size

    136.      a_recipe_switch_off(i)

    137.    end

    138.  end

    139.  def recipe_all_switch_on

    140.    i_recipe_all_switch_on

    141.    w_recipe_all_switch_on

    142.    a_recipe_all_switch_on

    143.  end

    144.  def recipe_all_switch_off

    145.    i_recipe_all_switch_off

    146.    w_recipe_all_switch_off

    147.    a_recipe_all_switch_off

    148.  end

    149.

    150.end

    151.

    152.class Game_Interpreter

    153.  include WD_itemsynthesis

    154.end

    155.

    156.class Game_System

    157.  #--------------------------------------------------------------------------

    158.  # ● 公开实例变量

    159.  #--------------------------------------------------------------------------

    160.  attr_accessor :i_rcp_sw

    161.  attr_accessor :w_rcp_sw

    162.  attr_accessor :a_rcp_sw

    163.  #--------------------------------------------------------------------------

    164.  # ● 初始化

    165.  #--------------------------------------------------------------------------

    166.  alias wd_orig_initialize004 initialize

    167.  def initialize

    168.    wd_orig_initialize004

    169.    @i_rcp_sw = []

    170.    @w_rcp_sw = []

    171.    @a_rcp_sw = []

    172.  end

    173.end

    174.

    175.

    176.#==============================================================================

    177.# ■ Scene_ItemSynthesis

    178.#------------------------------------------------------------------------------

    179.#  执行物品合成的界面。

    180.#==============================================================================

    181.

    182.class Scene_ItemSynthesis < Scene_MenuBase

    183.  #--------------------------------------------------------------------------

    184.  # ● 開始処理

    185.  #--------------------------------------------------------------------------

    186.  def start

    187.    super

    188.    create_help_window

    189.    create_dummy_window

    190.    create_number_window

    191.    create_status_window

    192.    create_material_window

    193.    create_list_window

    194.    create_category_window

    195.    create_gold_window

    196.    create_change_window

    197.  end

    198.  #--------------------------------------------------------------------------

    199.  # ● 建立金钱窗口

    200.  #--------------------------------------------------------------------------

    201.  def create_gold_window

    202.    @gold_window = Window_Gold.new

    203.    @gold_window.viewport = @viewport

    204.    @gold_window.x = Graphics.width - @gold_window.width

    205.    @gold_window.y = @help_window.height

    206.    @gold_window.hide

    207.  end

    208.  #--------------------------------------------------------------------------

    209.  # ● 建立交换窗口

    210.  #--------------------------------------------------------------------------

    211.  def create_change_window

    212.    wx = 0

    213.    wy = @gold_window.y

    214.    ww = Graphics.width - @gold_window.width

    215.    wh = @gold_window.height

    216.    @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)

    217.    @change_window.viewport = @viewport

    218.    @change_window.hide

    219.  end

    220.  #--------------------------------------------------------------------------

    221.  # ● 建立底部大框窗口

    222.  #--------------------------------------------------------------------------

    223.  def create_dummy_window

    224.    wy = @help_window.y + @help_window.height + 48

    225.    wh = Graphics.height - wy

    226.    @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)

    227.    @dummy_window.viewport = @viewport

    228.  end

    229.  #--------------------------------------------------------------------------

    230.  # ● 建立数值输入窗口

    231.  #--------------------------------------------------------------------------

    232.  def create_number_window

    233.    wy = @dummy_window.y

    234.    wh = @dummy_window.height

    235.    @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)

    236.    @number_window.viewport = @viewport

    237.    @number_window.hide

    238.    @number_window.set_handler(:ok,     method(:on_number_ok))

    239.    @number_window.set_handler(:cancel, method(:on_number_cancel))

    240.  end

    241.  #--------------------------------------------------------------------------

    242.  # ● 建立商店信息窗口

    243.  #--------------------------------------------------------------------------

    244.  def create_status_window

    245.    wx = @number_window.width

    246.    wy = @dummy_window.y

    247.    ww = Graphics.width - wx

    248.    wh = @dummy_window.height

    249.    @status_window = Window_ShopStatus.new(wx, wy, ww, wh)

    250.    @status_window.viewport = @viewport

    251.    @status_window.hide

    252.  end

    253.  #--------------------------------------------------------------------------

    254.  # ● 建立素材窗口

    255.  #--------------------------------------------------------------------------

    256.  def create_material_window

    257.    wx = @number_window.width

    258.    wy = @dummy_window.y

    259.    ww = Graphics.width - wx

    260.    wh = @dummy_window.height

    261.    @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)

    262.    @material_window.viewport = @viewport

    263.    @material_window.hide

    264.    @number_window.material_window = @material_window

    265.  end

    266.  #--------------------------------------------------------------------------

    267.  # ● 建立物品合成列表窗口

    268.  #--------------------------------------------------------------------------

    269.  def create_list_window

    270.    wy = @dummy_window.y

    271.    wh = @dummy_window.height

    272.    @list_window = Window_ItemSynthesisList.new(0, wy, wh)

    273.    @list_window.viewport = @viewport

    274.    @list_window.help_window = @help_window

    275.    @list_window.status_window = @status_window

    276.    @list_window.material_window = @material_window

    277.    @list_window.hide

    278.    @list_window.set_handler(:ok,     method(:on_list_ok))

    279.    @list_window.set_handler(:cancel, method(:on_list_cancel))

    280.    @list_window.set_handler(:change_window, method(:on_change_window))   

    281.  end

    282.  #--------------------------------------------------------------------------

    283.  # ● 建立物品分类窗口

    284.  #--------------------------------------------------------------------------

    285.  def create_category_window

    286.    @category_window = Window_ItemSynthesisCategory.new

    287.    @category_window.viewport = @viewport

    288.    @category_window.help_window = @help_window

    289.    @category_window.y = @help_window.height

    290.    @category_window.activate

    291.    @category_window.item_window = @list_window

    292.    @category_window.set_handler(:ok,     method(:on_category_ok))

    293.    @category_window.set_handler(:cancel, method(:return_scene))

    294.  end

    295.  

    296.  #--------------------------------------------------------------------------

    297.  # ● 界面返回

    298.  #--------------------------------------------------------------------------

    299.  def return_scene

    300.    $game_map.autoplay

    301.    SceneManager.return

    302.  end

    303.

    304.  #--------------------------------------------------------------------------

    305.  # ● 合成アイテムリストウィンドウのアクティブ化

    306.  #--------------------------------------------------------------------------

    307.  def activate_list_window

    308.    @list_window.money = money

    309.    @list_window.show.activate

    310.  end

    311.  #--------------------------------------------------------------------------

    312.  # ● 合成[決定]

    313.  #--------------------------------------------------------------------------

    314.  def on_list_ok

    315.    @item = @list_window.item

    316.    @list_window.hide

    317.    @number_window.set(@item, max_buy, buying_price, currency_unit)

    318.    @number_window.show.activate

    319.  end

    320.  #--------------------------------------------------------------------------

    321.  # ● 合成[キャンセル]

    322.  #--------------------------------------------------------------------------

    323.  def on_list_cancel

    324.    @category_window.activate

    325.    @category_window.show

    326.    @dummy_window.show

    327.    @list_window.hide

    328.    @status_window.hide

    329.    @status_window.item = nil

    330.    @material_window.hide

    331.    @material_window.set(nil, nil)

    332.    @gold_window.hide

    333.    @change_window.hide

    334.    @help_window.clear

    335.  end

    336.  #--------------------------------------------------------------------------

    337.  # ● 表示切替

    338.  #--------------------------------------------------------------------------

    339.  def on_change_window

    340.    if @status_window.visible

    341.      @status_window.hide

    342.      @material_window.show

    343.    else

    344.      @status_window.show

    345.      @material_window.hide

    346.    end

    347.  end

    348.  #--------------------------------------------------------------------------

    349.  # ● カテゴリ[決定]

    350.  #--------------------------------------------------------------------------

    351.  def on_category_ok

    352.    activate_list_window

    353.    @gold_window.show

    354.    @change_window.show

    355.    @material_window.show

    356.    @category_window.hide

    357.    @list_window.select(0)

    358.  end

    359.  #--------------------------------------------------------------------------

    360.  # ● 個数入力[決定]

    361.  #--------------------------------------------------------------------------

    362.  def on_number_ok

    363.    Sound.play_shop

    364.    do_syntetic(@number_window.number)

    365.    end_number_input

    366.    @gold_window.refresh

    367.  end

    368.  #--------------------------------------------------------------------------

    369.  # ● 個数入力[キャンセル]

    370.  #--------------------------------------------------------------------------

    371.  def on_number_cancel

    372.    Sound.play_cancel

    373.    end_number_input

    374.  end

    375.  #--------------------------------------------------------------------------

    376.  # ● 合成の実行

    377.  #--------------------------------------------------------------------------

    378.  def do_syntetic(number)

    379.    $game_party.lose_gold(number * buying_price)

    380.    $game_party.gain_item(@item, number)

    381.    @recipe = @list_window.recipe(@item)

    382.    for i in [email protected]

    383.      kind = @recipe[0]

    384.      id   = @recipe[1]

    385.      num  = @recipe[2]

    386.      if kind == "I"

    387.        item = $data_items[id]

    388.      elsif kind == "W"

    389.        item = $data_weapons[id]

    390.      elsif kind == "A"

    391.        item = $data_armors[id]

    392.      end

    393.      $game_party.lose_item(item, num * number)

    394.    end

    395.  end

    396.  #--------------------------------------------------------------------------

    397.  # ● 個数入力の終了

    398.  #--------------------------------------------------------------------------

    399.  def end_number_input

    400.    @number_window.hide

    401.    activate_list_window

    402.  end

    403.  #--------------------------------------------------------------------------

    404.  # ● 最大購入可能個数の取得

    405.  #--------------------------------------------------------------------------

    406.  def max_buy

    407.    max = $game_party.max_item_number(@item) - $game_party.item_number(@item)

    408.

    409.    @recipe = @list_window.recipe(@item)

    410.    for i in [email protected]

    411.      kind = @recipe[0]

    412.      id   = @recipe[1]

    413.      num  = @recipe[2]

    414.      if kind == "I"

    415.        item = $data_items[id]

    416.      elsif kind == "W"

    417.        item = $data_weapons[id]

    418.      elsif kind == "A"

    419.        item = $data_armors[id]

    420.      end

    421.      if num > 0

    422.        max_buf = $game_party.item_number(item)/num

    423.      else

    424.        max_buf = 999

    425.      end

    426.      max = [max, max_buf].min

    427.    end

    428.    buying_price == 0 ? max : [max, money / buying_price].min

    429.

    430.  end

    431.  #--------------------------------------------------------------------------

    432.  # ● 所持金の取得

    433.  #--------------------------------------------------------------------------

    434.  def money

    435.    @gold_window.value

    436.  end

    437.  #--------------------------------------------------------------------------

    438.  # ● 通貨単位の取得

    439.  #--------------------------------------------------------------------------

    440.  def currency_unit

    441.    @gold_window.currency_unit

    442.  end

    443.  #--------------------------------------------------------------------------

    444.  # ● 合成費用の取得

    445.  #--------------------------------------------------------------------------

    446.  def buying_price

    447.    @list_window.price(@item)

    448.  end

    449.end

    450.

    451.

    452.#==============================================================================

    453.# ■ Window_ItemSynthesisList

    454.#------------------------------------------------------------------------------

    455.#  合成画面で、合成可能なアイテムの一覧を表示するウィンドウです。

    456.#==============================================================================

    457.

    458.class Window_ItemSynthesisList < Window_Selectable

    459.  include WD_itemsynthesis

    460.  #--------------------------------------------------------------------------

    461.  # ● 公開インスタンス変数

    462.  #--------------------------------------------------------------------------

    463.  attr_reader   :status_window            # ステータスウィンドウ

    464.  #--------------------------------------------------------------------------

    465.  # ● オブジェクト初期化

    466.  #--------------------------------------------------------------------------

    467.  def initialize(x, y, height)

    468.    super(x, y, window_width, height)

    469.

    470.    @shop_goods = []

    471.    @shop_recipes = []

    472.

    473.    for i in 1..WD_itemsynthesis_ini::I_recipe.size

    474.      recipe = WD_itemsynthesis_ini::I_recipe

    475.      if recipe

    476.        good = [0, i, recipe[0]]

    477.        if i_recipe_switch_on?(i)

    478.          @shop_goods.push(good)

    479.          @shop_recipes.push(recipe)

    480.        end

    481.      end

    482.    end

    483.    for i in 1..WD_itemsynthesis_ini::W_recipe.size

    484.      recipe = WD_itemsynthesis_ini::W_recipe

    485.      if recipe

    486.        good = [1, i, recipe[0]]

    487.        if w_recipe_switch_on?(i)

    488.          @shop_goods.push(good)

    489.          @shop_recipes.push(recipe)

    490.        end

    491.      end

    492.    end

    493.    for i in 1..WD_itemsynthesis_ini::A_recipe.size

    494.      recipe = WD_itemsynthesis_ini::A_recipe

    495.      if recipe

    496.        good = [2, i, recipe[0]]

    497.        if a_recipe_switch_on?(i)

    498.          @shop_goods.push(good)

    499.          @shop_recipes.push(recipe)

    500.        end

    501.      end

    502.    end

    503.

    504.    @Money = 0

    505.    refresh

    506.    select(0)

    507.  end

    508.  #--------------------------------------------------------------------------

    509.  # ● ウィンドウ幅の取得

    510.  #--------------------------------------------------------------------------

    511.  def window_width

    512.    return 304

    513.  end

    514.  #--------------------------------------------------------------------------

    515.  # ● 項目数の取得

    516.  #--------------------------------------------------------------------------

    517.  def item_max

    518.    @data ? @data.size : 1

    519.  end

    520.  #--------------------------------------------------------------------------

    521.  # ● アイテムの取得

    522.  #--------------------------------------------------------------------------

    523.  def item

    524.    @data[index]

    525.  end

    526.  #--------------------------------------------------------------------------

    527.  # ● 所持金の設定

    528.  #--------------------------------------------------------------------------

    529.  def money=(money)

    530.    @Money = money

    531.    refresh

    532.  end

    533.  #--------------------------------------------------------------------------

    534.  # ● 選択項目の有効状態を取得

    535.  #--------------------------------------------------------------------------

    536.  def current_item_enabled?

    537.    enable?(@data[index])

    538.  end

    539.  #--------------------------------------------------------------------------

    540.  # ● 合成費用を取得

    541.  #--------------------------------------------------------------------------

    542.  def price(item)

    543.    @price[item]

    544.  end

    545.  #--------------------------------------------------------------------------

    546.  # ● 合成可否を取得

    547.  #--------------------------------------------------------------------------

    548.  def enable?(item)

    549.    @makable[item]

    550.  end

    551.  #--------------------------------------------------------------------------

    552.  # ● レシピを取得

    553.  #--------------------------------------------------------------------------

    554.  def recipe(item)

    555.    @recipe[item]

    556.  end

    557.  #--------------------------------------------------------------------------

    558.  # ● アイテムを許可状態で表示するかどうか

    559.  #--------------------------------------------------------------------------

    560.  def have_mat?(recipe)

    561.    flag = true

    562.    if @money >= recipe[0]

    563.      for i in 1...recipe.size

    564.        kind = recipe[0]

    565.        id   = recipe[1]

    566.        num  = recipe[2]

    567.        if kind == "I"

    568.          item = $data_items[id]

    569.        elsif kind == "W"

    570.          item = $data_weapons[id]

    571.        elsif kind == "A"

    572.          item = $data_armors[id]

    573.        end

    574.        if $game_party.item_number(item) < [num, 1].max

    575.          flag = false

    576.        end

    577.      end

    578.    else

    579.      flag = false

    580.    end

    581.    return flag

    582.  end

    583.  #--------------------------------------------------------------------------

    584.  # ● カテゴリの設定

    585.  #--------------------------------------------------------------------------

    586.  def category=(category)

    587.    return if @category == category

    588.    @category = category

    589.    refresh

    590.  end

    591.  #--------------------------------------------------------------------------

    592.  # ● リフレッシュ

    593.  #--------------------------------------------------------------------------

    594.  def refresh

    595.    make_item_list

    596.    create_contents

    597.    draw_all_items

    598.  end

    599.  #--------------------------------------------------------------------------

    600.  # ● アイテムをリストに含めるかどうか

    601.  #--------------------------------------------------------------------------

    602.  def include?(item)

    603.    case @category

    604.    when :item

    605.      item.is_a?(RPG::Item) && !item.key_item?

    606.    when :weapon

    607.      item.is_a?(RPG::Weapon)

    608.    when :armor

    609.      item.is_a?(RPG::Armor)

    610.    when :key_item

    611.      item.is_a?(RPG::Item) && item.key_item?

    612.    else

    613.      false

    614.    end

    615.  end

    616.  #--------------------------------------------------------------------------

    617.  # ● アイテムリストの作成

    618.  #--------------------------------------------------------------------------

    619.  def make_item_list

    620.    @data = []

    621.    @price = {}

    622.    @makable = {}

    623.    @recipe = {}

    624.    for i in 0...@shop_goods.size

    625.      goods = @shop_goods

    626.      recipe = @shop_recipes

    627.      case goods[0]

    628.      when 0;  item = $data_items[goods[1]]

    629.      when 1;  item = $data_weapons[goods[1]]

    630.      when 2;  item = $data_armors[goods[1]]

    631.      end

    632.      if item and include?(item)

    633.        @data.push(item)

    634.        @price[item] = goods[2]

    635.        @makable[item] = have_mat?(recipe)

    636.        @recipe[item] = recipe

    637.      end

    638.    end

    639.  end

    640.  #--------------------------------------------------------------------------

    641.  # ● 項目の描画

    642.  #--------------------------------------------------------------------------

    643.  def draw_item(index)

    644.    item = @data[index]

    645.    rect = item_rect(index)

    646.    draw_item_name(item, rect.x, rect.y, enable?(item))

    647.    rect.width -= 4

    648.    draw_text(rect, price(item), 2)  if WD_itemsynthesis_ini::Cost_view

    649.  end

    650.  #--------------------------------------------------------------------------

    651.  # ● ステータスウィンドウの設定

    652.  #--------------------------------------------------------------------------

    653.  def status_window=(status_window)

    654.    @status_window = status_window

    655.    call_update_help

    656.  end

    657.  #--------------------------------------------------------------------------

    658.  # ● 素材ウィンドウの設定

    659.  #--------------------------------------------------------------------------

    660.  def material_window=(material_window)

    661.    @material_window = material_window

    662.    call_update_help

    663.  end

    664.  #--------------------------------------------------------------------------

    665.  # ● ヘルプテキスト更新

    666.  #--------------------------------------------------------------------------

    667.  def update_help

    668.    @help_window.set_item(item) if @help_window

    669.    @status_window.item = item if @status_window

    670.    @material_window.set(item, recipe(item)) if @material_window

    671.  end

    672.  #--------------------------------------------------------------------------

    673.  # ● ←→ ボタン(表示切替)が押されたときの処理

    674.  #--------------------------------------------------------------------------

    675.  def process_change_window

    676.    Sound.play_cursor

    677.    Input.update

    678.    call_handler(:change_window)

    679.  end

    680.  #--------------------------------------------------------------------------

    681.  # ● 決定やキャンセルなどのハンドリング処理

    682.  #--------------------------------------------------------------------------

    683.  def process_handling

    684.    super

    685.    if active

    686.      return process_change_window if handle?(:change_window) && Input.trigger?(:RIGHT)

    687.      return process_change_window if handle?(:change_window) && Input.trigger?(:LEFT)

    688.    end

    689.  end

    690.end

    691.

    692.

    693.#==============================================================================

    694.# ■ Window_ItemSynthesisMaterial

    695.#------------------------------------------------------------------------------

    696.#  合成画面で、合成に必要な素材を表示するウィンドウです。

    697.#==============================================================================

    698.

    699.class Window_ItemSynthesisMaterial < Window_Base

    700.  #--------------------------------------------------------------------------

    701.  # ● オブジェクト初期化

    702.  #--------------------------------------------------------------------------

    703.  def initialize(x, y, width, height)

    704.    super(x, y, width, height)

    705.    @item = nil

    706.    refresh

    707.  end

    708.  #--------------------------------------------------------------------------

    709.  # ● リフレッシュ

    710.  #--------------------------------------------------------------------------

    711.  def refresh

    712.    contents.clear

    713.    draw_possession(4, 0)

    714.    draw_material_info(0, line_height * 2)

    715.  end

    716.  #--------------------------------------------------------------------------

    717.  # ● アイテムの設定

    718.  #--------------------------------------------------------------------------

    719.  def set(item, recipe)

    720.    @item = item

    721.    @recipe = recipe

    722.    @make_number = 1

    723.    refresh

    724.  end

    725.  #--------------------------------------------------------------------------

    726.  # ● 作成個数の設定

    727.  #--------------------------------------------------------------------------

    728.  def set_num(make_number)

    729.    @make_number = make_number

    730.    refresh

    731.  end

    732.  #--------------------------------------------------------------------------

    733.  # ● 所持数の描画

    734.  #--------------------------------------------------------------------------

    735.  def draw_possession(x, y)

    736.    rect = Rect.new(x, y, contents.width - 4 - x, line_height)

    737.    change_color(system_color)

    738.    draw_text(rect, Vocab::Possession)

    739.    change_color(normal_color)

    740.    draw_text(rect, $game_party.item_number(@item), 2)

    741.  end

    742.  #--------------------------------------------------------------------------

    743.  # ● 素材情報の描画

    744.  #--------------------------------------------------------------------------

    745.  def draw_material_info(x, y)

    746.    rect = Rect.new(x, y, contents.width, line_height)

    747.    change_color(system_color)

    748.    contents.font.size = 18

    749.    draw_text(rect, "必要素材", 0)

    750.    if @recipe

    751.      for i in [email protected]

    752.        kind = @recipe[0]

    753.        id   = @recipe[1]

    754.        num  = @recipe[2]

    755.        if kind == "I"

    756.          item = $data_items[id]

    757.        elsif kind == "W"

    758.          item = $data_weapons[id]

    759.        elsif kind == "A"

    760.          item = $data_armors[id]

    761.        end

    762.        rect = Rect.new(x, y + line_height*i, contents.width, line_height)

    763.        enabled = true

    764.        enabled = false if [num*@make_number, 1].max  > $game_party.item_number(item)

    765.        draw_item_name(item, rect.x, rect.y, enabled)

    766.        change_color(normal_color, enabled)

    767.        if num > 0

    768.          draw_text(rect, "#{num*@make_number}/#{$game_party.item_number(item)}", 2)

    769.        end

    770.      end

    771.    end

    772.    change_color(normal_color)

    773.    contents.font.size = 24

    774.  end

    775.end

    776.

    777.

    778.#==============================================================================

    779.# ■ Window_ItemSynthesisNumber

    780.#------------------------------------------------------------------------------

    781.#  合成画面で、合成するアイテムの個数を入力するウィンドウです。

    782.#==============================================================================

    783.

    784.class Window_ItemSynthesisNumber < Window_ShopNumber

    785.  #--------------------------------------------------------------------------

    786.  # ● リフレッシュ

    787.  #--------------------------------------------------------------------------

    788.  def refresh

    789.    contents.clear

    790.    draw_item_name(@item, 0, item_y)

    791.    draw_number

    792.    draw_total_price if WD_itemsynthesis_ini::Cost_view

    793.  end

    794.  #--------------------------------------------------------------------------

    795.  # ● オブジェクト初期化

    796.  #--------------------------------------------------------------------------

    797.  def material_window=(material_window)

    798.    @material_window = material_window

    799.    call_update_help

    800.  end

    801.  #--------------------------------------------------------------------------

    802.  # ● 作成個数の変更

    803.  #--------------------------------------------------------------------------

    804.  def change_number(amount)

    805.    @number = [[@number + amount, @max].min, 1].max

    806.    call_update_help #追加

    807.  end

    808.  #--------------------------------------------------------------------------

    809.  # ● ヘルプテキスト更新

    810.  #--------------------------------------------------------------------------

    811.  def call_update_help

    812.    @material_window.set_num(@number) if @material_window

    813.  end

    814.end

    815.

    816.

    817.#==============================================================================

    818.# ■ Window_ItemSynthesisCategory

    819.#------------------------------------------------------------------------------

    820.#  合成画面で、通常アイテムや装備品の分類を選択するウィンドウです。

    821.#==============================================================================

    822.

    823.class Window_ItemSynthesisCategory < Window_ItemCategory

    824.  #--------------------------------------------------------------------------

    825.  # ● 桁数の取得

    826.  #--------------------------------------------------------------------------

    827.  def col_max

    828.    i = 0

    829.    i += 1 if WD_itemsynthesis_ini::Category_i

    830.    i += 1 if WD_itemsynthesis_ini::Category_w

    831.    i += 1 if WD_itemsynthesis_ini::Category_a

    832.    i += 1 if WD_itemsynthesis_ini::Category_k

    833.    return i

    834.  end

    835.  #--------------------------------------------------------------------------

    836.  # ● コマンドリストの作成

    837.  #--------------------------------------------------------------------------

    838.  def make_command_list

    839.    add_command(Vocab::item,     :item)     if WD_itemsynthesis_ini::Category_i

    840.    add_command(Vocab::weapon,   :weapon)   if WD_itemsynthesis_ini::Category_w

    841.    add_command(Vocab::armor,    :armor)    if WD_itemsynthesis_ini::Category_a

    842.    add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k

    843.  end

    844.end

    845.

    846.

    847.#==============================================================================

    848.# ■ Window_ItemSynthesisNumber

    849.#------------------------------------------------------------------------------

    850.#  合成画面で、切替を表示するウィンドウです。

    851.#==============================================================================

    852.

    853.class Window_ItemSynthesisChange < Window_Base

    854.  #--------------------------------------------------------------------------

    855.  # ● オブジェクト初期化

    856.  #--------------------------------------------------------------------------

    857.  def initialize(x, y, width, height)

    858.    super(x, y, width, height)

    859.    refresh

    860.  end

    861.  #--------------------------------------------------------------------------

    862.  # ● リフレッシュ

    863.  #--------------------------------------------------------------------------

    864.  def refresh

    865.    contents.clear

    866.    text = "← → :显示转换"

    867.    draw_text(0, 0, contents_width, line_height, text, 1)

    868.  end

    869.end
    回复

    使用道具 举报

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

    本版积分规则

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

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

    GMT+8, 2024-3-29 14:21

    Powered by Discuz! X3.1

    © 2001-2013 Comsenz Inc.

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