-- -- Autor: Catalin Marcu -- Date: 20-09-2009 -- -- Main loading script -- --=============================================================================== execute ("menu/functions_back_button.lua") -- back button support for android execute ("menu/menuScreens.lua") -- Menu Objects for PSP function getMenuText(index) if (index == 1) then return { scale = 0.09, font = "font5.fnt", overlap = -3, color = {255, 255, 255, 255}, vertical = E_VALIGN_CENTER, layer = LF_PANELS, text = txtWorldChallenge } elseif (index == 2) then return { scale = 0.09, font = "font5.fnt", overlap = -3, color = {255, 255, 255, 255}, vertical = E_VALIGN_CENTER, layer = LF_PANELS, text = txtMultiplayer } elseif (index == 3) then return { scale = 0.09, font = "font5.fnt", overlap = -3, color = {255, 255, 255, 255}, vertical = E_VALIGN_CENTER, layer = LF_PANELS, text = txtQuickShootout } elseif (index == 4) then return { scale = 0.09, font = "font5.fnt", overlap = -3, color = {255, 255, 255, 255}, vertical = E_VALIGN_CENTER, layer = LF_PANELS, align = E_ALIGN_RIGHT, text = txtStats .. ":"} elseif (index == 5) then return { name = "MainMenuGoalsText", scale = 0.09, font = "font4.fnt", overlap = -3, color = {0, 0, 0, 255}, layer = LF_PANELS, align = E_ALIGN_LEFT, vertical = E_VALIGN_CENTER, text = txtGoals } elseif (index == 6) then return { scale = 0.09, font = "font5.fnt", overlap = -3, color = {255, 255, 255, 255}, vertical = E_VALIGN_CENTER, layer = LF_PANELS, text = txtBuyPremium } end end --=============================================================================== function getUserText(index) if (index == 1) then return { name = "MainMenuTeamText", scale = 0.08, font = "font4.fnt", overlap = -3, color = {255, 255, 255, 255}, layer = LF_PANELS, align = E_ALIGN_LEFT, vertical = E_VALIGN_CENTER, text = "Spain" } elseif (index == 2) then return { name = "MainMenuUserNameText", scale = 0.07, font = "font4.fnt", overlap = -3, color = {200, 200, 200, 255}, layer = LF_PANELS, align = E_ALIGN_LEFT, vertical = E_VALIGN_CENTER, text = txtGuest } elseif (index == 3) then if (LITE_VERSION == true) then return { name = "MainMenuTeamText2", scale = 0.09, font = "font4.fnt", overlap = -3, color = {255, 255, 255, 255}, layer = LF_PANELS, align = E_ALIGN_RIGHT, vertical = E_VALIGN_TOP, text = "" } else return { name = "MainMenuTeamText2", scale = 0.08, font = "font4.fnt", overlap = -3, color = {255, 255, 255, 255}, layer = LF_PANELS, align = E_ALIGN_RIGHT, vertical = E_VALIGN_CENTER, text = "" } end elseif (index == 4) then if (LITE_VERSION == true) then return { name = "MainMenuUserNameText2", scale = 0.07, font = "font4.fnt", overlap = -3, color = {200, 200, 200, 255}, layer = LF_PANELS, align = E_ALIGN_RIGHT, vertical = E_VALIGN_CENTER, text = "" } else return { name = "MainMenuUserNameText2", scale = 0.07, font = "font4.fnt", overlap = -3, color = {200, 200, 200, 255}, layer = LF_PANELS, align = E_ALIGN_RIGHT, vertical = E_VALIGN_CENTER, text = txtTapToChange } end end end --=============================================================================== function updateUserData(userName, userGoals, userTeam) if (ExistsActor("MainMenuUserNameText") == true) then SetText("MainMenuUserNameText", userName) if (ExistsActor("MainMenuGoalsText") == true) then SetText("MainMenuGoalsText", "" .. userGoals .. " " .. txtGoals) end setCurrentTeam(userTeam) userTeamId = userTeam SetText("MainMenuTeamText", currentTeam.fullName) SetTexture("MenuUser", "userflag", currentTeam.flag) SetText("MainMenuTeamText2", currentTeam.fullName) updatePlayerLook("MenuPlayer", userTeamId) end end --=============================================================================== function updatePlayerLook(actorName, teamId) if (ExistsActor(actorName) == true) then SetTexture(actorName, "piel", playersSkins[teamsTextures[teamId + 1].playerSkins[1]]) SetTexture(actorName, "ropa", teamsTextures[teamId + 1].player) end end --=============================================================================== function exitMainMenu(functionName) if (stopMainMusic == true and (gameModeSelected == GAME_MODE_WORLDCUP or gameModeSelected == GAME_MODE_QUICK)) then mainMusicStarted = false StopMenuMusic(MenuSounds.Music.main) end ClearActorAnims("MenuArrowsBack", true, true) ClearActorAnims("MenuArrowsFront", true, true) SetActorAnimPenalty("MenuArrowsBack", { anim = "Main_menu_arrowsback_out.anm", loop = false }) SetActorAnimPenalty("MenuArrowsFront", { anim = "Main_menu_arrowsfront_out.anm", loop = false }) if (LITE_VERSION == true) then SetActorAnimPenalty("Menu", { anim = "Main_menu_buttons_out_lite.anm", loop = false }) else SetActorAnimPenalty("Menu", { anim = "Main_menu_buttons_out.anm", loop = false }) end SetActorAnimPenalty("MenuInfo", { anim = "Main_menu_infobutton_out.anm", loop = false }) Sound.PlaySound(MenuSounds.Fx.panelOut, false) EnqueueExecuteScript("Menu", "destroyMainMenu()") EnqueueExecuteScript("Menu", functionName) end --=============================================================================== function destroyMainMenu() DestroyActor("MenuArrowsBack") DestroyActor("MenuArrowsFront") DestroyActor("Menu") DestroyActor("MenuInfo") end --=============================================================================== function changePlayerAnim() if (ignorePlayerAnims > 0) then -- print("ignoring: anim: " .. currentPlayerAnim) ignorePlayerAnims = ignorePlayerAnims - 1 return end preparedPlayerAnim = false local playerAnims = { "Main_menu_player_entrada.anm", "Main_menu_player_respiraparado.anm", "Main_menu_player_despiste.anm", "Main_menu_player_cruzabrazos.anm", "Main_menu_player_respirabrazocruzado.anm", "Main_menu_player_descruzabrazo.anm", "Main_menu_player_miraropa.anm", "Main_menu_player_salejugadormenu.anm", "Main_menu_player_entrajugadormenu.anm", } local oldPlayerAnim = currentPlayerAnim if (currentPlayerAnim == 1 or currentPlayerAnim == 3 or currentPlayerAnim == 6) then currentPlayerAnim = 2 ClearActorAnims("MenuPlayer", true, true) SetActorAnimPenalty("MenuPlayer", { anim = playerAnims[currentPlayerAnim], loop = true }) prepareChangePlayerAnim("", 2) elseif (currentPlayerAnim == 2) then currentPlayerAnim = 3 + (GetRandomNumber() % 2) ClearActorAnims("MenuPlayer", true, true) SetActorAnimPenalty("MenuPlayer", { anim = playerAnims[currentPlayerAnim], loop = false }) prepareChangePlayerAnim("MenuPlayer", currentPlayerAnim) elseif (currentPlayerAnim == 4) then currentPlayerAnim = 5 ClearActorAnims("MenuPlayer", true, true) SetActorAnimPenalty("MenuPlayer", { anim = playerAnims[currentPlayerAnim], loop = true }) prepareChangePlayerAnim("", 5) elseif (currentPlayerAnim == 5) then currentPlayerAnim = 6 ClearActorAnims("MenuPlayer", true, true) SetActorAnimPenalty("MenuPlayer", { anim = playerAnims[currentPlayerAnim], loop = false }) prepareChangePlayerAnim("MenuPlayer", 6) end -- print("change anim from: " .. oldPlayerAnim .. " to: " .. currentPlayerAnim) end --=============================================================================== function prepareChangePlayerAnim(actorToWait, animIndex) -- print("preparing: actor: " .. actorToWait .. " anim: " .. animIndex) ClearAllTimeExecuteScripts() if (actorToWait == "") then local _time = 10.0 + (GetRandomNumber() % 5) EnqueueTimeExecuteScript("currentPlayerAnim = " .. animIndex, _time) EnqueueTimeExecuteScript("changePlayerAnim()", _time) else if (preparedPlayerAnim == true) then ignorePlayerAnims = ignorePlayerAnims + 1 end preparedPlayerAnim = true EnqueueExecuteScript(actorToWait, "currentPlayerAnim = " .. animIndex) EnqueueExecuteScript(actorToWait, "changePlayerAnim()") end end --=============================================================================== function goToMainMenu() -- DestroyAllActors moved from onExitMatchActions, see comment there and bug #2180 -- currentScreen is nil either on first run or after a match if currentScreen == nil then DestroyAllActors() end playingMatch = false currentScreen = SCREEN_MAIN_MENU gameModeSelected = GAME_MODE_NONE if (mainMusicStarted == false) then mainMusicStarted = true StartMenuMusic(MenuSounds.Music.main) end stopMainMusic = true ChangeCamera("default") if (ExistsActor("MenuBackground") == false) then CreateActor("ActorGeom", {name = "MenuBackground", model = "Main_menu_background.mesh", touchable = false, camera = "backgroundCamera"}) SetActorAnimPenalty("MenuBackground", { anim = "Main_menu_background.anm", loop = true }) end CreateActor("ActorGeom", {name = "MenuArrowsBack", model = "Main_menu_arrowsback.mesh", touchable = false, camera = "backgroundCamera"}) SetActorAnimPenalty("MenuArrowsBack", { anim = "Main_menu_arrowsback_in.anm", loop = false }) if (ExistsActor("MenuPlayer") == false) then CreateActor("ActorGeom", {name = "MenuPlayer", model = "Main_menu_player.mesh", touchable = false, camera = "backgroundCamera", layer = LF_PANELS}) ClearActorAnims("MenuPlayer", true, true) SetActorAnimPenalty("MenuPlayer", { anim = "Main_menu_player_entrada.anm", loop = false }) currentPlayerAnim = 0 ignorePlayerAnims = 0 prepareChangePlayerAnim("MenuPlayer", 1) else DeactivateActor("MenuPlayer") ActivateActor("MenuPlayer") end CreateActor("ActorGeom", {name = "MenuArrowsFront", model = "Main_menu_arrowsfront.mesh", touchable = false, camera = "backgroundCamera", layer = LF_PANELS}) SetActorAnimPenalty("MenuArrowsFront", { anim = "Main_menu_arrowsfront_in.anm", loop = false }) if (LITE_VERSION == true) then CreateActor("ActorGeom", {name = "Menu", model = "Main_menu_buttons_lite.mesh", touchable = true, camera = "backgroundCamera", layer = LF_PANELS}) SetActorAnimPenalty("Menu", { anim = "Main_menu_buttons_in_lite.anm", loop = false }) else CreateActor("ActorGeom", {name = "Menu", model = "Main_menu_buttons.mesh", touchable = true, camera = "backgroundCamera", layer = LF_PANELS}) SetActorAnimPenalty("Menu", { anim = "Main_menu_buttons_in.anm", loop = false }) end Sound.PlaySound(MenuSounds.Fx.panelIn, false) if (ExistsActor("MenuInfo") == false) then CreateActor("ActorGeom", {name = "MenuInfo", model = "Main_menu_infobutton.mesh", touchable = true, camera = "backgroundCamera", layer = LF_PANELS}) SetActorAnimPenalty("MenuInfo", { anim = "Main_menu_infobutton_in.anm", loop = false }) else DeactivateActor("MenuInfo") ActivateActor("MenuInfo") end if (ExistsActor("MenuUser") == false) then CreateActor("ActorGeom", {name = "MenuUser", model = "Main_menu_userbutton.mesh", touchable = true, camera = "backgroundCamera", layer = LF_PANELS}) SetActorAnimPenalty("MenuUser", { anim = "Main_menu_userbutton_in.anm", loop = false }) else DeactivateActor("MenuUser") ActivateActor("MenuUser") end UpdateUserData() allowBackButton = true --[[ currentMenuScreen = TMainMenuScreen:new(); currentMenuScreen:resetScreen() THIS IS FOR PSP ONLY]] end -- Goes to the next option in the menu function nextOption() end -- Goes to the previous option in the menu function previousOption() end -- presses accept in the current option function acceptButton() end -- presses cancel in the current option function cancelButton() end