Add a Multiplayer menu
This commit is contained in:
@@ -70,6 +70,7 @@
|
|||||||
<Compile Include="CncWaterPaletteRotation.cs" />
|
<Compile Include="CncWaterPaletteRotation.cs" />
|
||||||
<Compile Include="AttackPopupTurreted.cs" />
|
<Compile Include="AttackPopupTurreted.cs" />
|
||||||
<Compile Include="SpawnViceroid.cs" />
|
<Compile Include="SpawnViceroid.cs" />
|
||||||
|
<Compile Include="Widgets\CncMenuLogic.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
@@ -103,5 +104,6 @@ cd "$(SolutionDir)"</PostBuildEvent>
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Activities\" />
|
<Folder Include="Activities\" />
|
||||||
|
<Folder Include="Widgets\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
49
OpenRA.Mods.Cnc/Widgets/CncMenuLogic.cs
Executable file
49
OpenRA.Mods.Cnc/Widgets/CncMenuLogic.cs
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using OpenRA.FileFormats;
|
||||||
|
using OpenRA.Network;
|
||||||
|
using OpenRA.Server;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||||
|
{
|
||||||
|
public class CncMenuLogic : IWidgetDelegate
|
||||||
|
{
|
||||||
|
enum MenuType
|
||||||
|
{
|
||||||
|
Main,
|
||||||
|
Multiplayer,
|
||||||
|
Settings
|
||||||
|
}
|
||||||
|
MenuType Menu = MenuType.Main;
|
||||||
|
|
||||||
|
[ObjectCreator.UseCtor]
|
||||||
|
public CncMenuLogic([ObjectCreator.Param] Widget widget)
|
||||||
|
{
|
||||||
|
// Root level menu
|
||||||
|
var mainButtons = widget.GetWidget("MAIN_BUTTONS");
|
||||||
|
mainButtons.IsVisible = () => Menu == MenuType.Main;
|
||||||
|
|
||||||
|
mainButtons.GetWidget("MULTIPLAYER_BUTTON").OnMouseUp = mi => { Menu = MenuType.Multiplayer; return true; };
|
||||||
|
mainButtons.GetWidget("QUIT_BUTTON").OnMouseUp = mi => { Game.Exit(); return true; };
|
||||||
|
|
||||||
|
// Multiplayer menu
|
||||||
|
var multiplayerButtons = widget.GetWidget("MULTIPLAYER_BUTTONS");
|
||||||
|
multiplayerButtons.IsVisible = () => Menu == MenuType.Multiplayer;
|
||||||
|
|
||||||
|
multiplayerButtons.GetWidget("BACK_BUTTON").OnMouseUp = mi => { Menu = MenuType.Main; return true; };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ Container@MAINMENU_BG:
|
|||||||
Y:0
|
Y:0
|
||||||
Width:WINDOW_RIGHT
|
Width:WINDOW_RIGHT
|
||||||
Height:WINDOW_BOTTOM
|
Height:WINDOW_BOTTOM
|
||||||
|
Delegate:CncMenuLogic
|
||||||
Children:
|
Children:
|
||||||
Image@RETICLE:
|
Image@RETICLE:
|
||||||
X:(WINDOW_RIGHT-WIDTH)/2
|
X:(WINDOW_RIGHT-WIDTH)/2
|
||||||
@@ -18,20 +19,29 @@ Container@MAINMENU_BG:
|
|||||||
Width:WINDOW_RIGHT
|
Width:WINDOW_RIGHT
|
||||||
Height:WINDOW_BOTTOM
|
Height:WINDOW_BOTTOM
|
||||||
Background:shellmapborder
|
Background:shellmapborder
|
||||||
Container@BUTTON_CONTAINER:
|
Container@MAIN_BUTTONS:
|
||||||
Id:BUTTON_CONTAINER
|
Id:MAIN_BUTTONS
|
||||||
X:(WINDOW_RIGHT-WIDTH)/2
|
X:(WINDOW_RIGHT-WIDTH)/2
|
||||||
Y:WINDOW_BOTTOM-33-HEIGHT-10
|
Y:WINDOW_BOTTOM-33-HEIGHT-10
|
||||||
Width:740
|
Width:740
|
||||||
Height:35
|
Height:35
|
||||||
Children:
|
Children:
|
||||||
|
Label@TITLE:
|
||||||
|
X:0
|
||||||
|
Y:0-30
|
||||||
|
Width:PARENT_RIGHT
|
||||||
|
Height:20
|
||||||
|
Text:Main Menu
|
||||||
|
Align:Center
|
||||||
|
Bold:True
|
||||||
|
Contrast:True
|
||||||
Button@SOLO_BUTTON:
|
Button@SOLO_BUTTON:
|
||||||
Id:SOLO_BUTTON
|
Id:SOLO_BUTTON
|
||||||
X:0
|
X:0
|
||||||
Y:0
|
Y:0
|
||||||
Width:140
|
Width:140
|
||||||
Height:35
|
Height:35
|
||||||
Text:Solo Play
|
Text:Skirmish
|
||||||
Bold:True
|
Bold:True
|
||||||
Button@MULTIPLAYER_BUTTON:
|
Button@MULTIPLAYER_BUTTON:
|
||||||
Id:MULTIPLAYER_BUTTON
|
Id:MULTIPLAYER_BUTTON
|
||||||
@@ -65,6 +75,55 @@ Container@MAINMENU_BG:
|
|||||||
Height:35
|
Height:35
|
||||||
Text:Quit
|
Text:Quit
|
||||||
Bold:True
|
Bold:True
|
||||||
|
Container@MULTIPLAYER_BUTTONS:
|
||||||
|
Id:MULTIPLAYER_BUTTONS
|
||||||
|
X:(WINDOW_RIGHT-WIDTH)/2
|
||||||
|
Y:WINDOW_BOTTOM-33-HEIGHT-10
|
||||||
|
Width:740
|
||||||
|
Height:35
|
||||||
|
Visible:false
|
||||||
|
Children:
|
||||||
|
Label@TITLE:
|
||||||
|
X:0
|
||||||
|
Y:0-30
|
||||||
|
Width:PARENT_RIGHT
|
||||||
|
Height:20
|
||||||
|
Text:Multiplayer
|
||||||
|
Align:Center
|
||||||
|
Bold:True
|
||||||
|
Contrast:True
|
||||||
|
Button@CREATE_BUTTON:
|
||||||
|
Id:CREATE_BUTTON
|
||||||
|
X:0
|
||||||
|
Y:0
|
||||||
|
Width:140
|
||||||
|
Height:35
|
||||||
|
Text:Create Server
|
||||||
|
Bold:True
|
||||||
|
Button@JOIN_BUTTON:
|
||||||
|
Id:JOIN_BUTTON
|
||||||
|
X:150
|
||||||
|
Y:0
|
||||||
|
Width:140
|
||||||
|
Height:35
|
||||||
|
Text:Find Server
|
||||||
|
Bold:True
|
||||||
|
Button@DIRECTCONNECT_BUTTON:
|
||||||
|
Id:DIRECTCONNECT_BUTTON
|
||||||
|
X:300
|
||||||
|
Y:0
|
||||||
|
Width:140
|
||||||
|
Height:35
|
||||||
|
Text:Direct Connect
|
||||||
|
Bold:True
|
||||||
|
Button@BACK_BUTTON:
|
||||||
|
Id:BACK_BUTTON
|
||||||
|
X:600
|
||||||
|
Y:0
|
||||||
|
Width:140
|
||||||
|
Height:35
|
||||||
|
Text:Back
|
||||||
|
Bold:True
|
||||||
Background@QUICKMODSWITCHER:
|
Background@QUICKMODSWITCHER:
|
||||||
Id:QUICKMODSWITCHER
|
Id:QUICKMODSWITCHER
|
||||||
Background: dialog4
|
Background: dialog4
|
||||||
|
|||||||
Reference in New Issue
Block a user