home *** CD-ROM | disk | FTP | other *** search
/ MacFormat UK 160 - Disc 1 / MF_UK_160_1.iso / pc / Files / Scenes / HOME.DIR / Internal_7.ls < prev    next >
Encoding:
Text File  |  2005-08-01  |  8.0 KB  |  223 lines

  1. global gRootPath, dv, mFont, MMFSize, SMFSize, HDFSize, BDFSize, clickAction, bOpaqueMenubar, mTxtAlign, mTxtIndent, ShadowOffset, bWidth, bHeight, menuStartSp, FinalMMSp, MaxItems
  2.  
  3. on exitFrame me
  4.   mFont = "Arial"
  5.   MMFSize = 18
  6.   SMFSize = 14
  7.   HDFSize = 24
  8.   BDFSize = 14
  9.   bWidth = 140
  10.   bHeight = 40
  11.   ShadowOffset = 15
  12.   MaxItems = 18
  13.   tempSettings = member("TempSettings")
  14.   menuTree = member("menuTree")
  15.   member("menuShadow").centerRegPoint = 1
  16.   member("menuBack").centerRegPoint = 1
  17.   repeat with i = 1 to tempSettings.line.count
  18.     delete tempSettings.line[i]
  19.   end repeat
  20.   repeat with i = 1 to menuTree.line.count
  21.     delete menuTree.line[i]
  22.   end repeat
  23.   repeat with i = 1 to the number of castMembers of castLib "menuText"
  24.     castLib("menuText").member[i].erase()
  25.   end repeat
  26.   repeat with i = 1 to the number of castMembers of castLib "submenufields"
  27.     castLib("submenufields").member[i].erase()
  28.   end repeat
  29.   settings = getNetText(gRootPath & "files" & dv & "menu" & dv & "settings.menu")
  30.   if netDone(settings) then
  31.     tempSettings.text = netTextresult(settings)
  32.     repeat with i = 1 to tempSettings.line.count
  33.       mess = tempSettings.line[i].word[1]
  34.       case mess of
  35.         "<interface_font>":
  36.           mFont = tempSettings.line[i].char[18..tempSettings.line[i].char.count]
  37.         "<main_menu_fontsize>":
  38.           MMFSize = integer(tempSettings.line[i].word[2])
  39.         "<submenu_fontsize>":
  40.           SMFSize = integer(tempSettings.line[i].word[2])
  41.         "<Header_Fontsize>":
  42.           HDFSize = integer(tempSettings.line[i].word[2])
  43.         "<body_fontsize>":
  44.           BDFSize = integer(tempSettings.line[i].word[2])
  45.         "<button_width>":
  46.           bWidth = integer(tempSettings.line[i].word[2])
  47.         "<button_height>":
  48.           bHeight = integer(tempSettings.line[i].word[2])
  49.         "<Item_Mode>":
  50.           clickAction = string(tempSettings.line[i].word[2])
  51.         "<opaque_menu_bar?>":
  52.           bOpaqueMenubar = string(tempSettings.line[i].word[2])
  53.         "<TextAlign>":
  54.           mTxtAlign = string(tempSettings.line[i].word[2])
  55.           case mTxtAlign of
  56.             "left":
  57.               mTxtAlign = #left
  58.             "right":
  59.               mTxtAlign = #right
  60.             "center":
  61.               mTxtAlign = #center
  62.           end case
  63.         "<textIndent>":
  64.           mTxtIndent = integer(tempSettings.line[i].word[2])
  65.         "<ShadowOffset>":
  66.           ShadowOffset = integer(tempSettings.line[i].word[2])
  67.       end case
  68.     end repeat
  69.   end if
  70.   tempSp = sprite("menuplaceholder").spriteNum
  71.   menuStartSp = sprite(tempSp)
  72.   menuStartSp.visible = 0
  73.   repeat with p = tempSp to _movie.channel.count
  74.     channel(p).removeScriptedSprite()
  75.     sprite(p).visible = 0
  76.   end repeat
  77.   dynItems = getNetText(gRootPath & "files" & dv & "menu" & dv & "items.menu")
  78.   MMCount = 0
  79.   SMCount = 0
  80.   SpCount = 0
  81.   pLocV = menuStartSp.locV
  82.   sLocH = menuStartSp.left
  83.   pLocH = sLocH
  84.   if netDone(dynItems) then
  85.     menuTree.text = netTextresult(dynItems)
  86.     repeat with i = 1 to menuTree.line.count
  87.       if menuTree.line[i] contains "---End---" then
  88.         FinalMMSp = menuStartSp.spriteNum + MMCount
  89.         exit repeat
  90.       end if
  91.       if menuTree.line[i] contains "---" then
  92.         MMCount = MMCount + 1
  93.         SpCount = SpCount + 1
  94.         NewTxt = new(#text, castLib("menuText"))
  95.         NewTxt.width = integer(bWidth)
  96.         repeat with d = 1 to the number of chars in menuTree.line[i]
  97.           if menuTree.line[i].char[d] = "@" then
  98.             if menuTree.line[i].char[d + 1] = "@" then
  99.               pEnd = d - 1
  100.               exit repeat
  101.             end if
  102.           end if
  103.         end repeat
  104.         NewTxt.text = menuTree.line[i].char[4..pEnd]
  105.         NewTxt.font = mFont
  106.         NewTxt.fontSize = MMFSize
  107.         NewTxt.alignment = mTxtAlign
  108.         NewTxt.antialias = 1
  109.         NewTxt.antiAliasThreshold = 0
  110.         NewTxt.leftIndent = mTxtIndent
  111.         NewTxt.rightIndent = mTxtIndent
  112.         NewTxt.topSpacing = 0
  113.         NewTxt.bottomSpacing = 0
  114.         NewTxt.centerRegPoint = 1
  115.         tempList = EMPTY
  116.         repeat with k = i + 1 to menuTree.line.count
  117.           if menuTree.line[k] contains "---" then
  118.             pbEnd = k - 1
  119.             exit repeat
  120.           end if
  121.         end repeat
  122.         j = i + 1
  123.         pbEnd = pbEnd
  124.         pNumber = pbEnd - j
  125.         holder = menuTree.line[j..pbEnd]
  126.         repeat with f = 1 to holder.line.count
  127.           popo = holder.line[f].word.count
  128.           repeat with g = 1 to popo
  129.             if holder.line[f].word[g] contains "@@" then
  130.               delete holder.line[f].word[g..popo]
  131.               job = holder.line[f].char.count
  132.               delete holder.line[f].char[job]
  133.               NewItemList = new(#text, castLib("submenufields"))
  134.               NewItemList.width = bWidth
  135.               NewItemList.centerRegPoint = 1
  136.               NewItemList.width = bWidth
  137.               NewItemList.text = holder.line[f]
  138.               NewItemList.font = mFont
  139.               NewItemList.fontSize = SMFSize
  140.               NewItemList.alignment = mTxtAlign
  141.               NewItemList.leftIndent = mTxtIndent
  142.               NewItemList.rightIndent = mTxtIndent
  143.               NewTxt.antialias = 1
  144.               NewTxt.antiAliasThreshold = 0
  145.               NewItemList.topSpacing = 0
  146.               NewItemList.bottomSpacing = 0
  147.               NewItemList.name = string(NewTxt.text & f)
  148.             end if
  149.           end repeat
  150.         end repeat
  151.       end if
  152.     end repeat
  153.     TmpSp = menuStartSp.spriteNum + 5
  154.     sLocH = menuStartSp.left + (bWidth / 2)
  155.     sLocV = menuStartSp.top
  156.     repeat with k = 1 to the number of castMembers of castLib "MenuText"
  157.       subBCount = 0
  158.       repeat with o = 1 to the number of castMembers of castLib "submenuitems"
  159.         if castLib("submenufields").member[o].name contains castLib("menuText").member[k].text then
  160.           subBCount = subBCount + 1
  161.           if subBCount = MaxItems then
  162.             twoBox = 1
  163.             exit repeat
  164.             next repeat
  165.           end if
  166.           twoBox = 0
  167.         end if
  168.       end repeat
  169.       pStarter = TmpSp
  170.       pLocH = sLocH + (bWidth * (k - 1))
  171.       if twoBox then
  172.         channel(TmpSp).makeScriptedSprite(member("menuBack"), point(pLocH, pLocV))
  173.         menuBack1 = TmpSp
  174.         add(sprite(TmpSp).scriptInstanceList, new(script("HideMenuLeave"), 1))
  175.         TmpSp = TmpSp + 1
  176.         channel(TmpSp).makeScriptedSprite(member("menuBack"), point(pLocH, pLocV))
  177.         add(sprite(TmpSp).scriptInstanceList, new(script("HideMenuLeave"), 1))
  178.         menuBack2 = TmpSp
  179.       else
  180.         channel(TmpSp).makeScriptedSprite(member("menuBack"), point(pLocH, pLocV))
  181.         add(sprite(TmpSp).scriptInstanceList, new(script("HideMenuLeave"), 1))
  182.         menuBack1 = TmpSp
  183.         menuBack2 = 0
  184.       end if
  185.       TmpSp = TmpSp + 1
  186.       pMember = castLib("menuText").member[k]
  187.       channel(TmpSp).makeScriptedSprite(pMember, point(pLocH, pLocV))
  188.       add(sprite(TmpSp).scriptInstanceList, new(script("RollOverExpose"), 1))
  189.       sprite(TmpSp).visible = 1
  190.       sprite(TmpSp).ink = 36
  191.       MMSp = TmpSp
  192.       TmpSp = TmpSp + 1
  193.       subCount = 0
  194.       repeat with o = 1 to the number of castMembers of castLib "submenuitems"
  195.         if castLib("submenufields").member[o].name contains castLib("menuText").member[k].text then
  196.           subCount = subCount + 1
  197.           if subCount < MaxItems then
  198.             myH = pLocH
  199.             myCount = subCount
  200.           else
  201.             myH = pLocH + bWidth
  202.             myCount = subCount - (MaxItems - 1)
  203.           end if
  204.           channel(TmpSp).makeScriptedSprite(castLib("submenufields").member[o], point(myH, pLocV + (bHeight / 2) + (bHeight * myCount)))
  205.           add(sprite(TmpSp).scriptInstanceList, new(script("showmyname"), 1))
  206.           sprite(TmpSp).visible = 0
  207.           sprite(TmpSp).ink = 36
  208.           TmpSp = TmpSp + 1
  209.         end if
  210.       end repeat
  211.       pEnder = TmpSp - 1
  212.       pList = [:]
  213.       lcount = 0
  214.       repeat with j = pStarter to pEnder
  215.         pString = string("item" && lcount)
  216.         pList[pString] = sprite(j)
  217.         lcount = lcount + 1
  218.       end repeat
  219.       sendSprite(MMSp, #pInit, pList, menuBack1, menuBack2, MMSp)
  220.     end repeat
  221.   end if
  222. end
  223.