home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2006 April / SGP.iso / dema / Keepsake-Demo-en-li-v1.0.exe / res / interface / common / itf.desc.tcl < prev    next >
Text File  |  2005-10-30  |  9KB  |  279 lines

  1. proc descCallBack {} {}
  2.  
  3. class itf'zoom {
  4.     proc itf'zoom {this} oz'widget {itf'zoom} {
  5.         set base "interface/[MODE]/fs"
  6.         set ($this,bg) 0
  7.         set ($this,state) ""
  8.         set ($this,currentPage) 0
  9.         set ($this,maxPage) 0
  10.         set ($this,obj) ""
  11.  
  12.         oz'widget::bind $this enter itf'zoom::enter $this
  13.         oz'widget::bind $this leave itf'zoom::leave $this
  14.      
  15.         set ($this,back)  [new oz'button "$base/fs.back"]
  16.         set ($this,close) [new oz'button "$base/fs.close"]
  17.         set ($this,next)  [new oz'button "$base/fs.next"]
  18.  
  19.         oz'button::property $($this,back) -pos 0.005859 0.945313 \
  20.                                           -click itf'zoom::back $this -alpha 1
  21.         oz'button::property $($this,close) -pos 0.005859 0.945313 -sclick "sound/interface/backClick.ogg" \
  22.                                            -click itf'zoom::close $this -alpha 0
  23.         oz'button::property $($this,next) -pos 0.587891 0.945313 \
  24.                                           -click itf'zoom::next $this -alpha 1
  25.         
  26.         oz'widget::child $this $($this,back)  0
  27.         oz'widget::child $this $($this,close) 0
  28.         oz'widget::child $this $($this,next)  0
  29.     }
  30.  
  31.     proc enter {this} {
  32.         oz'mouse::cursor +100
  33.     }
  34.  
  35.     proc leave {this} {
  36.         oz'mouse::cursor -100
  37.     }
  38.  
  39.     proc full {this obj} {
  40.         set ($this,obj) $obj
  41.         
  42.         if {[ozGet "itemCirclet"] == "pickedUp"} {
  43.             set ($this,state) "text"
  44.         } else {
  45.             set ($this,state) "rune"
  46.         }
  47.  
  48.         set ($this,currentPage) 1
  49.  
  50.         switch $obj {
  51.             noteBook {
  52.                 set ($this,maxPage) 2
  53.             }
  54.             caretakerNote {
  55.                 set ($this,state) "text"
  56.                 set ($this,maxPage) 1
  57.             }
  58.             wineCaveClue {
  59.                 set ($this,state) "text"
  60.                 set ($this,maxPage) 1
  61.             }
  62.             tapestrySolarium {
  63.                 set ($this,maxPage) 1
  64.             }
  65.             tapestryObservatory {
  66.                 set ($this,maxPage) 1
  67.             }
  68.             tapestryForge {
  69.                 set ($this,maxPage) 1
  70.             }
  71.             tapestryArtRoom {
  72.                 set ($this,maxPage) 1
  73.             }
  74.             spellbook {
  75.                 set ($this,maxPage) 1
  76.             }
  77.             orbNotes {
  78.                 set ($this,maxPage) 1
  79.             }
  80.             yewlockLeavesPage {
  81.                 set ($this,maxPage) 1
  82.             }
  83.             nigilisPage {
  84.                 set ($this,maxPage) 2
  85.             }
  86.             headenFlowerPage {
  87.                 set ($this,maxPage) 1
  88.             }
  89.         }
  90.  
  91.         init $this
  92.     }
  93.  
  94.     proc close {this} {
  95.         oz'widget::fadeto $this 0
  96.     }
  97.  
  98.     proc back {this} {
  99.         incr ($this,currentPage) -1
  100.  
  101.         if {$($this,currentPage) == 1} {
  102.         }
  103.         
  104.         init $this
  105.     }
  106.  
  107.     proc next {this} {
  108.         incr ($this,currentPage) 1
  109.  
  110.         if {$($this,currentPage) == $($this,maxPage)} {
  111.             oz'mouse::cursor 99
  112.         }
  113.         
  114.         init $this
  115.     }
  116.  
  117.     proc init {this} {
  118.         set base "interface/[MODE]/fs"
  119.  
  120.         if $($this,bg) {
  121.             delete $($this,bg)
  122.         }
  123.        
  124.         set ($this,bg) [new oz'sprite "$base/fs.$($this,obj).$($this,state).$($this,currentPage)"]
  125.         oz'widget::property $($this,bg) -alpha 1
  126.  
  127.         oz'widget::property $this -isize [oz'widget::width $($this,bg)] [oz'widget::height $($this,bg)]
  128.         
  129.         oz'widget::child $this $($this,bg) 1
  130.  
  131.         if {$($this,currentPage) == $($this,maxPage)} {
  132.             oz'button::disable $($this,next)
  133.         } else {
  134.             oz'button::enable $($this,next)
  135.         }
  136.  
  137.         if {$($this,currentPage) == 1} {
  138.             oz'widget::alpha $($this,back) 0
  139.             oz'widget::alpha $($this,close) 1
  140.         } else {
  141.             oz'widget::alpha $($this,back) 1
  142.             oz'widget::alpha $($this,close) 0
  143.         }
  144.     }
  145. }
  146. class itf'desc {
  147.     proc itf'desc {this} oz'widget {itf'desc} {
  148.         set base "interface/[MODE]/desc"
  149.         set ($this,flag) ""
  150.         set ($this,obj) ""
  151.  
  152.         set ($this,bg) [new oz'sprite "$base/desc.bg"]
  153.         
  154.         oz'widget::child $this $($this,bg) 1
  155.         
  156.         oz'widget::bind $this enter itf'desc::enter $this
  157.         oz'widget::bind $this leave itf'desc::leave $this
  158.  
  159.         oz'widget::property $this -isize [oz'widget::width $($this,bg)] [oz'widget::height $($this,bg)]
  160.         
  161.         set ($this,back.butt) [new oz'button "$base/desc.back"]
  162.         set ($this,zoom.butt) [new oz'button "$base/desc.zoom"]
  163.  
  164.         oz'button::property $($this,back.butt) -pos 0.025391 0.270833 -click itf'desc::back $this \
  165.                                                -sclick "sound/interface/backClick.ogg"
  166.         oz'button::property $($this,zoom.butt) -pos 0.077148 0.270833 -disable -click itf'desc::zoom $this
  167.         
  168.         oz'widget::child $this $($this,back.butt)  0
  169.         oz'widget::child $this $($this,zoom.butt)  0
  170.  
  171.         set ($this,name.label) [new oz'label "name" 0.485351 0.067708]
  172.         set ($this,desc.label) [new oz'label "desc" 0.369140 0.227864]
  173.  
  174.         oz'label::property $($this,name.label) -pos 0.025390 0.011718 -font system.ttf -fsize 20 -color 0.3 0.8 1
  175.         oz'label::property $($this,desc.label) -pos 0.147460 0.092447 -font system.ttf -fsize 16 -color 0.7 0.9 1
  176.  
  177.         oz'widget::child $this $($this,name.label) 0
  178.         oz'widget::child $this $($this,desc.label) 0
  179.     }
  180.  
  181.     proc ~itf'desc {this} {
  182.         delete $($this,bg)
  183.         
  184.         delete $($this,back.butt)
  185.         delete $($this,next.butt)
  186.         delete $($this,prev.butt)
  187.  
  188.         delete $($this,name.label)
  189.         delete $($this,desc.label)
  190.     }
  191.    
  192.     proc addobject {this obj} {
  193.         set ($this,$obj.spr)  [new oz'sprite "interface/[MODE]/desc/desc.$obj"]
  194.         oz'widget::property $($this,$obj.spr) -pos 0.006836 0.011719 -alpha 0
  195.         oz'widget::child $this $($this,$obj.spr)  0
  196.     }
  197.  
  198.     proc enter {this} {
  199.         oz'mouse::cursor +100
  200.     }
  201.  
  202.     proc leave {this} {
  203.         oz'mouse::cursor -100
  204.     }
  205.  
  206.     proc back {this} {
  207.         MainEnableSidebar
  208.         MainEnableHelp
  209.  
  210.         hide $this
  211.         
  212.         if {$($this,flag) == "-inv"} {
  213.             itf'sidebar::show $::itf::sidebar
  214.             itf'sidebar::inv  $::itf::sidebar
  215.         }
  216.         if {$($this,flag) == "-notebook"} {
  217.             itf'sidebar::show     $::itf::sidebar
  218.             itf'sidebar::notebook $::itf::sidebar
  219.         }
  220.         if {$($this,flag) == "-callback"} {
  221.             descCallBack
  222.         }
  223.     }
  224.  
  225.     proc show {this obj {flag ""}} {
  226.         set ($this,flag) $flag
  227.         set ($this,obj) $obj
  228.         
  229.         MainDisableSidebar
  230.         MainDisableTalk
  231.         iactive interface.help  false
  232.         ozIMenu disable help
  233.         
  234.         oz'label::property $($this,name.label) -text [GetObjectName $obj]
  235.         oz'label::property $($this,desc.label) -text [GetObjectDesc $obj]
  236.  
  237.         setThreadID 4
  238.         oz'event {wizDisableMouse}
  239.         oz'event {oz'delay 0.25}
  240.         oz'event {itf'inventory::showicon $::itf::inventory $obj 0.21875 0.333333}
  241.         oz'event {wizEnableMouse}
  242.         setThreadID 0
  243.         
  244.         oz'widget::fadeto $this 1
  245.  
  246.         switch $obj {
  247.             noteBook            {oz'button::enable  $($this,zoom.butt)}
  248.             caretakerNote       {oz'button::enable  $($this,zoom.butt)}
  249.             wineCaveClue        {oz'button::enable  $($this,zoom.butt)}
  250.             tapestrySolarium    {oz'button::enable  $($this,zoom.butt)}
  251.             tapestryObservatory {oz'button::enable  $($this,zoom.butt)}
  252.             tapestryForge       {oz'button::enable  $($this,zoom.butt)}
  253.             tapestryArtRoom     {oz'button::enable  $($this,zoom.butt)}
  254.             yewlockLeavesPage   {oz'button::enable  $($this,zoom.butt)}
  255.             nigilisPage         {oz'button::enable  $($this,zoom.butt)}
  256.             headenFlowerPage    {oz'button::enable  $($this,zoom.butt)}
  257.             spellBook           {oz'button::enable  $($this,zoom.butt)}
  258.             orbNotes            {oz'button::enable  $($this,zoom.butt)}
  259.             default             {oz'button::disable $($this,zoom.butt)}
  260.         }
  261.  
  262.         if {$($this,flag) == "-callback"} {
  263.             itf'zoom::full $::itf::zoom $($this,obj)
  264.             oz'widget::fadeto $::itf::zoom 1
  265.         }
  266.     }
  267.  
  268.     proc zoom {this} {
  269.         itf'zoom::full $::itf::zoom $($this,obj)
  270.         oz'widget::fadeto $::itf::zoom 1
  271.     }
  272.  
  273.     proc hide {this} {
  274.         oz'widget::fadeto $this 0
  275.         itf'inventory::hideicon $::itf::inventory
  276.     }
  277. }
  278.  
  279.