Unreal Tutorial: Custom Mid Game Menu

来源:互联网 发布:手机高程测量软件 编辑:程序博客网 时间:2024/06/05 20:14
Tutorial: Custom Mid Game Menu
This tutorial will go over the steps required to have a custom mid-game menu. Note, replacing the mid-game menu REQUIRES UT PATCH 1.1 to be installed. Without it this isn't possible. Also, I'll be building a sample mod while I go but you can easily incorporate this in to your current mods. Let's begin:

Step 1: In your "../My Documents/My Games/Unreal Tournament 3/UTGame/Src" folder create a new mod folder called "MidGameMenuMod" and inside that create your "Classes" folder.

Step 2: Inside the classes folder, create 2 files.

xCTFGame.UC

Code:
class XCTFGame extends UTCTFGame_Content;

simulated function PostBeginPlay()
{
    super.PostBeginPlay();
    `log(
"[XCTFGame] - Initialized and running");
}
and xTestMidGamePanel.uc

Code:
class xTestMidGamePanel extends UTTabPage;

event bool ActivatePage( int PlayerIndex, bool bActivate, optional bool bTakeFocus=true )
{
    `log(
"[XCTFGame] - Our Page is Active");
    
return Super.ActivatePage(PlayerIndex, bActivate, bTakeFocus);
}
Step 3: Follow the instructions at this link http://utforums.epicgames.com/showthread.php?t=584867 and compile your mod. You should now have the file /MidGameMenuMod.u in your "Unpublished/CookedPC/Script" folder.

Step 4: Time to create the content. Load the editor ("UT3.exe editor") and go to the generic browser. Find the package "UI_InGameHUD" and make sure it's fully loaded.

Step 5: Switch to the log tab and type the following:

obj savepackage file=C:/tmpdata package=UI_InGameHud

You can find out more about this trick in this thread by Matt:

http://utforums.epicgames.com/showthread.php?t=585462

Step 6: You can now duplicate the current mid game menu. Go back to the browser tab and expand UI_InGameHud and select the Menus Group. Select "MidGameMenu" from the list of objects. Right click and select Duplicate.

Step 7: In the dialog that appears, change the package to "MidGameMenuModData" and edit New Name to say "NewMidGameMenu". Finally click OK.

Step 8. You now have a new package in your browser called "MidGameMenuModData". Save this package to disk then double click on the NewMidGameMenu object to edit it.

Step 9: Find the widget "TabControl" and expand it. Right click on widget in the Scene Tool and select "UTUITabControl" which will show a submenu with "Insert New Page" and "Remove Page". Select "Insert New Page".

Step 10: The "Choose the type of page to add" dialog will appear. Expand the drop down until you see the entry for XTestMidGamePanel and select it. Then click OK.

Step 11: This will create a panel in the scene, you will see the panel in the Scene Tools (called xTestMidGamePanel_0) but a bug will stop it from showing the tab in the current open scene. Don't worry about this right now.

Step 12: Select the panel in the Scene Tools window and rename "xTestMidGamePanel_0" to "TestPage".

Step 13: While it's selected go to the properties window and under Data expand ButtonCaption. Set the markup to "TEST".

Step 14: close the scene editor.

Step 15: Double click on the NewMidGameMenu object to edit it again. Bingo, your tab has appeared.

Step 16: In the Scene Tools, browse back to TestPage. By default the Tab control will mark the tab as bHidden. In the properties window, uncheck it and add widgets to your new page.

Step 17: Close the Scene editor and save the package. Then exit the editor.

Step 18: Open xCTFGame.uc and add the following section to the end of the file:

Code:
defaultproperties
{
    MidGameMenuTemplate
=UTUIScene_MidGameMenu'MidGameMenuModData.Menus.NewMidGameMenu'

}
That creates the reference. BUT Before you can compile you have to do the following (due to a bug we haven't fixed yet)...

Step 19: In your "../My Documents/My Games/Unreal Tournament 3/UTGame" folder create a new folder called "Published" and inside "Published" create "CookedPC".

Step 20: COPY (not move) MidGameMenuModData from your "Unpublished/CookedPC" directory to your "Published/CookedPC".

Step 21: Recompile your code.

Run the game "ut3 ctf-strident?game=MidGameMenuMod.XCTFGame -log -useunpublished"

Your mid game menu should now have the TEST tab in your custom game type.

I've attached the source and data to this project. Keep in mind that you can modify your copy of the mid game menu any way you would like.
 
原创粉丝点击