[資料1]
スタックResourceForLectureの
スタックスクリプト

------------------------------------------
--- written by Takashi KURITA  --
------------------------------------------
on startLecture
  global gAuto, gBeginToLecture
  set userLevel to 5
  put false into gBeginToLecture
  setMenuBarLecture
  put false into gAuto
  if the number of bg parts = 0 then setBkgndLecture
  set the textFont of field 1 to "OSAKA"
  set the textSize of field 1 to 24
  set the textStyle of field 1 to plain
end startLecture
------------
on endLecture
  if there is a menu "民法入門" then
    delete menu "民法入門"
  end if
end endLecture
----------------
on openLecture
  global gBeginToLecture
  if gBeginToLecture then
    lecture
  end if
end openLecture
------------
on lecture
  setUp
  send "beginToTalk" to this card
  talkEnded
end lecture
------------
on closeLecture
  hideFields
end closeLecture
------------
on openBkgndLecture
  global gAuto
  if gAuto is true then
    hide bg button 2
    hide bg button 3
  else
    show bg button 2
    show bg button 3
  end if
end openBkgndLecture
------------
on setUp
  global showMode
  hideFields
  AddColor colorCard
  put 3 into n
  put random(n) into showMode
end setUp
---------------
on setMenuBarLecture
  global gBeginToLecture
  if there is not a menu "民法入門" then
    create menu "民法入門"
    put "データフィールド生成24" into menu "民法入門"
    put "データフィールド生成18" after menu "民法入門"
    put "-" after menu "民法入門"
    put "フィールドを表示" after menu "民法入門"
    put "フィールドを隠す" after menu "民法入門"
    put "-" after menu "民法入門"
    put "タイトル位置の初期化" after menu "民法入門"
    put "フィールド左揃え" after menu "民法入門"
    put "フィールド枠揃え" after menu "民法入門"
    put "-" after menu "民法入門"
    put "全体の自動進行" after menu "民法入門"
    put "カードを開くと講義開始" after menu "民法入門"
    
    set menuMsg of menuItem "データフィールド生成24" of menu "民法入門" to "makeField24"
    set menuMsg of menuItem "データフィールド生成18" of menu "民法入門" to "makeField18"
    set menuMsg of menuItem "フィールドを表示" of menu "民法入門" to "showAllFields"
    set menuMsg of menuItem "フィールドを隠す" of menu "民法入門" to " hideFields"
    set menuMsg of menuItem "タイトル位置の初期化" of menu "民法入門" to "setTitlePosition"
    set menuMsg of menuItem "フィールド左揃え" of menu "民法入門" to "setLeftMargin"
    set menuMsg of menuItem "フィールド枠揃え" of menu "民法入門" to "setFieldMargin"
    set menuMsg of menuItem "全体の自動進行" of menu "民法入門" to "autoTalk"
    set menuMsg of menuItem "カードを開くと講義開始" of menu "民法入門" to "changeBeginToLecture"
  end if
  set the checkMark of menuItem "カードを開くと講義開始" of menu "民法入門" to gBeginToLecture
end setMenuBarLecture
------------
on changeBeginToLecture
  global gBeginToLecture
  put not(gBeginToLecture) into gBeginToLecture
  set the checkMark of menuItem "カードを開くと講義開始" of menu "民法入門" to gBeginToLecture
end changeBeginToLecture
------------
on hideFields
  repeat with nn=1 to number of  card fields
    hide card field nn
  end repeat
end hideFields
-----------
on setBkgndLecture
  doMenu "バックグラウンド"
  set the name of this bkgnd to "Lecture"
  doMenu "新規フィールド"
  set the name of the last bg field to "Title"
  set the rectangle of the last bg field to 140, 25, 500,130
  set the fixedLineHeight of the last bg field to true
  set the style of the last bg field to transparent
  set the textAlign of the last bg field to center
  set the textFont of the last bg field to "細明朝"
  set the textSize of the last bg field to 18
  set the textstyle of the last bg field to shadow, extend
  set the textFont of the last bg field to "細明朝"
  doMenu "新規ボタン"
  set the name of the last bg button to "Lecture"
  set the showName of the last bg button to false
  set the style of the last bg button to transparent
  set the rect of the last bg button to 575,35,610,80
  doMenu "新規ボタン"
  set the name of the last bg button to "Previous"
  set the showName of the last bg button to false
  set the style of the last bg button to transparent
  set the rect of the last bg button to 550,55,570,75
  set the icon of the last bg button to "Prev Arrow"
  set the script of the last bg button to ~
  "on mouseUp"&return&"myPreviousCard"&return&"end mouseUp"
  doMenu "新規ボタン"
  set the name of the last bg button to "Next"
  set the showName of the last bg button to false
  set the style of the last bg button to transparent
  set the rect of the last bg button to 615,55,635,75
  set the icon of the last bg button to "Next Arrow"
  set the script of the last bg button to ~
  "on mouseUp"&return&"myNextCard"&return&"end mouseUp"
  doMenu "新規ボタン"
  set the name of the last bg button to "SetMenu"
  set the showName of the last bg button to false
  set the style of the last bg button to transparent
  set the rect of the last bg button to 5,25,25,45
  set the script of the last bg button to ~
  "on mouseUp"&return&"setMenuBar"&return&"end mouseUp"
  doMenu "バックグラウンド"
end setBkgndLecture
---------------
on setTitlePosition
  set the rectangle of bg field "Title" to 140, 25, 500,130
end setTitlePosition
---------------
on setLeftMargin
  repeat with nn=1 to number of  card fields
    if the textSize of cd field nn is 24 then
      set the left of  card field nn to 40
    end if
  end repeat
end setLeftMargin
---------------
on setFieldMargin
  repeat with nn=1 to number of  card fields
    if the textSize of cd field nn is 24 then
      set the width of  card field nn to 588
      set the left of  card field nn to 40
    end if
  end repeat
end setFieldMargin
------------
on makeField24
  doMenu "新規フィールド"
  set the style of the last card field to opaque
  set the textSize of the last card field to 24
  set the rect of the last card field to 20,400,620,430
  put "◆●" into the last card field
  set the textFont of the last card field to "細明朝体"
  set the fixedLineHeight of the last card field to true
end makeField24
------------
on makeField18
  doMenu "新規フィールド"
  set the style of the last card field to opaque
  set the textSize of the last card field to 18
  set the textStyle of the last card field to bold
  set the rect of the last card field to 20,400,220,430
  set the textFont of the last card field to "細明朝体"
  set the fixedLineHeight of the last card field to true
end makeField18
------------
on showAllFields
  repeat with nn=1 to number of  card fields
    show card field nn
    set the textSize of card field nn to 24
  end repeat
  AddColor colorCard
end showAllFields
------------
on talk itemName
  global titleV, showMode
  wait until the sound is "done"
  put itemName into soundName
  if the last char of soundName is "*" then
    delete the last char of soundName
  end if
  play soundName
  myShow itemName
  if the mouseClick is true then
    put "次のマウスクリックまで一時停止"
    wait until the mouseClick
    set the visible of message window to false
  end if
end talk
------------------
on myShow itemName
  global titleV, showMode
  set the cantAbort of this stack to true
  if the last char of itemName is "*" then
    delete the last char of itemName
    put true into starFlag
  else
    put false into starFlag
  end if
  if there is a card field itemName then
    if showMode is 1 then
      winkShow itemName
    else if showMode is 2 then
      showSequent itemName, starFlag
    else if showMode is 3 then
      showToLeft itemName
    else if showMode is 4 then
      upShow itemName
    else
      winkShow itemName
    end if
  end if
  set the cantAbort of this stack to false
  AddColor colorCard
end myShow
------------------
on winkShow itemName
  show card field itemName
  wait for 20
  hide card field itemName
  wait for 20
  show card field itemName
  wait for 20
end winkShow
------------------
on showSequent itemName, starFlag
  if starFlag  then
    winkShow itemName
  else
    put card field itemName into st
    put empty into card field itemName
    show card field itemName
    put the number of characters of st into nn
    repeat with n=1 to nn
      put character n of st after card field itemName
      wait for 5
    end repeat
  end if
  wait for 1 second
end showSequent
------------------
on upShow itemName
  put the top of card field itemName into originalTop
  put (originalTop + 250) into vv
  if vv > 480 then put 480 into vv
  set the top of card field itemName to vv
  show card field itemName
  repeat while vv > originalTop
    set the top of card field itemName to vv
    subtract 2 from vv
  end repeat
  set the top of card field itemName to originalTop
end upShow
---------------
on showToLeft itemName
  put the left of card field itemName into originalLeft
  put originalLeft+300 into hh
  if hh > 600 then put 600 into hh
  set the left of card field itemName to hh
  show card field itemName
  repeat while hh > originalLeft
    set the left of card field itemName to hh
    subtract 3 from hh
  end repeat
  set the left of card field itemName to originalLeft
end showToLeft
--------------
on   goNext
  visual effect dissolve slowly
  if the number of this card is not number of cards then
    go to next card
  else
    send "getNextStack" to this stack
    put the result into nextStack
    if nextStack is not empty then
      go to stack nextStack
    end if
  end if
end   goNext
--------------
on goPrevious
  visual effect dissolve slowly
  if the number of this card is not 1 then
    go to previous  card
  else
    send "getPreviousStack" to this stack
    put the result into previousStack
    if previousStack is not empty then
      go to the last card of stack previousStack
    end if
  end if
end goPrevious
--------------
on talkEnded
  global gAuto
  wait until the sound is "done"
  if gAuto is not true then
    AddColor colorPict, "cd",  "126", "5,20", "t"
  end if
end talkEnded
---------------
on autoTalk
  global nextStack, gAuto
  put true into gAuto
  hide bg button 2
  hide bg button 3
  
  hide msg
  wait for  7 seconds
  put false into talkDone
  repeat until  talkDone is true
    lecture
    wait until the sound is "done"
    wait for 3 second
    if number of this card is not number of cards
    then
      visual effect dissolve slowly
      go to next card
    else
      send "getNextStack" to this stack
      put the result into nextStack
      if nextStack is not empty
      then
        visual effect dissolve slowly
        go to stack nextStack
      else
        put true into talkDone
        exit autoTalk
      end if
    end if
  end repeat
  put false into gAuto
  show bg button 2
  show bg button 3
end autoTalk
------------------
on getNextStack
  return(empty)
end getnextStack
-----------------
on getPreviousStack
  return(empty)
end getPreviousStack
---------------- 


[本文] [栗田隆のホームページ]

Copyright: 栗田隆
Contact: 栗田隆 Email: <KURITA@kansai-u.ac.jp>
Last Updated: 1996年 3月 19日 (火)