Hey everyone, this is the basic framework of a fruit slicing game. It makes use of my mobile gesture system, but only for aesthetics really.
I set out to recreate a simple fruit slicing game with UDK and UScript. It's pretty heavily commented, but if you need any clarification just ask
. This source gives fully commented UScript examples of:
The MobileMenu system (including MobileMenuList)
An application of my gesutre system
Getting input from the user via the iDevice's native keyboard (from Xces)
A massive use of the BasicSave and BasicLoadObject
A real time color picker via MobileSliders (from WillyG302)
It also includes all of the raw source, textures, meshes, particles, sounds, etc.
Dev_Ninja Source
Install Guide
There are multiples of classes so you can implement functionality specific to meshes (create a slow time or frenzy on slice). I'll go over the most important classes and their relationships.
The PreGame: Small class, used to open the main menu on launch. Also good to reset the game to after a session for clean up
MobileMenuScenes
Main Menu: Opens on load, points to PlayMenu, HighScoreMenu, and OptionsMenu.
OptionsMenu: This was an interesting menu to put together - beside the poor choice of flattening the visuals into the background image which causes scaling issues on different devices due to explicit positioning. It implements a real time "color picker" via MobileMenuSliders (Thanks WillyG302) that spans the whole RGB range ,0-255. It also has an option to turn sound on and off.
The OptionsMenu's primary function is to edit the Options object which is saved and loaded via the BasicSaveObject and BasicLoadObject.
Options Object: Very simple
PlayMenu: Also edits the Options Object to set the game mode.
HighScoreMenu: Renders a dynamic list that consists of a single HighScores Object.
QuitMenu: Simple creates a Quit button in the top right of the screen while a session is in progress.
HighScores Object: Extends a MenuListItem for the RenderItem hook, holds two dynamic arrays (Player and Score) that's saved to when a new high score is met.
GameOverMenu: If there isn't a new high score after a quickplay session, this menu opens. It lets the player access the other menus.
Some how a straight copy/paste messed up some of my formatting?
I set out to recreate a simple fruit slicing game with UDK and UScript. It's pretty heavily commented, but if you need any clarification just ask

The MobileMenu system (including MobileMenuList)
An application of my gesutre system
Getting input from the user via the iDevice's native keyboard (from Xces)
A massive use of the BasicSave and BasicLoadObject
A real time color picker via MobileSliders (from WillyG302)
It also includes all of the raw source, textures, meshes, particles, sounds, etc.
Dev_Ninja Source
Install Guide
There are multiples of classes so you can implement functionality specific to meshes (create a slow time or frenzy on slice). I'll go over the most important classes and their relationships.
The PreGame: Small class, used to open the main menu on launch. Also good to reset the game to after a session for clean up
Code:
/* * Dev_Ninja_PreGame is used when game is first opened. It opens the MainMenu on PostLogin. */ class Dev_Ninja_PreGame extends MobileMenuGame; defaultproperties { InitialSceneToDisplayClass=class'Dev_Ninja_MainMen u' }
Main Menu: Opens on load, points to PlayMenu, HighScoreMenu, and OptionsMenu.
Code:
/* * Dev_Ninja_MainMenu is the first menu to open when Dev_Ninja_PreGameController initializes. */ class Dev_Ninja_MainMenu extends MobileMenuScene; /* When a touch ends, check the Tag of the MobileMenuObject that was pressed * 1. If the play button was pressed, open the PlayMenu and close this one. * 2. If the options button was pressed, open the OptionsMenu and close this one. * 3. Open the HighScore menu close this one. */ function OnTouch(MobileMenuObject Sender, ETouchType Type, float TouchX, float TouchY) { if(Type == Touch_Ended) { Switch(Sender.Tag) { /* 1 */ case "PLAYBUTTON": InputOwner.OpenMenuScene(class'Dev_Ninja_PlayMenu' ); InputOwner.CloseMenuScene(self); break; /* 2 */ case "OPTIONSBUTTON": InputOwner.OpenMenuScene(class'Dev_Ninja_OptionsMe nu'); InputOwner.CloseMenuScene(self); break; /* 3 */ case "HIGHSCOREBUTTON": InputOwner.OpenMenuScene(class'Dev_Ninja_HighScore Menu'); InputOwner.CloseMenuScene(self); break; } } } /* * For a thorough overview of these properties, go to: http://udn.epicgames.com/Three/MobileMenuTechnicalGuide.html#MobileMenuScene */ defaultproperties { bRelativeLeft=true bRelativeTop=true bRelativeWidth=true bRelativeHeight=true Left=0 Top=0 Width=1 Height=1 Begin Object Class=MobileMenuImage Name=Background Tag="Background" Left=0 Top=0 Width=1.0 Height=1.0 bRelativeWidth=true bRelativeHeight=true Image=Texture2D'D_NContent.Textures.dev_ninja' ImageDrawStyle=IDS_Stretched End Object MenuObjects.Add(Background) Begin Object Class=MobileMenuButton Name=PlayButton Tag="PLAYBUTTON" Left=0.2 Top=0.5 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.Play' ImagesUVs(0)=(bCustomCoords=true,U=0,V=0,UL=256,VL =64) End Object MenuObjects.Add(PlayButton) Begin Object Class=MobileMenuButton Name=OptionsButton Tag="OPTIONSBUTTON" Left=0.6 Top=0.5 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.Options' ImagesUVs(0)=(bCustomCoords=true,U=0,V=0,UL=256,VL =64) End Object MenuObjects.Add(OptionsButton) Begin Object Class=MobileMenuButton Name=HighScoreButton Tag="HIGHSCOREBUTTON" Left=0.39 Top=0.7 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.High_Score s_black' ImagesUVs(0)=(bCustomCoords=true,U=0,V=0,UL=256,VL =64) End Object MenuObjects.Add(HighScoreButton) }
Code:
/* * Dev_Ninja_OptionsMenu is where the game options are set. Opened from the MainMenu. */ class Dev_Ninja_OptionsMenu extends MobileMenuScene; /* * @ var OptR,OptG,OptB: Values set through the respective sliders. Saved to the Options object's R,G,B values. * @ var bShouldPlaySound: Not implemented. Saved to the options Object. */ var float OptR,OptG,OptB; var bool bShouldPlaySound; /* This function gets called when the Scene is opened, loads the Options object */ function Opened(string Mode) { LoadOptionsObject(); } /* Called when the scene is touched. Should look familiar by now.*/ function OnTouch(MobileMenuObject Sender, ETouchType Type, float TouchX, float TouchY) { if(Type == Touch_Ended) { Switch(Sender.Tag) { case "ONBUTTON": bShouldPlaySound = true; break; case "OFFBUTTON": bShouldPlaySound = false; break; case "BACKBUTTON": InputOwner.OpenMenuScene(class'Dev_Ninja_MainMenu' ); InputOwner.CloseMenuScene(self); break; case "SAVEBUTTON": `Log("SAVEBUTTON Ended"); SaveOptionsObject(); break; } } } /* Dev_Ninja_Slider calls this with its slider value. */ function SetSliderValues(string SliderTag, float SliderValue) { switch(SliderTag) { case "RSLIDER": OptR = SliderValue; break; case "GSLIDER": OptG = SliderValue; break; case "BSLIDER": OptB = SliderValue; break; } } /* * Because the ParticleFake object has bTellSceneBeforeRendering=true, this function gets called so we * can change the drawcolor before its drawn again. */ function PreRenderMenuObject(MobileMenuObject MenuObject, Canvas Canvas,float RenderDelta) { /* Make sure it's the ParticleFake, and set its drawcolor to its slider value. */ if(MenuObject.isA('MobileMenuImage')) { MobileMenuImage(MenuObject).ImageColor.R = OptR; MobileMenuImage(MenuObject).ImageColor.G = OptG; MobileMenuImage(MenuObject).ImageColor.B = OptB; } /* If it's a Slider, draw the slider at its last saved value. */ else if(MenuObject.isA('Dev_Ninja_Slider')) { switch(MenuObject.Tag) { case "RSLIDER": Dev_Ninja_Slider(MenuObject).NubLeft = OptR; break; case "GSLIDER": Dev_Ninja_Slider(MenuObject).NubLeft = OptG; break; case "BSLIDER": Dev_Ninja_Slider(MenuObject).NubLeft = OptB; break; } /* This makes sure it only gets called once */ MenuObject.bTellSceneBeforeRendering=false; } } /* Load the Options object, set the OptR/G/B values to the loaded obvect's R/G/B. */ function LoadOptionsObject() { local Dev_Ninja_Options Options; Options = new class'Dev_Ninja_Options'; class'Engine'.static.BasicLoadObject(Options, "Dev_Ninja_Options.bin", true, 1); OptR = Options.R; OptG = Options.G; OptB = Options.B; bShouldPlaySound = Options.bShouldPlaySound; } /* Save the Options object with the new slider values and sound bool. */ function SaveOptionsObject() { local Dev_Ninja_Options Options; Options = new class'Dev_Ninja_Options'; Options.bShouldPlaySound = bShouldPlaySound; Options.R = OptR; Options.G = OptG; Options.B = OptB; class'Engine'.static.BasicSaveObject(Options, "Dev_Ninja_Options.bin", true, 1); InputOwner.OpenMenuScene(class'Dev_Ninja_MainMenu' ); InputOwner.CloseMenuScene(self); } /* * For a thorough overview of these properties, go to: http://udn.epicgames.com/Three/MobileMenuTechnicalGuide.html#MobileMenuScene. * For the MobileMenuSlider, head to http://willyg302.wordpress.com/2012/09/15/udk-mobile-slider-tutorial/. */ defaultproperties { bRelativeLeft=true bRelativeTop=true bRelativeWidth=true bRelativeHeight=true Left=0 Top=0 Width=1 Height=1 Begin Object Class=MobileMenuImage Name=Background Tag="Background" Left=0 Top=0 Width=1.0 Height=1.0 bRelativeWidth=true bRelativeHeight=true Image=Texture2D'D_NContent.Textures.Options_Menu' ImageDrawStyle=IDS_Stretched ImageUVs=(bCustomCoords=true,U=1024,V=512,UL=1024, VL=512) End Object MenuObjects.Add(Background) Begin Object Class=MobileMenuImage Name=ParticleFake Tag="ParticleFake" Left=0.6 Top=0.22 Width=270 Height=270 bRelativeLeft=true bRelativeTop=true bTellSceneBeforeRendering=true; Image=Texture2D'D_NContent.Textures.MGT_Gesture_Te xture' ImageUVs=(bCustomCoords=true,U=30,V=32,UL=30,VL=32 ) ImageDrawStyle=IDS_Stretched End Object MenuObjects.Add(ParticleFake) Begin Object Class=Dev_Ninja_Slider Name=RSlider Tag="RSLIDER" Left=0.22 Top=0.2 Width=380 Height=64 bRelativeLeft=true bRelativeTop=true SliderMin=0 SliderMax=255 NubWidth=64 NubHeight=64 bTellSceneBeforeRendering=true; Image=Texture2D'D_NContent.Textures.SliderNub' ImageUV=(bCustomCoords=true,U=32,V=32,UL=32,VL=32) End Object MenuObjects.Add(RSlider) Begin Object Class=Dev_Ninja_Slider Name=GSlider Tag="GSLIDER" Left=0.22 Top=0.37 Width=380 Height=64 bRelativeLeft=true bRelativeTop=true SliderMin=0 SliderMax=255 NubWidth=64 NubHeight=64 bTellSceneBeforeRendering=true; Image=Texture2D'D_NContent.Textures.SliderNub' ImageUV=(bCustomCoords=true,U=32,V=32,UL=32,VL=32) End Object MenuObjects.Add(GSlider) Begin Object Class=Dev_Ninja_Slider Name=BSlider Tag="BSLIDER" Left=0.22 Top=0.535 Width=380 Height=64 bRelativeLeft=true bRelativeTop=true SliderMin=0 SliderMax=255 NubWidth=64 NubHeight=64 bTellSceneBeforeRendering=true; Image=Texture2D'D_NContent.Textures.SliderNub' ImageUV=(bCustomCoords=true,U=32,V=32,UL=32,VL=32) End Object MenuObjects.Add(BSlider) Begin Object Class=MobileMenuButton Name=OnButton Tag="ONBUTTON" Left=0.35 Top=0.7 Width=64 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.On' ImagesUVs(0)=(bCustomCoords=true,U=64,V=64,UL=64,V L=32) End Object MenuObjects.Add(OnButton) Begin Object Class=MobileMenuButton Name=OffButton Tag="OFFBUTTON" Left=0.45 Top=0.7 Width=64 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.Off' ImagesUVs(0)=(bCustomCoords=true,U=64,V=64,UL=64,V L=32) End Object MenuObjects.Add(OffButton) Begin Object Class=MobileMenuButton Name=BackButton Tag="BACKBUTTON" Left=0.28 Top=0.85 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.Back' ImagesUVs(0)=(bCustomCoords=true,U=256,V=64,UL=256 ,VL=64) End Object MenuObjects.Add(BackButton) Begin Object Class=MobileMenuButton Name=SaveButton Tag="SAVEBUTTON" Left=0.55 Top=0.85 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.Save' ImagesUVs(0)=(bCustomCoords=true,U=256,V=64,UL=256 ,VL=64) End Object MenuObjects.Add(SaveButton) }
Options Object: Very simple
Code:
/* * Dev_Ninja_Options is the object that is saved to, and loaded from. * Make sure to load objects before you save to them, or you'll override * the last save with the variable defaults. */ class Dev_Ninja_Options extends Object; /* * Read/Write variables * * @ var R,B,G: Saved to in the Options menu via the sliders. Loaded from when Dev_Ninja_PlayerController initializes. * @ var Saved to in the OptionsMenu. Loaded in the PlayerController. * @ var GameMode: Saved to in the PlayMenu. Loaded in the PlayerController. */ var float R,G,B; var bool bShouldPlaySound; var string GameMode; defaultproperties { }
Code:
/* * Dev_Ninja_PlayMenu is called from the MainMenu. */ class Dev_Ninja_PlayMenu extends MobileMenuScene; function OnTouch(MobileMenuObject Sender, ETouchType Type, float TouchX, float TouchY) { if(Type == Touch_Ended) { Switch(Sender.Tag) { case "QUICKPLAYBUTTON": SetGame("QuickPlay"); break; case "ENDLESSPLAYBUTTON": SetGame("Endless"); break; case "BACKBUTTON": InputOwner.OpenMenuScene(class'Dev_Ninja_MainMenu' ); InputOwner.CloseMenuScene(self); break; } } } /* * Load the Options object so its not overridden with variable defaults. * Set the Options GameMode based off the button that was pressed. * Run a console command from the controller to to open Dev_Ninja map and set its GameType to Dev_Ninja_Game. */ function SetGame(string GameMode) { /* 1 */ local Dev_Ninja_Options Options; Options = new class'Dev_Ninja_Options'; class'Engine'.static.BasicLoadObject(Options, "Dev_Ninja_Options.bin", true, 1); /* 2 */ Options.GameMode = GameMode; class'Engine'.static.BasicSaveObject(Options, "Dev_Ninja_Options.bin", true, 1); /* 3 */ InputOwner.Outer.ConsoleCommand("open Dev_Ninja_Map?Game=Dev_Ninja.Dev_Ninja_Game"); } /* * For a thorough overview of these properties, go to: http://udn.epicgames.com/Three/MobileMenuTechnicalGuide.html#MobileMenuScene */ defaultproperties { bRelativeLeft=true bRelativeTop=true bRelativeWidth=true bRelativeHeight=true Left=0 Top=0 Width=1 Height=1; Begin Object Class=MobileMenuImage Name=Background Left=0 Top=0 Width=1.0 Height=1.0 bRelativeWidth=true bRelativeHeight=true Image=Texture2D'D_NContent.Textures.Blank_Backroun d' ImageDrawStyle=IDS_Stretched End Object MenuObjects.Add(Background) Begin Object Class=MobileMenuImage Name=PlayMenu Left=0.3 Top=0.1 Width=512 Height=128 bRelativeLeft=true bRelativeTop=true Image=Texture2D'D_NContent.Textures.Play_Menux2' ImageDrawStyle=IDS_Stretched ImageUVs=(bCustomCoords=true,U=0,V=0,UL=512,VL=128 ) End Object MenuObjects.Add(PlayMenu) Begin Object Class=MobileMenuButton Name=QuickPlayButton Tag="QUICKPLAYBUTTON" Left=0.2 Top=0.5 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.Quick_Play ' ImagesUVs(0)=(bCustomCoords=true,U=0,V=0,UL=256,VL =64) End Object MenuObjects.Add(QuickPlayButton) Begin Object Class=MobileMenuButton Name=EndlessPlayButton Tag="ENDLESSPLAYBUTTON" Left=0.6 Top=0.5 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.Endless' ImagesUVs(0)=(bCustomCoords=true,U=0,V=0,UL=256,VL =64) End Object MenuObjects.Add(EndlessPlayButton) Begin Object Class=MobileMenuButton Name=BackButton Tag="BACKBUTTON" Left=0.39 Top=0.85 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.Back' ImagesUVs(0)=(bCustomCoords=true,U=0,V=0,UL=256,VL =64) End Object MenuObjects.Add(BackButton) }
Code:
/* * Dev_Ninja_HighScoreMenu can be opened from the MainMenu or after a QuickPlay is over and a new high score is recorded. */ class Dev_Ninja_HighScoreMenu extends MobileMenuScene; /* * @ var HighScores: HighScore object pointer. */ var Dev_Ninja_HighScores HighScores; event InitMenuScene(MobilePlayerInput PlayerInput, int ScreenWidth, int ScreenHeight, bool bIsFirstInitialization) { super.InitMenuScene(PlayerInput, ScreenWidth, ScreenHeight, bIsFirstInitialization); /* Load the HighScore object on Init. so all the saved scored are rendered in the list. */ class'Engine'.static.BasicLoadObject(HighScores, "Dev_Ninja_Highscores.bin", true, 1); } /* When a touch ends, check the Tag of the MobileMenuObject that was pressed * 1. If the play menu button was pressed, open the PlayMenu and close this one. * 2. If the main menu button was pressed, open the MainMenu and close this one. */ function OnTouch(MobileMenuObject Sender, ETouchType Type, float TouchX, float TouchY) { if(Type == Touch_Ended) { Switch(Sender.Tag) { /* 1 */ case "PLAYMENUBUTTON": InputOwner.OpenMenuScene(class'Dev_Ninja_PlayMenu' ); InputOwner.CloseMenuScene(self); break; /* 2 */ case "MAINMENUBUTTON": InputOwner.OpenMenuScene(class'Dev_Ninja_MainMenu' ); InputOwner.CloseMenuScene(self); break; } } } /* * For a thorough overview of these properties, go to: http://udn.epicgames.com/Three/MobileMenuTechnicalGuide.html#MobileMenuScene */ defaultproperties { bRelativeLeft=true bRelativeTop=true bRelativeWidth=true bRelativeHeight=true Left=0 Top=0 Width=1 Height=1 Begin Object Class=MobileMenuImage Name=HighScore Left=0.3 Top=0.1 Width=512 Height=128 bRelativeLeft=true bRelativeTop=true Image=Texture2D'D_NContent.Textures.High_Scores' ImageUVs=(bCustomCoords=true,U=0,V=0,UL=512,VL=128 ) ImageDrawStyle=IDS_Stretched End Object MenuObjects.Add(HighScore) Begin object class=Dev_Ninja_HighScores name=HighScoreObject bIsVisible=true end object HighScores=HighScoreObject Begin Object Class=MobileMenuList Name=HighScoreList Left=0.30 Top=0.5 Width=0.4 Height=0.5 bIsHidden=false bRelativeWidth=true bRelativeHeight=true bRelativeLeft=true bRelativeTop=true EndOfListSupression=1.0 Items.Add(HighScoreObject) End Object MenuObjects.Add(HighScoreList) Begin Object Class=MobileMenuButton Name=PlayMenuButton Tag="PLAYMENUBUTTON" Left=0.1 Top=0.7 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.Play_Menu' ImagesUVs(0)=(bCustomCoords=true,U=0,V=0,UL=256,VL =64) End Object MenuObjects.Add(PlayMenuButton) Begin Object Class=MobileMenuButton Name=MainMenuButton Tag="MAINMENUBUTTON" Left=0.7 Top=0.7 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.Main_Menu' ImagesUVs(0)=(bCustomCoords=true,U=0,V=0,UL=256,VL =64) End Object MenuObjects.Add(MainMenuButton) }
Code:
/* * Dev_Ninja_QuitMenu is opened when the game starts, just a button. */ class Dev_Ninja_QuitMenu extends MobileMenuScene; /* * On touch end, check the button's tag. * 1. IF]f quit button was pressed, open the PreGame and close this menu. */ function OnTouch(MobileMenuObject Sender, ETouchType Type, float TouchX, float TouchY) { if(Type == Touch_Ended) { switch(Sender.Tag) { /* 1 */ case "QUITBUTTON": InputOwner.Outer.ConsoleCommand("open Empty?Game=Dev_Ninja.Dev_Ninja_PreGame"); InputOwner.CloseMenuScene(self); break; } } } /* * For a thorough overview of these properties, go to: http://udn.epicgames.com/Three/MobileMenuTechnicalGuide.html#MobileMenuScene */ defaultproperties { bRelativeLeft=true bRelativeTop=true Left=0.8 Top=0.1 Width=128 Height=32 Begin Object Class=MobileMenuButton Name=QuitButton Tag="QUITBUTTON" Left=0.8 Top=0.0 Width=128 Height=32 bRelativeLeft=true bRelativeTop=true Images(0)=Texture2D'D_NContent.Textures.Quit' ImagesUVs(0)=(bCustomCoords=true,U=0,V=0,UL=256,VL =64) End Object MenuObjects.Add(QuitButton) }
Code:
/* * Dev_Ninja_HighScoreMenu can be opened from the MainMenu or after a QuickPlay is over and a new high score is recorded. */ class Dev_Ninja_HighScoreMenu extends MobileMenuScene; /* * @ var HighScores: HighScore object pointer. */ var Dev_Ninja_HighScores HighScores; event InitMenuScene(MobilePlayerInput PlayerInput, int ScreenWidth, int ScreenHeight, bool bIsFirstInitialization) { super.InitMenuScene(PlayerInput, ScreenWidth, ScreenHeight, bIsFirstInitialization); /* Load the HighScore object on Init. so all the saved scored are rendered in the list. */ class'Engine'.static.BasicLoadObject(HighScores, "Dev_Ninja_Highscores.bin", true, 1); } /* When a touch ends, check the Tag of the MobileMenuObject that was pressed * 1. If the play menu button was pressed, open the PlayMenu and close this one. * 2. If the main menu button was pressed, open the MainMenu and close this one. */ function OnTouch(MobileMenuObject Sender, ETouchType Type, float TouchX, float TouchY) { if(Type == Touch_Ended) { Switch(Sender.Tag) { /* 1 */ case "PLAYMENUBUTTON": InputOwner.OpenMenuScene(class'Dev_Ninja_PlayMenu' ); InputOwner.CloseMenuScene(self); break; /* 2 */ case "MAINMENUBUTTON": InputOwner.OpenMenuScene(class'Dev_Ninja_MainMenu' ); InputOwner.CloseMenuScene(self); break; } } } /* * For a thorough overview of these properties, go to: http://udn.epicgames.com/Three/MobileMenuTechnicalGuide.html#MobileMenuScene */ defaultproperties { bRelativeLeft=true bRelativeTop=true bRelativeWidth=true bRelativeHeight=true Left=0 Top=0 Width=1 Height=1 Begin Object Class=MobileMenuImage Name=HighScore Left=0.3 Top=0.1 Width=512 Height=128 bRelativeLeft=true bRelativeTop=true Image=Texture2D'D_NContent.Textures.High_Scores' ImageUVs=(bCustomCoords=true,U=0,V=0,UL=512,VL=128 ) ImageDrawStyle=IDS_Stretched End Object MenuObjects.Add(HighScore) Begin object class=Dev_Ninja_HighScores name=HighScoreObject bIsVisible=true end object HighScores=HighScoreObject Begin Object Class=MobileMenuList Name=HighScoreList Left=0.30 Top=0.5 Width=0.4 Height=0.5 bIsHidden=false bRelativeWidth=true bRelativeHeight=true bRelativeLeft=true bRelativeTop=true EndOfListSupression=1.0 Items.Add(HighScoreObject) End Object MenuObjects.Add(HighScoreList) Begin Object Class=MobileMenuButton Name=PlayMenuButton Tag="PLAYMENUBUTTON" Left=0.1 Top=0.7 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.Play_Menu' ImagesUVs(0)=(bCustomCoords=true,U=0,V=0,UL=256,VL =64) End Object MenuObjects.Add(PlayMenuButton) Begin Object Class=MobileMenuButton Name=MainMenuButton Tag="MAINMENUBUTTON" Left=0.7 Top=0.7 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.Main_Menu' ImagesUVs(0)=(bCustomCoords=true,U=0,V=0,UL=256,VL =64) End Object MenuObjects.Add(MainMenuButton) }
Code:
/* * Dev_Ninja_GameOverMenu is opened after a QuickPlay didn't yield a new high score. */ class Dev_Ninja_GameOverMenu extends MobileMenuScene; /* When a touch ends, check the Tag of the MobileMenuObject that was pressed * 1. If the play menu button was pressed, open the PlayMenu and close this one. * 2. If the high score menu button was pressed, open the HighScoreMenu and close this one. * 3. If the main menu button was pressed, open the MainMenu and close this one. */ function OnTouch(MobileMenuObject Sender, ETouchType Type, float TouchX, float TouchY) { if(Type == Touch_Ended) { switch(Sender.Tag) { /* 1 */ case "PLAYMENUBUTTON": InputOwner.OpenMenuScene(class'Dev_Ninja_PlayMenu' ); InputOwner.CloseMenuScene(self); break; /* 2 */ case "HIGHSCOREBUTTON": InputOwner.OpenMenuScene(class'Dev_Ninja_HighScore Menu'); InputOwner.CloseMenuScene(self); break; /* 3 */ case "MAINMENUBUTTON": InputOwner.OpenMenuScene(class'Dev_Ninja_MainMenu' ); InputOwner.CloseMenuScene(self); break; } } } /* * For a thorough overview of these properties, go to: http://udn.epicgames.com/Three/MobileMenuTechnicalGuide.html#MobileMenuScene */ defaultproperties { bRelativeLeft=true bRelativeTop=true bRelativeWidth=true bRelativeHeight=true Left=0 Top=0 Width=1 Height=1 Begin Object Class=MobileMenuImage Name=GameOver Left=0.3 Top=0.1 Width=512 Height=128 bRelativeLeft=true bRelativeTop=true Image=Texture2D'D_NContent.Textures.GameOver' ImageDrawStyle=IDS_Stretched ImageUVs=(bCustomCoords=true,U=0,V=0,UL=512,VL=128 ) End Object MenuObjects.Add(GameOver) Begin Object Class=MobileMenuButton Name=PlayMenuButton Tag="PLAYMENUBUTTON" Left=0.1 Top=0.8 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.Play_Menu' ImagesUVs(0)=(bCustomCoords=true,U=0,V=0,UL=256,VL =64) End Object MenuObjects.Add(PlayMenuButton) Begin Object Class=MobileMenuButton Name=MainMenuButton Tag="MAINMENUBUTTON" Left=0.7 Top=0.8 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.Main_Menu' ImagesUVs(0)=(bCustomCoords=true,U=0,V=0,UL=256,VL =64) End Object MenuObjects.Add(MainMenuButton) Begin Object Class=MobileMenuButton Name=HighScoreButton Tag="HIGHSCOREBUTTON" Left=0.39 Top=0.8 Width=256 Height=64 bRelativeLeft=true bRelativeTop=true TopLeeway=20 Images(0)=Texture2D'D_NContent.Textures.High_Score s_white' ImagesUVs(0)=(bCustomCoords=true,U=0,V=0,UL=256,VL =64) End Object MenuObjects.Add(HighScoreButton) }

Comment