Non-WinForms launcher with auto updater

This commit is contained in:
Regalis
2015-09-11 22:13:44 +03:00
parent ea15397725
commit 29a6260d0f
104 changed files with 46296 additions and 5638 deletions

View File

@@ -37,6 +37,12 @@
this.contentPackageBox = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.packageManagerButton = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.autoUpdateCheckBox = new System.Windows.Forms.CheckBox();
this.progressBar = new System.Windows.Forms.ProgressBar();
this.patchNoteBox = new System.Windows.Forms.TextBox();
this.updateLabel = new System.Windows.Forms.Label();
this.downloadButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
@@ -70,7 +76,7 @@
//
this.resolutionBox.AllowDrop = true;
this.resolutionBox.FormattingEnabled = true;
this.resolutionBox.Location = new System.Drawing.Point(57, 207);
this.resolutionBox.Location = new System.Drawing.Point(369, 236);
this.resolutionBox.Name = "resolutionBox";
this.resolutionBox.Size = new System.Drawing.Size(212, 21);
this.resolutionBox.TabIndex = 2;
@@ -80,7 +86,7 @@
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.ForeColor = System.Drawing.SystemColors.Window;
this.label1.Location = new System.Drawing.Point(54, 191);
this.label1.Location = new System.Drawing.Point(366, 220);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(60, 13);
this.label1.TabIndex = 3;
@@ -91,7 +97,7 @@
this.fullscreenBox.AutoSize = true;
this.fullscreenBox.BackColor = System.Drawing.Color.Transparent;
this.fullscreenBox.ForeColor = System.Drawing.SystemColors.Window;
this.fullscreenBox.Location = new System.Drawing.Point(57, 252);
this.fullscreenBox.Location = new System.Drawing.Point(369, 281);
this.fullscreenBox.Name = "fullscreenBox";
this.fullscreenBox.Size = new System.Drawing.Size(74, 17);
this.fullscreenBox.TabIndex = 4;
@@ -101,7 +107,7 @@
// contentPackageBox
//
this.contentPackageBox.FormattingEnabled = true;
this.contentPackageBox.Location = new System.Drawing.Point(368, 207);
this.contentPackageBox.Location = new System.Drawing.Point(369, 138);
this.contentPackageBox.Name = "contentPackageBox";
this.contentPackageBox.Size = new System.Drawing.Size(212, 21);
this.contentPackageBox.TabIndex = 5;
@@ -112,7 +118,7 @@
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.ForeColor = System.Drawing.SystemColors.Window;
this.label2.Location = new System.Drawing.Point(365, 191);
this.label2.Location = new System.Drawing.Point(366, 122);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(92, 13);
this.label2.TabIndex = 6;
@@ -123,7 +129,7 @@
this.packageManagerButton.BackColor = System.Drawing.Color.OrangeRed;
this.packageManagerButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.packageManagerButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.packageManagerButton.Location = new System.Drawing.Point(368, 234);
this.packageManagerButton.Location = new System.Drawing.Point(369, 165);
this.packageManagerButton.Name = "packageManagerButton";
this.packageManagerButton.Size = new System.Drawing.Size(120, 35);
this.packageManagerButton.TabIndex = 7;
@@ -131,6 +137,71 @@
this.packageManagerButton.UseVisualStyleBackColor = false;
this.packageManagerButton.Click += new System.EventHandler(this.packageManagerButton_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.BackColor = System.Drawing.Color.Transparent;
this.label3.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label3.Location = new System.Drawing.Point(266, 78);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(86, 13);
this.label3.TabIndex = 8;
this.label3.Text = "Installed version:";
//
// autoUpdateCheckBox
//
this.autoUpdateCheckBox.AutoSize = true;
this.autoUpdateCheckBox.BackColor = System.Drawing.Color.Transparent;
this.autoUpdateCheckBox.ForeColor = System.Drawing.SystemColors.Window;
this.autoUpdateCheckBox.Location = new System.Drawing.Point(47, 122);
this.autoUpdateCheckBox.Name = "autoUpdateCheckBox";
this.autoUpdateCheckBox.Size = new System.Drawing.Size(177, 17);
this.autoUpdateCheckBox.TabIndex = 9;
this.autoUpdateCheckBox.Text = "Automatically check for updates";
this.autoUpdateCheckBox.UseVisualStyleBackColor = false;
//
// progressBar
//
this.progressBar.Location = new System.Drawing.Point(129, 407);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(207, 30);
this.progressBar.TabIndex = 10;
//
// patchNoteBox
//
this.patchNoteBox.AcceptsReturn = true;
this.patchNoteBox.Location = new System.Drawing.Point(47, 145);
this.patchNoteBox.Multiline = true;
this.patchNoteBox.Name = "patchNoteBox";
this.patchNoteBox.ReadOnly = true;
this.patchNoteBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.patchNoteBox.Size = new System.Drawing.Size(289, 226);
this.patchNoteBox.TabIndex = 11;
//
// updateLabel
//
this.updateLabel.AutoSize = true;
this.updateLabel.BackColor = System.Drawing.Color.Transparent;
this.updateLabel.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.updateLabel.Location = new System.Drawing.Point(44, 383);
this.updateLabel.Name = "updateLabel";
this.updateLabel.Size = new System.Drawing.Size(98, 13);
this.updateLabel.TabIndex = 12;
this.updateLabel.Text = "New update found!";
//
// downloadButton
//
this.downloadButton.BackColor = System.Drawing.Color.OrangeRed;
this.downloadButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.downloadButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.downloadButton.Location = new System.Drawing.Point(47, 407);
this.downloadButton.Name = "downloadButton";
this.downloadButton.Size = new System.Drawing.Size(76, 30);
this.downloadButton.TabIndex = 13;
this.downloadButton.Text = "Download";
this.downloadButton.UseVisualStyleBackColor = false;
this.downloadButton.Click += new System.EventHandler(this.downloadButton_Click);
//
// LauncherMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -139,6 +210,12 @@
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ClientSize = new System.Drawing.Size(628, 453);
this.Controls.Add(this.downloadButton);
this.Controls.Add(this.updateLabel);
this.Controls.Add(this.patchNoteBox);
this.Controls.Add(this.progressBar);
this.Controls.Add(this.autoUpdateCheckBox);
this.Controls.Add(this.label3);
this.Controls.Add(this.packageManagerButton);
this.Controls.Add(this.label2);
this.Controls.Add(this.contentPackageBox);
@@ -166,6 +243,12 @@
private System.Windows.Forms.ComboBox contentPackageBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button packageManagerButton;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.CheckBox autoUpdateCheckBox;
private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.TextBox patchNoteBox;
private System.Windows.Forms.Label updateLabel;
private System.Windows.Forms.Button downloadButton;
}
}

View File

@@ -1,4 +1,5 @@
using Subsurface;
using RestSharp;
using Subsurface;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -7,6 +8,8 @@ using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
@@ -17,9 +20,13 @@ namespace Launcher
{
public partial class LauncherMain : Form
{
string version = AssemblyName.GetAssemblyName("subsurface.exe").Version.ToString();
private const string configPath = "config.xml";
private Subsurface.GameSettings settings;
private string latestVersionFileList, latestVersionFolder;
[DllImport("user32.dll")]
public static extern bool EnumDisplaySettings(
string deviceName, int modeNum, ref DEVMODE devMode);
@@ -35,6 +42,12 @@ namespace Launcher
set { settings.FullScreenEnabled = value; }
}
public bool AutoCheckUpdates
{
get { return settings.AutoCheckUpdates; }
set { settings.AutoCheckUpdates = value; }
}
//private GraphicsMode selectedMode;
public LauncherMain()
@@ -80,6 +93,9 @@ namespace Launcher
fullscreenBox.DataBindings.Add("Checked", this, "FullscreenEnabled");
autoUpdateCheckBox.DataBindings.Add("Checked", this, "AutoCheckUpdates");
if (settings.SelectedContentPackage == null)
{
if (contentPackageBox.Items.Count > 0) contentPackageBox.SelectedItem = contentPackageBox.Items[0];
@@ -89,6 +105,15 @@ namespace Launcher
contentPackageBox.SelectedItem = settings.SelectedContentPackage;
}
progressBar.Visible = false;
updateLabel.Visible = false;
downloadButton.Visible = false;
if (settings.AutoCheckUpdates)
{
CheckForUpdates();
}
//resolutionBox.SelectedItem = selectedMode;
}
@@ -122,6 +147,172 @@ namespace Launcher
settings.SelectedContentPackage = comboBox.SelectedItem as ContentPackage;
}
private bool CheckForUpdates()
{
patchNoteBox.Text = "Checking for updates...";
XDocument doc = null;
try
{
doc = FetchXML("versioninfo.xml");
}
catch (Exception e)
{
patchNoteBox.Text = "Error while checking for updates: " + e.Message;
return false;
}
CheckUpdateXML(doc);
return true;
}
private XDocument FetchXML(string fileName)
{
var client = new RestClient(settings.MasterServerUrl);
var request = new RestRequest(fileName, Method.GET);
IRestResponse response = client.Execute(request);
if (response.ResponseStatus!= ResponseStatus.Completed) return null;
if (response.StatusCode != HttpStatusCode.OK) return null;
string xml = response.Content;
string _byteOrderMarkUtf8 = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble());
if (xml.StartsWith(_byteOrderMarkUtf8))
{
xml = xml.Remove(0, _byteOrderMarkUtf8.Length);
}
return XDocument.Parse(xml);
}
private bool CheckUpdateXML(XDocument doc)
{
if (doc.Root==null)
{
patchNoteBox.Text = "Error while checking for updates: could not parse update info";
return false;
}
progressBar.Visible = true;
downloadButton.Visible = true;
updateLabel.Visible = true;
string latestVersion = ToolBox.GetAttributeString(doc.Root, "latestversion", "");
latestVersionFolder = ToolBox.GetAttributeString(doc.Root, "latestversionfolder", "");
latestVersionFileList = ToolBox.GetAttributeString(doc.Root, "latestversionfilelist", "");
if (latestVersion == version)
{
patchNoteBox.Text = "Game is up to date!";
return false;
}
updateLabel.Text = "New update found! (" + latestVersion + ")";
XElement patchNotes = doc.Root.Element("patchnotes");
if (patchNotes!=null)
{
StringBuilder sb = new StringBuilder();
foreach (XElement patchNote in patchNotes.Elements())
{
string patchNumber = ToolBox.GetAttributeString(patchNote, "version", "");
//read the patch notes until we reach the user's version
if (patchNumber == version) break;
sb.AppendLine(ToolBox.ElementInnerText(patchNote));
sb.AppendLine("*************************************\n");
}
patchNoteBox.Text = sb.ToString();
}
return true;
}
private void downloadButton_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(latestVersionFolder)) return;
Button senderButton = sender as Button;
senderButton.Enabled = false;
XDocument doc = null;
try
{
doc = FetchXML("filelist.xml");
}
catch (Exception exception)
{
patchNoteBox.Text = "Error while checking for updates: " + exception.Message;
return;
}
filesToDownload = UpdaterUtil.GetRequiredFiles(doc);
string dir = Directory.GetCurrentDirectory();
filesToDownloadCount = filesToDownload.Count;
if (filesToDownloadCount>0)
{
WebClient webClient = new WebClient();
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
//webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
webClient.DownloadFileAsync(new Uri(latestVersionFolder + filesToDownload[0]), dir);
}
}
private List<string> filesToDownload;
private int filesDownloaded, filesToDownloadCount;
private void Completed(object sender, AsyncCompletedEventArgs e)
{
filesDownloaded++;
progressBar.Value = (int)(((float)filesDownloaded / (float)filesToDownloadCount) * 100.0f);//e.ProgressPercentage;
filesToDownload.RemoveAt(0);
if (filesToDownload.Count==0)
{
progressBar.Visible = false;
downloadButton.Visible = false;
updateLabel.Visible = false;
MessageBox.Show("Download completed!");
return;
}
updateLabel.Text = "Downloading file "+ filesDownloaded + "/" + filesToDownloadCount + " ("+ filesToDownload[0] + ")";
WebClient webClient = new WebClient();
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
//webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
string dir = Directory.GetCurrentDirectory();
string fileDir = Path.GetDirectoryName(filesToDownload[0]);
if (!string.IsNullOrWhiteSpace(fileDir) && !Directory.Exists(fileDir))
{
Directory.CreateDirectory(fileDir);
}
webClient.DownloadFileAsync(new Uri(latestVersionFolder + filesToDownload[0]), @dir + "\\" + filesToDownload[0]);
}
}
public class GraphicsMode
@@ -182,7 +373,6 @@ namespace Launcher
public int dmReserved2;
public int dmPanningWidth;
public int dmPanningHeight;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -38,6 +38,10 @@
<ApplicationIcon>Icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.DirectoryServices" />
@@ -67,6 +71,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="PackageManager.resx">
<DependentUpon>PackageManager.cs</DependentUpon>
@@ -80,6 +85,7 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

4
Launcher/packages.config Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="RestSharp" version="105.2.3" targetFramework="net45" />
</packages>

View File

@@ -0,0 +1,15 @@
#----------------------------- Global Properties ----------------------------#
/outputDir:bin/Windows
/intermediateDir:obj/Windows
/platform:Windows
/config:
/profile:Reach
/compress:False
#-------------------------------- References --------------------------------#
#---------------------------------- Content ---------------------------------#

BIN
Launcher2/Icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{251AAFE1-F24B-4837-9128-9D04FCBFD528}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Launcher2</RootNamespace>
<AssemblyName>Launcher2</AssemblyName>
<FileAlignment>512</FileAlignment>
<MonoGamePlatform>Windows</MonoGamePlatform>
<MonoGameContentBuilderExe>
</MonoGameContentBuilderExe>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Subsurface\bin\Windows\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Windows\Release\</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Compile Include="LauncherMain.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="MonoGame.Framework">
<HintPath>$(MSBuildProgramFiles32)\MonoGame\v3.0\Assemblies\Windows\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\RestSharp.105.2.3\lib\net4\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.XML" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Content Include="Icon.ico" />
</ItemGroup>
<ItemGroup>
<MonoGameContentReference Include="Content\Content.mgcb" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Subsurface\Subsurface.csproj">
<Project>{008c0f83-e914-4966-9135-ea885059edd8}</Project>
<Name>Subsurface</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

486
Launcher2/LauncherMain.cs Normal file
View File

@@ -0,0 +1,486 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Subsurface;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Xml.Linq;
using System.Linq;
using System.Diagnostics;
using System.IO;
using System;
using System.Net;
using System.ComponentModel;
using RestSharp;
using System.Text;
namespace Launcher2
{
/// <summary>
/// This is the main type for your game
/// </summary>
public class LauncherMain : Game
{
string version = AssemblyName.GetAssemblyName("subsurface.exe").Version.ToString();
private const string configPath = "config.xml";
private Subsurface.GameSettings settings;
private string latestVersionFileList, latestVersionFolder;
private List<DisplayMode> supportedModes;
private GUIDropDown resolutionDD, contentPackageDD;
private GUITextBlock updateInfoText;
private GUIListBox updateInfoBox;
private GUIProgressBar progressBar;
private GUIButton downloadButton;
public bool FullScreenEnabled
{
get { return settings.FullScreenEnabled; }
set { settings.FullScreenEnabled = value; }
}
public bool AutoCheckUpdates
{
get { return settings.AutoCheckUpdates; }
set { settings.AutoCheckUpdates = value; }
}
Texture2D backgroundTexture, titleTexture;
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
int graphicsWidth, graphicsHeight;
GUIFrame guiRoot;
public LauncherMain()
: base()
{
graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 640;
graphics.PreferredBackBufferHeight = 360;
IsMouseVisible = true;
supportedModes = new List<DisplayMode>();
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
// TODO: Add your initialization logic here
ContentPackage.LoadAll(ContentPackage.Folder);
settings = new GameSettings(configPath);
base.Initialize();
}
protected override void LoadContent()
{
graphicsWidth = GraphicsDevice.Viewport.Width;
graphicsHeight = GraphicsDevice.Viewport.Height;
TextureLoader.Init(GraphicsDevice);
GUI.Init(Content);
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
GUI.LoadContent(GraphicsDevice);
backgroundTexture = TextureLoader.FromFile("Content/UI/titleBackground.png");
titleTexture = TextureLoader.FromFile("Content/UI/titleText.png");
guiRoot = new GUIFrame(new Rectangle(0,0,graphicsWidth, graphicsHeight), Color.Transparent);
guiRoot.Padding = new Vector4(40.0f, 40.0f, 40.0f, 40.0f);
GUIButton button = new GUIButton(new Rectangle(0,0,100,30), "START", Alignment.BottomRight, GUI.Style, guiRoot);
button.OnClicked = LaunchClick;
int y = 50;
var checkForUpdates = new GUITickBox(new Rectangle(0, y, 20, 20), "Automatically check for updates", Alignment.TopLeft, guiRoot);
checkForUpdates.Selected = settings.AutoCheckUpdates;
updateInfoText = new GUITextBlock(new Rectangle(0,y+30,100,20), "", GUI.Style, guiRoot);
updateInfoBox = new GUIListBox(new Rectangle(0, y + 55, 330, 150), GUI.Style, guiRoot);
updateInfoBox.Visible = false;
progressBar = new GUIProgressBar(new Rectangle(110,y+220,220,20), Color.Green, 0.0f, guiRoot);
progressBar.Visible = false;
downloadButton = new GUIButton(new Rectangle(0, y+220, 100, 20), "Download", GUI.Style, guiRoot);
downloadButton.OnClicked = DownloadButtonClicked;
downloadButton.Visible = false;
//-----------------------------------------------------------------
//-----------------------------------------------------------------
int x = 360;
new GUITextBlock(new Rectangle(x, y, 20, 20), "Resolution", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, guiRoot);
resolutionDD = new GUIDropDown(new Rectangle(x, y + 20, 200, 20), "", GUI.Style, guiRoot);
foreach (DisplayMode mode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
{
if (supportedModes.FirstOrDefault(m => m.Width == mode.Width && m.Height == mode.Height)!=null) continue;
resolutionDD.AddItem(mode.Width+"x"+mode.Height, mode);
supportedModes.Add(mode);
if (settings.GraphicsWidth == mode.Width && settings.GraphicsHeight == mode.Height) resolutionDD.SelectItem(mode);
}
new GUITextBlock(new Rectangle(x, y + 50, 20, 20), "Content package", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, guiRoot);
contentPackageDD = new GUIDropDown(new Rectangle(x, y + 70, 200, 20), "", GUI.Style, guiRoot);
foreach (ContentPackage contentPackage in ContentPackage.list)
{
contentPackageDD.AddItem(contentPackage.Name, contentPackage);
if (settings.SelectedContentPackage == contentPackage) contentPackageDD.SelectItem(contentPackage);
}
new GUIButton(new Rectangle(x,y+120,150,20), "Package Manager", GUI.Style, guiRoot);
var fullScreenTick = new GUITickBox(new Rectangle(x,y+150,20,20), "Fullscreen", Alignment.TopLeft, guiRoot);
fullScreenTick.OnSelected = ToggleFullScreen;
fullScreenTick.Selected = settings.FullScreenEnabled;
if (settings.AutoCheckUpdates)
{
CheckForUpdates();
}
}
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
base.Update(gameTime);
float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
PlayerInput.Update(deltaTime);
guiRoot.Update(deltaTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin();
spriteBatch.Draw(backgroundTexture,
new Rectangle(0, 0, graphicsWidth, graphicsHeight),
new Rectangle(635, 995, graphicsWidth, graphicsHeight),
Color.White);
spriteBatch.Draw(titleTexture, new Vector2(40.0f, 20.0f), null, Color.White, 0.0f, Vector2.Zero, new Vector2(0.2f, 0.2f), SpriteEffects.None, 0.0f);
guiRoot.Draw(spriteBatch);
spriteBatch.End();
}
private bool TrySaveSettings(string filePath)
{
DisplayMode selectedMode = resolutionDD.SelectedItemData as DisplayMode;
if (selectedMode==null)
{
resolutionDD.Flash();
return false;
}
ContentPackage selectedPackage = contentPackageDD.SelectedItemData as ContentPackage;
if (selectedPackage==null)
{
contentPackageDD.Flash();
return false;
}
settings.GraphicsWidth = selectedMode.Width;
settings.GraphicsHeight = selectedMode.Height;
settings.SelectedContentPackage = selectedPackage;
settings.Save(configPath);
return true;
}
private bool ToggleFullScreen(object obj)
{
settings.FullScreenEnabled = !settings.FullScreenEnabled;
return true;
}
private bool LaunchClick(GUIButton button, object obj)
{
if (!TrySaveSettings(configPath)) return false;
Process.Start(new ProcessStartInfo(Directory.GetCurrentDirectory() + "//" + settings.SelectedContentPackage.GetFilesOfType(ContentType.Executable)[0]));
Exit();
return true;
}
private void SetUpdateInfoBox(string text)
{
updateInfoBox.ClearChildren();
string wrappedText = ToolBox.WrapText(text, updateInfoBox.Rect.Width, GUI.SmallFont);
int lineHeight = (int)GUI.SmallFont.MeasureString(" ").Y;
string[] lines = wrappedText.Split('\n');
foreach (string line in lines)
{
if (string.IsNullOrWhiteSpace(line)) continue;
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0,0,0,lineHeight),
line, GUI.Style,
Alignment.TopLeft, Alignment.TopLeft,
updateInfoBox, false, GUI.SmallFont);
textBlock.CanBeFocused = false;
}
}
private bool CheckForUpdates()
{
updateInfoText.Text = "Checking for updates...";
XDocument doc = null;
try
{
doc = FetchXML("versioninfo.xml");
}
catch (Exception e)
{
SetUpdateInfoBox("Error while checking for updates: " + e.Message);
return false;
}
CheckUpdateXML(doc);
return true;
}
private XDocument FetchXML(string fileName)
{
var client = new RestClient(settings.MasterServerUrl);
var request = new RestRequest(fileName, Method.GET);
IRestResponse response = client.Execute(request);
if (response.ResponseStatus != ResponseStatus.Completed) return null;
if (response.StatusCode != HttpStatusCode.OK) return null;
string xml = response.Content;
string _byteOrderMarkUtf8 = System.Text.Encoding.UTF8.GetString(System.Text.Encoding.UTF8.GetPreamble());
if (xml.StartsWith(_byteOrderMarkUtf8))
{
xml = xml.Remove(0, _byteOrderMarkUtf8.Length);
}
return XDocument.Parse(xml);
}
private bool CheckUpdateXML(XDocument doc)
{
if (doc.Root == null)
{
updateInfoText.Text = "Error while checking for updates: could not parse update info";
return false;
}
string latestVersion = ToolBox.GetAttributeString(doc.Root, "latestversion", "");
latestVersionFolder = ToolBox.GetAttributeString(doc.Root, "latestversionfolder", "");
latestVersionFileList = ToolBox.GetAttributeString(doc.Root, "latestversionfilelist", "");
if (latestVersion == version)
{
updateInfoText.Text = "Game is up to date!";
return false;
}
progressBar.Visible = true;
downloadButton.Visible = true;
updateInfoBox.Visible = true;
updateInfoText.Text = "New update found! (" + latestVersion + ")";
XElement patchNotes = doc.Root.Element("patchnotes");
if (patchNotes != null)
{
StringBuilder sb = new StringBuilder();
foreach (XElement patchNote in patchNotes.Elements())
{
string patchNumber = ToolBox.GetAttributeString(patchNote, "version", "");
//read the patch notes until we reach the user's version
if (patchNumber == version) break;
string innerText = ToolBox.ElementInnerText(patchNote);
innerText = innerText.Replace("\r\n", "\n");
sb.Append(innerText+"\n");
sb.AppendLine("*************************************\n");
}
SetUpdateInfoBox(sb.ToString());
}
return true;
}
private bool DownloadButtonClicked(GUIButton button, object obj)
{
if (string.IsNullOrWhiteSpace(latestVersionFolder)) return false;
button.Enabled = false;
XDocument doc = null;
try
{
doc = FetchXML("filelist.xml");
}
catch (Exception e)
{
SetUpdateInfoBox("Error while updating: " + e.Message);
return false;
}
updateInfoBox.ClearChildren();
latestVersionFiles = UpdaterUtil.GetFileList(doc);
filesToDownload = UpdaterUtil.GetRequiredFiles(doc);
string dir = Directory.GetCurrentDirectory();
filesToDownloadCount = filesToDownload.Count;
if (filesToDownloadCount > 0)
{
//WebClient webClient = new WebClient();
//webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
////webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
//webClient.DownloadFileAsync(new Uri(latestVersionFolder + filesToDownload[0]), dir);
DownloadNextFile();
}
return true;
}
private List<string> filesToDownload;
private List<string> latestVersionFiles;
private int filesDownloaded, filesToDownloadCount;
private void DownloadNextFile()
{
string dir = Directory.GetCurrentDirectory() + "\\UpdateFiles";
if (filesDownloaded == filesToDownload.Count)
{
progressBar.Visible = false;
downloadButton.Visible = false;
//updateInfoBox.Visible = false;
updateInfoText.Text = "Installing update...";
try
{
UpdaterUtil.InstallUpdatedFiles(dir);
}
catch (Exception e)
{
updateInfoText.Text = "Update failed";
SetUpdateInfoBox("Error while installing the update: "+e.Message);
return;
}
UpdaterUtil.CleanUnnecessaryFiles(latestVersionFiles);
updateInfoText.Text = "The game was updated succesfully!";
//MessageBox.Show("Download completed!");
return;
}
updateInfoText.Text = "Downloading file " + filesDownloaded + "/" + filesToDownloadCount;
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 17),
"Downloading " + filesToDownload[filesDownloaded] + "...", GUI.Style,
Alignment.TopLeft, Alignment.TopLeft,
updateInfoBox, false, GUI.SmallFont);
textBlock.CanBeFocused = false;
WebClient webClient = new WebClient();
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
//webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
string fileDir = Path.GetDirectoryName(filesToDownload[filesDownloaded]);
if (!string.IsNullOrWhiteSpace(fileDir) && !Directory.Exists(fileDir))
{
Directory.CreateDirectory(fileDir);
}
webClient.DownloadFileAsync(new Uri(latestVersionFolder + filesToDownload[filesDownloaded]), @dir + "\\" + filesToDownload[filesDownloaded]);
}
private void Completed(object sender, AsyncCompletedEventArgs e)
{
if (e.Error!=null)
{
string errorMsg = "Error while downloading: " + e.Error.InnerException.Message;
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 0),
errorMsg, GUI.Style,
Alignment.TopLeft, Alignment.TopLeft,
updateInfoBox, true, GUI.SmallFont);
textBlock.TextColor = Color.Red;
//textBlock.CanBeFocused = false;
}
filesDownloaded++;
progressBar.BarSize = ((float)filesDownloaded / (float)filesToDownloadCount);//e.ProgressPercentage;
DownloadNextFile();
}
}
}

26
Launcher2/Program.cs Normal file
View File

@@ -0,0 +1,26 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
#endregion
namespace Launcher2
{
#if WINDOWS || LINUX
/// <summary>
/// The main class.
/// </summary>
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
using (var game = new LauncherMain())
game.Run();
}
}
#endif
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Launcher2")]
[assembly: AssemblyProduct("Launcher2")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("809d00d0-88f0-4b93-8a77-718afeaeb614")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.3.0.2069")]
[assembly: AssemblyFileVersion("3.3.0.2069")]

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="RestSharp" version="105.2.3" targetFramework="net40" />
</packages>

View File

@@ -16,11 +16,11 @@
</GUIFrame>
<GUIButton
color="0.88, 0.25, 0.15, 1.0"
color="0.88, 0.25, 0.15, 0.3"
textcolor="1.0, 1.0, 1.0, 1.0"
hovercolor="1.0, 0.57, 0.31, 1.0"
hovercolor="0.88, 0.25, 0.15, 1.0"
selectedcolor="1.0, 0.0, 0.0, 1.0"/>
<GUITextBlock

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@@ -170,24 +170,24 @@ namespace Subsurface
GUIImage image = new GUIImage(new Rectangle(0,0,30,30), HeadSprite, Alignment.TopLeft, frame);
int x = 0, y = 0;
new GUITextBlock(new Rectangle(x+80, y, 200, 20), Name, GUI.style, frame);
new GUITextBlock(new Rectangle(x+80, y, 200, 20), Name, GUI.Style, frame);
y += 20;
if (Job!=null)
{
new GUITextBlock(new Rectangle(x+80, y, 200, 20), Job.Name, GUI.style, frame);
new GUITextBlock(new Rectangle(x+80, y, 200, 20), Job.Name, GUI.Style, frame);
y += 30;
var skills = Job.Skills;
skills.Sort((s1, s2) => -s1.Level.CompareTo(s2.Level));
new GUITextBlock(new Rectangle(x, y, 200, 20), "Skills:", GUI.style, frame);
new GUITextBlock(new Rectangle(x, y, 200, 20), "Skills:", GUI.Style, frame);
y += 20;
foreach (Skill skill in skills)
{
Color textColor = Color.White * (0.5f + skill.Level/200.0f);
new GUITextBlock(new Rectangle(x+20, y, 200, 20), skill.Name, Color.Transparent, textColor, Alignment.Left, GUI.style, frame);
new GUITextBlock(new Rectangle(x + 20, y, 200, 20), skill.Level.ToString(), Color.Transparent, textColor, Alignment.Right, GUI.style, frame);
new GUITextBlock(new Rectangle(x+20, y, 200, 20), skill.Name, Color.Transparent, textColor, Alignment.Left, GUI.Style, frame);
new GUITextBlock(new Rectangle(x + 20, y, 200, 20), skill.Level.ToString(), Color.Transparent, textColor, Alignment.Right, GUI.Style, frame);
y += 20;
}
}

View File

@@ -153,6 +153,9 @@ namespace Subsurface
switch (commands[0].ToLower())
{
case "createfilelist":
UpdaterUtil.SaveFileList("filelist.xml");
break;
case "spawn":
if (commands.Length == 1) return;
@@ -165,7 +168,7 @@ namespace Subsurface
SinglePlayerMode mode = Game1.GameSession.gameMode as SinglePlayerMode;
if (mode == null) break;
mode.CrewManager.AddCharacter(Character.Controlled);
mode.CrewManager.SelectCharacter(Character.Controlled);
mode.CrewManager.SelectCharacter(null, Character.Controlled);
}
}
else

View File

@@ -7,7 +7,7 @@ using System.Xml.Linq;
namespace Subsurface
{
class GUIComponentStyle
public class GUIComponentStyle
{
public readonly Vector4 Padding;

View File

@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
@@ -15,9 +16,9 @@ namespace Subsurface
BottomRight = (Bottom | Right), BottomLeft = (Bottom | Left), BottomCenter = (CenterX | Bottom)
}
class GUI
public class GUI
{
public static GUIStyle style;
public static GUIStyle Style;
static Texture2D t;
public static SpriteFont Font, SmallFont, LargeFont;
@@ -31,6 +32,13 @@ namespace Subsurface
private static bool pauseMenuOpen;
private static GUIFrame pauseMenu;
public static void Init(ContentManager content)
{
GUI.Font = ToolBox.TryLoadFont("SpriteFont1", content);
GUI.SmallFont = ToolBox.TryLoadFont("SmallFont", content);
GUI.LargeFont = ToolBox.TryLoadFont("LargeFont", content);
}
public static bool PauseMenuOpen
{
get { return pauseMenuOpen; }
@@ -48,7 +56,7 @@ namespace Subsurface
t.SetData<Color>(
new Color[] { Color.White });// fill the texture with white
style = new GUIStyle("Content/UI/style.xml");
Style = new GUIStyle("Content/UI/style.xml");
}
public static void TogglePauseMenu()
@@ -59,10 +67,10 @@ namespace Subsurface
if (pauseMenuOpen)
{
pauseMenu = new GUIFrame(new Rectangle(0,0,200,300), null, Alignment.Center, style);
pauseMenu = new GUIFrame(new Rectangle(0,0,200,300), null, Alignment.Center, Style);
int y = 0;
var button = new GUIButton(new Rectangle(0, y, 0, 30), "Resume", Alignment.CenterX, GUI.style, pauseMenu);
var button = new GUIButton(new Rectangle(0, y, 0, 30), "Resume", Alignment.CenterX, GUI.Style, pauseMenu);
button.OnClicked = TogglePauseMenu;
y += 60;
@@ -72,7 +80,7 @@ namespace Subsurface
SinglePlayerMode spMode = Game1.GameSession.gameMode as SinglePlayerMode;
if (spMode!=null)
{
button = new GUIButton(new Rectangle(0, y, 0, 30), "Load previous", Alignment.CenterX, GUI.style, pauseMenu);
button = new GUIButton(new Rectangle(0, y, 0, 30), "Load previous", Alignment.CenterX, GUI.Style, pauseMenu);
button.OnClicked += TogglePauseMenu;
button.OnClicked += Game1.GameSession.LoadPrevious;
@@ -85,7 +93,7 @@ namespace Subsurface
SinglePlayerMode spMode = Game1.GameSession.gameMode as SinglePlayerMode;
if (spMode != null)
{
button = new GUIButton(new Rectangle(0, y, 0, 30), "Save & quit", Alignment.CenterX, GUI.style, pauseMenu);
button = new GUIButton(new Rectangle(0, y, 0, 30), "Save & quit", Alignment.CenterX, GUI.Style, pauseMenu);
button.OnClicked += QuitClicked;
button.OnClicked += TogglePauseMenu;
button.UserData = "save";
@@ -95,7 +103,7 @@ namespace Subsurface
}
button = new GUIButton(new Rectangle(0, y, 0, 30), "Quit", Alignment.CenterX, GUI.style, pauseMenu);
button = new GUIButton(new Rectangle(0, y, 0, 30), "Quit", Alignment.CenterX, GUI.Style, pauseMenu);
button.OnClicked += QuitClicked;
button.OnClicked += TogglePauseMenu;
}
@@ -118,7 +126,7 @@ namespace Subsurface
Game1.MainMenuScreen.Select();
Game1.MainMenuScreen.SelectTab(null, (int)MainMenuScreen.Tabs.Main);
//Game1.MainMenuScreen.SelectTab(null, (int)MainMenuScreen.Tabs.Main);
return true;
}

View File

@@ -4,7 +4,7 @@ using Microsoft.Xna.Framework.Input;
namespace Subsurface
{
class GUIButton : GUIComponent
public class GUIButton : GUIComponent
{
protected GUITextBlock textBlock;
protected GUIFrame frame;
@@ -16,6 +16,42 @@ namespace Subsurface
public OnPressedHandler OnPressed;
public bool Enabled { get; set; }
public override Color Color
{
get { return base.Color; }
set
{
base.Color = value;
frame.Color = value;
}
}
public override Color HoverColor
{
get { return base.HoverColor; }
set
{
base.HoverColor = value;
frame.HoverColor = value;
}
}
public override Color OutlineColor
{
get { return base.OutlineColor; }
set
{
base.OutlineColor = value;
if (frame != null) frame.OutlineColor = value;
}
}
public Color TextColor
{
get { return textBlock.TextColor; }
set { textBlock.TextColor = value; }
}
public string Text
{
@@ -23,6 +59,8 @@ namespace Subsurface
set { textBlock.Text = value; }
}
public bool Selected { get; set; }
public GUIButton(Rectangle rect, string text, GUIStyle style, GUIComponent parent = null)
: this(rect, text, null, Alignment.Left, style, parent)
{
@@ -39,6 +77,12 @@ namespace Subsurface
}
public GUIButton(Rectangle rect, string text, Color? color, Alignment alignment, GUIStyle style, GUIComponent parent = null)
:this(rect, text, color, alignment, Alignment.Center, style, parent)
{
}
public GUIButton(Rectangle rect, string text, Color? color, Alignment alignment, Alignment textAlignment, GUIStyle style, GUIComponent parent = null)
:base (style)
{
this.rect = rect;
@@ -47,19 +91,20 @@ namespace Subsurface
Enabled = true;
if (parent != null)
parent.AddChild(this);
if (parent != null) parent.AddChild(this);
frame = new GUIFrame(new Rectangle(0,0,0,0), style, this);
if (style!=null) style.Apply(frame, this);
frame = new GUIFrame(Rectangle.Empty, style, this);
if (style != null) style.Apply(frame, this);
textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 0), text,
Color.Transparent, (this.style==null) ? Color.Black : this.style.textColor,
Alignment.Center, style, this);
textBlock = new GUITextBlock(Rectangle.Empty, text,
Color.Transparent, (this.style == null) ? Color.Black : this.style.textColor,
textAlignment, style, this);
}
public override void Draw(SpriteBatch spriteBatch)
{
if (!Visible) return;
if (rect.Contains(PlayerInput.MousePosition) && Enabled && (MouseOn == null || MouseOn == this || IsParentOf(MouseOn)))
{
state = ComponentState.Hover;
@@ -80,7 +125,7 @@ namespace Subsurface
}
else
{
state = ComponentState.None;
state = Selected ? ComponentState.Selected : ComponentState.None;
}
frame.State = state;

View File

@@ -7,7 +7,7 @@ using Microsoft.Xna.Framework.Graphics;
namespace Subsurface
{
abstract class GUIComponent
public abstract class GUIComponent
{
const float FlashDuration = 1.5f;
@@ -53,6 +53,12 @@ namespace Subsurface
set;
}
public bool Visible
{
get;
set;
}
private GUITextBlock toolTipBlock;
//protected float alpha;
@@ -94,7 +100,7 @@ namespace Subsurface
//public Alignment SpriteAlignment { get; set; }
//public bool RepeatSpriteX, RepeatSpriteY;
public Color OutlineColor { get; set; }
public virtual Color OutlineColor { get; set; }
public ComponentState State
{
@@ -125,38 +131,21 @@ namespace Subsurface
set { color = value; }
}
public Color HoverColor
public virtual Color HoverColor
{
get { return hoverColor; }
set { hoverColor = value; }
}
public Color SelectedColor
public virtual Color SelectedColor
{
get { return selectedColor; }
set { selectedColor = value; }
}
//public float Alpha
//{
// get
// {
// return alpha;
// }
// set
// {
// alpha = MathHelper.Clamp(value, 0.0f, 1.0f);
// foreach (GUIComponent child in children)
// {
// child.Alpha = value;
// }
// }
//}
protected GUIComponent(GUIStyle style)
{
//alpha = 1.0f;
Visible = true;
OutlineColor = Color.Transparent;
@@ -218,6 +207,8 @@ namespace Subsurface
public virtual void Draw(SpriteBatch spriteBatch)
{
if (!Visible) return;
Color currColor = color;
if (state == ComponentState.Selected) currColor = selectedColor;
if (state == ComponentState.Hover) currColor = hoverColor;
@@ -255,20 +246,26 @@ namespace Subsurface
public void DrawToolTip(SpriteBatch spriteBatch)
{
int width = 200;
if (!Visible) return;
int width = 400;
if (toolTipBlock==null || (string)toolTipBlock.userData != ToolTip)
{
string wrappedText = ToolBox.WrapText(ToolTip, width, GUI.SmallFont);
toolTipBlock = new GUITextBlock(new Rectangle(0,0,width, wrappedText.Split('\n').Length*15), ToolTip, GUI.style, null, true);
toolTipBlock = new GUITextBlock(new Rectangle(0,0,width, wrappedText.Split('\n').Length*15), ToolTip, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, null, true, GUI.SmallFont);
toolTipBlock.Color = Color.Black*0.7f;
toolTipBlock.OutlineColor = Color.White;
toolTipBlock.userData = ToolTip;
}
toolTipBlock.rect = new Rectangle((int)PlayerInput.MousePosition.X, (int)PlayerInput.MousePosition.Y, toolTipBlock.rect.Width, toolTipBlock.rect.Height);
toolTipBlock.rect = new Rectangle(MouseOn.Rect.Center.X, MouseOn.rect.Bottom, toolTipBlock.rect.Width, toolTipBlock.rect.Height);
toolTipBlock.Draw(spriteBatch);
}
public virtual void Update(float deltaTime)
{
if (!Visible) return;
if (flashTimer>0.0f) flashTimer -= deltaTime;
if (CanBeFocused)
@@ -276,6 +273,7 @@ namespace Subsurface
if (rect.Contains(PlayerInput.MousePosition))
{
MouseOn = this;
//ToolTip = this.ToolTip;
}
else
{

View File

@@ -0,0 +1,138 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Subsurface
{
public class GUIDropDown : GUIComponent
{
private GUIButton button;
private GUIListBox listBox;
public bool Dropped { get; set; }
public object SelectedItemData
{
get
{
if (listBox.Selected == null) return null;
return listBox.Selected.UserData;
}
}
public GUIDropDown(Rectangle rect, string text, GUIStyle style, GUIComponent parent = null)
: base(style)
{
this.rect = rect;
if (parent != null) parent.AddChild(this);
button = new GUIButton(Rectangle.Empty, "", Color.White, Alignment.TopLeft, Alignment.TopLeft, null, this);
button.TextColor = Color.White;
button.Color = Color.Black * 0.8f;
button.HoverColor = Color.DarkGray * 0.8f;
button.OutlineColor = Color.LightGray * 0.8f;
button.OnClicked = OnClicked;
listBox = new GUIListBox(new Rectangle(this.rect.X, this.rect.Bottom, this.rect.Width, 200), style, null);
listBox.OnSelected = SelectItem;
//listBox.ScrollBarEnabled = false;
}
public void AddItem(string text, object userData = null)
{
GUITextBlock textBlock = new GUITextBlock(new Rectangle(0,0,0,20), text, GUI.Style, listBox);
textBlock.UserData = userData;
//int totalHeight = 0;
//foreach (GUIComponent child in listBox.children)
//{
// totalHeight += child.Rect.Height;
//}
//listBox.Rect = new Rectangle(listBox.Rect.X,listBox.Rect.Y,listBox.Rect.Width,totalHeight);
}
private bool SelectItem(GUIComponent component, object obj)
{
GUITextBlock textBlock = component as GUITextBlock;
if (textBlock==null) return false;
button.Text = textBlock.Text;
Dropped = false;
return true;
}
public void SelectItem(object userData)
{
//GUIComponent child = listBox.children.FirstOrDefault(c => c.UserData == userData);
//if (child == null) return;
listBox.Select(userData);
//SelectItem(child, userData);
}
private bool wasOpened;
private bool OnClicked(GUIComponent component, object obj)
{
if (wasOpened) return false;
wasOpened = true;
Dropped = !Dropped;
if (Dropped && parent.children[parent.children.Count-1]!=this)
{
parent.children.Remove(this);
parent.children.Add(this);
}
return true;
}
public override void Update(float deltaTime)
{
if (!Visible) return;
wasOpened = false;
base.Update(deltaTime);
if (Dropped && PlayerInput.LeftButtonClicked())
{
Rectangle listBoxRect = listBox.Rect;
listBoxRect.Width += 20;
if (!listBoxRect.Contains(PlayerInput.MousePosition))
{
Dropped = false;
}
}
button.Update(deltaTime);
if (Dropped) listBox.Update(deltaTime);
}
public override void Draw(SpriteBatch spriteBatch)
{
if (!Visible) return;
base.Draw(spriteBatch);
button.Draw(spriteBatch);
if (!Dropped) return;
listBox.Draw(spriteBatch);
}
}
}

View File

@@ -3,7 +3,7 @@ using System;
namespace Subsurface
{
class GUIFrame : GUIComponent
public class GUIFrame : GUIComponent
{
public GUIFrame(Rectangle rect, GUIStyle style = null, GUIComponent parent = null)
: this(rect, null, (Alignment.Left | Alignment.Top), style, parent)
@@ -39,7 +39,7 @@ namespace Subsurface
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
{
if (!Visible) return;
Color currColor = color;
if (state == ComponentState.Selected) currColor = selectedColor;

View File

@@ -4,7 +4,7 @@ using Microsoft.Xna.Framework.Graphics;
namespace Subsurface
{
class GUIImage : GUIComponent
public class GUIImage : GUIComponent
{
Sprite sprite;
@@ -72,6 +72,8 @@ namespace Subsurface
public override void Draw(SpriteBatch spriteBatch)
{
if (!Visible) return;
Color currColor = color;
if (state == ComponentState.Hover) currColor = hoverColor;
if (state == ComponentState.Selected) currColor = selectedColor;

View File

@@ -5,11 +5,11 @@ using Microsoft.Xna.Framework.Graphics;
namespace Subsurface
{
class GUIListBox : GUIComponent
public class GUIListBox : GUIComponent
{
protected GUIComponent selected;
public delegate bool OnSelectedHandler(object obj);
public delegate bool OnSelectedHandler(GUIComponent component, object obj);
public OnSelectedHandler OnSelected;
public delegate object CheckSelectedHandler();
@@ -34,7 +34,7 @@ namespace Subsurface
return selected;
}
}
public object SelectedData
{
get
@@ -145,13 +145,15 @@ namespace Subsurface
if (child.UserData != selection) continue;
selected = child;
if (OnSelected != null) OnSelected(selected.UserData);
if (OnSelected != null) OnSelected(selected, selected.UserData);
return;
}
}
public override void Update(float deltaTime)
{
if (!Visible) return;
base.Update(deltaTime);
scrollBar.Update(deltaTime);
@@ -165,7 +167,7 @@ namespace Subsurface
if (childIndex >= children.Count || childIndex<0) return;
selected = children[childIndex];
if (OnSelected != null) OnSelected(selected.UserData);
if (OnSelected != null) OnSelected(selected, selected.UserData);
}
public void Deselect()
@@ -238,6 +240,8 @@ namespace Subsurface
public override void Draw(SpriteBatch spriteBatch)
{
if (!Visible) return;
base.Draw(spriteBatch);
frame.Draw(spriteBatch);
@@ -284,7 +288,8 @@ namespace Subsurface
if (CheckSelected() != selected.UserData) selected = null;
}
}
else if (enabled && (MouseOn == this || (MouseOn != null && this.IsParentOf(MouseOn))) && child.Rect.Contains(PlayerInput.MousePosition))
else if (enabled && child.CanBeFocused &&
(MouseOn == this || (MouseOn != null && this.IsParentOf(MouseOn))) && child.Rect.Contains(PlayerInput.MousePosition))
{
child.State = ComponentState.Hover;
if (PlayerInput.LeftButtonClicked())
@@ -293,7 +298,7 @@ namespace Subsurface
selected = child;
if (OnSelected != null)
{
if (!OnSelected(child.UserData)) selected = null;
if (!OnSelected(selected, child.UserData)) selected = null;
}
}

View File

@@ -40,7 +40,7 @@ namespace Subsurface
public GUIMessageBox(string header, string text, string[] buttons, int width=DefaultWidth, int height=DefaultHeight, Alignment textAlignment = Alignment.TopLeft)
: base(new Rectangle(0,0, width, height),
null, Alignment.Center, GUI.style, null)
null, Alignment.Center, GUI.Style, null)
{
//Padding = GUI.style.smallPadding;
@@ -50,14 +50,14 @@ namespace Subsurface
// return;
//}
new GUITextBlock(new Rectangle(0, 0, 0, 30), header, Color.Transparent, Color.White, textAlignment, GUI.style, this, true);
new GUITextBlock(new Rectangle(0, 30, 0, height - 70), text, Color.Transparent, Color.White, textAlignment, GUI.style, this, true);
new GUITextBlock(new Rectangle(0, 0, 0, 30), header, Color.Transparent, Color.White, textAlignment, GUI.Style, this, true);
new GUITextBlock(new Rectangle(0, 30, 0, height - 70), text, Color.Transparent, Color.White, textAlignment, GUI.Style, this, true);
int x = 0;
this.Buttons = new GUIButton[buttons.Length];
for (int i = 0; i < buttons.Length; i++)
{
this.Buttons[i] = new GUIButton(new Rectangle(x, 0, 150, 30), buttons[i], Alignment.Left | Alignment.Bottom, GUI.style, this);
this.Buttons[i] = new GUIButton(new Rectangle(x, 0, 150, 30), buttons[i], Alignment.Left | Alignment.Bottom, GUI.Style, this);
x += this.Buttons[i].Rect.Width + 20;
}

View File

@@ -3,7 +3,7 @@ using Microsoft.Xna.Framework.Graphics;
namespace Subsurface
{
class GUIProgressBar : GUIComponent
public class GUIProgressBar : GUIComponent
{
private bool isHorizontal;
@@ -67,6 +67,8 @@ namespace Subsurface
public override void Draw(SpriteBatch spriteBatch)
{
if (!Visible) return;
if (ProgressGetter != null) BarSize = ProgressGetter();
DrawChildren(spriteBatch);

View File

@@ -4,7 +4,7 @@ using Microsoft.Xna.Framework.Graphics;
namespace Subsurface
{
class GUIScrollBar : GUIComponent
public class GUIScrollBar : GUIComponent
{
public static GUIScrollBar draggingBar;
@@ -122,6 +122,8 @@ namespace Subsurface
public override void Update(float deltaTime)
{
if (!Visible) return;
base.Update(deltaTime);
if (draggingBar != this) return;
@@ -132,6 +134,8 @@ namespace Subsurface
public override void Draw(SpriteBatch spriteBatch)
{
if (!Visible) return;
DrawChildren(spriteBatch);
}

View File

@@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace Subsurface
{
class GUIStyle
public class GUIStyle
{
private Dictionary<string, GUIComponentStyle> componentStyles;

View File

@@ -3,7 +3,7 @@ using Microsoft.Xna.Framework.Graphics;
namespace Subsurface
{
class GUITextBlock : GUIComponent
public class GUITextBlock : GUIComponent
{
protected string text;
@@ -21,8 +21,6 @@ namespace Subsurface
public bool Wrap;
public override Vector4 Padding
{
get { return padding; }
@@ -75,15 +73,6 @@ namespace Subsurface
{
}
public GUITextBlock(Rectangle rect, string text, GUIStyle style, Alignment alignment = Alignment.TopLeft, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null, bool wrap = false, SpriteFont font =null)
: this (rect, text, null, null, alignment, textAlignment, style, parent, wrap)
{
this.Font = font == null ? GUI.Font : font;
SetTextPos();
}
public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment textAlignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null, bool wrap = false)
: this(rect, text,color, textColor, Alignment.TopLeft, textAlignment, style, parent, wrap)
{
@@ -105,24 +94,36 @@ namespace Subsurface
public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment alignment, Alignment textAlignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null, bool wrap = false)
:base (style)
: this (rect, text, style, alignment, textAlignment, parent, wrap, null)
{
if (color != null) this.color = (Color)color;
if (textColor != null) this.textColor = (Color)textColor;
}
public GUITextBlock(Rectangle rect, string text, GUIStyle style, Alignment alignment = Alignment.TopLeft, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null, bool wrap = false, SpriteFont font = null)
:base (style)
{
this.Font = font == null ? GUI.Font : font;
this.rect = rect;
if (color!=null) this.color = (Color)color;
if (textColor!=null) this.textColor = (Color)textColor;
this.text = text;
this.alignment = alignment;
this.textAlignment = textAlignment;
if (parent != null)
parent.AddChild(this);
this.Wrap = wrap;
SetTextPos();
if (rect.Height == 0)
{
this.rect.Height = (int)Font.MeasureString(Text).Y;
}
}
private void SetTextPos()
@@ -201,6 +202,8 @@ namespace Subsurface
public override void Draw(SpriteBatch spriteBatch)
{
if (!Visible) return;
Color currColor = color;
if (state == ComponentState.Hover) currColor = hoverColor;
if (state == ComponentState.Selected) currColor = selectedColor;

View File

@@ -153,6 +153,8 @@ namespace Subsurface
MouseState previousMouse;
public override void Update(float deltaTime)
{
if (!Visible) return;
if (flashTimer > 0.0f) flashTimer -= deltaTime;
if (!Enabled) return;
@@ -186,6 +188,8 @@ namespace Subsurface
public override void Draw(SpriteBatch spriteBatch)
{
if (!Visible) return;
DrawChildren(spriteBatch);
Vector2 caretPos = textBlock.CaretPos;

View File

@@ -4,7 +4,7 @@ using Microsoft.Xna.Framework.Input;
namespace Subsurface
{
class GUITickBox : GUIComponent
public class GUITickBox : GUIComponent
{
GUIFrame box;
GUITextBlock text;
@@ -41,25 +41,24 @@ namespace Subsurface
box.HoverColor = Color.Gray;
box.SelectedColor = Color.DarkGray;
text = new GUITextBlock(new Rectangle(rect.X + 40, rect.Y, 200, rect.Height), label, Color.Transparent, Color.White, Alignment.TopLeft, null, this);
this.rect = new Rectangle(box.Rect.X, box.Rect.Y, 240, rect.Height);
Enabled = true;
}
public override void Update(float deltaTime)
{
if (rect.Width ==420)
{
int asd = 1;
}
//base.Update(deltaTime);
if (!Visible || !Enabled) return;
if (!Enabled) return;
if (text.Rect.Contains(PlayerInput.MousePosition)) MouseOn = this;
if (box.Rect.Contains(PlayerInput.MousePosition))
{
//ToolTip = this.ToolTip;
MouseOn = this;
box.State = ComponentState.Hover;
@@ -84,10 +83,7 @@ namespace Subsurface
public override void Draw(SpriteBatch spriteBatch)
{
if (rect.Width == 420)
{
int asd = 1;
}
if (!Visible) return;
DrawChildren(spriteBatch);

View File

@@ -17,13 +17,26 @@ namespace Subsurface
float state;
public Vector2 Position;
public Vector2 CenterPosition;
public Vector2 TitlePosition;
public Vector2 TitleSize
{
get { return new Vector2(titleTexture.Width, titleTexture.Height); }
}
public float Scale
{
get;
private set;
}
public TitleScreen(GraphicsDevice graphics)
{
backgroundTexture = Game1.TextureLoader.FromFile("Content/UI/titleBackground.png");
monsterTexture = Game1.TextureLoader.FromFile("Content/UI/titleMonster.png");
titleTexture = Game1.TextureLoader.FromFile("Content/UI/titleText.png");
backgroundTexture = TextureLoader.FromFile("Content/UI/titleBackground.png");
monsterTexture = TextureLoader.FromFile("Content/UI/titleMonster.png");
titleTexture = TextureLoader.FromFile("Content/UI/titleText.png");
renderTarget = new RenderTarget2D(graphics, Game1.GraphicsWidth, Game1.GraphicsHeight);
@@ -40,46 +53,44 @@ namespace Subsurface
graphics.SetRenderTarget(renderTarget);
//Debug.WriteLine(stopwatch.Elapsed.TotalMilliseconds);
float scale = Game1.GraphicsHeight/2048.0f;
Scale = Game1.GraphicsHeight/1500.0f;
state += deltaTime;
Vector2 center = new Vector2(Game1.GraphicsWidth*0.3f, Game1.GraphicsHeight/2.0f) + Position*scale;
if (loadState>-1)
{
CenterPosition = new Vector2(Game1.GraphicsWidth*0.3f, Game1.GraphicsHeight/2.0f);
TitlePosition = CenterPosition + new Vector2(-0.0f + (float)Math.Sqrt(state) * 220.0f, 0.0f) * Scale;
TitlePosition.X = Math.Min(TitlePosition.X, (float)Game1.GraphicsWidth / 2.0f);
}
Vector2 titlePos = center + new Vector2(-0.0f + (float)Math.Sqrt(state) * 220.0f, 0.0f) * scale;
titlePos.X = Math.Min(titlePos.X, (float)Game1.GraphicsWidth / 2.0f);
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
graphics.Clear(Color.Black);
spriteBatch.Draw(backgroundTexture, center, null, Color.White * Math.Min(state / 5.0f, 1.0f), 0.0f,
spriteBatch.Draw(backgroundTexture, CenterPosition, null, Color.White * Math.Min(state / 5.0f, 1.0f), 0.0f,
new Vector2(backgroundTexture.Width / 2.0f, backgroundTexture.Height / 2.0f),
scale, SpriteEffects.None, 0.2f);
Scale*1.5f, SpriteEffects.None, 0.2f);
spriteBatch.Draw(monsterTexture,
center + new Vector2(state * 100.0f - 1200.0f, state * 30.0f - 100.0f) * scale, null,
Color.White, 0.0f, Vector2.Zero, scale, SpriteEffects.None, 0.1f);
CenterPosition + new Vector2((state % 40) * 100.0f - 1800.0f, (state % 40) * 30.0f - 200.0f) * Scale, null,
Color.White, 0.0f, Vector2.Zero, Scale, SpriteEffects.None, 0.1f);
spriteBatch.Draw(titleTexture,
titlePos, null,
Color.White * Math.Min((state - 1.0f) / 5.0f, 1.0f), 0.0f, new Vector2(titleTexture.Width / 2.0f, titleTexture.Height / 2.0f), scale, SpriteEffects.None, 0.0f);
TitlePosition, null,
Color.White * Math.Min((state - 1.0f) / 5.0f, 1.0f), 0.0f, new Vector2(titleTexture.Width / 2.0f, titleTexture.Height / 2.0f), Scale, SpriteEffects.None, 0.0f);
spriteBatch.End();
graphics.SetRenderTarget(null);
Matrix transform = Matrix.CreateTranslation(
new Vector3(Game1.GraphicsWidth / 2.0f,
Game1.GraphicsHeight / 2.0f, 0));
Hull.renderer.RenderBack(spriteBatch, renderTarget, transform);
Hull.renderer.RenderBack(spriteBatch, renderTarget, 0.0f);
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
spriteBatch.Draw(titleTexture,
titlePos, null,
Color.White * Math.Min((state - 3.0f) / 5.0f, 1.0f), 0.0f, new Vector2(titleTexture.Width / 2.0f, titleTexture.Height / 2.0f), scale, SpriteEffects.None, 0.0f);
TitlePosition, null,
Color.White * Math.Min((state - 3.0f) / 5.0f, 1.0f), 0.0f, new Vector2(titleTexture.Width / 2.0f, titleTexture.Height / 2.0f), Scale, SpriteEffects.None, 0.0f);
string loadText = "";
if (loadState == 100.0f)

View File

@@ -53,7 +53,7 @@ namespace Subsurface
public static ParticleManager ParticleManager;
public static TextureLoader TextureLoader;
//public static TextureLoader TextureLoader;
public static World World;
@@ -153,7 +153,7 @@ namespace Subsurface
ConvertUnits.SetDisplayUnitToSimUnitRatio(Physics.DisplayToSimRation);
spriteBatch = new SpriteBatch(GraphicsDevice);
TextureLoader = new TextureLoader(GraphicsDevice);
TextureLoader.Init(GraphicsDevice);
titleScreenOpen = true;
TitleScreen = new TitleScreen(GraphicsDevice);
@@ -164,9 +164,7 @@ namespace Subsurface
private float loadState = 0.0f;
private IEnumerable<object> Load()
{
GUI.Font = ToolBox.TryLoadFont("SpriteFont1", Content);
GUI.SmallFont = ToolBox.TryLoadFont("SmallFont", Content);
GUI.LargeFont = ToolBox.TryLoadFont("LargeFont", Content);
GUI.Init(Content);
sw = new Stopwatch();

View File

@@ -53,8 +53,8 @@ namespace Subsurface
characterInfos.Add(new CharacterInfo(subElement));
}
}
public bool SelectCharacter(object selection)
public bool SelectCharacter(GUIComponent component, object selection)
{
//listBox.Select(selection);
Character character = selection as Character;
@@ -137,7 +137,7 @@ namespace Subsurface
AddCharacter(character);
}
if (characters.Count > 0) SelectCharacter(characters[0]);
if (characters.Count > 0) SelectCharacter(null, characters[0]);
}
public void EndShift()

View File

@@ -47,7 +47,7 @@ namespace Subsurface
CargoManager = new CargoManager();
endShiftButton = new GUIButton(new Rectangle(Game1.GraphicsWidth - 220, 20, 200, 25), "End shift", Alignment.TopLeft, GUI.style);
endShiftButton = new GUIButton(new Rectangle(Game1.GraphicsWidth - 220, 20, 200, 25), "End shift", Alignment.TopLeft, GUI.Style);
endShiftButton.OnClicked = EndShift;
for (int i = 0; i < 3; i++)

View File

@@ -543,7 +543,7 @@ namespace Subsurface
messageBox.Buttons[0].OnClicked += Restart;
messageBox.Buttons[0].OnClicked += messageBox.Close;
messageBox.Buttons[1].UserData = MainMenuScreen.Tabs.Main;
//messageBox.Buttons[1].UserData = MainMenuScreen.Tabs.Main;
messageBox.Buttons[1].OnClicked = Game1.MainMenuScreen.SelectTab;
messageBox.Buttons[1].OnClicked += messageBox.Close;
@@ -605,12 +605,12 @@ namespace Subsurface
height += wrappedText.Split('\n').Length*25;
var infoBlock = new GUIFrame(new Rectangle(-20, 20, width, height), null, Alignment.TopRight, GUI.style);
var infoBlock = new GUIFrame(new Rectangle(-20, 20, width, height), null, Alignment.TopRight, GUI.Style);
//infoBlock.Color = infoBlock.Color * 0.8f;
infoBlock.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
infoBlock.Flash(Color.Green);
new GUITextBlock(new Rectangle(10, 10, width - 40, height), text, GUI.style, infoBlock, true);
new GUITextBlock(new Rectangle(10, 10, width - 40, height), text, GUI.Style, infoBlock, true);
GUI.PlayMessageSound();

View File

@@ -37,6 +37,12 @@ namespace Subsurface
private set;
}
public bool AutoCheckUpdates
{
get;
set;
}
public GameSettings(string filePath)
{
Load(filePath);
@@ -68,6 +74,8 @@ namespace Subsurface
MasterServerUrl = ToolBox.GetAttributeString(doc.Root, "masterserverurl", "");
AutoCheckUpdates = ToolBox.GetAttributeBool(doc.Root, "autocheckupdates", true);
foreach (XElement subElement in doc.Root.Elements())
{
switch (subElement.Name.ToString().ToLower())
@@ -91,7 +99,10 @@ namespace Subsurface
doc.Add(new XElement("config"));
}
doc.Root.Add(new XAttribute("masterserverurl", MasterServerUrl));
doc.Root.Add(
new XAttribute("masterserverurl", MasterServerUrl),
new XAttribute("autocheckupdates", AutoCheckUpdates));
XElement gMode = doc.Root.Element("graphicsmode");
if (gMode == null)

View File

@@ -29,7 +29,7 @@ namespace Subsurface
{
this.character = character;
if (icons == null) icons = Game1.TextureLoader.FromFile("Content/UI/inventoryIcons.png");
if (icons == null) icons = TextureLoader.FromFile("Content/UI/inventoryIcons.png");
slotPositions = new Vector2[limbSlots.Length];

View File

@@ -216,7 +216,7 @@ namespace Subsurface.Items.Components
guiFrame = new GUIFrame(
new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Z, (int)rect.W),
new Color(color.X, color.Y, color.Z, color.W), alignment, GUI.style);
new Color(color.X, color.Y, color.Z, color.W), alignment, GUI.Style);
//guiFrame.Alpha = color.W;
break;

View File

@@ -34,12 +34,12 @@ namespace Subsurface.Items.Components
{
if (textBox == null)
{
textBox = new GUITextBox(Rectangle.Empty, GUI.style, GuiFrame);
textBox = new GUITextBox(Rectangle.Empty, GUI.Style, GuiFrame);
textBox.Wrap = true;
textBox.OnTextChanged = TextChanged;
textBox.LimitText = true;
GUIButton button = new GUIButton(new Rectangle(0,0,100,15), "OK", null, Alignment.BottomRight, GUI.style, GuiFrame);
GUIButton button = new GUIButton(new Rectangle(0,0,100,15), "OK", null, Alignment.BottomRight, GUI.Style, GuiFrame);
button.OnClicked = Close;
}

View File

@@ -104,7 +104,7 @@ namespace Subsurface.Items.Components
}
}
private bool SelectItem(object obj)
private bool SelectItem(GUIComponent component, object obj)
{
FabricableItem targetItem = obj as FabricableItem;
if (targetItem == null) return false;
@@ -134,7 +134,7 @@ namespace Subsurface.Items.Components
Alignment.Left, null,
selectedItemFrame);
GUIButton button = new GUIButton(new Rectangle(0,0,100,20), "Create", Color.White, Alignment.CenterX | Alignment.Bottom, GUI.style, selectedItemFrame);
GUIButton button = new GUIButton(new Rectangle(0,0,100,20), "Create", Color.White, Alignment.CenterX | Alignment.Bottom, GUI.Style, selectedItemFrame);
button.OnClicked = StartFabricating;
button.UserData = targetItem;

View File

@@ -82,11 +82,11 @@ namespace Subsurface
int width = 400, height = 500;
int x = 0, y = 0;
frame = new GUIFrame(new Rectangle(0, 0, width, height), Color.White * 0.8f, Alignment.Center, GUI.style);
frame = new GUIFrame(new Rectangle(0, 0, width, height), Color.White * 0.8f, Alignment.Center, GUI.Style);
frame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
frame.UserData = item;
new GUITextBlock(new Rectangle(0,0,200,20), "Attempting to fix " + item.Name, GUI.style, frame);
new GUITextBlock(new Rectangle(0,0,200,20), "Attempting to fix " + item.Name, GUI.Style, frame);
y = y + 40;
foreach (FixRequirement requirement in item.FixRequirements)
@@ -97,7 +97,7 @@ namespace Subsurface
reqFrame.UserData = requirement;
var fixButton = new GUIButton(new Rectangle(0, 0, 50, 20), "Fix", GUI.style, reqFrame);
var fixButton = new GUIButton(new Rectangle(0, 0, 50, 20), "Fix", GUI.Style, reqFrame);
fixButton.OnClicked = FixButtonPressed;
fixButton.UserData = requirement;
@@ -107,7 +107,7 @@ namespace Subsurface
int y2 = 20;
foreach (string itemName in requirement.requiredItems)
{
var itemBlock = new GUITextBlock(new Rectangle(30, y2, 200, 15), itemName, GUI.style, reqFrame);
var itemBlock = new GUITextBlock(new Rectangle(30, y2, 200, 15), itemName, GUI.Style, reqFrame);
itemBlock.Font = GUI.SmallFont;
itemBlock.UserData = itemName;
@@ -117,7 +117,7 @@ namespace Subsurface
y2 = 20;
foreach (Skill skill in requirement.requiredSkills)
{
var skillBlock = new GUITextBlock(new Rectangle(150, y2, 200, 15), skill.Name + " - " + skill.Level, GUI.style, Alignment.Right, Alignment.TopLeft, reqFrame);
var skillBlock = new GUITextBlock(new Rectangle(150, y2, 200, 15), skill.Name + " - " + skill.Level, GUI.Style, Alignment.Right, Alignment.TopLeft, reqFrame);
skillBlock.Font = GUI.SmallFont;
skillBlock.UserData = skill;

View File

@@ -635,11 +635,11 @@ namespace Subsurface
}
}
editingHUD = new GUIFrame(new Rectangle(x, y, width, 60 + (editableProperties.Count() + requiredItemCount) * 30), GUI.style);
editingHUD = new GUIFrame(new Rectangle(x, y, width, 60 + (editableProperties.Count() + requiredItemCount) * 30), GUI.Style);
editingHUD.Padding = new Vector4(10, 10, 0, 0);
editingHUD.UserData = this;
new GUITextBlock(new Rectangle(0, 0, 100, 20), prefab.Name, GUI.style,
new GUITextBlock(new Rectangle(0, 0, 100, 20), prefab.Name, GUI.Style,
Alignment.TopLeft, Alignment.TopLeft, editingHUD, false, GUI.LargeFont);
y += 20;
@@ -649,15 +649,15 @@ namespace Subsurface
if (prefab.IsLinkable)
{
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Hold space to link to another item",
GUI.style, Alignment.TopLeft, Alignment.TopRight, editingHUD);
GUI.Style, Alignment.TopLeft, Alignment.TopRight, editingHUD);
y += 25;
}
foreach (ItemComponent ic in components)
{
foreach (RelatedItem relatedItem in ic.requiredItems)
{
new GUITextBlock(new Rectangle(0, y, 100, 20), ic.Name + ": " + relatedItem.Type.ToString() + " required", GUI.style, editingHUD);
GUITextBox namesBox = new GUITextBox(new Rectangle(0, y, 200, 20), Alignment.Right, GUI.style, editingHUD);
new GUITextBlock(new Rectangle(0, y, 100, 20), ic.Name + ": " + relatedItem.Type.ToString() + " required", GUI.Style, editingHUD);
GUITextBox namesBox = new GUITextBox(new Rectangle(0, y, 200, 20), Alignment.Right, GUI.Style, editingHUD);
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (relatedItem);
PropertyDescriptor property = properties.Find("JoinedNames", false);
@@ -681,7 +681,7 @@ namespace Subsurface
var editable = objectProperty.Attributes.OfType<Editable>().FirstOrDefault<Editable>();
if (editable != null) height = (int)(Math.Ceiling(editable.MaxLength / 20.0f) * 20.0f);
GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, height), GUI.style, editingHUD);
GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, height), GUI.Style, editingHUD);
if (height>20) propertyBox.Wrap = true;
object value = objectProperty.GetValue();

View File

@@ -97,7 +97,7 @@ namespace Subsurface
public Level(string seed, float difficulty, int width, int height, int siteInterval)
{
if (shaftTexture == null) shaftTexture = Game1.TextureLoader.FromFile("Content/Map/shaft.png");
if (shaftTexture == null) shaftTexture = TextureLoader.FromFile("Content/Map/shaft.png");
if (basicEffect==null)
{
@@ -106,7 +106,7 @@ namespace Subsurface
basicEffect.VertexColorEnabled = false;
basicEffect.TextureEnabled = true;
basicEffect.Texture = Game1.TextureLoader.FromFile("Content/Map/iceSurface.png");
basicEffect.Texture = TextureLoader.FromFile("Content/Map/iceSurface.png");
}
this.seed = seed;

View File

@@ -46,7 +46,7 @@ namespace Subsurface.Lights
penumbraEffect.TextureEnabled = true;
//shadowEffect.VertexColorEnabled = true;
penumbraEffect.LightingEnabled = false;
penumbraEffect.Texture = Game1.TextureLoader.FromFile("Content/Lights/penumbra.png");
penumbraEffect.Texture = TextureLoader.FromFile("Content/Lights/penumbra.png");
}
if (penumbraVertices==null)

View File

@@ -43,7 +43,7 @@ namespace Subsurface.Lights
if (lightTexture == null)
{
lightTexture = Game1.TextureLoader.FromFile("Content/Lights/light.png");
lightTexture = TextureLoader.FromFile("Content/Lights/light.png");
}
texture = lightTexture;

View File

@@ -41,7 +41,7 @@ namespace Subsurface.Lights
if (alphaClearTexture==null)
{
alphaClearTexture = Game1.TextureLoader.FromFile("Content/Lights/alphaOne.png");
alphaClearTexture = TextureLoader.FromFile("Content/Lights/alphaOne.png");
}
}

View File

@@ -69,8 +69,8 @@ namespace Subsurface
connections = new List<LocationConnection>();
if (iceTexture==null) iceTexture = new Sprite("Content/Map/iceSurface.png", Vector2.Zero);
if (iceCraters == null) iceCraters = Game1.TextureLoader.FromFile("Content/Map/iceCraters.png");
if (iceCrack == null) iceCrack = Game1.TextureLoader.FromFile("Content/Map/iceCrack.png");
if (iceCraters == null) iceCraters = TextureLoader.FromFile("Content/Map/iceCraters.png");
if (iceCrack == null) iceCrack = TextureLoader.FromFile("Content/Map/iceCrack.png");
Rand.SetSyncedSeed(ToolBox.StringToInt(this.seed));

View File

@@ -31,10 +31,10 @@ namespace Subsurface
waterEffect = new Effect(graphicsDevice, bytecode);
waterTexture = Game1.TextureLoader.FromFile("Content/waterbump.jpg");
waterEffect.Parameters["xWaveWidth"].SetValue(0.1f);
waterEffect.Parameters["xWaveHeight"].SetValue(0.1f);
waterEffect.Parameters["xBlurDistance"].SetValue(0.0007f);
waterTexture = TextureLoader.FromFile("Content/waterbump.png");
waterEffect.Parameters["xWaveWidth"].SetValue(0.05f);
waterEffect.Parameters["xWaveHeight"].SetValue(0.05f);
if (basicEffect==null)
{
@@ -45,13 +45,14 @@ namespace Subsurface
}
}
public void RenderBack (SpriteBatch spriteBatch, RenderTarget2D texture, Matrix transform)
public void RenderBack (SpriteBatch spriteBatch, RenderTarget2D texture, float blurAmount = 0.0007f)
{
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearWrap);
waterEffect.CurrentTechnique = waterEffect.Techniques["WaterShader"];
waterEffect.Parameters["xTexture"].SetValue(texture);
waterEffect.Parameters["xWavePos"].SetValue(wavePos);
waterEffect.Parameters["xWavePos"].SetValue(wavePos);
waterEffect.Parameters["xBlurDistance"].SetValue(blurAmount);
waterEffect.CurrentTechnique.Passes[0].Apply();
wavePos.X += 0.0001f;

View File

@@ -150,17 +150,17 @@ namespace Subsurface
editingHUD.Padding = new Vector4(10, 10, 0, 0);
editingHUD.UserData = this;
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing waypoint", GUI.style, editingHUD);
new GUITextBlock(new Rectangle(0, 20, 100, 20), "Hold space to link to another entity", GUI.style, editingHUD);
new GUITextBlock(new Rectangle(0, 40, 100, 20), "Spawnpoint: ", GUI.style, editingHUD);
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing waypoint", GUI.Style, editingHUD);
new GUITextBlock(new Rectangle(0, 20, 100, 20), "Hold space to link to another entity", GUI.Style, editingHUD);
new GUITextBlock(new Rectangle(0, 40, 100, 20), "Spawnpoint: ", GUI.Style, editingHUD);
var spawnTypeText = new GUITextBlock(new Rectangle(0, 40, 200, 20), spawnType.ToString(), GUI.style, Alignment.Right, Alignment.TopLeft, editingHUD);
var spawnTypeText = new GUITextBlock(new Rectangle(0, 40, 200, 20), spawnType.ToString(), GUI.Style, Alignment.Right, Alignment.TopLeft, editingHUD);
var button = new GUIButton(new Rectangle(-30,0,20,20), "-", Alignment.Right, GUI.style, spawnTypeText);
var button = new GUIButton(new Rectangle(-30,0,20,20), "-", Alignment.Right, GUI.Style, spawnTypeText);
button.UserData = -1;
button.OnClicked = ChangeSpawnType;
button = new GUIButton(new Rectangle(0, 0, 20, 20), "+", Alignment.Right, GUI.style, spawnTypeText);
button = new GUIButton(new Rectangle(0, 0, 20, 20), "+", Alignment.Right, GUI.Style, spawnTypeText);
button.UserData = 1;
button.OnClicked = ChangeSpawnType;
@@ -169,14 +169,14 @@ namespace Subsurface
y = 40+20;
new GUITextBlock(new Rectangle(0, y, 100, 20), "ID Card tags:", Color.Transparent, Color.Black, Alignment.TopLeft, null, editingHUD);
GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), GUI.style, editingHUD);
GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), GUI.Style, editingHUD);
propertyBox.Text = string.Join(", ", idCardTags);
propertyBox.OnEnter = EnterIDCardTags;
propertyBox.OnTextChanged = TextBoxChanged;
y = y + 30;
new GUITextBlock(new Rectangle(0, y, 100, 20), "Assigned job:", Color.Transparent, Color.Black, Alignment.TopLeft, null, editingHUD);
propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), GUI.style, editingHUD);
propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), GUI.Style, editingHUD);
propertyBox.Text = (assignedJob == null) ? "None" : assignedJob.Name;
propertyBox.OnEnter = EnterAssignedJob;

View File

@@ -36,7 +36,7 @@ namespace Subsurface.Networking
public GameServer(string name, int port, bool isPublic = false, string password = "", bool attemptUPnP = false, int maxPlayers = 10)
{
var endRoundButton = new GUIButton(new Rectangle(Game1.GraphicsWidth - 290, 20, 150, 25), "End round", Alignment.TopLeft, GUI.style, inGameHUD);
var endRoundButton = new GUIButton(new Rectangle(Game1.GraphicsWidth - 290, 20, 150, 25), "End round", Alignment.TopLeft, GUI.Style, inGameHUD);
endRoundButton.OnClicked = EndButtonHit;
this.name = name;
@@ -419,7 +419,7 @@ namespace Subsurface.Networking
AddChatMessage(sender.name + " has joined the server", ChatMessageType.Server);
UpdateNetLobby(null);
UpdateNetLobby(null, null);
}
}
else if (inc.SenderConnection.Status == NetConnectionStatus.Disconnected)
@@ -798,10 +798,14 @@ namespace Subsurface.Networking
y += 50;
}
}
public bool UpdateNetLobby(object obj)
{
return UpdateNetLobby(null, obj);
}
public bool UpdateNetLobby(GUIComponent component, object obj)
{
NetOutgoingMessage msg = server.CreateMessage();
msg.Write((byte)PacketTypes.UpdateNetLobby);

View File

@@ -96,15 +96,15 @@ namespace Subsurface.Networking
Game1.GraphicsWidth - 20 - width,
Game1.GraphicsHeight - 40 - 25 - height,
width, height),
Color.White * 0.5f, GUI.style, inGameHUD);
Color.White * 0.5f, GUI.Style, inGameHUD);
chatMsgBox = new GUITextBox(
new Rectangle(chatBox.Rect.X, chatBox.Rect.Y + chatBox.Rect.Height + 20, chatBox.Rect.Width, 25),
Color.White * 0.5f, Color.Black, Alignment.TopLeft, Alignment.Left, GUI.style, inGameHUD);
Color.White * 0.5f, Color.Black, Alignment.TopLeft, Alignment.Left, GUI.Style, inGameHUD);
chatMsgBox.Font = GUI.SmallFont;
chatMsgBox.OnEnter = EnterChatMessage;
crewButton = new GUIButton(new Rectangle(chatBox.Rect.Right-80, chatBox.Rect.Y-30, 80, 20), "Crew", GUI.style, inGameHUD);
crewButton = new GUIButton(new Rectangle(chatBox.Rect.Right-80, chatBox.Rect.Y-30, 80, 20), "Crew", GUI.Style, inGameHUD);
crewButton.OnClicked = ToggleCrewFrame;
}
@@ -112,10 +112,10 @@ namespace Subsurface.Networking
{
int width = 500, height = 400;
crewFrame = new GUIFrame(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, Game1.GraphicsHeight / 2 - height / 2, width, height), GUI.style);
crewFrame = new GUIFrame(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, Game1.GraphicsHeight / 2 - height / 2, width, height), GUI.Style);
crewFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
GUIListBox crewList = new GUIListBox(new Rectangle(0, 0, 200, 300), Color.White * 0.7f, GUI.style, crewFrame);
GUIListBox crewList = new GUIListBox(new Rectangle(0, 0, 200, 300), Color.White * 0.7f, GUI.Style, crewFrame);
crewList.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
crewList.OnSelected = SelectCharacter;
@@ -138,11 +138,11 @@ namespace Subsurface.Networking
new GUIImage(new Rectangle(-10, -10, 0, 0), character.AnimController.limbs[0].sprite, Alignment.Left, frame);
}
var closeButton = new GUIButton(new Rectangle(0,0, 80, 20), "Close", Alignment.BottomCenter, GUI.style, crewFrame);
var closeButton = new GUIButton(new Rectangle(0,0, 80, 20), "Close", Alignment.BottomCenter, GUI.Style, crewFrame);
closeButton.OnClicked = ToggleCrewFrame;
}
private bool SelectCharacter(object obj)
private bool SelectCharacter(GUIComponent component, object obj)
{
Character character = obj as Character;
if (obj == null) return false;
@@ -152,7 +152,7 @@ namespace Subsurface.Networking
var previewPlayer = new GUIFrame(
new Rectangle(0,0, 230, 300),
new Color(0.0f, 0.0f, 0.0f, 0.8f), Alignment.TopRight, GUI.style, crewFrame);
new Color(0.0f, 0.0f, 0.0f, 0.8f), Alignment.TopRight, GUI.Style, crewFrame);
previewPlayer.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
previewPlayer.UserData = "selectedcharacter";

View File

@@ -65,7 +65,7 @@ namespace Subsurface
}
}
static class PlayerInput
public static class PlayerInput
{
static MouseState mouseState, oldMouseState;
static KeyboardState keyboardState, oldKeyboardState;

View File

@@ -43,18 +43,18 @@ namespace Subsurface
cam = new Camera();
GUIpanel = new GUIFrame(new Rectangle(0, 0, 300, Game1.GraphicsHeight), GUI.style);
GUIpanel = new GUIFrame(new Rectangle(0, 0, 300, Game1.GraphicsHeight), GUI.Style);
GUIpanel.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
physicsButton = new GUIButton(new Rectangle(0, 50, 200, 25), "Physics", Alignment.Left, GUI.style, GUIpanel);
physicsButton = new GUIButton(new Rectangle(0, 50, 200, 25), "Physics", Alignment.Left, GUI.Style, GUIpanel);
physicsButton.OnClicked += TogglePhysics;
new GUITextBlock(new Rectangle(0, 80, 0, 25), "Limbs:", GUI.style, GUIpanel);
limbList = new GUIListBox(new Rectangle(0, 110, 0, 250), Color.White * 0.7f, GUI.style, GUIpanel);
new GUITextBlock(new Rectangle(0, 80, 0, 25), "Limbs:", GUI.Style, GUIpanel);
limbList = new GUIListBox(new Rectangle(0, 110, 0, 250), Color.White * 0.7f, GUI.Style, GUIpanel);
limbList.OnSelected = SelectLimb;
new GUITextBlock(new Rectangle(0, 360, 0, 25), "Joints:", GUI.style, GUIpanel);
jointList = new GUIListBox(new Rectangle(0, 390, 0, 250), Color.White * 0.7f, GUI.style, GUIpanel);
new GUITextBlock(new Rectangle(0, 360, 0, 25), "Joints:", GUI.Style, GUIpanel);
jointList = new GUIListBox(new Rectangle(0, 390, 0, 250), Color.White * 0.7f, GUI.Style, GUIpanel);
while (Character.CharacterList.Count > 1)
{
@@ -304,7 +304,7 @@ namespace Subsurface
}
}
private bool SelectLimb(object selection)
private bool SelectLimb(GUIComponent component, object selection)
{
try
{

View File

@@ -31,34 +31,34 @@ namespace Subsurface
selectedTab = -1;
GUIpanel = new GUIFrame(new Rectangle(0, 0, 150, Game1.GraphicsHeight), GUI.style);
GUIpanel = new GUIFrame(new Rectangle(0, 0, 150, Game1.GraphicsHeight), GUI.Style);
GUIpanel.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
//GUIListBox constructionList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, GUIpanel);
//constructionList.OnSelected = MapEntityPrefab.SelectPrefab;
//constructionList.CheckSelected = MapEntityPrefab.GetSelected;
GUIButton button = new GUIButton(new Rectangle(0, 50, 100, 20), "Items", Alignment.Left, GUI.style, GUIpanel);
GUIButton button = new GUIButton(new Rectangle(0, 50, 100, 20), "Items", Alignment.Left, GUI.Style, GUIpanel);
button.UserData = 0;
button.OnClicked = SelectTab;
button = new GUIButton(new Rectangle(0, 80, 100, 20), "Structures", Alignment.Left, GUI.style, GUIpanel);
button = new GUIButton(new Rectangle(0, 80, 100, 20), "Structures", Alignment.Left, GUI.Style, GUIpanel);
button.UserData = 1;
button.OnClicked = SelectTab;
button = new GUIButton(new Rectangle(0, 140, 100, 20), "Character mode", Alignment.Left, GUI.style, GUIpanel);
button = new GUIButton(new Rectangle(0, 140, 100, 20), "Character mode", Alignment.Left, GUI.Style, GUIpanel);
button.OnClicked = ToggleCharacterMode;
GUItabs = new GUIComponent[2];
int width = 400, height = 400;
GUItabs[0] = new GUIFrame(new Rectangle(Game1.GraphicsWidth/2-width/2, Game1.GraphicsHeight/2-height/2, width, height), GUI.style);
GUItabs[0] = new GUIFrame(new Rectangle(Game1.GraphicsWidth/2-width/2, Game1.GraphicsHeight/2-height/2, width, height), GUI.Style);
GUItabs[0].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
GUIListBox itemList = new GUIListBox(new Rectangle(0, 0, 0, 0), Color.White * 0.7f, GUI.style, GUItabs[0]);
GUIListBox itemList = new GUIListBox(new Rectangle(0, 0, 0, 0), Color.White * 0.7f, GUI.Style, GUItabs[0]);
itemList.OnSelected = SelectPrefab;
itemList.CheckSelected = MapEntityPrefab.GetSelected;
GUItabs[1] = new GUIFrame(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, Game1.GraphicsHeight / 2 - height / 2, width, height), GUI.style);
GUItabs[1] = new GUIFrame(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, Game1.GraphicsHeight / 2 - height / 2, width, height), GUI.Style);
GUItabs[1].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
GUIListBox structureList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, GUI.style, GUItabs[1]);
GUIListBox structureList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, GUI.Style, GUItabs[1]);
structureList.OnSelected = SelectPrefab;
structureList.CheckSelected = MapEntityPrefab.GetSelected;
@@ -154,7 +154,7 @@ namespace Subsurface
return true;
}
private bool SelectPrefab(object obj)
private bool SelectPrefab(GUIComponent component, object obj)
{
MapEntityPrefab.SelectPrefab(obj);
selectedTab = -1;

View File

@@ -246,7 +246,7 @@ namespace Subsurface
//2. pass the renderTarget to the water shader to do the water effect
//----------------------------------------------------------------------------------------
Hull.renderer.RenderBack(spriteBatch, renderTargetWater, Cam.ShaderTransform);
Hull.renderer.RenderBack(spriteBatch, renderTargetWater);
Array.Clear(Hull.renderer.vertices, 0, Hull.renderer.vertices.Length);
Hull.renderer.PositionInBuffer = 0;

View File

@@ -60,29 +60,29 @@ namespace Subsurface
180,
Game1.GraphicsHeight - 80);
leftPanel = new GUIFrame(panelRect, GUI.style);
leftPanel = new GUIFrame(panelRect, GUI.Style);
//leftPanel.Padding = GUI.style.smallPadding;
new GUITextBlock(new Rectangle(0, 0, 200, 25),
"asdfdasfasdf", Color.Transparent, Color.White, Alignment.Left, GUI.style, leftPanel);
"asdfdasfasdf", Color.Transparent, Color.White, Alignment.Left, GUI.Style, leftPanel);
GUITextBlock moneyText = new GUITextBlock(new Rectangle(0, 30, 200, 25),
"", Color.Transparent, Color.White, Alignment.Left, GUI.style, leftPanel);
"", Color.Transparent, Color.White, Alignment.Left, GUI.Style, leftPanel);
moneyText.TextGetter = GetMoney;
GUIButton button = new GUIButton(new Rectangle(0, 70, 100, 30), "Map", null, Alignment.Left, GUI.style, leftPanel);
GUIButton button = new GUIButton(new Rectangle(0, 70, 100, 30), "Map", null, Alignment.Left, GUI.Style, leftPanel);
button.UserData = PanelTab.Map;
button.OnClicked = SelectRightPanel;
button = new GUIButton(new Rectangle(0, 110, 100, 30), "Crew", null, Alignment.Left, GUI.style, leftPanel);
button = new GUIButton(new Rectangle(0, 110, 100, 30), "Crew", null, Alignment.Left, GUI.Style, leftPanel);
button.UserData = PanelTab.Crew;
button.OnClicked = SelectRightPanel;
button = new GUIButton(new Rectangle(0, 150, 100, 30), "Hire", null, Alignment.Left, GUI.style, leftPanel);
button = new GUIButton(new Rectangle(0, 150, 100, 30), "Hire", null, Alignment.Left, GUI.Style, leftPanel);
button.UserData = PanelTab.CurrentLocation;
button.OnClicked = SelectRightPanel;
button = new GUIButton(new Rectangle(0, 190, 100, 30), "Store", null, Alignment.Left, GUI.style, leftPanel);
button = new GUIButton(new Rectangle(0, 190, 100, 30), "Store", null, Alignment.Left, GUI.Style, leftPanel);
button.UserData = PanelTab.Store;
button.OnClicked = SelectRightPanel;
@@ -97,42 +97,42 @@ namespace Subsurface
rightPanel = new GUIFrame[4];
rightPanel[(int)PanelTab.Crew] = new GUIFrame(panelRect, GUI.style);
rightPanel[(int)PanelTab.Crew] = new GUIFrame(panelRect, GUI.Style);
//rightPanel[(int)PanelTab.Crew].Padding = GUI.style.smallPadding;
new GUITextBlock(new Rectangle(0, 0, 200, 25), "Crew:", Color.Transparent, Color.White, Alignment.Left, GUI.style, rightPanel[(int)PanelTab.Crew]);
new GUITextBlock(new Rectangle(0, 0, 200, 25), "Crew:", Color.Transparent, Color.White, Alignment.Left, GUI.Style, rightPanel[(int)PanelTab.Crew]);
characterList = new GUIListBox(new Rectangle(0, 30, 300, 0), GUI.style, rightPanel[(int)PanelTab.Crew]);
characterList = new GUIListBox(new Rectangle(0, 30, 300, 0), GUI.Style, rightPanel[(int)PanelTab.Crew]);
characterList.OnSelected = SelectCharacter;
//---------------------------------------
rightPanel[(int)PanelTab.Map] = new GUIFrame(panelRect, GUI.style);
rightPanel[(int)PanelTab.Map] = new GUIFrame(panelRect, GUI.Style);
//rightPanel[(int)PanelTab.Map].Padding = GUI.style.smallPadding;
startButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start",
Alignment.BottomRight, GUI.style, rightPanel[(int)PanelTab.Map]);
Alignment.BottomRight, GUI.Style, rightPanel[(int)PanelTab.Map]);
startButton.OnClicked = StartShift;
startButton.Enabled = false;
//---------------------------------------
rightPanel[(int)PanelTab.CurrentLocation] = new GUIFrame(panelRect, GUI.style);
rightPanel[(int)PanelTab.CurrentLocation] = new GUIFrame(panelRect, GUI.Style);
//---------------------------------------
rightPanel[(int)PanelTab.Store] = new GUIFrame(panelRect, GUI.style);
rightPanel[(int)PanelTab.Store] = new GUIFrame(panelRect, GUI.Style);
selectedItemList = new GUIListBox(new Rectangle(0, 0, 300, 400), Color.White * 0.7f, GUI.style, rightPanel[(int)PanelTab.Store]);
selectedItemList = new GUIListBox(new Rectangle(0, 0, 300, 400), Color.White * 0.7f, GUI.Style, rightPanel[(int)PanelTab.Store]);
selectedItemList.OnSelected = DeselectItem;
var costText = new GUITextBlock(new Rectangle(0, 0, 200, 25), "Cost: ", GUI.style, Alignment.BottomLeft, Alignment.TopLeft, rightPanel[(int)PanelTab.Store]);
var costText = new GUITextBlock(new Rectangle(0, 0, 200, 25), "Cost: ", GUI.Style, Alignment.BottomLeft, Alignment.TopLeft, rightPanel[(int)PanelTab.Store]);
costText.TextGetter = CostTextGetter;
buyButton = new GUIButton(new Rectangle(150, 0, 100, 25), "Buy", Alignment.Bottom, GUI.style, rightPanel[(int)PanelTab.Store]);
buyButton = new GUIButton(new Rectangle(150, 0, 100, 25), "Buy", Alignment.Bottom, GUI.Style, rightPanel[(int)PanelTab.Store]);
buyButton.OnClicked = BuyItems;
itemList = new GUIListBox(new Rectangle(0, 0, 300, 400), Color.White * 0.7f, Alignment.TopRight, GUI.style, rightPanel[(int)PanelTab.Store]);
itemList = new GUIListBox(new Rectangle(0, 0, 300, 400), Color.White * 0.7f, Alignment.TopRight, GUI.Style, rightPanel[(int)PanelTab.Store]);
itemList.OnSelected = SelectItem;
foreach (MapEntityPrefab ep in MapEntityPrefab.list)
@@ -158,18 +158,18 @@ namespace Subsurface
private void UpdateLocationTab(Location location)
{
rightPanel[(int)PanelTab.CurrentLocation] = new GUIFrame(rightPanel[(int)PanelTab.CurrentLocation].Rect, GUI.style);
rightPanel[(int)PanelTab.CurrentLocation] = new GUIFrame(rightPanel[(int)PanelTab.CurrentLocation].Rect, GUI.Style);
rightPanel[(int)PanelTab.CurrentLocation].UserData = location;
//rightPanel[(int)PanelTab.Hire].Padding = GUI.style.smallPadding;
new GUITextBlock(new Rectangle(0, 0, 200, 25),
"Location: "+location.Name, GUI.style, rightPanel[(int)PanelTab.CurrentLocation]);
"Location: "+location.Name, GUI.Style, rightPanel[(int)PanelTab.CurrentLocation]);
new GUITextBlock(new Rectangle(0, 20, 200, 25),
"("+location.Type.Name+")", GUI.style, rightPanel[(int)PanelTab.CurrentLocation]);
"("+location.Type.Name+")", GUI.Style, rightPanel[(int)PanelTab.CurrentLocation]);
if (location.HireManager != null)
{
hireList = new GUIListBox(new Rectangle(0, 60, 300, 0), GUI.style, Alignment.Left, rightPanel[(int)PanelTab.CurrentLocation]);
hireList = new GUIListBox(new Rectangle(0, 60, 300, 0), GUI.Style, Alignment.Left, rightPanel[(int)PanelTab.CurrentLocation]);
hireList.OnSelected = SelectCharacter;
hireList.ClearChildren();
@@ -177,14 +177,14 @@ namespace Subsurface
{
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
c.Name + " (" + c.Job.Name + ")", GUI.style, hireList);
c.Name + " (" + c.Job.Name + ")", GUI.Style, hireList);
textBlock.UserData = c;
textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
c.Salary.ToString(),
null, null,
Alignment.TopRight, GUI.style, textBlock);
Alignment.TopRight, GUI.Style, textBlock);
}
}
}
@@ -234,7 +234,7 @@ namespace Subsurface
{
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
c.Name + " (" + c.Job.Name + ")", GUI.style,
c.Name + " (" + c.Job.Name + ")", GUI.Style,
Alignment.Left,
Alignment.Left,
characterList);
@@ -266,7 +266,7 @@ namespace Subsurface
new Rectangle(0, 0, 0, 25),
ep.Price.ToString(),
null, null,
Alignment.TopRight, GUI.style, textBlock);
Alignment.TopRight, GUI.Style, textBlock);
if (ep.sprite != null)
{
@@ -275,7 +275,7 @@ namespace Subsurface
}
}
private bool SelectItem(object obj)
private bool SelectItem(GUIComponent component, object obj)
{
MapEntityPrefab prefab = obj as MapEntityPrefab;
if (prefab == null) return false;
@@ -287,7 +287,7 @@ namespace Subsurface
return false;
}
private bool DeselectItem(object obj)
private bool DeselectItem(GUIComponent component, object obj)
{
MapEntityPrefab prefab = obj as MapEntityPrefab;
if (prefab == null) return false;
@@ -383,7 +383,7 @@ namespace Subsurface
return "Money: " + ((Game1.GameSession == null) ? "" : gameMode.CrewManager.Money.ToString());
}
private bool SelectCharacter(object selection)
private bool SelectCharacter(GUIComponent component, object selection)
{
CharacterInfo characterInfo = selection as CharacterInfo;
if (characterInfo == null) return false;
@@ -394,7 +394,7 @@ namespace Subsurface
{
previewFrame = new GUIFrame(new Rectangle(350, 60, 300, 300),
new Color(0.0f, 0.0f, 0.0f, 0.8f),
Alignment.Top, GUI.style, rightPanel[selectedRightPanel]);
Alignment.Top, GUI.Style, rightPanel[selectedRightPanel]);
previewFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
previewFrame.UserData = characterInfo;
@@ -403,7 +403,7 @@ namespace Subsurface
if (selectedRightPanel == (int)PanelTab.CurrentLocation)
{
GUIButton hireButton = new GUIButton(new Rectangle(0,0, 100, 20), "Hire", Alignment.BottomCenter, GUI.style, previewFrame);
GUIButton hireButton = new GUIButton(new Rectangle(0,0, 100, 20), "Hire", Alignment.BottomCenter, GUI.Style, previewFrame);
hireButton.UserData = characterInfo;
hireButton.OnClicked = HireCharacter;
}

View File

@@ -9,7 +9,9 @@ namespace Subsurface
{
class MainMenuScreen : Screen
{
public enum Tabs { Main = 0, NewGame = 1, LoadGame = 2, HostServer = 3 }
public enum Tabs { NewGame = 1, LoadGame = 2, HostServer = 3 }
GUIFrame buttonsTab;
private GUIFrame[] menuTabs;
private GUIListBox mapList;
@@ -27,145 +29,154 @@ namespace Subsurface
public MainMenuScreen(Game1 game)
{
menuTabs = new GUIFrame[Enum.GetValues(typeof(Tabs)).Length];
menuTabs = new GUIFrame[Enum.GetValues(typeof(Tabs)).Length+1];
Rectangle panelRect = new Rectangle(
Game1.GraphicsWidth / 2 - 250,
Game1.GraphicsHeight/ 2 - 250,
500, 500);
menuTabs[(int)Tabs.Main] = new GUIFrame(panelRect, GUI.style);
buttonsTab = new GUIFrame(new Rectangle(50, 200, 200, 500), Color.Transparent, Alignment.Left);
//menuTabs[(int)Tabs.Main].Padding = GUI.style.smallPadding;
GUIButton button = new GUIButton(new Rectangle(0, 0, 0, 30), "Tutorial", Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.Main]);
Rectangle panelRect = new Rectangle(
Game1.GraphicsWidth / 2 - 250,
buttonsTab.Rect.Y,
500, 360);
GUIButton button = new GUIButton(new Rectangle(0, 0, 0, 30), "Tutorial", Alignment.CenterX, GUI.Style, buttonsTab);
button.OnClicked = TutorialButtonClicked;
button = new GUIButton(new Rectangle(0, 70, 0, 30), "New Game", Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.Main]);
button = new GUIButton(new Rectangle(0, 70, 0, 30), "New Game", Alignment.CenterX, GUI.Style, buttonsTab);
button.UserData = (int)Tabs.NewGame;
button.OnClicked = SelectTab;
button = new GUIButton(new Rectangle(0, 130, 0, 30), "Load Game", Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.Main]);
button = new GUIButton(new Rectangle(0, 130, 0, 30), "Load Game", Alignment.CenterX, GUI.Style, buttonsTab);
button.UserData = (int)Tabs.LoadGame;
button.OnClicked = SelectTab;
button = new GUIButton(new Rectangle(0, 200, 0, 30), "Join Server", Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.Main]);
button = new GUIButton(new Rectangle(0, 200, 0, 30), "Join Server", Alignment.CenterX, GUI.Style, buttonsTab);
//button.UserData = (int)Tabs.JoinServer;
button.OnClicked = JoinServerClicked;
button = new GUIButton(new Rectangle(0, 260, 0, 30), "Host Server", Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.Main]);
button = new GUIButton(new Rectangle(0, 260, 0, 30), "Host Server", Alignment.CenterX, GUI.Style, buttonsTab);
button.UserData = (int)Tabs.HostServer;
button.OnClicked = SelectTab;
button = new GUIButton(new Rectangle(0, 330, 0, 30), "Quit", Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.Main]);
button = new GUIButton(new Rectangle(0, 330, 0, 30), "Quit", Alignment.CenterX, GUI.Style, buttonsTab);
button.OnClicked = QuitClicked;
//----------------------------------------------------------------------
menuTabs[(int)Tabs.NewGame] = new GUIFrame(panelRect, GUI.style);
menuTabs[(int)Tabs.NewGame] = new GUIFrame(panelRect, GUI.Style);
//menuTabs[(int)Tabs.NewGame].Padding = GUI.style.smallPadding;
new GUITextBlock(new Rectangle(0, -20, 0, 30), "New Game", null, null, Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.NewGame]);
//new GUITextBlock(new Rectangle(0, -20, 0, 30), "New Game", null, null, Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.NewGame]);
new GUITextBlock(new Rectangle(0, 30, 0, 30), "Selected submarine:", null, null, Alignment.Left, GUI.style, menuTabs[(int)Tabs.NewGame]);
mapList = new GUIListBox(new Rectangle(0, 60, 200, 360), GUI.style, menuTabs[(int)Tabs.NewGame]);
new GUITextBlock(new Rectangle(0, 0, 0, 30), "Selected submarine:", null, null, Alignment.Left, GUI.Style, menuTabs[(int)Tabs.NewGame]);
mapList = new GUIListBox(new Rectangle(0, 30, 200, panelRect.Height-100), GUI.Style, menuTabs[(int)Tabs.NewGame]);
foreach (Submarine sub in Submarine.SavedSubmarines)
{
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
sub.Name,
GUI.style,
GUI.Style,
Alignment.Left, Alignment.Left, mapList);
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
textBlock.UserData = sub;
}
if (Submarine.SavedSubmarines.Count > 0) mapList.Select(Submarine.SavedSubmarines[0]);
new GUITextBlock(new Rectangle((int)(mapList.Rect.Width + 20), 30, 100, 20),
"Save name: ", GUI.style, Alignment.Left, Alignment.Left, menuTabs[(int)Tabs.NewGame]);
new GUITextBlock(new Rectangle((int)(mapList.Rect.Width + 20), 0, 100, 20),
"Save name: ", GUI.Style, Alignment.Left, Alignment.Left, menuTabs[(int)Tabs.NewGame]);
saveNameBox = new GUITextBox(new Rectangle((int)(mapList.Rect.Width + 20), 60, 180, 20),
Alignment.TopLeft, GUI.style, menuTabs[(int)Tabs.NewGame]);
saveNameBox = new GUITextBox(new Rectangle((int)(mapList.Rect.Width + 20), 30, 180, 20),
Alignment.TopLeft, GUI.Style, menuTabs[(int)Tabs.NewGame]);
saveNameBox.Text = SaveUtil.CreateSavePath();
new GUITextBlock(new Rectangle((int)(mapList.Rect.Width + 20), 90, 100, 20),
"Map Seed: ", GUI.style, Alignment.Left, Alignment.Left, menuTabs[(int)Tabs.NewGame]);
new GUITextBlock(new Rectangle((int)(mapList.Rect.Width + 20), 60, 100, 20),
"Map Seed: ", GUI.Style, Alignment.Left, Alignment.Left, menuTabs[(int)Tabs.NewGame]);
seedBox = new GUITextBox(new Rectangle((int)(mapList.Rect.Width + 20), 120, 180, 20),
Alignment.TopLeft, GUI.style, menuTabs[(int)Tabs.NewGame]);
seedBox = new GUITextBox(new Rectangle((int)(mapList.Rect.Width + 20), 90, 180, 20),
Alignment.TopLeft, GUI.Style, menuTabs[(int)Tabs.NewGame]);
seedBox.Text = ToolBox.RandomSeed(8);
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, GUI.style, menuTabs[(int)Tabs.NewGame]);
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, GUI.Style, menuTabs[(int)Tabs.NewGame]);
button.OnClicked = StartGame;
//----------------------------------------------------------------------
menuTabs[(int)Tabs.LoadGame] = new GUIFrame(panelRect, GUI.style);
menuTabs[(int)Tabs.LoadGame] = new GUIFrame(panelRect, GUI.Style);
//menuTabs[(int)Tabs.LoadGame].Padding = GUI.style.smallPadding;
menuTabs[(int)Tabs.HostServer] = new GUIFrame(panelRect, GUI.style);
menuTabs[(int)Tabs.HostServer] = new GUIFrame(panelRect, GUI.Style);
//menuTabs[(int)Tabs.JoinServer].Padding = GUI.style.smallPadding;
new GUITextBlock(new Rectangle(0, -25, 0, 30), "Host Server", GUI.style, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.HostServer], false, GUI.LargeFont);
//new GUITextBlock(new Rectangle(0, -25, 0, 30), "Host Server", GUI.style, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.HostServer], false, GUI.LargeFont);
new GUITextBlock(new Rectangle(0, 50, 0, 30), "Server Name:", GUI.style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tabs.HostServer]);
serverNameBox = new GUITextBox(new Rectangle(160, 50, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.style, menuTabs[(int)Tabs.HostServer]);
new GUITextBlock(new Rectangle(0, 0, 0, 30), "Server Name:", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tabs.HostServer]);
serverNameBox = new GUITextBox(new Rectangle(160, 0, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tabs.HostServer]);
new GUITextBlock(new Rectangle(0, 100, 0, 30), "Server port:", GUI.style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tabs.HostServer]);
portBox = new GUITextBox(new Rectangle(160, 100, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.style, menuTabs[(int)Tabs.HostServer]);
new GUITextBlock(new Rectangle(0, 50, 0, 30), "Server port:", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tabs.HostServer]);
portBox = new GUITextBox(new Rectangle(160, 50, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tabs.HostServer]);
portBox.Text = NetConfig.DefaultPort.ToString();
portBox.ToolTip = "Server port";
new GUITextBlock(new Rectangle(0, 150, 100, 30), "Max players:", GUI.style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tabs.HostServer]);
maxPlayersBox = new GUITextBox(new Rectangle(195, 150, 30, 30), null, null, Alignment.TopLeft, Alignment.Center, GUI.style, menuTabs[(int)Tabs.HostServer]);
new GUITextBlock(new Rectangle(0, 100, 100, 30), "Max players:", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tabs.HostServer]);
maxPlayersBox = new GUITextBox(new Rectangle(195, 100, 30, 30), null, null, Alignment.TopLeft, Alignment.Center, GUI.Style, menuTabs[(int)Tabs.HostServer]);
maxPlayersBox.Text = "8";
maxPlayersBox.Enabled = false;
var plusPlayersBox = new GUIButton(new Rectangle(230, 150, 30, 30), "+", GUI.style, menuTabs[(int)Tabs.HostServer]);
var plusPlayersBox = new GUIButton(new Rectangle(230, 100, 30, 30), "+", GUI.Style, menuTabs[(int)Tabs.HostServer]);
plusPlayersBox.UserData = 1;
plusPlayersBox.OnClicked = ChangeMaxPlayers;
var minusPlayersBox = new GUIButton(new Rectangle(160, 150, 30, 30), "-", GUI.style, menuTabs[(int)Tabs.HostServer]);
var minusPlayersBox = new GUIButton(new Rectangle(160, 100, 30, 30), "-", GUI.Style, menuTabs[(int)Tabs.HostServer]);
minusPlayersBox.UserData = -1;
minusPlayersBox.OnClicked = ChangeMaxPlayers;
new GUITextBlock(new Rectangle(0, 200, 0, 30), "Password (optional):", GUI.style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tabs.HostServer]);
passwordBox = new GUITextBox(new Rectangle(160, 200, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.style, menuTabs[(int)Tabs.HostServer]);
isPublicBox = new GUITickBox(new Rectangle(10, 250, 20, 20), "Public server", Alignment.TopLeft, menuTabs[(int)Tabs.HostServer]);
useUpnpBox = new GUITickBox(new Rectangle(10, 300, 20, 20), "Attempt UPnP port forwarding", Alignment.TopLeft, menuTabs[(int)Tabs.HostServer]);
new GUITextBlock(new Rectangle(0, 330, 0, 30),
"UPnP can be used for forwarding ports on your router to allow players join the server."
+ " However, UPnP isn't supported by all routers, so you may need to setup port forwards manually"
+" if players are unable to join the server (see the readme for instructions).",
GUI.style, Alignment.TopLeft, Alignment.TopLeft, menuTabs[(int)Tabs.HostServer], true, GUI.SmallFont);
new GUITextBlock(new Rectangle(0, 150, 0, 30), "Password (optional):", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tabs.HostServer]);
passwordBox = new GUITextBox(new Rectangle(160, 170, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tabs.HostServer]);
isPublicBox = new GUITickBox(new Rectangle(10, 200, 20, 20), "Public server", Alignment.TopLeft, menuTabs[(int)Tabs.HostServer]);
isPublicBox.ToolTip = "Public servers are shown in the list of available servers in the ''Join Server'' -tab";
GUIButton hostButton = new GUIButton(new Rectangle(0, 0, 200, 30), "Start", Alignment.BottomCenter, GUI.style, menuTabs[(int)Tabs.HostServer]);
useUpnpBox = new GUITickBox(new Rectangle(10, 250, 20, 20), "Attempt UPnP port forwarding", Alignment.TopLeft, menuTabs[(int)Tabs.HostServer]);
useUpnpBox.ToolTip = "UPnP can be used for forwarding ports on your router to allow players join the server."
+ " However, UPnP isn't supported by all routers, so you may need to setup port forwards manually"
+" if players are unable to join the server (see the readme for instructions).";
GUIButton hostButton = new GUIButton(new Rectangle(0, 0, 200, 30), "Start", Alignment.BottomRight, GUI.Style, menuTabs[(int)Tabs.HostServer]);
hostButton.OnClicked = HostServerClicked;
//----------------------------------------------------------------------
for (int i = 1; i < 4; i++ )
{
button = new GUIButton(new Rectangle(-20, -20, 100, 30), "Back", Alignment.TopLeft, GUI.style, menuTabs[i]);
button.OnClicked = PreviousTab;
}
this.game = game;
}
public override void Select()
{
base.Select();
selectedTab = 0;
}
public bool SelectTab(GUIButton button, object obj)
{
selectedTab = (int)obj;
if (button != null) button.Selected = true;
foreach (GUIComponent child in buttonsTab.children)
{
GUIButton otherButton = child as GUIButton;
if (otherButton == null || otherButton == button) continue;
otherButton.Selected = false;
}
if (selectedTab == (int)Tabs.LoadGame) UpdateLoadScreen();
this.Select();
if (Selected != this) this.Select();
return true;
}
@@ -229,11 +240,9 @@ namespace Subsurface
{
menuTabs[(int)Tabs.LoadGame].ClearChildren();
new GUITextBlock(new Rectangle(0, -25, 0, 30), "Load Game", GUI.style, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.LoadGame], false, GUI.LargeFont);
string[] saveFiles = SaveUtil.GetSaveFiles();
saveList = new GUIListBox(new Rectangle(0, 60, 200, 360), Color.White, GUI.style, menuTabs[(int)Tabs.LoadGame]);
saveList = new GUIListBox(new Rectangle(0, 0, 200, menuTabs[(int)Tabs.LoadGame].Rect.Height - 80), Color.White, GUI.Style, menuTabs[(int)Tabs.LoadGame]);
saveList.OnSelected = SelectSaveFile;
foreach (string saveFile in saveFiles)
@@ -241,7 +250,7 @@ namespace Subsurface
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
saveFile,
GUI.style,
GUI.Style,
Alignment.Left,
Alignment.Left,
saveList);
@@ -249,14 +258,12 @@ namespace Subsurface
textBlock.UserData = saveFile;
}
var button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.Right | Alignment.Bottom, GUI.style, menuTabs[(int)Tabs.LoadGame]);
var button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.Right | Alignment.Bottom, GUI.Style, menuTabs[(int)Tabs.LoadGame]);
button.OnClicked = LoadGame;
button = new GUIButton(new Rectangle(-20, -20, 100, 30), "Back", Alignment.TopLeft, GUI.style, menuTabs[(int)Tabs.LoadGame]);
button.OnClicked = PreviousTab;
}
private bool SelectSaveFile(object obj)
private bool SelectSaveFile(GUIComponent component, object obj)
{
string fileName = (string)obj;
@@ -283,19 +290,19 @@ namespace Subsurface
string mapseed = ToolBox.GetAttributeString(modeElement, "mapseed", "unknown");
GUIFrame saveFileFrame = new GUIFrame(new Rectangle((int)(saveList.Rect.Width + 20), 60, 200, 200), Color.Black*0.4f, GUI.style, menuTabs[(int)Tabs.LoadGame]);
GUIFrame saveFileFrame = new GUIFrame(new Rectangle((int)(saveList.Rect.Width + 20), 0, 200, 200), Color.Black*0.4f, GUI.Style, menuTabs[(int)Tabs.LoadGame]);
saveFileFrame.UserData = "savefileframe";
saveFileFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
new GUITextBlock(new Rectangle(0,0,0,20), fileName, GUI.style, saveFileFrame);
new GUITextBlock(new Rectangle(0,0,0,20), fileName, GUI.Style, saveFileFrame);
new GUITextBlock(new Rectangle(0, 30, 0, 20), "Last saved: ", GUI.style, saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(15, 45, 0, 20), saveTime, GUI.style, saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(0, 30, 0, 20), "Last saved: ", GUI.Style, saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(15, 45, 0, 20), saveTime, GUI.Style, saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(0, 65, 0, 20), "Map seed: ", GUI.style, saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(15, 80, 0, 20), mapseed, GUI.style, saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(0, 65, 0, 20), "Map seed: ", GUI.Style, saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(15, 80, 0, 20), mapseed, GUI.Style, saveFileFrame).Font = GUI.SmallFont;
var deleteSaveButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Delete", Alignment.BottomCenter, GUI.style, saveFileFrame);
var deleteSaveButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Delete", Alignment.BottomCenter, GUI.Style, saveFileFrame);
deleteSaveButton.UserData = fileName;
deleteSaveButton.OnClicked = DeleteSave;
@@ -330,9 +337,15 @@ namespace Subsurface
public override void Update(double deltaTime)
{
menuTabs[selectedTab].Update((float)deltaTime);
buttonsTab.Update((float)deltaTime);
if (selectedTab>0) menuTabs[selectedTab].Update((float)deltaTime);
Game1.TitleScreen.Position.Y = MathHelper.Lerp(Game1.TitleScreen.Position.Y, -870.0f, 0.1f);
Game1.TitleScreen.TitlePosition =
Vector2.Lerp(Game1.TitleScreen.TitlePosition, new Vector2(
Game1.TitleScreen.TitleSize.X / 2.0f * Game1.TitleScreen.Scale + 30.0f,
Game1.TitleScreen.TitleSize.Y / 2.0f * Game1.TitleScreen.Scale + 30.0f),
0.1f);
}
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
@@ -345,7 +358,8 @@ namespace Subsurface
spriteBatch.Begin();
menuTabs[selectedTab].Draw(spriteBatch);
buttonsTab.Draw(spriteBatch);
if (selectedTab>0) menuTabs[selectedTab].Draw(spriteBatch);
GUI.Draw((float)deltaTime, spriteBatch, null);
@@ -384,7 +398,7 @@ namespace Subsurface
private bool PreviousTab(GUIButton button, object obj)
{
selectedTab = (int)Tabs.Main;
//selectedTab = (int)Tabs.Main;
return true;
}

View File

@@ -115,7 +115,7 @@ namespace Subsurface
//server info panel ------------------------------------------------------------
infoFrame = new GUIFrame(new Rectangle(0, 0, (int)(panelRect.Width * 0.7f), (int)(panelRect.Height * 0.6f)), GUI.style, menu);
infoFrame = new GUIFrame(new Rectangle(0, 0, (int)(panelRect.Width * 0.7f), (int)(panelRect.Height * 0.6f)), GUI.Style, menu);
//infoFrame.Padding = GUI.style.smallPadding;
//chatbox ----------------------------------------------------------------------
@@ -123,10 +123,10 @@ namespace Subsurface
new Rectangle(0, (int)(panelRect.Height * 0.6f + 20),
(int)(panelRect.Width * 0.7f),
(int)(panelRect.Height * 0.4f - 20)),
GUI.style, menu);
GUI.Style, menu);
chatBox = new GUIListBox(new Rectangle(0,0,0,chatFrame.Rect.Height-80), Color.White, GUI.style, chatFrame);
textBox = new GUITextBox(new Rectangle(0, 25, 0, 25), Alignment.Bottom, GUI.style, chatFrame);
chatBox = new GUIListBox(new Rectangle(0,0,0,chatFrame.Rect.Height-80), Color.White, GUI.Style, chatFrame);
textBox = new GUITextBox(new Rectangle(0, 25, 0, 25), Alignment.Bottom, GUI.Style, chatFrame);
textBox.Font = GUI.SmallFont;
textBox.OnEnter = EnterChatMessage;
@@ -135,24 +135,24 @@ namespace Subsurface
playerFrame = new GUIFrame(
new Rectangle((int)(panelRect.Width * 0.7f + 20), 0,
(int)(panelRect.Width * 0.3f - 20), (int)(panelRect.Height * 0.6f)),
GUI.style, menu);
GUI.Style, menu);
//player list ------------------------------------------------------------------
GUIFrame playerListFrame = new GUIFrame(
new Rectangle((int)(panelRect.Width * 0.7f + 20), (int)(panelRect.Height * 0.6f + 20),
(int)(panelRect.Width * 0.3f - 20), (int)(panelRect.Height * 0.4f - 20)),
GUI.style, menu);
GUI.Style, menu);
playerList = new GUIListBox(new Rectangle(0,0,0,0), null, GUI.style, playerListFrame);
playerList = new GUIListBox(new Rectangle(0,0,0,0), null, GUI.Style, playerListFrame);
//submarine list ------------------------------------------------------------------
int columnWidth = infoFrame.Rect.Width / 5 - 30;
int columnX = 0;
new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 30), "Selected submarine:", GUI.style, infoFrame);
subList = new GUIListBox(new Rectangle(columnX, 150, columnWidth, infoFrame.Rect.Height - 150 - 80), Color.White, GUI.style, infoFrame);
new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 30), "Selected submarine:", GUI.Style, infoFrame);
subList = new GUIListBox(new Rectangle(columnX, 150, columnWidth, infoFrame.Rect.Height - 150 - 80), Color.White, GUI.Style, infoFrame);
subList.OnSelected = SelectMap;
if (Submarine.SavedSubmarines.Count > 0)
@@ -161,7 +161,7 @@ namespace Subsurface
{
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
sub.Name, GUI.style,
sub.Name, GUI.Style,
Alignment.Left, Alignment.Left,
subList);
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
@@ -178,8 +178,8 @@ namespace Subsurface
//gamemode ------------------------------------------------------------------
new GUITextBlock(new Rectangle(columnX, 120, 0, 30), "Selected game mode: ", GUI.style, infoFrame);
modeList = new GUIListBox(new Rectangle(columnX, 150, columnWidth, infoFrame.Rect.Height - 150 - 80), GUI.style, infoFrame);
new GUITextBlock(new Rectangle(columnX, 120, 0, 30), "Selected game mode: ", GUI.Style, infoFrame);
modeList = new GUIListBox(new Rectangle(columnX, 150, columnWidth, infoFrame.Rect.Height - 150 - 80), GUI.Style, infoFrame);
foreach (GameModePreset mode in GameModePreset.list)
@@ -188,7 +188,7 @@ namespace Subsurface
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
mode.Name, GUI.style,
mode.Name, GUI.Style,
Alignment.Left, Alignment.Left,
modeList);
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
@@ -202,7 +202,7 @@ namespace Subsurface
var modeDescription = new GUITextBlock(
new Rectangle(columnX, 150, (int)(columnWidth * 1.5f), infoFrame.Rect.Height - 150 - 80),
"", Color.Black*0.3f, Color.White, Alignment.TopLeft, Alignment.TopLeft, GUI.style, infoFrame, true);
"", Color.Black*0.3f, Color.White, Alignment.TopLeft, Alignment.TopLeft, GUI.Style, infoFrame, true);
modeList.UserData = modeDescription;
@@ -211,31 +211,31 @@ namespace Subsurface
//duration ------------------------------------------------------------------
GUITextBlock durationText = new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 20),
"Game duration: ", GUI.style, Alignment.Left, Alignment.TopLeft, infoFrame);
"Game duration: ", GUI.Style, Alignment.Left, Alignment.TopLeft, infoFrame);
durationText.TextGetter = DurationText;
durationBar = new GUIScrollBar(new Rectangle(columnX, 150, columnWidth, 20),
GUI.style, 0.1f, infoFrame);
GUI.Style, 0.1f, infoFrame);
durationBar.BarSize = 0.1f;
//seed ------------------------------------------------------------------
new GUITextBlock(new Rectangle(columnX, 190, columnWidth, 20),
"Level Seed: ", GUI.style, Alignment.Left, Alignment.TopLeft, infoFrame);
"Level Seed: ", GUI.Style, Alignment.Left, Alignment.TopLeft, infoFrame);
seedBox = new GUITextBox(new Rectangle(columnX, 220, columnWidth, 20),
Alignment.TopLeft, GUI.style, infoFrame);
Alignment.TopLeft, GUI.Style, infoFrame);
seedBox.OnTextChanged = SelectSeed;
LevelSeed = ToolBox.RandomSeed(8);
//server info ------------------------------------------------------------------
var serverName = new GUITextBox(new Rectangle(0, 0, 200, 20), null, null, Alignment.TopLeft, Alignment.TopLeft, GUI.style, infoFrame);
var serverName = new GUITextBox(new Rectangle(0, 0, 200, 20), null, null, Alignment.TopLeft, Alignment.TopLeft, GUI.Style, infoFrame);
serverName.TextGetter = GetServerName;
serverName.Enabled = Game1.Server != null;
serverName.OnTextChanged = ChangeServerName;
serverMessage = new GUITextBox(new Rectangle(0, 30, 360, 70), null, null, Alignment.TopLeft, Alignment.TopLeft, GUI.style, infoFrame);
serverMessage = new GUITextBox(new Rectangle(0, 30, 360, 70), null, null, Alignment.TopLeft, Alignment.TopLeft, GUI.Style, infoFrame);
serverMessage.Wrap = true;
serverMessage.TextGetter = GetServerMessage;
serverMessage.OnTextChanged = UpdateServerMessage;
@@ -270,7 +270,7 @@ namespace Subsurface
if (IsServer && Game1.Server != null)
{
GUIButton startButton = new GUIButton(new Rectangle(0, 0, 200, 30), "Start", Alignment.BottomRight, GUI.style, infoFrame);
GUIButton startButton = new GUIButton(new Rectangle(0, 0, 200, 30), "Start", Alignment.BottomRight, GUI.Style, infoFrame);
startButton.OnClicked = Game1.Server.StartGame;
startButton.UserData = "startButton";
@@ -311,42 +311,42 @@ namespace Subsurface
playYourself.UserData = "playyourself";
}
new GUITextBlock(new Rectangle(60, 0, 200, 30), "Name: ", GUI.style, playerFrame);
new GUITextBlock(new Rectangle(60, 0, 200, 30), "Name: ", GUI.Style, playerFrame);
GUITextBox playerName = new GUITextBox(new Rectangle(60, 30, 0, 20),
Alignment.TopLeft, GUI.style, playerFrame);
Alignment.TopLeft, GUI.Style, playerFrame);
playerName.Text = characterInfo.Name;
playerName.OnEnter += ChangeCharacterName;
new GUITextBlock(new Rectangle(0, 70, 200, 30), "Gender: ", GUI.style, playerFrame);
new GUITextBlock(new Rectangle(0, 70, 200, 30), "Gender: ", GUI.Style, playerFrame);
GUIButton maleButton = new GUIButton(new Rectangle(0, 100, 70, 20), "Male",
Alignment.TopLeft, GUI.style, playerFrame);
Alignment.TopLeft, GUI.Style, playerFrame);
maleButton.UserData = Gender.Male;
maleButton.OnClicked += SwitchGender;
GUIButton femaleButton = new GUIButton(new Rectangle(90, 100, 70, 20), "Female",
Alignment.TopLeft, GUI.style, playerFrame);
Alignment.TopLeft, GUI.Style, playerFrame);
femaleButton.UserData = Gender.Female;
femaleButton.OnClicked += SwitchGender;
new GUITextBlock(new Rectangle(0, 150, 200, 30), "Job preferences:", GUI.style, playerFrame);
new GUITextBlock(new Rectangle(0, 150, 200, 30), "Job preferences:", GUI.Style, playerFrame);
jobList = new GUIListBox(new Rectangle(0, 180, 180, 0), GUI.style, playerFrame);
jobList = new GUIListBox(new Rectangle(0, 180, 180, 0), GUI.Style, playerFrame);
jobList.Enabled = false;
int i = 1;
foreach (JobPrefab job in JobPrefab.List)
{
GUITextBlock jobText = new GUITextBlock(new Rectangle(0, 0, 0, 20), i + ". " + job.Name, GUI.style, Alignment.Left, Alignment.Right, jobList);
GUITextBlock jobText = new GUITextBlock(new Rectangle(0, 0, 0, 20), i + ". " + job.Name, GUI.Style, Alignment.Left, Alignment.Right, jobList);
jobText.UserData = job;
GUIButton upButton = new GUIButton(new Rectangle(0, 0, 15, 15), "u", GUI.style, jobText);
GUIButton upButton = new GUIButton(new Rectangle(0, 0, 15, 15), "u", GUI.Style, jobText);
upButton.UserData = -1;
upButton.OnClicked += ChangeJobPreference;
GUIButton downButton = new GUIButton(new Rectangle(25, 0, 15, 15), "d", GUI.style, jobText);
GUIButton downButton = new GUIButton(new Rectangle(25, 0, 15, 15), "d", GUI.Style, jobText);
downButton.UserData = 1;
downButton.OnClicked += ChangeJobPreference;
}
@@ -383,7 +383,7 @@ namespace Subsurface
return false;
}
private bool SelectMap(object obj)
private bool SelectMap(GUIComponent component, object obj)
{
if (Game1.Server != null) Game1.Server.UpdateNetLobby(obj);
@@ -401,7 +401,7 @@ namespace Subsurface
{
if (Game1.Server == null) return false;
ServerName = text;
Game1.Server.UpdateNetLobby(null);
Game1.Server.UpdateNetLobby(null, null);
return true;
}
@@ -410,7 +410,7 @@ namespace Subsurface
{
if (Game1.Server == null) return false;
ServerMessage = text;
Game1.Server.UpdateNetLobby(null);
Game1.Server.UpdateNetLobby(null, null);
return true;
}
@@ -421,7 +421,7 @@ namespace Subsurface
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
client.name + ((client.assignedJob==null) ? "" : " (" + client.assignedJob.Name + ")"),
GUI.style, Alignment.Left, Alignment.Left,
GUI.Style, Alignment.Left, Alignment.Left,
playerList);
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
textBlock.UserData = client;
@@ -494,7 +494,7 @@ namespace Subsurface
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, 0, 20),
message,
((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black*0.1f, color,
Alignment.Left, GUI.style, null, true);
Alignment.Left, GUI.Style, null, true);
msg.Font = GUI.SmallFont;
msg.CanBeFocused = false;
@@ -545,7 +545,7 @@ namespace Subsurface
return true;
}
private bool SelectMode(object obj)
private bool SelectMode(GUIComponent component, object obj)
{
GameModePreset modePreset = obj as GameModePreset;
if (modePreset == null) return false;

View File

@@ -41,19 +41,19 @@ namespace Subsurface
Rectangle panelRect = new Rectangle(0, 0, width, height);
menu = new GUIFrame(panelRect, null, Alignment.Center, GUI.style);
menu = new GUIFrame(panelRect, null, Alignment.Center, GUI.Style);
new GUITextBlock(new Rectangle(0, -25, 0, 30), "Join Server", GUI.style, Alignment.CenterX, Alignment.CenterX, menu, false, GUI.LargeFont);
new GUITextBlock(new Rectangle(0, -25, 0, 30), "Join Server", GUI.Style, Alignment.CenterX, Alignment.CenterX, menu, false, GUI.LargeFont);
new GUITextBlock(new Rectangle(0, 30, 0, 30), "Your Name:", GUI.style, menu);
clientNameBox = new GUITextBox(new Rectangle(0, 60, 200, 30), GUI.style, menu);
new GUITextBlock(new Rectangle(0, 30, 0, 30), "Your Name:", GUI.Style, menu);
clientNameBox = new GUITextBox(new Rectangle(0, 60, 200, 30), GUI.Style, menu);
new GUITextBlock(new Rectangle(0, 100, 0, 30), "Server IP:", GUI.style, menu);
ipBox = new GUITextBox(new Rectangle(0, 130, 200, 30), GUI.style, menu);
new GUITextBlock(new Rectangle(0, 100, 0, 30), "Server IP:", GUI.Style, menu);
ipBox = new GUITextBox(new Rectangle(0, 130, 200, 30), GUI.Style, menu);
int middleX = (int)(width * 0.4f);
serverList = new GUIListBox(new Rectangle(middleX,60,0,(int)(height*0.7f)), GUI.style, menu);
serverList = new GUIListBox(new Rectangle(middleX,60,0,(int)(height*0.7f)), GUI.Style, menu);
serverList.OnSelected = SelectServer;
float[] columnRelativeX = new float[] { 0.15f, 0.55f, 0.15f, 0.15f };
@@ -64,19 +64,19 @@ namespace Subsurface
if (n > 0) columnX[n] += columnX[n - 1];
}
new GUITextBlock(new Rectangle(middleX, 30, 0, 30), "Password", GUI.style, menu);
new GUITextBlock(new Rectangle(middleX, 30, 0, 30), "Password", GUI.Style, menu);
new GUITextBlock(new Rectangle(middleX + columnX[0], 30, 0, 30), "Name", GUI.style, menu);
new GUITextBlock(new Rectangle(middleX + columnX[1], 30, 0, 30), "Players", GUI.style, menu);
new GUITextBlock(new Rectangle(middleX + columnX[2], 30, 0, 30), "Running", GUI.style, menu);
new GUITextBlock(new Rectangle(middleX + columnX[0], 30, 0, 30), "Name", GUI.Style, menu);
new GUITextBlock(new Rectangle(middleX + columnX[1], 30, 0, 30), "Players", GUI.Style, menu);
new GUITextBlock(new Rectangle(middleX + columnX[2], 30, 0, 30), "Running", GUI.Style, menu);
joinButton = new GUIButton(new Rectangle(-170, 0, 150, 30), "Refresh", Alignment.BottomRight, GUI.style, menu);
joinButton = new GUIButton(new Rectangle(-170, 0, 150, 30), "Refresh", Alignment.BottomRight, GUI.Style, menu);
joinButton.OnClicked = RefreshServers;
joinButton = new GUIButton(new Rectangle(0,0,150,30), "Join", Alignment.BottomRight, GUI.style, menu);
joinButton = new GUIButton(new Rectangle(0,0,150,30), "Join", Alignment.BottomRight, GUI.Style, menu);
joinButton.OnClicked = JoinServer;
GUIButton button = new GUIButton(new Rectangle(-20, -20, 100, 30), "Back", Alignment.TopLeft, GUI.style, menu);
GUIButton button = new GUIButton(new Rectangle(-20, -20, 100, 30), "Back", Alignment.TopLeft, GUI.Style, menu);
button.UserData = 0;
button.OnClicked = Game1.MainMenuScreen.SelectTab;
@@ -93,7 +93,7 @@ namespace Subsurface
//UpdateServerList();
}
private bool SelectServer(object obj)
private bool SelectServer(GUIComponent component, object obj)
{
string ip = obj as string;
if (string.IsNullOrWhiteSpace(ip)) return false;
@@ -108,7 +108,7 @@ namespace Subsurface
if (waitingForRefresh) return false;
serverList.ClearChildren();
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Refreshing server list...", GUI.style, serverList);
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Refreshing server list...", GUI.Style, serverList);
CoroutineManager.StartCoroutine(WaitForRefresh());
@@ -141,7 +141,7 @@ namespace Subsurface
if (string.IsNullOrWhiteSpace(masterServerData))
{
var nameText = new GUITextBlock(new Rectangle(0, 0, 0, 20), "Couldn't find any servers", GUI.style, serverList);
var nameText = new GUITextBlock(new Rectangle(0, 0, 0, 20), "Couldn't find any servers", GUI.Style, serverList);
return;
}
@@ -178,12 +178,12 @@ namespace Subsurface
passwordBox.Enabled = false;
passwordBox.UserData = "password";
var nameText = new GUITextBlock(new Rectangle(columnX[0], 0, 0, 0), serverName, GUI.style, serverFrame);
var nameText = new GUITextBlock(new Rectangle(columnX[0], 0, 0, 0), serverName, GUI.Style, serverFrame);
int playerCount, maxPlayers;
playerCount = GameClient.ByteToPlayerCount((byte)int.Parse(playerCountStr), out maxPlayers);
var playerCountText = new GUITextBlock(new Rectangle(columnX[1], 0, 0, 0), playerCount + "/" + maxPlayers, GUI.style, serverFrame);
var playerCountText = new GUITextBlock(new Rectangle(columnX[1], 0, 0, 0), playerCount + "/" + maxPlayers, GUI.Style, serverFrame);
var gameStartedBox = new GUITickBox(new Rectangle(columnX[2] + (columnX[3] - columnX[2])/ 2, 0, 20, 20), "", Alignment.TopLeft, serverFrame);
gameStartedBox.Selected = gameStarted == "1";
@@ -288,7 +288,7 @@ namespace Subsurface
if (serverList.Selected!=null && (serverList.Selected.GetChild("password") as GUITickBox).Selected)
{
var msgBox = new GUIMessageBox("Password required", "");
var passwordBox = new GUITextBox(new Rectangle(0,0,150,20), Alignment.BottomCenter, GUI.style, msgBox);
var passwordBox = new GUITextBox(new Rectangle(0,0,150,20), Alignment.BottomCenter, GUI.Style, msgBox);
passwordBox.UserData = "password";
var okButton = msgBox.GetChild<GUIButton>();

View File

@@ -7,7 +7,7 @@ using System.Xml.Linq;
namespace Subsurface
{
class Sprite
public class Sprite
{
static List<Sprite> list = new List<Sprite>();
//the file from which the texture is loaded
@@ -170,7 +170,7 @@ namespace Subsurface
if (File.Exists(file))
{
return Game1.TextureLoader.FromFile(file);
return TextureLoader.FromFile(file);
}
else
{

View File

@@ -8,7 +8,7 @@ using System.Xml.Linq;
namespace Subsurface
{
class SaveUtil
public class SaveUtil
{
private const string SaveFolder = "Content/Data/Saves/";

View File

@@ -11,10 +11,11 @@ namespace Subsurface
/// <summary>
/// Based on http://jakepoz.com/jake_poznanski__background_load_xna.html
/// </summary>
public class TextureLoader
public static class TextureLoader
{
static TextureLoader()
{
BlendColorBlendState = new BlendState
{
ColorDestinationBlend = Blend.Zero,
@@ -34,14 +35,14 @@ namespace Subsurface
};
}
public TextureLoader(GraphicsDevice graphicsDevice, bool needsBmp = false)
public static void Init(GraphicsDevice graphicsDevice, bool needsBmp = false)
{
_graphicsDevice = graphicsDevice;
_needsBmp = needsBmp;
_spriteBatch = new SpriteBatch(_graphicsDevice);
}
public Texture2D FromFile(string path, bool preMultiplyAlpha = true)
public static Texture2D FromFile(string path, bool preMultiplyAlpha = true)
{
try
{
@@ -68,7 +69,7 @@ namespace Subsurface
}
#if WINDOWS
private Texture2D FromStream(Stream stream, bool preMultiplyAlpha = true)
private static Texture2D FromStream(Stream stream, bool preMultiplyAlpha = true)
{
Texture2D texture;
@@ -97,7 +98,7 @@ namespace Subsurface
}
#endif
private Texture2D PreMultiplyAlpha(Texture2D texture)
private static Texture2D PreMultiplyAlpha(Texture2D texture)
{
// Setup a render target to hold our final texture which will have premulitplied alpha values
using (RenderTarget2D renderTarget = new RenderTarget2D(_graphicsDevice, texture.Width, texture.Height))
@@ -136,8 +137,8 @@ namespace Subsurface
private static readonly BlendState BlendColorBlendState;
private static readonly BlendState BlendAlphaBlendState;
private readonly GraphicsDevice _graphicsDevice;
private readonly SpriteBatch _spriteBatch;
private readonly bool _needsBmp;
private static GraphicsDevice _graphicsDevice;
private static SpriteBatch _spriteBatch;
private static bool _needsBmp;
}
}

View File

@@ -5,11 +5,12 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
namespace Subsurface
{
static class ToolBox
public static class ToolBox
{
public static XDocument TryLoadXml(string filePath)
{
@@ -195,6 +196,19 @@ namespace Subsurface
return ParseToVector4(val);
}
public static string ElementInnerText(this XElement el)
{
StringBuilder str = new StringBuilder();
foreach (XNode element in el.DescendantNodes().Where(x => x.NodeType == XmlNodeType.Text))
{
str.Append(element.ToString());
}
return str.ToString();
}
public static Vector2 ParseToVector2(string stringVector2, bool errorMessages = true)
{
string[] components = stringVector2.Split(',');
@@ -284,14 +298,16 @@ namespace Subsurface
{
if (font.MeasureString(text).X < lineLength) return text;
string[] words = text.Split(' ', '\n');
text = text.Replace("\n", " \n ");
string[] words = text.Split(' ');//, '\n');
StringBuilder wrappedText = new StringBuilder();
float linePos = 0f;
float spaceWidth = font.MeasureString(" ").X;
for (int i = 0; i < words.Length; ++i)
{
if (string.IsNullOrWhiteSpace(words[i])) continue;
if (string.IsNullOrWhiteSpace(words[i]) && words[i]!="\n") continue;
Vector2 size;
string tempWord = words[i];
@@ -299,9 +315,8 @@ namespace Subsurface
while ((size = font.MeasureString(tempWord)).X > lineLength)
{
tempWord = tempWord.Remove(tempWord.Length - 1, 1);
}
words[i] = tempWord;
if (prevWord.Length> tempWord.Length)
{
@@ -315,22 +330,29 @@ namespace Subsurface
if (linePos + size.X < lineLength)
{
wrappedText.Append(words[i]);
linePos += size.X + spaceWidth;
wrappedText.Append(words[i]);
if (words[i] == "\n")
{
linePos = 0.0f;
}
else
{
linePos += size.X + spaceWidth;
}
}
else
{
//if (i>0)wrappedText.Remove(wrappedText.Length - 1, 1);
wrappedText.Append("\n");
wrappedText.Append(words[i]);
linePos = size.X + spaceWidth;
wrappedText.Append("\n");
wrappedText.Append(words[i]);
linePos = size.X + spaceWidth;
}
if (i<words.Length-1) wrappedText.Append(" ");
if (i < words.Length - 1) wrappedText.Append(" ");
}
return wrappedText.ToString();

View File

@@ -0,0 +1,181 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Xml.Linq;
namespace Subsurface
{
public static class UpdaterUtil
{
public static void SaveFileList(string filePath)
{
XDocument doc = new XDocument(CreateFileList());
doc.Save(filePath);
}
public static XElement CreateFileList()
{
XElement root = new XElement("filelist");
string currentDir = Directory.GetCurrentDirectory();
string[] files = Directory.GetFiles(currentDir, "*", SearchOption.AllDirectories);
foreach (string file in files)
{
XElement fileElement = new XElement("file");
fileElement.Add(new XAttribute("path", GetRelativePath(file, currentDir)));
fileElement.Add(new XAttribute("md5", GetFileMd5Hash(file)));
root.Add(fileElement);
}
return root;
}
public static List<string> GetFileList(XDocument fileListDoc)
{
List<string> fileList = new List<string>();
XElement fileListElement = fileListDoc.Root;
if (fileListElement == null)
{
throw new Exception("Received list of new files was corrupted");
}
foreach (XElement file in fileListElement.Elements())
{
string filePath = ToolBox.GetAttributeString(file, "path", "");
fileList.Add(filePath);
}
return fileList;
}
public static List<string> GetRequiredFiles(XDocument fileListDoc)
{
List<string> requiredFiles = new List<string>();
XElement fileList = fileListDoc.Root;
if (fileList==null)
{
throw new Exception("Received list of new files was corrupted");
}
foreach (XElement file in fileList.Elements())
{
string filePath = ToolBox.GetAttributeString(file, "path", "");
if (!File.Exists(filePath))
{
requiredFiles.Add(filePath);
continue;
}
string md5 = ToolBox.GetAttributeString(file, "md5", "");
if (GetFileMd5Hash(filePath) != md5)
{
requiredFiles.Add(filePath);
}
}
return requiredFiles;
}
private static string GetFileMd5Hash(string filePath)
{
Md5Hash md5Hash = null;
var md5 = MD5.Create();
using (var stream = File.OpenRead(filePath))
{
md5Hash = new Md5Hash(md5.ComputeHash(stream));
}
return md5Hash.Hash;
}
public static string GetRelativePath(string filespec, string folder)
{
Uri pathUri = new Uri(filespec);
// Folders must end in a slash
if (!folder.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
folder += Path.DirectorySeparatorChar;
}
Uri folderUri = new Uri(folder);
return Uri.UnescapeDataString(folderUri.MakeRelativeUri(pathUri).ToString().Replace('/', Path.DirectorySeparatorChar));
}
/// <summary>
/// moves the files in the updatefolder to the install folder
/// if there's an existing file with the same name in the install folder and it can't be removed,
/// it will be renamed as "OLD_[filename]"
/// </summary>
/// <param name="updateFileFolder"></param>
public static void InstallUpdatedFiles(string updateFileFolder)
{
string[] files = Directory.GetFiles(updateFileFolder, "*", SearchOption.AllDirectories);
string currentDir = Directory.GetCurrentDirectory();
foreach (string file in files)
{
string fileRelPath = GetRelativePath(file, updateFileFolder);
if (File.Exists(fileRelPath))
{
try
{
File.Delete(fileRelPath);
}
catch
{
string oldFileName = currentDir+"\\"+Path.GetDirectoryName(fileRelPath)+"\\OLD_"+Path.GetFileName(fileRelPath);
if (File.Exists(oldFileName)) File.Delete(oldFileName);
//couldn't delete file, probably because it's already in use
File.Move(fileRelPath, oldFileName);
}
}
File.Move(file, fileRelPath);
}
Directory.Delete(updateFileFolder);
}
public static void CleanUnnecessaryFiles(List<string> filesToKeep)
{
string currentDir = Directory.GetCurrentDirectory();
string[] files = Directory.GetFiles(currentDir, "*", SearchOption.AllDirectories);
foreach (string file in files)
{
if (filesToKeep.Contains(GetRelativePath(file, currentDir))) continue;
System.Diagnostics.Debug.WriteLine("deleting file "+file);
try
{
File.Delete(currentDir + "\\" + file);
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine("Could not delete file ''" + file + "'' (" + e.Message + ")");
continue;
}
}
}
}
}

View File

@@ -76,6 +76,7 @@
<Compile Include="Source\GameSession\GameModes\GameModePreset.cs" />
<Compile Include="Source\GameSession\GameModes\QuestMode.cs" />
<Compile Include="Source\GameSession\GameModes\TutorialMode.cs" />
<Compile Include="Source\GUI\GUIDropDown.cs" />
<Compile Include="Source\GUI\GUIMessage.cs" />
<Compile Include="Source\GUI\TitleScreen.cs" />
<Compile Include="Source\Items\Components\Holdable\MeleeWeapon.cs" />
@@ -222,6 +223,7 @@
<Compile Include="Source\Utils\TextureLoader.cs" />
<Compile Include="Source\Utils\ToolBox.cs" />
<Compile Include="Source\Map\Hull.cs" />
<Compile Include="Source\Utils\UpdaterUtil.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="MonoGame.Framework">
@@ -241,7 +243,7 @@
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.XML" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
@@ -710,9 +712,6 @@
<Content Include="Content\UI\uiBackground.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\waterbump.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\randomevents.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
@@ -720,6 +719,9 @@
<Content Include="Content\Quests.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\waterbump.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Icon.ico" />
<Content Include="OpenAL32.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

View File

@@ -15,10 +15,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher", "Launcher\Launch
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network", "Lidgren.Network\Lidgren.Network.csproj", "{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{30B01820-F0C0-4C31-8BE7-804EE61DBC8A}"
ProjectSection(SolutionItems) = preProject
Performance1.psess = Performance1.psess
EndProjectSection
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher2", "Launcher2\Launcher2.csproj", "{251AAFE1-F24B-4837-9128-9D04FCBFD528}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -303,6 +300,51 @@ Global
{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Windows8|Mixed Platforms.ActiveCfg = Release|Any CPU
{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Windows8|Mixed Platforms.Build.0 = Release|Any CPU
{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Windows8|x86.ActiveCfg = Release|Any CPU
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Android|Any CPU.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Android|Mixed Platforms.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Android|Mixed Platforms.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Android|x86.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Android|x86.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Debug|Any CPU.ActiveCfg = Debug|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Debug|Mixed Platforms.Build.0 = Debug|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Debug|x86.ActiveCfg = Debug|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Debug|x86.Build.0 = Debug|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.iOS|Any CPU.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.iOS|Mixed Platforms.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.iOS|Mixed Platforms.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.iOS|x86.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.iOS|x86.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Linux|Any CPU.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Linux|Mixed Platforms.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Linux|Mixed Platforms.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Linux|x86.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Linux|x86.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.OSX|Any CPU.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.OSX|Mixed Platforms.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.OSX|Mixed Platforms.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.OSX|x86.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.OSX|x86.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.PSM|Any CPU.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.PSM|Mixed Platforms.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.PSM|Mixed Platforms.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.PSM|x86.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.PSM|x86.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Release|Any CPU.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Release|Mixed Platforms.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Release|Mixed Platforms.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Release|x86.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Release|x86.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Windows|Any CPU.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Windows|Mixed Platforms.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Windows|Mixed Platforms.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Windows|x86.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Windows|x86.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Windows8|Any CPU.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Windows8|Mixed Platforms.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Windows8|Mixed Platforms.Build.0 = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Windows8|x86.ActiveCfg = Release|x86
{251AAFE1-F24B-4837-9128-9D04FCBFD528}.Windows8|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>RestSharp</id>
<version>105.2.3</version>
<authors>John Sheehan, RestSharp Community</authors>
<owners>John Sheehan, RestSharp Community</owners>
<licenseUrl>https://github.com/restsharp/RestSharp/blob/master/LICENSE.txt</licenseUrl>
<projectUrl>http://restsharp.org/</projectUrl>
<iconUrl>http://dl.dropbox.com/u/1827/restsharp100.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Simple REST and HTTP API Client</description>
<releaseNotes>For full release notes see https://github.com/restsharp/RestSharp/blob/master/releasenotes.markdown</releaseNotes>
<language>en-US</language>
<tags>REST HTTP API JSON XML</tags>
</metadata>
</package>

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More