| 赞 | 91 |
| VIP | |
| 好人卡 | |
| 积分 | 104 |
| 经验 | |
| 最后登录 | 2024-6-24 |
| 在线时间 | 5019 小时 |
无限の剣制
- 梦石
- 0
- 星屑
- 10445
- 在线时间
- 5019 小时
- 注册时间
- 2013-2-28
- 回帖
- 4942
 
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 VIPArcher 于 2019-1-14 00:22 编辑
效果如图
光标移过后消除 new 图标
脚本中使用到的图标素材(素材放到\Graphics\System文件夹下):
NewIcon.png
[fold=脚本内容]
[pre lang="ruby"]#===============================================================================
# ■ 新获得道具提示
# by :VIPArcher [email: VIPArcher@sina.com]
# -- Project1 论坛:https://rpg.blue/ 使用或转载请保留以上信息。
#==============================================================================
# ■ 使用说明:
# 使新获得的道具在物品栏列表中添加一个 New 的小图标
# 可以使用自定素材或者 Icon 里的图标
#==============================================================================
$VIPArcherScript ||= {};$VIPArcherScript[:new_item] = 20181226
#==============================================================================
# ★ 设定部分 ★
#==============================================================================
module VIPArcher end
module VIPArcher::NEW_ITEM
# 配置部分
Icon = "NewIcon" # 125
# 注:Icon 填文件名使用对应文件,填数字则使用 IconSet 对应位置的图标
Switch = 0 # 该开关开启时获得新道具不做记录
Icon_X = 0 # New图标相对位置的 X 坐标偏移
Icon_Y = 0 # New图标相对位置的 Y 坐标偏移
# 配置结束
end
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● 初始化新获得道具列表
#--------------------------------------------------------------------------
alias new_icon_init_all_items init_all_items
def init_all_items
new_icon_init_all_items
@new_icon_list = { RPG::Item => [],RPG::Armor => [],RPG::Weapon => [] }
end
#--------------------------------------------------------------------------
# ● 设置新获得道具
#--------------------------------------------------------------------------
def set_new_icon(item)
return unless item
return if item_is_new?(item)
@new_icon_list[item.class].push(item.id)
end
#--------------------------------------------------------------------------
# ● 移除新道具
#--------------------------------------------------------------------------
def remove_new_icon(item)
return unless item
@new_icon_list[item.class].delete(item.id)
end
#--------------------------------------------------------------------------
# ● 是否新道具
#--------------------------------------------------------------------------
def item_is_new?(item)
return unless item
@new_icon_list[item.class].include?(item.id)
end
#--------------------------------------------------------------------------
# ● 获取道具时设置 Icon 标志
#--------------------------------------------------------------------------
alias new_icon_gain_item gain_item
def gain_item(item, amount, include_equip = false)
new_icon_gain_item(item, amount, include_equip)
return if $game_switches[VIPArcher::NEW_ITEM::Switch]
set_new_icon(item) if amount > 0
end
end
class Window_ItemList < Window_Selectable
include VIPArcher::NEW_ITEM
#--------------------------------------------------------------------------
# ● 绘制新获得道具 Icon
#--------------------------------------------------------------------------
def draw_item_new_flag(rect, item)
if (Icon.is_a?(Integer))
draw_icon(Icon, rect.x + Icon_X, rect.y + Icon_Y, enable?(item))
else
bitmap = Cache.system(Icon)
contents.blt(rect.x + Icon_X, rect.y + Icon_Y, bitmap, bitmap.rect,
enable?(item) ? 255 : translucent_alpha)
end
end
#--------------------------------------------------------------------------
# ● 绘制项目
#--------------------------------------------------------------------------
alias new_icon_draw_item draw_item
def draw_item(index)
new_icon_draw_item(index)
item = @data[index]
return unless item && $game_party.item_is_new?(item)
rect = item_rect(index)
rect.width -= 4
draw_item_new_flag(rect, item)
end
#--------------------------------------------------------------------------
# ● 移除新道具 Icon
#--------------------------------------------------------------------------
def remove_new_icon(item)
return unless $game_party.item_is_new?(item)
$game_party.remove_new_icon(item)
redraw_item(@index)
end
#--------------------------------------------------------------------------
# ● 光标滑过移除 New Icon 标志
#--------------------------------------------------------------------------
def index=(index)
remove_new_icon(@data[@index]) unless @index < 0
super
end
#--------------------------------------------------------------------------
# ● 确定时消除 New Icon 标志
#--------------------------------------------------------------------------
def call_ok_handler
super
remove_new_icon(@data[@index])
end
end
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 交换物品(修正替换装备也提示 New)
#--------------------------------------------------------------------------
alias new_icon_trade_item_with_party trade_item_with_party
def trade_item_with_party(new_item, old_item)
result = new_icon_trade_item_with_party(new_item, old_item)
$game_party.remove_new_icon(old_item)
return result
end
end[/pre][/fold] |
评分
-
查看全部评分
|