Skip to content

Commit

Permalink
All Alpha features in place
Browse files Browse the repository at this point in the history
Ships can be created and added to taskgroups, new taskgroups can be
created and renamed, components can be designed, etc.
  • Loading branch information
NathanH- committed Dec 7, 2013
1 parent 4d45eb5 commit e4785e5
Show file tree
Hide file tree
Showing 18 changed files with 1,270 additions and 22 deletions.
24 changes: 24 additions & 0 deletions Pulsar4X/Pulsar4X.Lib/Entities/Faction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ public class Faction : GameEntity
public string Title { get; set; }
public Species Species { get; set; }

/// <summary>
/// For now this is a stub for where ships will be created.
/// </summary>
public Planet Capitol { get; set; }

public FactionTheme FactionTheme { get; set; }
public FactionCommanderTheme CommanderTheme { get; set; }

Expand Down Expand Up @@ -555,6 +560,18 @@ public enum FactionTechnology
/// </summary>



/// <summary>
/// Ship BP this faction starts with.
/// </summary>
public decimal ShipBPTotal { get; set; }

/// <summary>
/// PDC BP this faction starts with.
/// </summary>
public decimal PDCBPTotal { get; set; }


/// <summary>
/// Constructor for basic faction.
/// </summary>
Expand Down Expand Up @@ -620,6 +637,10 @@ public Faction(int ID)
FactionTechLevel[(int)Faction.FactionTechnology.ThermalReduction] = 0;
FactionTechLevel[(int)Faction.FactionTechnology.CapacitorChargeRate] = 0;
FactionTechLevel[(int)Faction.FactionTechnology.EngineBaseTech] = 0;


ShipBPTotal = 8000.0m;
PDCBPTotal = 4000.0m;
}

/// <summary>
Expand Down Expand Up @@ -688,6 +709,9 @@ public Faction(string a_oName, Species a_oSpecies, int ID)
FactionTechLevel[(int)Faction.FactionTechnology.ThermalReduction] = 0;
FactionTechLevel[(int)Faction.FactionTechnology.CapacitorChargeRate] = 0;
FactionTechLevel[(int)Faction.FactionTechnology.EngineBaseTech] = 0;

ShipBPTotal = 8000.0m;
PDCBPTotal = 4000.0m;
}

/// <summary>
Expand Down
7 changes: 7 additions & 0 deletions Pulsar4X/Pulsar4X.Lib/GameState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public static GameState Instance
}
}

/// <summary>
/// top level random number generator
/// </summary>
private static Random _RNG;
public static Random RNG
{
Expand All @@ -39,6 +42,9 @@ public static Random RNG
}
}

/// <summary>
/// The simulation proper, all the game mechanics are brought together here.
/// </summary>
private static SimEntity _SE;
public static SimEntity SE
{
Expand All @@ -52,6 +58,7 @@ public static SimEntity SE
}
}


/// <summary>
/// Constructor.
/// </summary>
Expand Down
31 changes: 21 additions & 10 deletions Pulsar4X/Pulsar4X.UI/Forms/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Pulsar4X/Pulsar4X.UI/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ private void createResearchProjectToolStripMenuItem_Click(object sender, EventAr
Helpers.UIController.Instance.ComponentRP.Popup();
}

private void fastOOBCreationToolStripMenuItem_Click(object sender, EventArgs e)
{
Helpers.UIController.Instance.FastOOBScreen.Popup();
}

#endregion
}
}
40 changes: 39 additions & 1 deletion Pulsar4X/Pulsar4X.UI/Handlers/ClassDesign.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
using Pulsar4X.Entities.Components;


/// <summary>
/// BuildDesignTab and getListBoxComponents both need to be updated if a component is added in addition to everything else.
/// </summary>
namespace Pulsar4X.UI.Handlers
{
public class ClassDesign
Expand Down Expand Up @@ -234,6 +237,7 @@ public ClassDesign()
/// </summary>
m_oRenameClassPanel.OKButton.Click +=new EventHandler(OKButton_Click);
m_oRenameClassPanel.CancelButton.Click += new EventHandler(CancelButton_Click);
m_oRenameClassPanel.RenameClassTextBox.KeyPress += new KeyPressEventHandler(RenameClassTextBox_KeyPress);

m_oOptionsPanel.DeploymentTimeTextBox.TextChanged += new EventHandler(DeploymentTimeTextBox_TextChanged);

Expand Down Expand Up @@ -480,11 +484,16 @@ private void RenameButton_Click(object sender, EventArgs e)
{
m_oRenameClassPanel.RenameClassTextBox.Text = _CurrnetShipClass.Name;
Helpers.UIController.Instance.SuspendAutoPanelDisplay = true;
m_oRenameClassPanel.Show();
m_oRenameClassPanel.ShowDialog();
Helpers.UIController.Instance.SuspendAutoPanelDisplay = false;
}
}

/// <summary>
/// Actually change the name
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OKButton_Click(object sender, EventArgs e)
{
_CurrnetShipClass.Name = m_oRenameClassPanel.RenameClassTextBox.Text;
Expand All @@ -498,6 +507,28 @@ private void OKButton_Click(object sender, EventArgs e)
UpdateDisplay();
}

/// <summary>
/// Same as above, only on enter pressed.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RenameClassTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Return)
{
_CurrnetShipClass.Name = m_oRenameClassPanel.RenameClassTextBox.Text;
_CurrnetShipClass.BuildClassSummary();

Helpers.UIController.Instance.SuspendAutoPanelDisplay = true;
m_oRenameClassPanel.Hide();
Helpers.UIController.Instance.SuspendAutoPanelDisplay = false;

m_oOptionsPanel.ClassComboBox.Items[m_oOptionsPanel.ClassComboBox.SelectedIndex] = _CurrnetShipClass.Name;
UpdateDisplay();

}
}

/// <summary>
/// Disregard the rename.
/// </summary>
Expand Down Expand Up @@ -1103,7 +1134,14 @@ private void BuildPassiveDefences()
/// </summary>
private void BuildCrewAccomPanel()
{

m_oOptionsPanel.DeploymentTimeTextBox.Text = CurrentShipClass.MaxDeploymentTime.ToString();

if (_CurrnetShipClass.IsLocked == true)
m_oOptionsPanel.DeploymentTimeTextBox.ReadOnly = true;
else
m_oOptionsPanel.DeploymentTimeTextBox.ReadOnly = false;

m_oOptionsPanel.TonsPerManTextBox.Text = String.Format("{0:N3}",CurrentShipClass.TonsPerMan);
m_oOptionsPanel.CapPerHSTextBox.Text = String.Format("{0:N2}",CurrentShipClass.CapPerHS);
m_oOptionsPanel.AccomHSReqTextBox.Text = String.Format("{0:N4}",CurrentShipClass.AccomHSRequirement);
Expand Down
9 changes: 8 additions & 1 deletion Pulsar4X/Pulsar4X.UI/Handlers/Components.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ public ComponentsViewModel.Components CurrentComponent
[DllImport("user32", CharSet = CharSet.Auto)]
private extern static IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);


public Components()
{

eventMask = IntPtr.Zero;

m_oComponentDesignPanel = new Panels.Component_Design();
Expand Down Expand Up @@ -128,6 +130,7 @@ public Components()

m_oComponentDesignPanel.InstantButton.Click += new EventHandler(InstantButton_Click);


//m_oComponentDesignPanel.ResizeBegin +=new EventHandler(ResizeBegin);
//m_oComponentDesignPanel.ResizeEnd += new EventHandler(ResizeEnd);

Expand All @@ -145,7 +148,9 @@ public Components()
/// </summary>
public void Popup()
{
Helpers.UIController.Instance.SuspendAutoPanelDisplay = true;
m_oComponentDesignPanel.ShowDialog();
Helpers.UIController.Instance.SuspendAutoPanelDisplay = false;
}

/// <summary>
Expand Down Expand Up @@ -248,7 +253,9 @@ private void TechComboBox_SelectedIndexChanged(object sender, EventArgs e)
/// <param name="e"></param>
private void CloseButton_Click(object sender, EventArgs e)
{
m_oComponentDesignPanel.Close();
Helpers.UIController.Instance.SuspendAutoPanelDisplay = true;
m_oComponentDesignPanel.Hide();
Helpers.UIController.Instance.SuspendAutoPanelDisplay = false;
}

/// <summary>
Expand Down
Loading

0 comments on commit e4785e5

Please sign in to comment.