-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathD$E_RingMenuParty.js
190 lines (170 loc) · 6.14 KB
/
D$E_RingMenuParty.js
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
//==============================================================================
// Dragon Engine (D$E) Ring Menu Party
// D$E_RingMenuParty.js
// Version 1.4.1
//==============================================================================
/*
* Copyright 2015 Ramiro Rojo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*:
*@plugindesc Used for any ring menu scene than requires an actor window.
*
* @param Icons
* @desc The set of icon used by the ring menu.
* The list is in the format name: icon1, name2: icon2, ...
* @default item: 176, skill: 79, equip: 137, status: 82, formation: 75, options: 83, save: 84, gameEnd: 1, cancel: 74
*
* @param Centre X
* @desc The x position to display the centre of the menu.
* Default: $gamePlayer.screenX()
* @default $gamePlayer.screenX()
*
* @param Centre Y
* @desc The y position to display the centre of the menu.
* Default: $gamePlayer.screenY() - ($gamePlayer.isInAirship() ? 48 : 16)
* @default $gamePlayer.screenY() - ($gamePlayer.isInAirship() ? 48 : 16)
*
* @param Radius X
* @desc The x radius of the menu.
* Default: Graphics.boxWidth / 10
* @default Graphics.boxWidth / 10
*
* @param Radius Y
* @desc The y radius of the menu.
* Default: 32
* @default 32
* *
* @param Starting Angle
* @desc The starting angle of the first element, in degrees
* Default: -90
* @default -90
*
* @param Rotation
* @desc 1- to clockwise, 1 to counter clockwise
* Default: -1
* @default -1
*
* @param Scale Difference
* @desc Reduction / Increment for y values when rotating for 3d effect.
* Default: 0.2
* @default 0.2
*
* @param Show Actor Sprite
* @desc Handles if the actor should be shown at the middle of the menu.
* Default: yes
* @default yes
* @help
* =============================================================================
* * FAQ
* =============================================================================
* - It is not working!
* Press F8, check the console, it usually gives you a nice formatted error
* made by me.
* If it doesn't then report please!
* ---------------------------------------------------------------------------
* - Can I use images instead of the iconset?
* Yes! you can, instead of putting a number, put it as a name like:
* item: My Awesome Name.
* Be aware than spaces before and after your name WILL be ignored
* So 'My Awesome name' is the same as 'My Awesome name ' (notice the spaces
* at the end) And remeber to not put the name with ''.
* ---------------------------------------------------------------------------
*/
if (!window.D$E) {
throw new Error("This plugin requires the 'Dragon Engine (D$E)' to work properly! Ensure your plugin list, or order of plugins.");
}
D$E.ensureParameters('D$E_RingMenuParty');
PluginManager.register("D$E_RingMenuParty", "1.0.0", {
"email": "[email protected]",
"website": "http://binarychest.wordpress.com",
"name": "Ramiro Rojo"
}, "2015-11-04");
(function ($) {
"use strict";
if (!$.ui || !$.ui.RingMenu) {
throw "The Ring Menu Party with a ring menu requires the Ring menu (D$E_RingSceneMenu) to work!";
}
var RingMenu = $.ui.RingMenu;
var params = RingMenu.readParams('D$E_RingMenuParty');
// Party Window
$.ui.RingMenu.Party = $.ui.RingMenu.Command.extend();
$.ui.RingMenu.Party.prototype.initialize = function(parent) {
$.ui.RingMenu.Command.prototype.initialize.call(this, parent, params.make());
this.close(0);
this._active = false;
this._formationMode = false;
this._pendingIndex = -1;
this.selectLast();
}
MVC.accessor(Window_MenuStatus.prototype, 'formationMode');
$.ui.RingMenu.Party.prototype.makeCommandList = function () {
var self = this;
$gameParty.members().forEach(function (member, i) {
self.addCommand(member.name(), i, true);
});
this.addCancelCommand();
}
$.ui.RingMenu.prototype.pendingIndex = function () {
return this._pendingIndex;
}
$.ui.RingMenu.prototype.setPendingIndex = function (index) {
this._pendingIndex = index;
}
$.ui.RingMenu.Party.prototype._createButton = function (text, name, enabled, icon) {
if (name == 'cancel') {
return new $.ui.RingMenu.Button(this, name);
}
return new $.ui.RingMenu.Party.Button(this, name);
}
$.ui.RingMenu.Party.prototype.setFormationMode = function (formationMode) {
this._formationMode = formationMode;
}
$.ui.RingMenu.Party.prototype.selectLast = function () {
this.select($gameParty.menuActor().index() || 0);
}
$.ui.RingMenu.Party.prototype.processOk = function () {
var member = $gameParty.members()[this.index()];
if (member) {
$gameParty.setMenuActor(member);
}
$.ui.RingMenu.prototype.processOk.call(this);
}
// Button
$.ui.RingMenu.Party.Button = $.ui.RingMenu.Button.extend();
$.ui.RingMenu.Party.Button.prototype._updateIconBitmap = function () {
var pw, ph, sx, sy;
var index = this._menu.indexOf(this._name);
var icon = $gameParty.members()[ index ];
if (this._menu.pendingIndex() == index) {
this.setColorTone([0, 0, 0, 255]);
} else {
this.setColorTone([0, 0, 0, 0]);
}
if (icon == this._lastIcon) {
return;
}
this._lastIcon = icon;
this.anchor.x = 0.5;
this.anchor.y = 1;
var bitmap = ImageManager.loadCharacter(icon.characterName());
var big = ImageManager.isBigCharacter(icon.characterName());
pw = bitmap.width / (big ? 3 : 12);
ph = bitmap.height / (big ? 4 : 8);
var n = icon.characterIndex();
sx = (n % 4 * 3 + 1) * pw;
sy = (Math.floor(n / 4) * 4) * ph;
this.bitmap = bitmap;
this.setColdFrame(sx, sy, pw, ph * 3 / 4);
};
$.PARAMETERS['RingMenuParty'] = params;
})(D$E);