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

Project1

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

[已经解决] 如何改变部分字体大小

[复制链接]

Lv1.梦旅人

梦石
0
星屑
85
在线时间
210 小时
注册时间
2013-7-26
帖子
346
跳转到指定楼层
1
发表于 2014-7-16 22:57:09 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 夕仔 于 2014-7-17 17:43 编辑


如图

我贴上了脚本@VIPArcher
  1. #encoding:utf-8
  2. #=============================================================================
  3. #-----------RMVA加点系统正常向-v1.03---By:救世小树--------转载请注明出处-------
  4. #=============================================================================

  5. module Point_Tree
  6.   
  7.   POINT_KIND     = 6       #设定加点种类
  8.   LEVEL_UP_POINT = 3       #每升一级自由属性点增加数
  9.   RESET_ITEM     = 20      #洗点水编号
  10.   
  11.   STR_POINT        = ["体力","精神","力量","魔力","韧性","灵活","???"]
  12.   
  13.   #分别对应增加       [MHP,MMP,物攻,物防,魔攻,魔防,敏捷,幸运]
  14.   POINT_ADD_PARAM = [[12 ,  0,   0,  0,   0,   0,   0,   0],     #体力
  15.                      [0  , 12,   0,  0,   0,   0,   0,   0],     #精神
  16.                      [0  ,  0,   5,  0,   0,   0,   0,   0],     #力量
  17.                      [0  ,  0,   0,  0,   5,   0,   0,   0],     #魔力
  18.                      [0  ,  0,   0,  3,   0,   2,   0,   1],     #韧性
  19.                      [0  ,  0,   0,  0,   0,   0,   3,   0],     #灵活
  20.                      
  21.                      [0,0,0,0,0,0,0,0]]
  22.                      #可以按上面的格式添加下去,不过要改POINT_KIND,STR_ALL,不然加了也白加
  23.   
  24.   #分别对应增加       [物理命中,物理闪避,必杀,必杀闪避,魔法闪避,魔法反射,物理反击,HP再生,Mp再生,Tp再生]
  25.   POINT_ADD_XPARAM = [[0 , 0, 0, 0, 0, 0, 0, 6, 0, 0],
  26.                       [0 , 0, 0, 0, 0, 0, 0, 0, 6, 0],
  27.                       [6 , 6, 0, 0, 0, 0, 0, 0, 0, 0],
  28.                       [0 , 0, 6, 0, 0, 0, 0, 0, 0, 0],
  29.                       [0 , 0, 0, 0, 0, 0, 0, 4, 4, 0],
  30.                       [0 , 6, 0, 6, 6, 0, 0, 0, 0, 0],
  31.                      
  32.                       [0,0,0,0,0,0,0,0,0,0]]
  33.                      #这里的单位是万分之一数值也就是0.01%,我随便填了下【别嫌小,够大了,有心情你可以算算看平衡性】
  34.   
  35.   #各种名称
  36.   
  37.   ADDPOINT       = "加点"     #菜单中选项
  38.   POINT_NAME     = "属性点"   #未分配点数
  39.   
  40.   XARAM_NAME     = ["物理命中","物理闪避","必杀","必杀闪避","魔法闪避","魔法反射","物理反击","HP再生","Mp再生","Tp再生"]

  41.   
  42.   def temp_all
  43.     r = 0
  44.     for i in 0 .. POINT_KIND-1
  45.       r+=$temp_point[i]
  46.     end
  47.     return r
  48.   end
  49.   
  50.   def reset(actor_id)
  51.     for i in 1..6
  52.       $game_actors[actor_id].point[0] += $game_actors[actor_id].point[i]
  53.       $game_actors[actor_id].point[i] =0
  54.     end
  55.   end
  56.   
  57. end

  58. $temp_point = []
  59. for i in 0 .. Point_Tree::POINT_KIND-1
  60.   $temp_point.push(0)
  61. end

  62. class Game_Actor < Game_Battler
  63.   include Point_Tree
  64.   attr_accessor :point
  65.   
  66.   alias setup_tre setup
  67.   def setup(actor_id)
  68.     @point = []
  69.     for i in 0 .. POINT_KIND
  70.       @point.push(0)
  71.     end
  72.     setup_tre(actor_id)
  73.   end
  74.   
  75.   
  76.   
  77.   
  78.   alias level_up_tre level_up
  79.   def level_up
  80.     level_up_tre
  81.     @hp += mhp
  82.     @mp += mmp
  83.     @point[0] += LEVEL_UP_POINT
  84.   end
  85.   

  86.   
  87.   def point_plus(param_id)
  88.     r=0
  89.     for i in 1 .. POINT_KIND
  90.       r+=@point[i]*POINT_ADD_PARAM[i-1][param_id]
  91.     end
  92.     return r
  93.   end

  94.   alias point_base_param param
  95.   
  96.   def param(param_id)
  97.     value = param_base(param_id) + param_plus(param_id) + point_plus(param_id)
  98.     value *= param_rate(param_id) * param_buff_rate(param_id)
  99.     [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  100.   end
  101.   def xparam(xparam_id,extra_add = 0)
  102.     xp = super(xparam_id)
  103.     for i in 0 .. POINT_KIND-1
  104.       xp+=(@point[i+1]*POINT_ADD_XPARAM[i][xparam_id]/10000.0)
  105.     end
  106.     return xp
  107.   end

  108.   def item_apply(user, item)
  109.     super(user, item)
  110.     if item.id == RESET_ITEM and item.is_a?(RPG::Item)
  111.       reset(@actor_id)
  112.       self.hp = [self.hp,self.mhp].min
  113.       self.mp = [self.mp,self.mmp].min
  114.     end
  115.   end
  116.   
  117. end

  118. class Window_Point_Command < Window_Command
  119.   
  120.   include Point_Tree
  121.   #--------------------------------------------------------------------------
  122.   # ● 初始化指令选择位置(类方法)
  123.   #--------------------------------------------------------------------------
  124.   def self.init_command_position
  125.     @@last_command_symbol = nil
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 初始化对象
  129.   #--------------------------------------------------------------------------
  130.   def initialize(actor)
  131.     @status_window = nil
  132.     @actor = actor
  133.     super(0,0)
  134.     select_last
  135.   end
  136.   def actor=(actor)
  137.     return if @actor == actor
  138.     @actor = actor
  139.     refresh
  140.   end
  141.   def status_window=(status_window)
  142.     return if @status_window == status_window
  143.     @status_window = status_window
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 获取窗口的宽度
  147.   #--------------------------------------------------------------------------
  148.   def window_width
  149.     return 160
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 获取显示行数
  153.   #--------------------------------------------------------------------------
  154.   def visible_line_number
  155.     item_max
  156.   end
  157.   def get_actor_point(index)
  158.     s = @actor.point[index+1].to_s
  159.     return "("+s+")+"+$temp_point[index].to_s
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● 生成指令列表
  163.   #--------------------------------------------------------------------------
  164.   def make_command_list
  165.     for i in 0 .. POINT_KIND-1
  166.       add_command(STR_POINT[i]   + get_actor_point(i)  , :point_add  ,add_enabled)
  167.     end
  168.     add_command("确认",  :point_ok)
  169.     add_command("取消",  :point_cancle)
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 按下确定键时的处理
  173.   #--------------------------------------------------------------------------
  174.   def process_ok
  175.     @@last_command_symbol = current_symbol
  176.     super
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● 返回最后一个选项的位置
  180.   #--------------------------------------------------------------------------
  181.   def select_last
  182.     select_symbol(@@last_command_symbol)
  183.   end
  184.   
  185.   def add_enabled
  186.     temp_all < @actor.point[0]
  187.   end

  188.   def update_help
  189.     @help_window.set_text(self.index+1) if @help_window
  190.     @status_window.index = self.index if @status_window
  191.   end
  192. end

  193. #帮助窗口
  194. class Window_Point_Help < Window_Base
  195.   include Point_Tree
  196.   def initialize(x,y,w,h)
  197.     super(x, y, w, h)
  198.    
  199.    
  200.   end
  201.   def set_text(id)
  202.     contents.clear
  203.     if id <= POINT_KIND
  204.       text = "\\}提升一点该属性"
  205.     elsif id == POINT_KIND+1
  206.       text = "\\}确认此次加点分配"
  207.     elsif  id == POINT_KIND+2
  208.       text = "\\}取消此次加点分配"
  209.     end
  210.     draw_text_ex(8, 8, text)
  211.   end
  212. end


  213. #角色状态窗口
  214. class Window_Point_Actor < Window_Base
  215.   include Point_Tree
  216.   
  217.   
  218.   def initialize(actor)
  219.     super(160, 0, Graphics.width - 160, Graphics.height)
  220.     @actor = actor
  221.     @index = 0
  222.     refresh
  223.   end
  224.   def actor=(actor)
  225.     return if @actor == actor
  226.     @actor = actor
  227.     refresh
  228.   end
  229.   def index=(index)
  230.     return if @index == index
  231.     @index = index
  232.     refresh
  233.   end
  234.   def line_height
  235.     return 24
  236.   end
  237.   def refresh
  238.     contents.clear
  239.     contents.font.size = 24
  240.     draw_actor_name(@actor, 100, 0)
  241.     draw_actor_class(@actor, 240, 0)
  242.     draw_actor_face(@actor, 2, 0)
  243.     contents.font.size = 20
  244.     draw_actor_level(@actor, 102,  24)
  245.     draw_actor_point(100,48)
  246.     contents.font.size = 16
  247.     draw_actor_param_point(8,16 * 6)
  248.     draw_actor_xparam_point(8,16 * 14)
  249.   end
  250.   def draw_actor_point(x,y)
  251.     draw_text(x,y,200,line_height,"  未分配"+POINT_NAME + ":" + @actor.point[0].to_s)
  252.     draw_text(x,y+line_height,200,line_height,"此次分配"+POINT_NAME + ":" + temp_all.to_s)
  253.   end
  254.   def draw_actor_param_point(x,y)
  255.     8.times {|i| draw_actor_param_to_s(x,y,i)}
  256.   end
  257.   def draw_actor_xparam_point(x,y)
  258.     10.times {|i| draw_actor_xparam_to_s(x,y,i)}
  259.   end
  260.   
  261.   def draw_actor_param_to_s(x,y,param_id)
  262.     a=0
  263.     for i in 0 .. POINT_KIND-1
  264.       a+=$temp_point[i]*POINT_ADD_PARAM[i][param_id]
  265.     end
  266.     s1 = Vocab::param(param_id)
  267.     s2 = @actor.param(param_id).to_s
  268.     s3 = (@actor.param(param_id)+a).to_s
  269.     if @index < POINT_KIND
  270.       if POINT_ADD_PARAM[@index][param_id]==0
  271.         s4 = ""
  272.       else
  273.         s4 = "+" + POINT_ADD_PARAM[@index][param_id].to_s
  274.       end
  275.     else
  276.       s4 = ""
  277.     end
  278.    
  279.     change_color(system_color)
  280.     draw_text(x,y+16*param_id,100,line_height,s1)
  281.     change_color(normal_color)
  282.     s2+= " →"
  283.     draw_text(x+82,y+16*param_id,120,line_height,s2,2)
  284.     change_color(system_color)
  285.     draw_text(x+150,y+16*param_id,100,line_height,s3,2)
  286.     change_color(normal_color)
  287.     contents.font.size = 14
  288.     draw_text(x+266,y+16*param_id,100,line_height,s4)
  289.     contents.font.size = 16
  290.   end
  291.   def draw_actor_xparam_to_s(x,y,xparam_id)
  292.     a=0.00
  293.     for i in 0 .. POINT_KIND-1
  294.       a+=($temp_point[i]*POINT_ADD_XPARAM[i][xparam_id]/10000.0)
  295.     end
  296.     s1 = XARAM_NAME[xparam_id]
  297.     s2 = sprintf("%02.2f%%",@actor.xparam(xparam_id)*100)
  298.     s3 = sprintf("%02.2f%%",(@actor.xparam(xparam_id) + a)*100)

  299.     if @index < POINT_KIND
  300.       if POINT_ADD_XPARAM[@index][xparam_id]==0
  301.         s4=""
  302.       else
  303.         s4 = sprintf("+%02.2f%%",POINT_ADD_XPARAM[@index][xparam_id]/100.0)
  304.       end
  305.     else
  306.       s4 = ""
  307.     end
  308.    
  309.     change_color(system_color)
  310.     draw_text(x,y+16*xparam_id,100,line_height,s1)
  311.     change_color(normal_color)
  312.     s2+= " →"
  313.     draw_text(x+82,y+16*xparam_id,120,line_height,s2,2)
  314.     change_color(system_color)
  315.     draw_text(x+150,y+16*xparam_id,100,line_height,s3,2)
  316.     change_color(normal_color)
  317.     contents.font.size = 14
  318.     draw_text(x+266,y+16*xparam_id,100,line_height,s4)
  319.     contents.font.size = 16
  320.    
  321.    
  322.   end
  323. end

  324. class Scene_Point < Scene_Base
  325.   include Point_Tree
  326.   def start
  327.     super
  328.     create_background
  329.     @actor = $game_party.menu_actor
  330.     create_command_window
  331.     create_status_window
  332.     create_help_window
  333.     @command_window.activate
  334.   end
  335.   def terminate
  336.     super
  337.     dispose_background
  338.   end
  339.   def create_background
  340.     @background_sprite = Sprite.new
  341.     @background_sprite.bitmap = SceneManager.background_bitmap
  342.     @background_sprite.color.set(16, 16, 16, 128)
  343.   end
  344.   def dispose_background
  345.     @background_sprite.dispose
  346.   end
  347.   
  348.   def create_command_window
  349.     @command_window = Window_Point_Command.new(@actor)
  350.     @command_window.set_handler(:cancel,      method(:return_scene))
  351.     @command_window.set_handler(:pagedown,    method(:next_actor))
  352.     @command_window.set_handler(:pageup,      method(:prev_actor))
  353.     @command_window.set_handler(:point_add,   method(:add_point))
  354.     @command_window.set_handler(:point_ok,    method(:add_ok))
  355.     @command_window.set_handler(:point_cancle,method(:add_cancle))
  356.    
  357.   end
  358.   def return_scene
  359.     add_cancle
  360.     SceneManager.return
  361.   end
  362.   def create_status_window
  363.     @status_window = Window_Point_Actor.new(@actor)
  364.     @command_window.status_window = @status_window
  365.   end
  366.   def create_help_window
  367.     @help_window = Window_Point_Help.new(0,@command_window.height,160,Graphics.height-@command_window.height)
  368.     #(0, 216, 160, 200)
  369.     @help_window.viewport = @viewport
  370.     @command_window.help_window = @help_window
  371.   end
  372.   
  373.   def add_point
  374.     if temp_all >= @actor.point[0]
  375.       @command_window.activate
  376.       return
  377.     end
  378.     $temp_point[@command_window.index] += 1
  379.     @status_window.refresh
  380.     @command_window.refresh
  381.     @command_window.activate
  382.   end
  383.   

  384.   def add_ok
  385.     for i in 0 .. POINT_KIND-1
  386.       @actor.point[i+1] += $temp_point[i]
  387.     end
  388.     @actor.point[0]-= temp_all
  389.     add_cancle
  390.   end
  391.   
  392.   def add_cancle
  393.     for i in 0 .. POINT_KIND-1
  394.       $temp_point[i]=0
  395.     end
  396.     @status_window.refresh
  397.     @command_window.refresh
  398.     @command_window.activate
  399.   end
  400.   
  401.   
  402.   def next_actor
  403.     @actor = $game_party.menu_actor_next
  404.     on_actor_change
  405.   end
  406.   #--------------------------------------------------------------------------
  407.   # ● 切换到上一个角色
  408.   #--------------------------------------------------------------------------
  409.   def prev_actor
  410.     @actor = $game_party.menu_actor_prev
  411.     on_actor_change
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # ● 切换角色
  415.   #--------------------------------------------------------------------------
  416.   def on_actor_change
  417.     add_cancle
  418.     @status_window.actor = @actor
  419.     @command_window.actor = @actor
  420.     @command_window.activate
  421.   end
  422.   
  423. end

  424. class Window_MenuCommand < Window_Command
  425.   alias add_original_commands_old add_original_commands
  426.   def add_original_commands
  427.     add_original_commands_old
  428.     add_command(Point_Tree::ADDPOINT,    :addpoint)
  429.   end
  430. end

  431. class Scene_Menu < Scene_MenuBase
  432.   alias create_command_window_old create_command_window
  433.   def create_command_window
  434.     create_command_window_old
  435.     @command_window.set_handler(:addpoint,method(:add_point))
  436.   end
  437.   def add_point
  438.     @status_window.select_last
  439.     @status_window.activate
  440.     @status_window.set_handler(:ok,     method(:on_ok))
  441.     @status_window.set_handler(:cancel, method(:on_personal_cancel))
  442.   end
  443.   def on_ok
  444.     SceneManager.call(Scene_Point)
  445.     Window_Point_Command::init_command_position
  446.   end
  447. end



  448. class Scene_ItemBase < Scene_MenuBase
  449.   def item_usable?
  450.     if item.id == Point_Tree::RESET_ITEM and item.is_a?(RPG::Item)
  451.       return true
  452.     end
  453.     user.usable?(item) && item_effects_valid?
  454.   end
  455. end






  456. class Window_Status < Window_Selectable
  457.   include Point_Tree
  458.   alias draw_parameters_old draw_parameters
  459.   def draw_parameters(x, y)
  460.     draw_parameters_old(x,y)
  461.     draw_point(x,y)
  462.   end
  463.   def draw_point(x,y)
  464.     for i in 0..5
  465.       change_color(system_color)
  466.       draw_text(x+100, y+ line_height * i, 80, line_height, STR_POINT[i])
  467.       change_color(normal_color)
  468.       draw_text(x+180, y+ line_height * i, 36, line_height,@actor.point[i+1].to_s, 2)
  469.     end
  470.   end
  471.   
  472. end

  473. class Window_Base < Window
  474.   def draw_actor_param(actor, x, y, param_id)
  475.     change_color(system_color)
  476.     draw_text(x-30, y, 80, line_height, Vocab::param(param_id))
  477.     change_color(normal_color)
  478.     draw_text(x+ 50, y, 36, line_height, actor.param(param_id), 2)
  479.   end
  480. end
复制代码

Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
21484
在线时间
9389 小时
注册时间
2012-6-19
帖子
7114

开拓者短篇九导演组冠军

2
发表于 2014-7-17 00:30:11 | 只看该作者
找到描绘那部分文字的代码,在描绘文字之前设置文字宽度
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
10073
在线时间
5020 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

3
发表于 2014-7-17 02:50:59 | 只看该作者
或者找到那些绘制方法在里面加上contents.font.size = 20来改变字体大小。
例如找到绘制名字
  1.   #--------------------------------------------------------------------------
  2.   # ● 绘制名字
  3.   #--------------------------------------------------------------------------
  4.   def draw_actor_name(actor, x, y, width = 112)
  5.     change_color(hp_color(actor))
  6.     contents.font.size = 20  #使用20号字体
  7.     draw_text(x, y, width, line_height, actor.name)
  8.     contents.font.size = Font.default_size #使用默认字体大小
  9.   end
复制代码
这样就可以单独使名字的绘制使用20号字体,其他的绘制也可以这样改变字体大小

评分

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

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-25 15:29

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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