home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2006 April / SGP.iso / dema / Keepsake-Demo-en-li-v1.0.exe / res / interface / common / itf.option.tcl < prev    next >
Text File  |  2005-11-01  |  6KB  |  161 lines

  1. proc update_var2 {} {
  2.     set master_volume     [expr double([itf'slider2::get_pos $itfoption::($itf::option,music)]) / 10.0]
  3.     set ::config::user::gamma_correction [expr double([itf'slider2::get_pos $itfoption::($itf::option,gamma)]) / 10.0]
  4.  
  5.     if {$master_volume == 0} {
  6.         set master_volume 0.01
  7.     }
  8.  
  9.     set ::config::voice::volume     [expr $::ref_voice_volume     * $master_volume]
  10.     set ::config::soundfx::volume   [expr $::ref_soundfx_volume   * $master_volume]
  11.     set ::config::music::volume     [expr $::ref_music_volume     * $master_volume]
  12.     set ::config::ambient2d::volume [expr $::ref_ambient2d_volume * $master_volume]
  13.  
  14.     masterVolume2 $master_volume
  15.     updateGamma
  16.     updateVolume
  17. }
  18.  
  19. class itf'slider2 {
  20.     proc itf'slider2 {this} oz'widget {itf'slider2} {
  21.         set ($this,more) [new oz'button "interface/[MODE]/slider/slider.more"]
  22.         set ($this,less) [new oz'button "interface/[MODE]/slider/slider.less"]
  23.  
  24.         set ($this,bar0) [new oz'sprite "interface/[MODE]/slider/slider.bar0"]
  25.         set ($this,bar1) [new oz'sprite "interface/[MODE]/slider/slider.bar1"]
  26.         set ($this,bar2) [new oz'sprite "interface/[MODE]/slider/slider.bar2"]
  27.         set ($this,bar3) [new oz'sprite "interface/[MODE]/slider/slider.bar3"]
  28.         set ($this,bar4) [new oz'sprite "interface/[MODE]/slider/slider.bar4"]
  29.         set ($this,bar5) [new oz'sprite "interface/[MODE]/slider/slider.bar5"]
  30.         set ($this,bar6) [new oz'sprite "interface/[MODE]/slider/slider.bar6"]
  31.         set ($this,bar7) [new oz'sprite "interface/[MODE]/slider/slider.bar7"]
  32.         set ($this,bar8) [new oz'sprite "interface/[MODE]/slider/slider.bar8"]
  33.         set ($this,bar9) [new oz'sprite "interface/[MODE]/slider/slider.bar9"]
  34.  
  35.         oz'widget::property $($this,less) -pos 0.005859 0.010417
  36.         oz'widget::property $($this,more) -pos 0.213867 0.010417
  37.  
  38.         oz'button::property $($this,less) -click itf'slider2::less $this
  39.         oz'button::property $($this,more) -click itf'slider2::more $this
  40.  
  41.         oz'widget::property $($this,bar0) -pos 0.050781 0.010417 -alpha 0
  42.         oz'widget::property $($this,bar1) -pos 0.066406 0.010417 -alpha 0
  43.         oz'widget::property $($this,bar2) -pos 0.082031 0.010417 -alpha 0
  44.         oz'widget::property $($this,bar3) -pos 0.097656 0.010417 -alpha 0
  45.         oz'widget::property $($this,bar4) -pos 0.113281 0.010417 -alpha 0
  46.         oz'widget::property $($this,bar5) -pos 0.128906 0.010417 -alpha 0
  47.         oz'widget::property $($this,bar6) -pos 0.144531 0.010417 -alpha 0
  48.         oz'widget::property $($this,bar7) -pos 0.160156 0.010417 -alpha 0
  49.         oz'widget::property $($this,bar8) -pos 0.175781 0.010417 -alpha 0
  50.         oz'widget::property $($this,bar9) -pos 0.191406 0.010417 -alpha 0
  51.  
  52.         set ($this,pos) 0
  53.  
  54.         oz'widget::child $this $($this,less) 0
  55.         oz'widget::child $this $($this,more) 0
  56.  
  57.         oz'widget::child $this $($this,bar0) 0
  58.         oz'widget::child $this $($this,bar1) 0
  59.         oz'widget::child $this $($this,bar2) 0
  60.         oz'widget::child $this $($this,bar3) 0
  61.         oz'widget::child $this $($this,bar4) 0
  62.         oz'widget::child $this $($this,bar5) 0
  63.         oz'widget::child $this $($this,bar6) 0
  64.         oz'widget::child $this $($this,bar7) 0
  65.         oz'widget::child $this $($this,bar8) 0
  66.         oz'widget::child $this $($this,bar9) 0
  67.     }
  68.  
  69.     proc ~itf'slider2 {this} {
  70.         delete $($this,more)
  71.         delete $($this,less)
  72.  
  73.         delete $($this,bar0)
  74.         delete $($this,bar1)
  75.         delete $($this,bar2)
  76.         delete $($this,bar3)
  77.         delete $($this,bar4)
  78.         delete $($this,bar5)
  79.         delete $($this,bar6)
  80.         delete $($this,bar7)
  81.         delete $($this,bar8)
  82.         delete $($this,bar9)
  83.     }
  84.  
  85.     proc get_pos {this} {
  86.         return $($this,pos)
  87.     }
  88.  
  89.     proc set_pos {this p} {
  90.         set ($this,pos) $p
  91.  
  92.         for {set i 0} {$i < $p} {incr i} {
  93.             oz'widget::alpha $($this,bar$i) 1
  94.         }
  95.         for {set i $p} {$i < 10} {incr i} {
  96.             oz'widget::alpha $($this,bar$i) 0
  97.         }
  98.     }
  99.  
  100.     proc less {this} {
  101.         oz'flush
  102.         if {$($this,pos) <= 0} return
  103.  
  104.         incr ($this,pos) -1
  105.  
  106.         oz'widget::fadeto $($this,bar$($this,pos)) 0
  107.  
  108.         update_var2
  109.  
  110.         oz'flush
  111.     }
  112.  
  113.     proc more {this} {
  114.         oz'flush
  115.         if {$($this,pos) >= 10} return
  116.  
  117.         oz'widget::fadeto $($this,bar$($this,pos)) 1
  118.  
  119.         incr ($this,pos) 1
  120.  
  121.         update_var2
  122.  
  123.         oz'flush
  124.     }
  125. }
  126.  
  127. class itfoption {
  128.     proc itfoption {this} oz'widget {itf'option} {
  129.         set base "interface/[MODE]/option"
  130.  
  131.         set ($this,bg)    [new oz'sprite "$base/option.bg"]
  132.         set ($this,music) [new itf'slider2]
  133.         set ($this,gamma) [new itf'slider2]
  134.         
  135.         oz'widget::property $this -isize [oz'widget::width $($this,bg)] [oz'widget::height $($this,bg)]
  136.  
  137.         oz'widget::property $($this,music) -pos 0.079102 [expr 0.054688 - 0.005]
  138.         oz'widget::property $($this,gamma) -pos 0.079102 [expr 0.169271 - 0.005]
  139.         
  140.         oz'widget::child $this $($this,bg)           1
  141.         oz'widget::child $this $($this,music)        0
  142.         oz'widget::child $this $($this,gamma)        0
  143.  
  144.         itf'slider2::set_pos $($this,music) 10
  145.         itf'slider2::set_pos $($this,gamma) [expr int($::config::user::gamma_correction * 10)]
  146.     }
  147.  
  148.     proc ~itfoption {this} {
  149.         delete $($this,bg)
  150.     }
  151. }
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.