-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlogo.rb
167 lines (147 loc) · 6.83 KB
/
logo.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# Title Multilogo
if true
#==============================================================================
# +++ MOG - Title Multilogo - [Stand-Alone Series] (V1.1) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Adiciona logos antes da tela de título
#==============================================================================
# Para adicionar os logos nomeie os arquivos da seguinte forma.
#
# Logo_0.png
# Logo_1.png
# Logo_2.png
# Logo_3.png
# Logo_4.png
# Logo_5.png ... Logo_999.png
#
# Grave as imagens na pasta /Graphics/Title1/
#==============================================================================
module MOG_MLOGOS
#--------------------------------------------------------------------------
# Definição do nome do arquivo.
#--------------------------------------------------------------------------
FILE_NAME = "Logo_"
#--------------------------------------------------------------------------
#Ativar ME (coloque " PLAY_ME = nil " para desativar o efeito )
#--------------------------------------------------------------------------
PLAY_ME = "Shock"
#--------------------------------------------------------------------------
#Duração do logo.
#--------------------------------------------------------------------------
LOGO_DURATION = 80
#--------------------------------------------------------------------------
#Ativar o Botão para pular o logo.
#--------------------------------------------------------------------------
SKIP_BUTTON = true
end
$imported = {} if $imported.nil?
$imported[:mog_title_multilogo] = true
#==============================================================================
# ■ Scene Tittle
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
alias mog_t_logo_main main
def main
execute_tlogo if $logo_enabled == nil
mog_t_logo_main
end
#--------------------------------------------------------------------------
# ● Execute Tlogo
#--------------------------------------------------------------------------
def execute_tlogo
$logo_enabled = true if $logo_enabled == nil
Graphics.transition(transition_speed); mlogo = M_logo.new
loop do
Input.update ; mlogo.update ; Graphics.update ; break if mlogo.phase == 1
end
end
end
#==============================================================================
# ■ M_Logo
#==============================================================================
class M_logo
include MOG_MLOGOS
attr_accessor :phase
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
@phase = 0 ; @logos = []
for i in 0...999 ; @logos.push(Cache.title1(MOG_MLOGOS::FILE_NAME + i.to_s)) rescue nil
break if @logos[i] == nil ; end
@logo_sprite = Sprite.new ; time = [LOGO_DURATION, 5].max
@logo_data = [0,0,61 + time] ; refresh_logo
Audio.me_play("Audio/ME/" + PLAY_ME, 100, 100) if PLAY_ME != nil
end
#--------------------------------------------------------------------------
# ● Refresh Logo
#--------------------------------------------------------------------------
def refresh_logo
if @logos[@logo_data[1]] == nil ; @phase = 1 ; return ; end
@logo_sprite.bitmap = @logos[@logo_data[1]]
@logo_sprite.opacity = 0 ; @logo_data[0] = 0 ; @logo_data[1] += 1
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
Graphics.freeze
@logos.each {|sprite| sprite.dispose }
@logo_sprite.bitmap.dispose ; @logo_sprite.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_skip_logo ; @logo_data[0] += 1
case @logo_data[0]
when 0..60 ; @logo_sprite.opacity += 5
when 61..@logo_data[2] ; @logo_sprite.opacity = 255
when @logo_data[2]..(@logo_data[2] + 120) ; @logo_sprite.opacity -= 5
end
refresh_logo if @logo_sprite.opacity == 0
end
#--------------------------------------------------------------------------
# ● Update Skip Logo
#--------------------------------------------------------------------------
def update_skip_logo
return if !SKIP_BUTTON
return if @logo_data[1] > @logos.size
if Input.press?(:C) or Input.press?(:B)
@logo_data[0] = @logo_data[2] + 10 ; @logo_data[1] = @logos.size + 1
end
end
end
#==============================================================================
# ■ Scene Base
#==============================================================================
class Scene_Base
#--------------------------------------------------------------------------
# ● Terminate
#--------------------------------------------------------------------------
alias mog_t_mlogos_main terminate
def terminate
mog_t_mlogos_main
$logo_enabled = nil unless SceneManager.scene_is?(Scene_Title) or SceneManager.scene_is?(Scene_Load)
end
end
#===============================================================================
# ■ SceneManager
#===============================================================================
class << SceneManager
#--------------------------------------------------------------------------
# ● First Scene Class
#--------------------------------------------------------------------------
alias mog_t_mlogos_first_scene_class first_scene_class
def first_scene_class
$logo_enabled = nil
mog_t_mlogos_first_scene_class
end
end
end