Io vorrei una piccola modifica alla barra dei tp in modo che non mostri mai (neanche nel menù) il numero dei tp in possesso, ma si veda solo la barra, e che quando raggiunga i 100 punti si metta a brillare (in pratica penso un modo che arrivata ai 100 punti le faccia cambiare colore ogni secondo), non credo che sia difficile, ma di java non ci capisco niente ^^;
Modifica alla barra dei TP
1
#2 Inviato 09 March 2023 - 08:51 AM
"vorrei una piccola modifica" xD
Ad ogni modo devi fare così:
Vai nella cartella css del tuo progetto
Trova il file Window_TP.css
Aprilo con un buon code editor e
Cerca la classe tpGauge
Aggiungi queste istruzioni:
Poi
Recati nella cartella js e trova il main.js
Dentro la funzione Window_TP.prototype.drawTpGauge
Inserisci questo:
e più o meno bisogna fa così:
Diamo 2 proprietà nuove a Window_Base
Per la precisione dentro la funzione Window_Base.prototype.updateTpb.
Esempio: Hide TP
Ad ogni modo devi fare così:
Vai nella cartella css del tuo progetto
Trova il file Window_TP.css
Aprilo con un buon code editor e
Cerca la classe tpGauge
Aggiungi queste istruzioni:
.tpGauge { font-size: 0; /* Nasconde il numero di TP */ }; .tpGauge .gauge { background-color: #fff; /* Colore di sfondo della barra */ border: 2px solid #666; /* Bordo della barra */ height: 8px; /* Altezza della barra */ margin: 0 6px; /* Margine della barra */ width: 92%; /* Larghezza della barra */ };Salva e chiudi
Poi
Recati nella cartella js e trova il main.js
Dentro la funzione Window_TP.prototype.drawTpGauge
Inserisci questo:
Window_TP.prototype.drawTpGauge = function() { var gaugeHeight = this.contentsHeight() - 4; var rate = $gameParty.tpRate(); var color1 = this.tpGaugeColor1(); var color2 = this.tpGaugeColor2(); this.contents.clearRect(this.gaugeX(), this.gaugeY(), this.gaugeWidth(), gaugeHeight); if (Imported.YEP_CoreEngine) { var currentTp = Yanfly.Util.toGroup($gameParty.tp()); var maxTp = Yanfly.Util.toGroup($gameParty.maxTp()); var text = currentTp + ' / ' + maxTp; this.drawText(text, this.textPadding(), 0, this.contentsWidth(), 'left'); } this.drawGauge(this.gaugeX(), this.gaugeY(), this.gaugeWidth(), rate, color1, color2); if ($gameParty.tp() === 100) { if (this._gaugeFlash === undefined) { this._gaugeFlash = false; } this._gaugeFlash = !this._gaugeFlash; this.changeTextColor(this.systemColor()); this.drawText(this.tpRate() * 100 + '%', 0, 0, this.contentsWidth(), 'right'); this.changeTextColor(this.normalColor()); if (this._gaugeFlash) { this.drawGauge(this.gaugeX(), this.gaugeY(), this.gaugeWidth(), rate, '#ffff00', '#ffff00'); } else { this.drawGauge(this.gaugeX(), this.gaugeY(), this.gaugeWidth(), rate, color1, color2); } } else { this.changeTextColor(this.systemColor()); this.drawText } Window_Base.prototype.drawTpGauge = function(x, y, width) { var color1 = this.tpGaugeColor1(); var color2 = this.tpGaugeColor2(); var rate = $gameParty.tpRate(); if ($gameParty.tp() === 100) { if (this._gaugeFlash === undefined) { this._gaugeFlash = false; } this._gaugeFlash = !this._gaugeFlash; if (this._gaugeFlash) { this.drawGauge(x, y, width, rate, '#ffff00', '#ffff00'); } else { this.drawGauge(x, y, width, rate, color1, color2); } } else { this.drawGauge(x, y, width, rate, color1, color2); } };Ora alla classe Window_TP aggiungiamo la funzione 'Brillare'
e più o meno bisogna fa così:
/** * Classe che rappresenta la finestra dei TP del gioco */ function Window_TP() { this.initialize.apply(this, arguments); } Window_TP.prototype = Object.create(Window_Base.prototype); Window_TP.prototype.constructor = Window_TP; /** * Inizializza la finestra dei TP */ Window_TP.prototype.initialize = function() { var width = this.windowWidth(); var height = this.windowHeight(); Window_Base.prototype.initialize.call(this, 0, 0, width, height); this.opacity = 0; this._tp = 0; this._maxTp = 0; this.brillare = false; // Nuovo attributo per la gestione dell'illuminazione della barra this.update(); }; /** * Imposta il numero di TP e il massimo di TP */ Window_TP.prototype.setTp = function(tp, maxTp) { if (this._tp !== tp || this._maxTp !== maxTp) { this._tp = tp; this._maxTp = maxTp; this.refresh(); } }; /** * Restituisce la larghezza della finestra */ Window_TP.prototype.windowWidth = function() { return 240; }; /** * Restituisce l'altezza della finestra */ Window_TP.prototype.windowHeight = function() { return this.fittingHeight(1); }; /** * Disegna la finestra dei TP */ Window_TP.prototype.refresh = function() { this.contents.clear(); var width = this.width - this.padding * 2; var rate = this._tp / this._maxTp; this.drawGauge(0, 0, width, rate, this.tpGaugeColor1(), this.tpGaugeColor2()); }; /** * Restituisce il colore 1 della barra dei TP */ Window_TP.prototype.tpGaugeColor1 = function() { return this.textColor(28); }; /** * Restituisce il colore 2 della barra dei TP */ Window_TP.prototype.tpGaugeColor2 = function() { return this.textColor(29); }; /** * Aggiorna la finestra dei TP */ Window_TP.prototype.update = function() { Window_Base.prototype.update.call(this); this.updateBlink(); // Chiamiamo il nuovo metodo per l'aggiornamento dell'illuminazione }; /** * Aggiorna l'illuminazione della barra dei TP quando questa è piena */ Window_TP.prototype.updateBlink = function() { if (this._tp >= this._maxTp) { this.brillare = !this.brillare; if (this.brillare) { this.contents.gradientFillRect(0, 0, this.width, this.height, this.tpGaugeColor1(), this.tpGaugeColor2(), true); } else { this.refresh(); } } };Dopo aver preparato la tavola se magna
Diamo 2 proprietà nuove a Window_Base
Per la precisione dentro la funzione Window_Base.prototype.updateTpb.
Esempio: Hide TP
Window_Base.prototype.drawActorTp = function(actor, x, y, width) { width = width || 186; var color1 = this.tpGaugeColor1(); var color2 = this.tpGaugeColor2(); this.drawGauge(x, y, width, actor.tpRate(), color1, color2); };Show TP a 100 punti.
Window_Base.prototype.updateTpb = function() { if (this._actor && this._actor.canMove()) { if (this._tpbTurnCount !== $gameParty.tpbTurnCount()) { this._tpbTurnCount = $gameParty.tpbTurnCount(); this.refresh(); if (this._actor.tp >= this._actor.maxTp()) { this.contents.clearRect(0, 0, this.contentsWidth(), this.contentsHeight()); var color = [this.textColor(30), this.textColor(31)]; var flashCount = 0; var flashInterval = 30; var gaugeWidth = this._width - 130; this._animationCount++; if (this._animationCount % flashInterval < flashInterval / 2) { this.contents.fillRect(0, 0, gaugeWidth, this.lineHeight(), color[0]); } else { this.contents.fillRect(0, 0, gaugeWidth, this.lineHeight(), color[1]); } } } } };Spero di aver soddisfatto la richiesta. ;)
Spoiler