Community Curator/Source/TSWRes Game3

-- Menus --

-- Mordal Menus -- Corform if you want to do an action. function GT.YesNo(Title, Des, B1Col, B2Col, B1Txt, B2Txt) local Ans = nil while Ans==nil do     draw.beginframe Draw.BGs.YesNo(Title, Des, B1Col, B2Col, B1Txt, B2Txt) draw.endframe TX, TY = draw.waittouch Yes=TRec(48+24, SizeY-72, SizeX*.5, SizeY-48, TX, TY) No=TRec(SizeX*.5, SizeY-72, SizeX-(48+24), SizeY-48, TX, TY) if No==true then Ans = false elseif Yes==true then Ans = true end end return Ans end

-- When your profile is corrupt function GT.CorruptProfile(ProfileOk, StoryOk, MMOk, ComOk) for i=1, math.huge do     draw.beginframe Draw.BGs.CorruptProfile(ProfileOk, StoryOk, MMOk, ComOk) draw.endframe local TX, TY = draw.waittouch end end

-- Community Main Menu function GT.CommunityMenu if Community == nil then draw.beginframe Draw.BGs.Loading draw.endframe Community = require "TSWRes Community" Community.LoadFile end if Community.Connected ~= true then Community.OfflineMenu else Community.OnlineMenu1 end end

-- Story Menu function GT.StoryMenu draw.beginframe Draw.BGs.Loading draw.endframe StoryRes = require "TSWRes Story" StoryRes.Menu end

-- My Moon Menu function GT.MyMoonMenu if MyMoonLevels["Levels"] == nil then draw.beginframe Draw.BGs.Loading draw.endframe local Ok = Loader.LoadMyMoonLevels if Ok ~= "Ok" then

end end LevScr = 0 for i=1, math.huge do     draw.beginframe Draw.BGs.MyMoon draw.endframe local TX, TY = draw.waittouch local BackTap = TRec(24, SizeY - 32, 128, SizeY, TX, TY) local TTap = TRec(0, 0, 128, 32, TX, TY) local DeleteTap = TRec(128, 0, 256, 32, TX, TY) local UTap = TRec(SizeX-32, 32, SizeX, 64, TX, TY) local DTap = TRec(SizeX-32, SizeY-64, SizeX, SizeY-32, TX, TY) if BackTap then return elseif TTap then LevelTab = {["Name"] = "Unnamed Level", ["Description"] = "Add a description to this level."} GT.Vars.CurrentLevel = MyMoonLevels["Levels"] + 1 GT.CreateMode(MyMoonLevels["Levels"] + 1) elseif UTap then LevScr = LevScr + 48 elseif DTap then LevScr = LevScr - 48 elseif DeleteTap then if MAction ~= "Delete" then MAction = "Delete" else MAction = nil end else for k,v in ipairs(MyMoonLevels["SavedLevelTab"]) do           local LTap = TRec(32, (32+LevScr+((k-1)*64)), SizeX-48, (32+LevScr+(k*64)), TX, TY) if LTap and MAction == nil then LevelTab = v              GT.Vars.CurrentLevel = k               GT.CreateMode(k) elseif LTap and MAction == "Delete" then local LevelSe = v              if GT.YesNo('Delete level "'..tostring(LevelSe["Name"])..'"?', "Selecting Delete will delete this level.", draw.red, PlayCol1, "Delete!", "Keep") then GT.DeleteLevel(k) end end end end CG end end

-- Settings Menu function GT.SettingsMenu for i=1, math.huge do     draw.beginframe Draw.BGs.Settings draw.endframe local TX, TY = draw.waittouch local BackTap = TRec(24, SizeY - 64, 128, SizeY - 32, TX, TY) if BackTap then return end end end

-- Help Menu function GT.HelpMenu if HelpRes == nil then require "TSWRes Help" end HelpRes.HelpMenu end

-- Credits Menu function GT.CreditsMenu for i=1, math.huge do     draw.beginframe Draw.BGs.Credits draw.endframe local TX, TY = draw.waittouch local BackTap = TRec(24, SizeY - 64, 128, SizeY - 32, TX, TY) if BackTap then return end CG end end

-- Exit the game function GT.ExitGame CloseGame = true print("Game is closing!") Strings.Loading = {"Saving Progress..."} draw.beginframe Draw.BGs.Loading Draw.StatusBar(0) draw.endframe LoaderTab.LoadMyMoonLevels LoaderTab.SaveMyMoonLevels draw.beginframe Draw.BGs.Exit Draw.StatusBar(0) draw.endframe sleep(2000) GT = nil Community = nil LoaderTab = nil Draw = OldDraw or nil Strings = nil collectgarbage collectgarbage collectgarbage collectgarbage return true end

-- Settings Menu function GT.Settings

end

-- Pod Control Menu function GT.Menu draw.setscreen(1) draw.settitle("LittleBigPlanet: Tag's Super World") for i=1, math.huge do     draw.beginframe Draw.BGs.Pod draw.endframe local TX, TY = draw.waittouch local CMTap = TRec(24, 128, 128, 256, TX, TY) local STap = TRec(128+24, 128, 128+128, 256, TX, TY) local MMTap =TRec(248+24, 128, 248+128, 256, TX, TY) local PodTap =TRec(384+24, 128, 384+72, 256, TX, TY) local SettingsTap =TRec(0, SizeY-32, 128, SizeY, TX, TY) local HelpTap =TRec(128, SizeY - 32, 256, SizeY, TX, TY) local CreditsTap =TRec(256, SizeY - 32, 384, SizeY, TX, TY) local ExitTap =TRec(384, SizeY - 32, SizeX, SizeY, TX, TY) if CMTap then GT.CommunityMenu elseif STap then GT.StoryMenu elseif MMTap then GT.MyMoonMenu elseif PodTap then GT.PodMenu elseif SettingsTap then GT.SettingsMenu elseif HelpTap then GT.HelpMenu elseif CreditsTap then GT.CreditsMenu elseif ExitTap then GT.ExitGame return end CG end end

-- Size function GT.LevelSize(Level) local LevelSave = io.open("LBPLua.Level"..Level..".lualevel") local LevelStr = LevelSave:read LevelSave:close local ObjSave = io.open("LBPLua.Level"..Level..".lualobj") local ObjStr = ObjSave:read ObjSave:close local ChPtSave = io.open("LBPLua.Level"..Level..".lualch") local ChPtStr = ChPtSave:read ChPtSave:close --if not Ok1 and not Ok2 and not Ok3 then     print("Warning: "..Level.." is missing!")   end local LevelSize = #tostring(LevelStr) + #tostring(ObjStr) + #tostring(ChPtStr) return LevelSize end

return