じ☆ve冰风 发表于 2026-7-24 19:14:48

ccoa's UMS name box position add-on

ccoa's UMS Name Box Position Add-on
by Black Mage​

Introduction
I wanted to change the position of the name box in some situations, but UMS doesn't have an option for it.
I had Black Mage create this add-on, so it's possible now.
It works for both normal mode and FIT_WINDOW_TO_TEXT mode.

Screenshots
Spoiler












How to Use
Install: Copy and paste the script above Main and below UMS.

Changing the value of $game_system.nb_align through script call.
For example:
                Ruby:       
$game_system.nb_align = 1

This will make the name box aligned to the center of the message window.
Available values:
                        0 = Left
1 = Center
2 = Right               
Click to expand...


Script
Spoiler                Ruby:       
#-------------------------------------------------------------------------------
# CCOA's UMS Addon By Black Mage
# Version: 1.0
#
# https://burningwizard.wordpress.com/
#-------------------------------------------------------------------------------
#
# This script is an addon for CCOA's UMS. It adds a function to change the
# alignment of the name box by changing the value of
#
#   $game_system.nb_align
#
# through script call. For example:
#
#   $game_system.nb_align = 1
#
# This will make the name box aligned to the center of the message window.
#
# Available values:
# 0 = Left
# 1 = Center
# 2 = Right
#
#-------------------------------------------------------------------------------

module BM_UMS_Addon
def self.set_pos(alignment, x, y, w1, w2)
    case alignment
    when 0
      pos =
    when 1
      pos =
    when 2
      pos =
    end
    pos
end
end

class Game_System
attr_accessor :nb_align
alias b_init initialize
def initialize; b_init; @nb_align = 0; end
end

class Window_Message < Window_Selectable
alias b_r_w reset_window
def reset_window(change_opacity = true)
    b_r_w(change_opacity)
    if $game_system.name != ""
      @name_window.set_name(@name)
      pos = BM_UMS_Addon.set_pos($game_system.nb_align, self.x, self.y, self.width, @name_window.width)
      @name_window.x = pos; @name_window.y = pos
      @name_window.set_name($game_system.name)
    end
end
end

class Window_Slave < Window_Base
alias b_r_w reset_window
def reset_window(change_opacity = true)
    b_r_w(change_opacity)
    if @name != "" and @name != nil
      @name_window.set_name(@name)
      pos = BM_UMS_Addon.set_pos($game_system.nb_align, self.x, self.y, self.width, @name_window.width)
      @name_window.x = pos; @name_window.y = pos
    end
end
end







Credits and Thanks
- Black Mage


本贴来自国际rpgmaker官方论坛作者:callmedan处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/ccoas-ums-name-box-position-add-on.165602/
页: [1]
查看完整版本: ccoa&#039;s UMS name box position add-on