❤ 0 Ce script permet de changer le skin des fenêtres au cours du jeu.
Auteur: PK8
Script et explications:
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
| =begin
Change Windowskin (Snippet)
by PK8
Created: 5/4/2012
Modified: -
──────────────────────────────────────────────────────────────────────────────
■ Table of Contents
o Author's Notes - Line 15-24
o Introduction - Line 26-28
o Features - Line 30-31
o Methods Aliased - Line 33-36
o How to Use - Line 38-42
──────────────────────────────────────────────────────────────────────────────
■ Author's Notes
I created a windowskin changer script a few years earlier but never posted
it due to there being other scripts that were basically similar in code. I
only wrote this again because as I was working on my Composite Windowskin
script (which I may or may not finish at the time of this writing), I was a
bit annoyed that two windowskin changer scripts I worked with didn't have
the variable names that were used in RPG Maker XP. Yeah, that's my reason
for writing this.
Kind of a dumb reason, right? Yeah, I know.
──────────────────────────────────────────────────────────────────────────────
■ Introduction
It's a quick snippet written to allow end-users to change the windowskin.
The only difference this script has compared to others is the variable names.
──────────────────────────────────────────────────────────────────────────────
■ Feature
o Change to another windowskin on the fly through a script call.
──────────────────────────────────────────────────────────────────────────────
■ Methods Aliased
Game_System.initialize
Window_Base.initialize
Window_Base.update
──────────────────────────────────────────────────────────────────────────────
■ How to Use
To change the windowskin, simply call:
$game_system.windowskin_name = value
=end
#==============================================================================
# ** Configuration
#==============================================================================
module PK8
class Change_Windowskin
Windowskin = "Window.png"
end
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :windowskin_name
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
unless method_defined?(:pk8_changewindowskin_initialize)
alias_method(:pk8_changewindowskin_initialize, :initialize)
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
pk8_changewindowskin_initialize
@windowskin_name = PK8::Change_Windowskin::Windowskin
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This is a superclass of all windows in the game.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
unless method_defined?(:pk8_changewindowskin_initialize)
alias_method(:pk8_changewindowskin_initialize, :initialize)
end
unless method_defined?(:pk8_changewindowskin_update)
alias_method(:pk8_changewindowskin_update, :update)
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(*args)
pk8_changewindowskin_initialize(*args)
@windowskin_name = $game_system.windowskin_name
self.windowskin = Cache.system(@windowskin_name)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
pk8_changewindowskin_update
if $game_system.windowskin_name != @windowskin_name
@windowskin_name = $game_system.windowskin_name
self.windowskin = Cache.system(@windowskin_name)
end
end
end |
|