ページ 11

【解決済み】hzCustomTimerでプラグインコマンドでOFFにしても元の表示に戻りません

Posted: 2019年8月14日(水) 12:50
by ヒグラシ
いつもすみません。
hzCustomTimerというプラグインでプラグインコマンドでHzTimer offとして元の表示に戻そうとしたところ
タイマーのフォントが黒色で表示されるようになってしまいました。
元に戻すにはどうしたらよいでしょうか?

hzCustomTimer
https://hiz-tkool.tumblr.com/post/14215 ... tomtimerjs

<追加>
ついでにもう一点、タイマーの表示をメッセージより手前に出すにはどうしたらいいですか?

Re: hzCustomTimerでプラグインコマンドでOFFにしても元の表示に戻りません

Posted: 2019年8月14日(水) 14:00
by 剣崎 宗二
テキスト色の件についてはバックアップした上で、以下のfunctionの差し替えで治るかお試しください。

コード: 全て選択

    var _Sprite_Timer_redraw = Sprite_Timer.prototype.redraw;
    Sprite_Timer.prototype.redraw = function() {
        if(customTimerFlg) {
            var sec      = Math.ceil(this._frames / 60);
            var surplus  = Math.floor(this._frames % 60);

            this.bitmap.clear();
            this.bitmap.fontSize = 28;
            if(this._frames > 0) {
                var text = this.timerText();
                var width = this.bitmap.width;
                var height = this.bitmap.height;
                var ctx = this.bitmap.context;
                ctx.save();
                drawArc(ctx, width/2, height/2, 42, 0, 360, "#ffffff");
                drawArc(ctx, width/2, height/2, 40, 0, surplus * 360 / 60, "#92c5e7");
                drawArc(ctx, width/2, height/2, 32, 0, 360, "#ffffff");
                drawArc(ctx, width/2, height/2, 30, 0, sec     * 360 / this._maxSec, "#9299e7");
                drawArc(ctx, width/2, height/2, 20, 0, 360, "#ffffff");

                this.bitmap.outlineWidth = 0;
                this.backupTextColor = this.bitmap.textColor;
                this.bitmap.textColor = "#000000";
                this.bitmap.drawText(text, 0, 0, width, height, 'center');
                ctx.restore();
            }
        } else {
            this.bitmap.fontSize = 32;
            if (this.backupTextColor)
            {
                this.bitmap.textColor = this.backupTextColor;
                this.backupTextColor = null;
            }
            _Sprite_Timer_redraw.call(this);
        }
       
    };


タイマーをメッセージウィンドウの前に出す、については調査してみましたが他のプラグインと競合しやすくなる等の副作用が想定されるのであまりお勧めは致しません…
(TimerがSpritesetに含まれている&メッセージ(=文章の表示)がWindowLayerに含まれており、WindowLayerがSpriteSetの前にある事に由来します)

Re: hzCustomTimerでプラグインコマンドでOFFにしても元の表示に戻りません

Posted: 2019年8月14日(水) 14:24
by ヒグラシ
剣崎さん、お返事ありがとうございます!
試しにSprite_Timer.prototype.redrawの中を提示されたコードに
書き換えてみましたが表示は変わらず黒のままでした。
わざわざ作っていただいたのにすみません。
HzCustomTimerプラグインのみ有効にして試しました。

調査方法は
◆プラグインコマンド:hzTimer on
◆タイマーの操作:始動, 1分0秒
の後に
◆プラグインコマンド:hzTimer off
◆タイマーの操作:始動, 1分0秒

を実行してみた感じです。
offにしたときにやはり黒文字になってしまいます。

あとタイマーをメッセージウィンドウの前に配置するのは難しそうなんですね。
了解しました。別の方法で検討してみることにします。

Re: hzCustomTimerでプラグインコマンドでOFFにしても元の表示に戻りません

Posted: 2019年8月14日(水) 15:36
by 剣崎 宗二
念のため確認いたしますが、書き換えたのはhzCustomTimer内のSprite_Timer.prototype.redrawでよろしいでしょうか。
そうであれば、帰宅後再度テストしてみます。

Re: hzCustomTimerでプラグインコマンドでOFFにしても元の表示に戻りません

Posted: 2019年8月14日(水) 15:52
by ヒグラシ
剣崎 宗二 さんが書きました:念のため確認いたしますが、書き換えたのはhzCustomTimer内のSprite_Timer.prototype.redrawでよろしいでしょうか。
そうであれば、帰宅後再度テストしてみます。


はいそうです。
hzCustomTimerの中のSprite_Timer.prototype.redrawです。
お手数おかけしますがよろしくおねがいします。

Re: hzCustomTimerでプラグインコマンドでOFFにしても元の表示に戻りません

Posted: 2019年8月15日(木) 00:32
by 剣崎 宗二
お待たせいたしました。差し替えるコード修正いたしました。
ご確認ください。

コード: 全て選択

var _Sprite_Timer_redraw = Sprite_Timer.prototype.redraw;
    Sprite_Timer.prototype.redraw = function() {
        if(customTimerFlg) {
            var sec      = Math.ceil(this._frames / 60);
            var surplus  = Math.floor(this._frames % 60);

            this.bitmap.clear();
            this.bitmap.fontSize = 28;
            if(this._frames > 0) {
                var text = this.timerText();
                var width = this.bitmap.width;
                var height = this.bitmap.height;
                var ctx = this.bitmap.context;
                ctx.save();
                drawArc(ctx, width/2, height/2, 42, 0, 360, "#ffffff");
                drawArc(ctx, width/2, height/2, 40, 0, surplus * 360 / 60, "#92c5e7");
                drawArc(ctx, width/2, height/2, 32, 0, 360, "#ffffff");
                drawArc(ctx, width/2, height/2, 30, 0, sec     * 360 / this._maxSec, "#9299e7");
                drawArc(ctx, width/2, height/2, 20, 0, 360, "#ffffff");

                this.bitmap.outlineWidth = 0;
                if (!this.backupTextColor)
                {
                    this.backupTextColor = this.bitmap.textColor;
                }
                this.bitmap.textColor = "#000000";
                this.bitmap.drawText(text, 0, 0, width, height, 'center');
                ctx.restore();
                console.log(this.backupTextColor);
            }
        } else {
            this.bitmap.fontSize = 32;
            console.log(this.backupTextColor);
            if (this.backupTextColor)
            {
                this.bitmap.textColor = this.backupTextColor;
                this.backupTextColor = null;
            }
            _Sprite_Timer_redraw.call(this);
        }
       
    };

Re: hzCustomTimerでプラグインコマンドでOFFにしても元の表示に戻りません

Posted: 2019年8月15日(木) 01:50
by ヒグラシ
剣先さん、修正確認しました。
問題なく文字が正常に白になっていました。
重ねてお礼申し上げます。ありがとうございました!
これで解決済みとさせていただきます。
お手数かけてすみませんでした。感謝します!