home *** CD-ROM | disk | FTP | other *** search
/ 3D World 113 / 3DW_113.iso / pc / Menu / Scenes / home.dir / Internal_1.ls < prev    next >
Encoding:
Text File  |  2008-09-12  |  4.9 KB  |  163 lines

  1. global gRootPath, gDiv, gMenuList, bMember, finalChan, rollcolor, imageMember
  2.  
  3. on prepareMovie
  4.   ClearCastElements()
  5. end
  6.  
  7. on ClearCastElements
  8.   member("intro_text").text = EMPTY
  9. end
  10.  
  11. on createBanner
  12.   trace("Nothing")
  13. end
  14.  
  15. on LoadIntroText
  16.   int_Text = getNetText(gRootPath & "menu" & gDiv & "IntroText.txt")
  17.   imageMember = member("imagebox")
  18.   if netDone(int_Text) then
  19.     member("intro_text").text = netTextResult(int_Text)
  20.     member("intro_text").topSpacing = 0
  21.   end if
  22. end
  23.  
  24. on InitialiseList
  25.   bMember = member("main_button", "GFX")
  26.   gMenuList = [:]
  27.   ListHolder = ReadListString()
  28.   MakeMemoryList(ListHolder)
  29.   MakeButtonTexts()
  30.   MakeButtonSprites()
  31. end
  32.  
  33. on ReadListString
  34.   sPath = gRootPath & "Menu" & gDiv & "Menu_Items.txt"
  35.   pNT = getNetText(sPath)
  36.   if netDone(pNT) then
  37.     tResult = netTextResult(pNT)
  38.   end if
  39.   return tResult
  40. end
  41.  
  42. on MakeMemoryList ListHolder
  43.   rollcolor = rgb(0, 100, 196)
  44.   repeat with i = 1 to ListHolder.line.count
  45.     if ListHolder.line[i] contains "---End---" then
  46.       exit repeat
  47.     end if
  48.     if ListHolder.line[i].char[1..3] = "---" then
  49.       LineEnd = ListHolder.line[i].char.count
  50.       repeat with g = 1 to ListHolder.line[i].char.count
  51.         endbit = g + 1
  52.         if ListHolder.line[i].char[g..endbit] = "@@" then
  53.           PathStartChar = g
  54.           pEndChar = PathStartChar - 2
  55.           pStartChar = PathStartChar + 2
  56.           mainItemTitle = ListHolder.line[i].char[4..pEndChar]
  57.           mainItemPath = ListHolder.line[i].char[pStartChar..LineEnd]
  58.           gMenuList[mainItemTitle] = [:]
  59.           gMenuList[mainItemTitle][#ItemTitle] = mainItemTitle
  60.           gMenuList[mainItemTitle][#ItemPath] = mainItemPath
  61.           gMenuList[mainItemTitle][#ItemList] = [:]
  62.         end if
  63.       end repeat
  64.       pStartLine = i + 1
  65.       repeat with h = pStartLine to ListHolder.line.count
  66.         if ListHolder.line[h].char[1..3] = "---" then
  67.           exit repeat
  68.           next repeat
  69.         end if
  70.         repeat with g = 1 to ListHolder.line[h].char.count
  71.           endbit = g + 1
  72.           if ListHolder.line[h].char[g..endbit] = "@@" then
  73.             PathStartChar = g
  74.             pEndChar = PathStartChar - 2
  75.             pStartChar = PathStartChar + 2
  76.             LineEnd = the number of chars in ListHolder.line[h]
  77.             subItemTitle = ListHolder.line[h].char[1..pEndChar]
  78.             subItemPath = ListHolder.line[h].char[pStartChar..LineEnd]
  79.             gMenuList[mainItemTitle][#ItemList][subItemTitle] = [:]
  80.             gMenuList[mainItemTitle][#ItemList][subItemTitle][#ItemTitle] = subItemTitle
  81.             gMenuList[mainItemTitle][#ItemList][subItemTitle][#ItemPath] = subItemPath
  82.             exit repeat
  83.           end if
  84.         end repeat
  85.       end repeat
  86.     end if
  87.   end repeat
  88. end
  89.  
  90. on MakeButtonTexts
  91.   repeat with i = 1 to the number of castMembers of castLib "MainItems"
  92.     castLib("MainItems").member[i].erase()
  93.   end repeat
  94.   repeat with i = 1 to the number of castMembers of castLib "SubItems"
  95.     castLib("SubItems").member[i].erase()
  96.   end repeat
  97.   repeat with i = 1 to gMenuList.count
  98.     g = new(#text, castLib("MainItems"))
  99.     g.width = 100
  100.     g.text = gMenuList[i].ItemTitle
  101.     g.name = gMenuList[i].ItemTitle
  102.     g.antialias = 1
  103.     g.antiAliasThreshold = 0
  104.     g.fontSize = 12
  105.     g.font = "Arial *"
  106.     g.fontStyle = [#bold]
  107.     g.alignment = #center
  108.     g.color = rgb(0, 0, 0)
  109.     g.width = bMember.width
  110.     repeat with u = 1 to gMenuList[i][#ItemList].count
  111.       p = new(#text, castLib("SubItems"))
  112.       p.name = gMenuList[i].ItemTitle && string(u)
  113.       p.text = gMenuList[i][#ItemList][u].ItemTitle
  114.       p.antialias = 1
  115.       p.antiAliasThreshold = 0
  116.       p.fontSize = 12
  117.       p.fontStyle = [#bold]
  118.       p.font = "Arial *"
  119.       p.width = 280
  120.       p.charSpacing = -0.5
  121.     end repeat
  122.   end repeat
  123. end
  124.  
  125. on MakeButtonSprites
  126.   repeat with i = 1 to _movie.channel.count
  127.     if sprite(i).member = member("MenuPlacer") then
  128.       FS = sprite(i)
  129.       exit repeat
  130.     end if
  131.   end repeat
  132.   bCount = 1
  133.   sCount = 1
  134.   bH = bMember.height
  135.   bW = bMember.width
  136.   bMember.regPoint = point(0, 0)
  137.   member("main_over", "gfx").regPoint = point(0, 0)
  138.   lV = FS.top
  139.   repeat with i = 1 to the number of castMembers of castLib "MainItems"
  140.     if bCount > 4 then
  141.       lV = lV + (bH + 1)
  142.       bCount = 1
  143.     end if
  144.     lH = FS.left + (bW * (bCount - 1))
  145.     Sp = channel(FS.spriteNum + sCount)
  146.     chan = FS.spriteNum + sCount
  147.     Sp.makeScriptedSprite(bMember, point(lH + (bCount * 4), lV))
  148.     add(sprite(chan).scriptInstanceList, new(script("Main Button Rollover"), 1))
  149.     _movie.sendSprite(chan, #Initialize, chan, gMenuList[i].ItemPath, i, gMenuList[i].ItemTitle)
  150.     sCount = sCount + 1
  151.     Sp = channel(FS.spriteNum + sCount)
  152.     chan = FS.spriteNum + sCount
  153.     Sp.makeScriptedSprite(member(i, "MainItems"), point(lH + (bCount * 4), lV + 5))
  154.     sprite(chan).ink = 36
  155.     sprite(chan).color = rgb(0, 0, 0)
  156.     bCount = bCount + 1
  157.     sCount = sCount + 1
  158.   end repeat
  159.   FS.visible = 0
  160.   finalChan = chan + 1
  161.   put finalChan
  162. end
  163.