0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【ティラノスクリプト】メッセージウィンドウの非表示で他の任意のレイヤーも一緒に非表示にしたい

Last updated at Posted at 2025-04-06

概要

環境はv600d

[button]タグのrole属性でwindowを指定すると、メッセージレイヤーとfixレイヤーが非表示になる。
非表示になっている状態で画面のクリックなどを行うと、非表示になったメッセージレイヤーとfixレイヤーが再度表示される。
このときに他の任意のレイヤーも非表示/表示させたかったので、できるようにした。

詳細

前提として、フォーマッターを掛けて見やすくしている。

メッセージレイヤーの表示切り替えは、tyrano/plugins/kag/kag.layer.jsで定義されているhideMessageLayersshowMessageLayersで行われている。
this.getLayerで操作したいレイヤーを取得し、this.hideLayerthis.showLayerに渡すことで実現可能。

実際のコード

  • レイヤー2を対象にしている場合
  • 既に色々修正が入っているかも
tyrano/plugins/kag/kag.layer.js
hideMessageLayers: function () {
    if (1 == this.kag.stat.display_link) return false;
    this.kag.stat.is_hide_message = true;
    this.kag.trigger("messagewindow-hide");
    for (
        var num_message_layer = parseInt(this.kag.config.numMessageLayers),
            i = 0;
        i < num_message_layer;
        i++
    )
        this.getLayer("message" + i).hide();
    this.hideFixLayer();
    // レイヤー2を非表示にする
    this.hideLayer(this.getLayer("2"));
},
showMessageLayers: function () {
    this.kag.stat.is_hide_message = false;
    this.kag.trigger("messagewindow-show");
    for (
        var num_message_layer = parseInt(this.kag.config.numMessageLayers),
            i = 0;
        i < num_message_layer;
        i++
    ) {
        var j_layer = this.getLayer("message" + i);
        "true" == j_layer.attr("l_visible") && j_layer.show();
    }
    this.showFixLayer();
    // レイヤー2を表示する
    this.showLayer(this.getLayer("2"));
},
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?