X Tutup
/* TyranoBuilder Plugin Template Edit this file to create TyranoBuilder templates. */ 'use strict'; module.exports = class plugin_setting { constructor(TB) { /* TB creates the UI to access TyranoBuilder functionality */ this.TB = TB; /* Set the plugin name */ this.name= TB.$.s("Plugin Template"); /* Set the plugin description */ this.plugin_text= TB.$.s("Plugin template. Use this file as reference to create TyranoBuilder plugins"); /* Set a thumbnail image for the plugin. Place the image in the plugin folder */ this.plugin_img = "no_image"; } /* This runs once after intalling and running the plugin. */ triggerInstall(){ /* //This is a sample showing how to copy a file from the plugin to the project var project_path = TB.getProjectPath() ; var from_path = project_path + "data/others/plugin/plugin_template/copy_folder"; var to_path = project_path + "data/image/copy_folder"; TB.io.copy(from_path,to_path); */ } /* Define the components to be added. */ defineComponents(){ var cmp = {}; var TB = this.TB; /* cmp配列 cmpにプラグイン用のコンポーネントを定義していきます。 配列名にはタグ名を指定してください。 他のタグと被らないように世界で一つだけの名称になるように工夫してください。 (自分の所持しているドメイン名を含めるなど) */ /* sample_component_1 次のパラメータのサンプルを設置 Image:イメージ選択 */ cmp["sample_component_1"] = { "info":{ "default":true, /*trueを指定するとコンポーネントがデフォルトで配置されます。*/ "name":TB.$.s("sample1"), /* コンポーネント名称 */ "help":TB.$.s("背景変更をプラグインでコンポーネント化したもの"), /* コンポーネントの説明を記述します */ "icon":TB.$.s("s-icon-star-full") /* ここは変更しないでください */ }, /* Set the component details */ "component":{ name : TB.$.s("Background Change (Sample)"), /* Component name */ component_type : "Image", /* Component type. Use 'Simple', 'Movie', 'Image', 'Text', or 'Sound' */ /*Values to pass to the viewer */ default_view : { base_img_url : "data/bgimage/", /* Set the base folder for images */ icon : "s-icon-star-full", /* Do not edit */ icon_color : "#FFFF99", /* Do not edit */ category : "plugin" /* Do not edit */ }, /* Do not edit */ param_view : { }, /* Set the component parameters */ param:{ /* Define the parameters. 'storage' represents the parameter name. */ /* Image selection example */ "storage" : { type : "ImageSelect", /* The parameter type. In this case, an image selection. */ file_path : "bgimage/", /* The background image folder is set as default */ base_img_url : "data/bgimage/", /* Set the target selection folder */ name : TB.$.s("background image"), /* Parameter name */ help : TB.$.s("Change the background image."), /* Parameter explanation. Displayed in the help bar at the bottom of the screen. */ vital : true, /* Sets optional or not. Recommended to be left as is. */ default_val : "", /* Set the default value of the component */ line_preview: "on", /* Set whether or not to preview in the Scene Editor */ validate : { required : true } }, /*数値入力の例*/ "time" : { type : "Num", /*Numは数字入力を設定できます*/ name : "時間", /*パラメータ名*/ unit : "ミリ秒", /*単位を表示できます*/ help : TB.$.s("指定した時間をかけて背景が切り替わります"), default_val : 1000, /*初期値*/ /*spinnerは数値をスピナー形式で表現します*/ spinner : { min : 0, /*入力の最小値*/ max : 10000, /*入力の最大値*/ step : 500 /*スピナーを1回動かした時のステップ値*/ }, validate : { number : true /*数値か否かのチェックを有効化*/ } }, /*セレクトボックス形式 */ "clickskip" : { type : "Select", select_list : [{ name : TB.$.s("有効"), val : "true" }, { name : TB.$.s("無効"), val : "false" }], default_val : "false", name : TB.$.s("演出スキップの可否"), help : TB.$.s("切り替え中にクリックすることで演出をスキップできるようにするか否か"), }, /*チェックボックス形式*/ "wait" : { type : "Check", text : TB.$.s("完了を待つ"), default_val : false }, /*カラー選択の形式*/ "color" : { type : "Color", name : TB.$.s("色"), default_val : "0x000000", validate : { required : true } }, /*テキストの自由入力*/ "text" : { type : "Text", name : TB.$.s("テキスト入力サンプル"), validate : { required : true, }, /* onChangeメソッド テキストが変更されたタイミングで、手動でパラメータを設定する必要があります。 Textの場合は必須です。 */ onChange : function(val, component) { TB.component.changeParam(component, "text", val); } }, }, /* 途中からプレビューの時に実行するタグを返す。 例えば背景変更の機能をもったコンポーネントの場合、 途中からプレビューのときに背景変更のタグを実行しておかないと 途中からプレビューにこのコンポーネントが反映されません。 timeなどの時間は短くしておく必要があります。 */ /* preview_tag:function(preview,cmp){ var storage = cmp.data.pm["storage"]; //返却用のタグを設定 preview.code_current_bg ="[bg time=10 storage="+storage+" ] \n"; }, */ } }; /* cmp は複数設定することができます。 つまり、1プラグインに対して3つのコンポーネントを追加するようなことも可能です。 */ /*イメージ選択、位置変更など*/ cmp["sample_component_2"] = { "info":{ "default":true, /*trueを指定するとコンポーネントがデフォルトで配置されます。*/ "name":TB.$.s("サンプル2"), /* コンポーネント名称 */ "help":TB.$.s("サンプル2です"), /* コンポーネントの説明を記述します */ "icon":TB.$.s("s-icon-star-full") /* ここは変更しないでください */ }, /* コンポーネントの情報の詳細を定義します */ "component":{ name : TB.$.s("サンプル2"), /* コンポーネント名称 */ /* headerが定義されている場合、タイムライン上のコンポーネントバー部分の文字列を自由に設定できます。 以下の例はジャンプ先のシナリオ名とターゲットをバーに表示させて視認性を確保します。 */ component_type : "Simple", /*タイムラインのコンポーネントタイプ Simpleはバーのみ */ /*ビューに渡す値*/ default_view : { base_img_url : "data/fgimage/", /*画像選択のベースとなるフォルダを指定*/ icon : "s-icon-star-full", /* Do not edit */ icon_color : "#FFFF99", /* Do not edit */ category : "plugin" /* Do not edit */ }, /* Do not edit */ param_view : { }, /* write_system_code 以下のメソッドは、同時生成されるシステム用のシナリオファイルにタグを追加することができます scene1.ks なら system/_scene1.ks です。 プリロードや準備作業が必要な場合はこのメソッドでタグを記述してください。 */ write_system_code : function(context) { var tag_name = this.data.name; var pm = this.data.pm; var storage = "./data/fgimage/" + pm.storage; if (!context["map_preload"][storage]) { context["map_preload"][storage] = "1"; return $.tag("preload", { "storage" : storage }); } else { return ""; } }, /* コンポーネントのパラメータを定義していきます */ param : { storage : { type : "ImageSelect", file_path : "fgimage/default/", name : TB.$.s("画像"), help : TB.$.s("表示するイメージを選択します"), vital : true, //必須かどうか default_val : "", validate : { required : true } }, /*画像をプレビューしながら位置を設定することができます*/ _clickable_img : { type : "BoundSelect", bound_type : "image", file_path : "bgimage/", //背景画像からデフォルト選択するようになっていること。 name : TB.$.s("領域選択"), help : TB.$.s("座標を見やすいツールを使って指定することができます"), vital : false, //必須かどうか default_val : "", }, x : { type : "Num", name : TB.$.s("横位置"), unit : TB.$.s("px"), help : TB.$.s("イメージを表示する横位置を指定。"), validate : { number : true } // default_val:3000, }, y : { type : "Num", name : TB.$.s("縦位置"), unit : TB.$.s("px"), help : TB.$.s("イメージを表示する画面上部からのを位置を指定。"), validate : { number : true } // default_val:3000, }, width : { type : "Num", name : TB.$.s("横幅"), unit : TB.$.s("px"), help : TB.$.s("イメージの横幅を指定します"), validate : { number : true } // default_val:3000, }, height : { type : "Num", name : TB.$.s("高さ"), unit : TB.$.s("px"), help : TB.$.s("イメージの高さを指定します"), validate : { number : true } }, }, /* 途中からプレビューの時に実行するタグを返す。 例えば背景変更の機能をもったコンポーネントの場合、 途中からプレビューのときに背景変更のタグを実行しておかないと 途中からプレビューにこのコンポーネントが反映されません。 timeなどの時間は短くしておく必要があります。 */ /* preview_tag:function(preview,cmp){ var storage = cmp.data.pm["storage"]; //返却用のタグを設定 preview.code_current_bg ="[bg time=10 storage="+storage+" ] \n"; }, */ } }; /*ジャンプ指定などを確認できるコンポーネント*/ cmp["sample_component_3"] = { "info":{ "default":true, /*trueを指定するとコンポーネントがデフォルトで配置されます。*/ "name":TB.$.s("サンプル3"), /* コンポーネント名称 */ "help":TB.$.s("サンプル3です"), /* コンポーネントの説明を記述します */ "icon":TB.$.s("s-icon-star-full") /* ここは変更しないでください */ }, /* コンポーネントの情報の詳細を定義します */ "component":{ name : TB.$.s("サンプル3"), /* コンポーネント名称 */ /* headerが定義されている場合、タイムライン上のコンポーネントバー部分の文字列を自由に設定できます。 以下の例はジャンプ先のシナリオ名とターゲットをバーに表示させて視認性を確保します。 */ header : function(obj) { obj.data.pm.storage || (obj.data.pm.storage = ""); obj.data.pm.target || (obj.data.pm.target = ""); return "" + obj.data.pm.storage + " " + obj.data.pm.target + ""; }, component_type : "Simple", /*タイムラインのコンポーネントタイプ Simpleはバーのみ */ /*ビューに渡す値*/ default_view : { icon : "s-icon-star-full", /* Do not edit */ icon_color : "#FFFF99", /* Do not edit */ category : "plugin" /* Do not edit */ }, /* Do not edit */ param_view : { }, /* コンポーネントのパラメータを定義していきます */ param : { /*テキスト入力*/ /* ジャンプの設定 シナリオ名とターゲットを選択したい場合は、次のように書くだけでOK */ storage : TB._pm_type["storage"], target : TB._pm_type["target"], next : { type : "Check", text : TB.$.s("復帰時に自動的に次の命令へ移動する"), default_val : true, //name:"", }, /* コンポーネントの実行に条件をつけたい場合は次のCondタイプが使えます */ cond : { type : "Cond", name : TB.$.s("フラグ判定用の式"), help : TB.$.s("スリープに発動条件を付けたい場合、ここにスクリプト条件式を記述してください。条件が真の場合のみジャンプします"), }, }, } }; /*サウンドファイル選択の動作確認ができるサンプル*/ cmp["sample_component_4"] = { "info":{ "default":true, /*trueを指定するとコンポーネントがデフォルトで配置されます。*/ "name":TB.$.s("サンプル4"), /* コンポーネント名称 */ "help":TB.$.s("サンプル4です"), /* コンポーネントの説明を記述します */ "icon":TB.$.s("s-icon-star-full") /* ここは変更しないでください */ }, /* コンポーネントの情報の詳細を定義します */ "component":{ name : TB.$.s("サンプル4"), /* コンポーネント名称 */ /* headerが定義されている場合、タイムライン上のコンポーネントバー部分の文字列を自由に設定できます。 以下の例はジャンプ先のシナリオ名とターゲットをバーに表示させて視認性を確保します。 */ header : function(obj) { return obj.data.pm.storage; }, component_type : "Sound", /*タイムラインのコンポーネントタイプ Simpleはバーのみ */ /*ビューに渡す値*/ default_view : { base_sound_url : "data/bgm/", /* soundフォルダから選択させる場合は data/sound に変更 */ icon : "s-icon-star-full", /* Do not edit */ icon_color : "#FFFF99", /* Do not edit */ category : "plugin", /* Do not edit */ }, /* Do not edit */ param_view : { }, /* コンポーネントのパラメータを定義していきます */ param : { storage : { type : "SoundSelect", /*パラメータのタイプです。これは画像選択の場合*/ file_path : "bgm/", /* 効果音の場合はsoundに変更 */ name : TB.$.s("音楽"), vital : true, //必須かどうか default_val : "", }, volume : { type : "Num", name : TB.$.s("音量"), unit : TB.$.s("%"), validate : { number : true }, spinner : { min : 0, max : 100, step : 10 }, default_val : 100 }, fadein : { type : "Check", text : TB.$.s("フェードイン効果"), default_val : false, name : TB.$.s("演出") }, time : { type : "Num", name : TB.$.s("フェードイン時間"), unit : TB.$.s("ミリ秒"), validate : { number : true }, spinner : { min : 0, max : 99999, step : 100 }, default_val : 1000 }, loop : { type : "Check", text : TB.$.s("ループ再生する"), default_val : "true", name : "", } }, } }; /*ムービーファイル選択の動作確認ができるサンプル*/ cmp["sample_component_5"] = { "info":{ "default":true, /*trueを指定するとコンポーネントがデフォルトで配置されます。*/ "name":TB.$.s("サンプル5"), /* コンポーネント名称 */ "help":TB.$.s("サンプル5です"), /* コンポーネントの説明を記述します */ "icon":TB.$.s("s-icon-star-full") /* ここは変更しないでください */ }, /* コンポーネントの情報の詳細を定義します */ "component":{ name : TB.$.s("サンプル5"), /* コンポーネント名称 */ /* headerが定義されている場合、タイムライン上のコンポーネントバー部分の文字列を自由に設定できます。 以下の例はジャンプ先のシナリオ名とターゲットをバーに表示させて視認性を確保します。 */ header : function(obj) { return obj.data.pm.storage; }, component_type : "Movie", /*タイムラインのコンポーネントタイプ */ /*ビューに渡す値*/ default_view : { base_movie_url : "data/video/", /* 必須 */ icon : "s-icon-star-full", /* Do not edit */ icon_color : "#FFFF99", /* Do not edit */ category : "plugin", /* Do not edit */ }, /* Do not edit */ param_view : { }, /* コンポーネントのパラメータを定義していきます */ param : { storage : { type : "MovieSelect", file_path : "video/", //背景画像からデフォルト選択するようになっていること。 name : TB.$.s("動画"), vital : true, //必須かどうか default_val : "", validate : { required : true } }, volume : { type : "Num", name : TB.$.s("音量"), unit : TB.$.s("%"), validate : { number : true }, spinner : { min : 0, max : 100, step : 10 }, default_val : 100 }, skip : { type : "Check", text : TB.$.s("スキップ可"), default_val : false, help : TB.$.s("チェックを入れると、ムービー再生中にクリックすることでスキップすることができるようになります"), name : "", } }, } }; return cmp; } test(){ } }
X Tutup