查看: 2072|回复: 4

[已经解决] 求一个自定义图标脚本

[复制链接]
梦石
0
星屑
50
在线时间
251 小时
注册时间
2010-7-22
回帖
70
发表于 2015-4-8 10:01:44 | 显示全部楼层 |阅读模式

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

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

×
图标脚本最好可以自定义大小,我现在是在用平行幻想曲的脚本
梦石
0
星屑
723
在线时间
530 小时
注册时间
2010-6-9
回帖
668
发表于 2015-4-8 11:26:30 | 显示全部楼层
你说的图标是指所有的图标还是某一部分的图标,所有的图标可以通过默认脚本参数来修改。自己新系统或新绘制的内容举一反三。
回复

使用道具 举报

梦石
0
星屑
50
在线时间
251 小时
注册时间
2010-7-22
回帖
70
 楼主| 发表于 2015-4-9 20:39:07 | 显示全部楼层
负零 发表于 2015-4-8 11:26
你说的图标是指所有的图标还是某一部分的图标,所有的图标可以通过默认脚本参数来修改。自己新系统或新绘制 ...

我是说一部分,尽量不要太长。不然游戏太卡了
回复

使用道具 举报

梦石
0
星屑
70
在线时间
1083 小时
注册时间
2013-3-29
回帖
2158
发表于 2015-4-9 20:47:28 | 显示全部楼层
本帖最后由 黄濑凉太 于 2015-4-9 16:48 编辑
szcszc156 发表于 2015-4-9 16:39
我是说一部分,尽量不要太长。不然游戏太卡了
[pre lang="ruby"]#==============================================================================
#
# ▼ Yanfly Engine Ace - Command Window Icons v1.00
# -- Last Updated: 2011.12.11
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-CommandWindowIcons"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2011.12.11 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Here's a script that allows you to allocate icons to each of your commands
# provided that the text for the command matches the icon in the script. There
# are, however, some scripts that this won't be compatible with and it's due
# to them using unique way of drawing out their commands. This script does not
# maintain compatibility for those specific scripts.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# Go to the module and match the text under ICON_HASH with a proper Icon ID.
# You can find an icon's ID by opening up the icon select window in the RPG
# Maker VX Ace database and look in the lower left corner.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================

module YEA
  module COMMAND_WINDOW_ICONS
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Icon Hash -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This hash controls all of the icon data for what's used with each text
    # item. Any text items without icons won't display icons. The text has to
    # match with the hash (case sensitive) to display icons.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    ICON_HASH ={
    # Matching Text   => Icon ID,
    "道具"      => 2723,    # Title scene.
    "技能"      => 2736,
    "装备"      => 2718,
    "状态"      => 2737,
    "手册"      => 2715,
    "系统"      => 2739
    } # Do not remove this.
   
  end # COMMAND_WINDOW_ICONS
end # YEA

#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

#==============================================================================
# ■ Window_Command
#==============================================================================

class Window_Command < Window_Selectable
  
  #--------------------------------------------------------------------------
  # new method: use_icon?
  #--------------------------------------------------------------------------
  def use_icon?(text)
    return YEA::COMMAND_WINDOW_ICONS::ICON_HASH.include?(text)
  end
  
  #--------------------------------------------------------------------------
  # new method: command_icon
  #--------------------------------------------------------------------------
  def command_icon(text)
    return YEA::COMMAND_WINDOW_ICONS::ICON_HASH[text]
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    enabled = command_enabled?(index)
    change_color(normal_color, enabled)
    rect = item_rect_for_text(index)
    text = command_name(index)
    if use_icon?(text)
      draw_icon_text(rect.clone, text, alignment, enabled)
    else
      draw_text(rect, text, alignment)
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: draw_icon_text
  #--------------------------------------------------------------------------
  def draw_icon_text(rect, text, alignment, enabled)
    cw = text_size(text).width
    icon = command_icon(text)
    draw_icon(icon, rect.x, rect.y, enabled)
    rect.x += 24
    rect.width -= 24
    draw_text(rect, text, alignment)
  end
  
end # Window_Command

#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]
大约55行可以定义图标,很简单

评分

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

查看全部评分


坑的进度如上                                                                                                        点击↑
回复

使用道具 举报

梦石
0
星屑
50
在线时间
251 小时
注册时间
2010-7-22
回帖
70
 楼主| 发表于 2015-4-9 20:55:49 | 显示全部楼层
黄濑凉太 发表于 2015-4-9 20:47
#==============================================================================
#
# ▼ Yanfly Engin ...

谢谢了哦
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部