Top > AirNovel - ラジオボタン

*AirNovel - ラジオボタン [#x0cc202c]

- どちらか一方しか押せないボタン。

適当に作ってみました。
適当に作ってみました。上手く動作しなかったらごめんなさい。
自由に改変してください。

何かもっといいやり方あったら教えてください。
サンプルのを参考にした方がいいかもしれません。
公式サンプルのを参考にした方がいいかもしれません。

----


#contents


** ラジオボタンセットアップ用のマクロ [#q45f051f]
  ;//--------------------------------------------------------------
  ;/**
  ; * ラジオボタンをセットアップ
  ; *
  ; * @param[ in ] layer : [必須]使用レイヤー名(他と共用不可)
  ; * @param[ in ] lcenter : [必須]左ボタンの表示位置xセンター
  ; * @param[ in ] lmiddle : [必須]左ボタンの表示位置yセンター
  ; * @param[ in ] rcenter : [必須]右ボタンの表示位置xセンター
  ; * @param[ in ] rmiddle : [必須]右ボタンの表示位置yセンター
  ; * @param[ in ] lpic_nosel : [必須]左ボタン未選択時の表示画像
  ; * @param[ in ] lpic_sel   : [必須]左ボタン選択時の表示画像
  ; * @param[ in ] rpic_nosel : [必須]右ボタン未選択時の表示画像
  ; * @param[ in ] rpic_sel   : [必須]右ボタン選択時の表示画像
  ; * @param[ in ] lfn     : [必須]左ボタンが押された時にcallされるファイル
  ; * @param[ in ] llabel  : [必須]左ボタンが押された時にcallされるラベル
  ; * @param[ in ] rfn     : [必須]右ボタンが押された時にcallされるファイル
  ; * @param[ in ] rlabel  : [必須]右ボタンが押された時にcallされるラベル
  ; * @param[ in ] var  : [必須]参照する変数。trueで左側がONになる。
  ; *
  ; * @note 使用例
  ; *   [call label=*Setup]
  ; *   [s]
  ; *   *Setup
  ; *     [RadioButtonSetup llabel=*Left rlabel=*Right ...]
  ; *     [return]
  ; *   *Left
  ; *     [let name="var" text="true" cast="bool"]
  ; *     [call label=*Setup]
  ; *     [return]
  ; *   *Right
  ; *     [let name="var" text="false" cast="bool"]
  ; *     [call label=*Setup]
  ; *     [return]
  ; *
  ; */
  ;//--------------------------------------------------------------
  [macro name="RadioButtonSetup"]
    [clear_lay layer="&mp:layer" page=back]
    [button layer="&mp:layer" page=back pic="&mp:lpic_nosel" center="&mp:lcenter" middle="&mp:lmiddle" join=true global=true call=true fn="&mp:lfn" label="&mp:llabel" cond="mp:var == false"]
    [button layer="&mp:layer" page=back pic="&mp:lpic_sel"   center="&mp:lcenter" middle="&mp:lmiddle" join=true enabled=false cond="mp:var == true"]
    [button layer="&mp:layer" page=back pic="&mp:rpic_nosel" center="&mp:rcenter" middle="&mp:rmiddle" join=true global=true call=true fn="&mp:rfn" label="&mp:rlabel" cond="mp:var == true"]
    [button layer="&mp:layer" page=back pic="&mp:rpic_sel"   center="&mp:rcenter" middle="&mp:rmiddle" join=true enabled=false  cond="mp:var == false"]
    [trans layer="&mp:layer"]
    [wt]
  [endmacro]


** 使用例 [#k0ab9b78]

  ; ウィンドウモードの設定のラジオボタン
  
  ; スクリプト処理
  [let name="is_fullscreen" text="false" cast="bool"]
  
  [add_lay layer="option_windowmode_button" class="txt"]
  [lay layer="option_windowmode_button" page=fore visible=true b_alpha=0]
  [lay layer="option_windowmode_button" page=back visible=true b_alpha=0]
  
  [call label=*Setup]
  [s]
  
  
  ;//--------------------------------------------------------------
  ;/// ラジオボタンのセットアップ
  ;//--------------------------------------------------------------
  *Setup
    [RadioButtonSetup layer="option_windowmode_button"
        lcenter=200 lmiddle=300 lpic_nosel="option_window_mode_fullscreen_nosel" lpic_sel="option_window_mode_fullscreen_sel" lfn="seq_option" llabel="*Left"
        rcenter=600 rmiddle=300 rpic_nosel="option_window_mode_window_nosel"     rpic_sel="option_window_mode_window_sel"     rfn="seq_option" rlabel="*Right"
        var="&is_fullscreen"]
    [return]
  
  ;//--------------------------------------------------------------
  ;/// 左のボタンが押された際に呼ばれる
  ;//--------------------------------------------------------------
  *Left
    [let name="is_fullscreen" text="true" cast="bool"]
    [call label=*Setup]
    [return]
  
  ;//--------------------------------------------------------------
  ;/// 右のボタンが押された際に呼ばれる
  ;//--------------------------------------------------------------
  *Right
    [let name="is_fullscreen" text="false" cast="bool"]
    [call label=*Setup]
    [return]


** 何か [#r4946dac]
- 使用するlayerは、このラジオボタン1つにつき1枚にしてください。他の物と共用になると正常に動作しません。
- lpic_nosel, rpic_nosel の画像は、[button]タグの3分割画像になります。(非選択、決定時、マウスオーバー時)
- lpic_sel, rpic_sel の画像は、固定の画像になります。([button enabled=false]の時の画像)

    ホーム 一覧 単語検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS