I’m using CGMZ_WindowCursor and have deleted the semi-transparent selection on the Window.png file (circled in the picture). What I want is for the text to flash instead of the default selection.
ページの内容から判断するに、CGMZ Window Cursor はカーソルスプライト自体(画像、色相、浮動、回転など)のみをスタイル設定しているようで、テキスト点滅オプションは備えていないようです。もしそのような機能をリクエストしたい場合は、Casper Gaming の Discord で提案を受け付けています。
その間、こちらの小さなプラグインで対応できるはずです。これは、選択中の項目のテキストを、デフォルトのカーソルが点滅するのと同じ 40 フレームのリズムで特定のカラーに向かって脈動させます。これを js/plugins フォルダに BazFlashText.js という名前で保存し、プラグインマネージャーで有効にしてください。
/*:
* @target MZ
* @plugindesc Flashes the selected item's text in selection windows.
* @author Baz
*/
(() => {
// [red, green, blue, strength] the text pulses toward, each 0 to 255
const FLASH_COLOR = [255, 220, 90, 255];
// frames for one full pulse, the default cursor blink is 40
const FLASH_FRAMES = 40;
const _initialize = Window_Selectable.prototype.initialize;
Window_Selectable.prototype.initialize = function(rect) {
_initialize.call(this, rect);
this._flashTextSprite = new Sprite();
this._flashTextSprite.setBlendColor(FLASH_COLOR);
this.addInnerChild(this._flashTextSprite);
};
const _update = Window_Selectable.prototype.update;
Window_Selectable.prototype.update = function() {
_update.call(this);
const sprite = this._flashTextSprite;
const rect = this._cursorRect;
sprite.visible = this.active && this.index() >= 0 && rect.width > 0;
if (!sprite.visible) return;
sprite.bitmap = this.contents;
sprite.setFrame(rect.x, rect.y, rect.width, rect.height);
sprite.move(rect.x, rect.y);
const t = (1 - Math.cos((this._animationCount * Math.PI * 2) / FLASH_FRAMES)) / 2;
sprite.opacity = t * this.contentsOpacity;
};
})();
先頭の 2 行が調整すべき箇所です。MZ のデフォルトのテキストカラーは白なので、白のフラッシュカラーでは何も表示されません。選択行に描画されたものはすべてこれに合わせて点滅するため、アイコンやアクターの顔も着色されます。FLASH_COLOR の最後の数値を下げると、その影響が和らぎます。
