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

Project1

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

[已经过期] 如何让这个环形菜单显示图标和文字大一些~?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
66 小时
注册时间
2013-5-8
帖子
71
跳转到指定楼层
1
发表于 2013-5-28 13:08:54 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式

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

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

x
本帖最后由 twb122633 于 2013-5-28 13:10 编辑

如何让这个环形菜单显示图标和文字大一些~?代码如下:
#=============================================================================
# Gab Ring Menu 3D
#-----------------------------------------------------------------------------
# Autor: Gab!
# Data: 28/11/12
#-----------------------------------------------------------------------------
# Deixa o menu com perspectiva 3D.
#=============================================================================

module Gab
module RingMenu3D
#=============================================================================
# * CONFIGURAÇÃO
#=============================================================================

# ID dos ícones
ICONS = [
192, # Itens
112, # Habilidades
169, # Equipamentos
14, # Status
12, # Formação
117, # Salvar
121 # Sair
]

# Fonte
FNAME = "Trebuchet MS" # Nome
FSIZE = 19 # Tamanho
FCOLOR = [255, 255, 255, 200] # Cor (R,G,B,A)

# Raios
R1 = 90 # Para que o efeito ocorra,
R2 = 20 # é necessário que R1 > R2.

# Precisão de movimento dos ícones (Quanto maior, mais lento)
# Valores sugeridos:
# 1 = Instantâneo
# 5 = Rápido
# 10 = Mediano
# 20 = Lento
MV = 10

# Frequência do movimento dos characters (Quanto maior, mais lento)
CFREQ = 15

# BGM (Deixar em branco para remover)
BGM = ""

# BGS (Deixar em branco para remover)
BGS = "Clock"

# Tempo de fade no audio para sair da cena (milissegundos)
AudioFade = 1000

# Janelas adicionais
Windows = {
mapName: [ # Nome do mapa
true, # Mostrar?
0, # Posição X
0, # Posição Y
400, # Largura
231, # Ícone
0, # Opacidade
],

time: [ # Tempo de jogo
true, # Mostrar?
0, # Posição X
34, # Posição Y
160, # Largura
280, # Ícone
0, # Opacidade
],

gold: [ # Dinheiro
true, # Mostrar?
0, # Posição X
68, # Posição Y
160, # Largura
361, # Ícone
0, # Opacidade
]
}

#=============================================================================
# * FIM DA CONFIGURAÇÃO
#=============================================================================
end
end

Object.send(:remove_const, :Scene_Menu)
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# ** Base para as janelas do menu
#--------------------------------------------------------------------------
class MenuWindow < Window_Base
def initialize(x, y, width, icon, opacity)
super(x, y, width, fitting_height(2))
@icon = icon
self.opacity = opacity
self.contents.font.name = Gab::RingMenu3D::FNAME
self.contents.font.size = Gab::RingMenu3D::FSIZE
self.contents.font.color = Color.new(*Gab::RingMenu3D::FCOLOR)
self.contents.font.outline = false
self.contents.font.shadow = true

draw_icon(@icon, 0, 0)
@clear_rect = Rect.new(30, 0, contents.width - 31, contents.height)

refresh
end

def refresh
self.contents.clear_rect(@clear_rect)
text_size = self.contents.width - 32
self.contents.draw_text(30, 0, text_size, self.contents.height, text, align)
end

def align
return 2
end

def update
super
refresh if (Graphics.frame_count % Graphics.frame_rate) == 0
end

def text
return ""
end
end

#--------------------------------------------------------------------------
# ** Nome do mapa
#--------------------------------------------------------------------------
class MenuWindowMapName < MenuWindow
def text
$game_map.display_name
end

def align
return 0
end
end

#--------------------------------------------------------------------------
# ** Tempo de jogo
#--------------------------------------------------------------------------
class MenuWindowTime < MenuWindow
def text
total_sec = Graphics.frame_count / Graphics.frame_rate
hour = total_sec / 60 / 60
min = total_sec / 60 % 60
sec = total_sec % 60
sprintf("%02d:%02d:%02d", hour, min, sec)
end
end

#--------------------------------------------------------------------------
# ** Dinheiro
#--------------------------------------------------------------------------
class MenuWindowGold < MenuWindow
def text
$game_party.gold.to_s
end
end

#--------------------------------------------------------------------------
# * Inicialização do processo
#--------------------------------------------------------------------------
def start
super

@vocabulary = [
Vocab::item,
Vocab::skill,
Vocab::equip,
Vocab::status,
Vocab::formation,
Vocab::save,
Vocab::game_end
]

@actorsNames = $game_party.members.map{|actor| actor.name}

create_background

@sprite = Sprite_Character.new(@main_viewport, $game_player)
@index = 0
@actorIndex = 0
@stage = 0
@pattern = 1
@actor1 = nil
@actor2 = nil

@bgm = RPG::BGM.new(Gab::RingMenu3D::BGM)
@bgs = RPG::BGS.new(Gab::RingMenu3D::BGS)

@bgm.play
@bgs.play

precalculus
create_icons
create_legend
create_actor_selection
create_windows
end
#--------------------------------------------------------------------------
# * Finalização do processo
#--------------------------------------------------------------------------
def terminate
super
RPG::BGM.fade(Gab::RingMenu3D::AudioFade)
RPG::BGS.fade(Gab::RingMenu3D::AudioFade)
dispose_background
@icons.each(&:dispose)
@actors.each(&:dispose)
@windows.each(&:dispose)
@sprite.dispose
@legend.dispose
Input.update
$game_map.autoplay
end
#--------------------------------------------------------------------------
# * Disposição do plano de fundo
#--------------------------------------------------------------------------
def dispose_background
@background_sprite.dispose
end
#--------------------------------------------------------------------------
# * Criação do plano de fundo
#--------------------------------------------------------------------------
def create_background
@background_sprite = Sprite.new
@background_sprite.bitmap = SceneManager.background_bitmap
@background_sprite.color.set(16, 16, 16, 128)
end
#--------------------------------------------------------------------------
# * Pré-calculo
#--------------------------------------------------------------------------
def precalculus
@elIcons = 2 * Math::PI / Gab::RingMenu3D::ICONS.size
@basePointIcons = @sprite.y + Gab::RingMenu3D::R2 * (Math.sin(-@elIcons) - 0.5)
@maxDifIcons = @sprite.y + Gab::RingMenu3D::R2 * Math.sin(Math::PI - @elIcons) - @basePointIcons
@moveTimesIcons = @elIcons / Gab::RingMenu3D::MV
@addIcons = 0

@elActors = 2 * Math::PI / $game_party.members.size
@basePointActors = @sprite.y + (Gab::RingMenu3D::R2 + 24) * Math.sin(-@elIcons)
@maxDifActors = @sprite.y + (Gab::RingMenu3D::R2 + 24) * Math.sin(Math::PI - @elActors) - @basePointActors
@moveTimesActors = @elActors / Gab::RingMenu3D::MV
@addActors = 0
end
#--------------------------------------------------------------------------
# * Criação dos ícones
#--------------------------------------------------------------------------
def create_icons
iconset = Cache.system("Iconset")
@icons = []

Gab::RingMenu3D::ICONS.each_with_index{|icon_index, index|
sprite = Sprite.new
sprite.bitmap = iconset
sprite.src_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
sprite.ox = sprite.width / 2
sprite.oy = sprite.height / 2

@icons << sprite
}

@icons[4].tone = Tone.new(0, 0, 0, 255) if $game_party.members.size <= 1
@icons[5].tone = Tone.new(0, 0, 0, 255) if $game_system.save_disabled

adjust_icons
end
#--------------------------------------------------------------------------
# * Cria a legenda
#--------------------------------------------------------------------------
def create_legend
base, c = Bitmap.new(1, 1), nil
base.font.name = Gab::RingMenu3D::FNAME
base.font.size = Gab::RingMenu3D::FSIZE
base.font.color = Color.new(*Gab::RingMenu3D::FCOLOR)

maxLen = (@vocabulary + @actorsNames).inject(0){|a, b|
c = base.text_size(b)
c.width > a ? c.width : a
}

@Legend = Sprite.new
@legend.bitmap = Bitmap.new(maxLen + 5, c.height)
@legend.bitmap.font.name = Gab::RingMenu3D::FNAME
@legend.bitmap.font.size = Gab::RingMenu3D::FSIZE
@legend.bitmap.font.color = Color.new(*Gab::RingMenu3D::FCOLOR)
@legend.ox = @legend.width / 2
@legend.oy = @legend.height / 2
@legend.x = @icons.first.x
@legend.y = @icons.first.y + @icons.first.height

base.dispose

legend_refresh
end
#--------------------------------------------------------------------------
# * Cria seleção de atores
#--------------------------------------------------------------------------
def create_actor_selection
@actors = $game_party.members.map{|char|
actor = Sprite.new
actor.bitmap = Cache.character(char.character_name)
sign = char.character_name[/^[\!\$]./]
if sign && sign.include?('$')
cw = actor.bitmap.width / 3
ch = actor.bitmap.height / 4
else
cw = actor.bitmap.width / 12
ch = actor.bitmap.height / 8
end

actor.ox = cw / 2
actor.oy = ch

actor.x = @sprite.x + 1.5 * Gab::RingMenu3D::R1
actor.instance_variable_set(:@charData, [char, cw, ch])

actor
}

adjust_actors
update_actors_src
end
#--------------------------------------------------------------------------
# * Cria janelas
#--------------------------------------------------------------------------
def create_windows
windows = Gab::RingMenu3D::Windows
@windows = []

@windows << MenuWindowMapName.new(*windows[:mapName][1,5]) if windows[:mapName][0]
@windows << MenuWindowTime.new(*windows[:time][1,5]) if windows[:time][0]
@windows << MenuWindowGold.new(*windows[:gold][1,5]) if windows[:gold][0]
end
#--------------------------------------------------------------------------
# * Posicionamento e ajuste de opacidade dos ícones
#--------------------------------------------------------------------------
def adjust_icons
el = 2 * Math::PI / @icons.size
t = @addIcons - el

@icons.each{|sprite|
t += el
sprite.x = @sprite.x + Math.sin(t) * Gab::RingMenu3D::R1
sprite.y = @sprite.y + Gab::RingMenu3D::R2 * (Math.cos(t) - 0.5)
dif = (sprite.y - @basePointIcons) / @maxDifIcons
sprite.opacity = @stage == 0 ? 127 + 255 * dif : 0
sprite.zoom_x = sprite.zoom_y = [0.5 + dif, 1].min
}
end
#--------------------------------------------------------------------------
# * Posicionamento e ajuste de opacidade dos atores
#--------------------------------------------------------------------------
def adjust_actors
el = 2 * Math::PI / @actors.size
t = @addActors - el

@actors.each{|sprite|
t += el
sprite.x = @sprite.x + Math.sin(t) * (Gab::RingMenu3D::R1 + 24)
sprite.y = @sprite.y + (Gab::RingMenu3D::R2 + 24) * Math.cos(t)
dif = (sprite.y - @basePointActors) / @maxDifActors
sprite.opacity = @stage != 0 ? 127 + 255 * dif : 0
sprite.zoom_x = sprite.zoom_y = [0.5 + dif, 1].min
}
end
#--------------------------------------------------------------------------
# * Movimento dos ícones
#--------------------------------------------------------------------------
def rotateIcons(dir)
@moveTimesIcons *= -1 if dir == :right

Sound.play_cursor

Gab::RingMenu3D::MV.times{|sprite|
@addIcons += @moveTimesIcons
@addIcons %= Math::PI * 2
adjust_icons
Graphics.update
}

if dir == :right
@moveTimesIcons *= -1
@index += 1
else
@index -= 1
end
@index %= @icons.size

legend_refresh
end
#--------------------------------------------------------------------------
# * Movimento dos atores
#--------------------------------------------------------------------------
def rotateActors(dir)
@moveTimesActors *= -1 if dir == :right

Sound.play_cursor

Gab::RingMenu3D::MV.times{|sprite|
@addActors += @moveTimesActors
@addActors %= Math::PI * 2
adjust_actors
Graphics.update
}

if dir == :right
@moveTimesActors *= -1
@actorIndex += 1
else
@actorIndex -= 1
end
@actorIndex %= @actors.size

legend_refresh
end
#--------------------------------------------------------------------------
# * Atualiza legenda
#--------------------------------------------------------------------------
def legend_refresh
@legend.bitmap.clear
text = @stage == 0 ? @vocabulary[@index] : @actorsNames[@actorIndex]
@legend.bitmap.draw_text(@legend.bitmap.rect, text, 1)
@legend.update
end
#--------------------------------------------------------------------------
# * Atualização Base
#--------------------------------------------------------------------------
def update
super

@windows.each(&:update)

case @stage
when 0
update_main_input
when 1, 2
@stage == 1 ? update_actors_input : update_formation_input

if (Graphics.frame_count % Gab::RingMenu3D::CFREQ) == 0
@pattern = (@pattern + 1) % 3
end
update_actors_src
end
end
#--------------------------------------------------------------------------
# * Atualização de input padrão
#--------------------------------------------------------------------------
def update_main_input
if Input.repeat?(:LEFT)
rotateIcons(:left)
elsif Input.repeat?(:RIGHT)
rotateIcons(:right)
elsif Input.trigger?(:B)
Sound.play_cancel
process_return
elsif Input.trigger?(:C)
process_confirm
end
end
#--------------------------------------------------------------------------
# * Atualização de entrada na seleção de ator
#--------------------------------------------------------------------------
def update_actors_input
if Input.repeat?(:LEFT)
rotateActors(:left)
elsif Input.repeat?(:RIGHT)
rotateActors(:right)
elsif Input.trigger?(:B)
Sound.play_cancel
process_return
elsif Input.trigger?(:C)
Sound.play_ok
process_special_confirm
end
end
#--------------------------------------------------------------------------
# * Atualização de entrada na seleção de ator
#--------------------------------------------------------------------------
def update_actors_input
if Input.repeat?(:LEFT)
rotateActors(:left)
elsif Input.repeat?(:RIGHT)
rotateActors(:right)
elsif Input.trigger?(:B)
Sound.play_cancel
process_return
elsif Input.trigger?(:C)
Sound.play_ok
process_special_confirm
end
end
#--------------------------------------------------------------------------
# * Atualização de troca de formação
#--------------------------------------------------------------------------
def update_formation_input
if Input.repeat?(:LEFT)
rotateActors(:left)
elsif Input.repeat?(:RIGHT)
rotateActors(:right)
elsif Input.trigger?(:B)
Sound.play_cancel
process_return
elsif Input.trigger?(:C)
process_formation_confirm
end
end
#--------------------------------------------------------------------------
# * Processa confirmação
#--------------------------------------------------------------------------
def process_confirm
case @index
when 0 # Item
Sound.play_ok
SceneManager.call(Scene_Item)
when 1, 2, 3, 4 # Skill, Equip, Status, Formação
return Sound.play_buzzer if ($game_party.members.size <= 1 && @index == 4)
Sound.play_ok
@stage = @index == 4 ? 2 : 1
adjust_actors
adjust_icons
legend_refresh
@legend.y -= 28
when 5 # Save
if ($game_system.save_disabled)
Sound.play_buzzer
else
SceneManager.call(Scene_Save)
Sound.play_ok
end
when 6 # Sair
Sound.play_ok
SceneManager.call(Scene_End)
end
end
#--------------------------------------------------------------------------
# * Processa confirmação das opções que requerem seleção de ator
#--------------------------------------------------------------------------
def process_special_confirm
$game_party.menu_actor = $game_party.members[@actorIndex]

case @index
when 1 # Skill
SceneManager.call(Scene_Skill)
when 2 # Equip
SceneManager.call(Scene_Equip)
when 3 # Status
SceneManager.call(Scene_Status)
end
end
#--------------------------------------------------------------------------
# * Processa confirmação de troca de formação
#--------------------------------------------------------------------------
def process_formation_confirm
if @actor1.nil?
@actor1 = @actorIndex
@actors[@actor1].tone = Tone.new(150, 150, 150, 0)
Sound.play_ok
else
return Sound.play_buzzer if @actor1 == @actorIndex
Sound.play_ok

$game_party.swap_order(@actor1, @actorIndex)
@actorsNames = $game_party.members.map{|actor| actor.name}

@sprite.dispose
@sprite = Sprite_Character.new(@main_viewport, $game_player)
@actors.each(&:dispose)
create_actor_selection

@actors[@actor1].tone = Tone.new(0, 0, 0, 0)

@stage = 0
@actor1 = nil

adjust_icons
adjust_actors
legend_refresh
@legend.y += 28
end
end
#--------------------------------------------------------------------------
# * Processa retorno
#--------------------------------------------------------------------------
def process_return
case @stage
when 0
return_scene
when 1
case @index
when 1, 2, 3
@stage = 0
adjust_actors
adjust_icons
legend_refresh
@legend.y += 28
when 4
if [email protected]?
@actors[@actor1].tone = Tone.new(0, 0, 0, 0)
return @actor1 = nil
end

@stage = 0
adjust_actors
adjust_icons
legend_refresh
@legend.y += 28
end
end
end
#--------------------------------------------------------------------------
# * Atualiza characters
#--------------------------------------------------------------------------
def update_actors_src
@actors.each{|sprite|
char, cw, ch = sprite.instance_variable_get(:@charData)
index = char.character_index
sx = (index % 4 * 3 + @pattern) * cw
sy = (index / 4 * 4) * ch
sprite.src_rect.set(sx, sy, cw, ch)
}
end
end

QQ图片20130528130744.jpg (13.87 KB, 下载次数: 38)

QQ图片20130528130744.jpg

Lv1.梦旅人

梦石
0
星屑
50
在线时间
173 小时
注册时间
2011-9-20
帖子
9
4
发表于 2013-5-29 18:49:18 | 只看该作者
话说你把图片实际大小改了试试。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
66 小时
注册时间
2013-5-8
帖子
71
3
 楼主| 发表于 2013-5-28 19:27:08 | 只看该作者
好的,那里只是改字体大小~~!图片大小怎么改?
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
22958
在线时间
8638 小时
注册时间
2011-12-31
帖子
3367
2
发表于 2013-5-28 14:11:21 | 只看该作者
FSIZE = 19???

评分

参与人数 1星屑 +100 收起 理由
Sion + 100 感谢帮忙

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-16 23:40

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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