Skip to content

Commit

Permalink
Merge pull request #431 from SoPra18-07/Trim
Browse files Browse the repository at this point in the history
Trim
  • Loading branch information
fkarg committed Jul 11, 2018
2 parents e07d8d9 + 9250e86 commit 7222e4b
Show file tree
Hide file tree
Showing 21 changed files with 63 additions and 60 deletions.
3 changes: 3 additions & 0 deletions Singularity/Singularity.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Singularity", "Singularity\Singularity.csproj", "{34A890E2-4E4D-4B3C-914F-1316E6461513}"
EndProject
Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
Expand Down
1 change: 0 additions & 1 deletion Singularity/Singularity/Levels/Skirmish.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ namespace Singularity.Levels
[DataContract]
internal sealed class Skirmish : BasicLevel
{

public Skirmish(GraphicsDeviceManager graphics,
ref Director director,
ContentManager content,
Expand Down
2 changes: 1 addition & 1 deletion Singularity/Singularity/Manager/DistributionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ public void Unregister(List<PlatformBlank> platforms, bool isDef, bool inactivat
}
//If there are any units to redistribute do it now
AssignUnitsFairly(unitstodistribute, isDef);

//TODO: this is a dirty fix and might cause slider adjustment issues (null propagation added)
mHandler?.ForceSliderPages();

Expand Down
6 changes: 3 additions & 3 deletions Singularity/Singularity/Manager/MilitaryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ internal void RemovePlatform(PlatformBlank platform)
mHostileDefensePlatforms.Remove(defensePlatform);
}
}

mUnitMap.RemoveUnit(platform);
}

Expand All @@ -148,7 +148,7 @@ internal void RemoveUnit(ICollider unit)
{
var friendlyMilitary = unit as MilitaryUnit;
var hostileMilitary = unit as EnemyUnit;

if (friendlyMilitary != null)
{
mFriendlyMilitary.Remove(friendlyMilitary);
Expand Down Expand Up @@ -454,4 +454,4 @@ public void Update(GameTime gametime)
#endregion
}
}
}
}
12 changes: 6 additions & 6 deletions Singularity/Singularity/Map/Camera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private float Zoom
mZoom = value;
ValidateZoom();
ValidatePosition();

}
}

Expand All @@ -79,7 +79,7 @@ private float Zoom

private readonly InputManager mInputManager;

private readonly Vector2 mOrigin;
private readonly Vector2 mOrigin;


/// <summary>
Expand Down Expand Up @@ -141,7 +141,7 @@ public float GetZoom()
{
return mZoom;
}

/// <summary>
/// Checks whether the camera would move out of bounds and corrects the camera to
/// clip to the edge if its the case.
Expand Down Expand Up @@ -243,9 +243,9 @@ private void ValidateZoom()
///</summary>
private void UpdateTransformMatrix()
{
mTransform = Matrix.CreateTranslation(new Vector3(-mPosition, 0f))
* Matrix.CreateTranslation(new Vector3(-mOrigin, 0f))
* Matrix.CreateScale(mZoom, mZoom, 1f)
mTransform = Matrix.CreateTranslation(new Vector3(-mPosition, 0f))
* Matrix.CreateTranslation(new Vector3(-mOrigin, 0f))
* Matrix.CreateScale(mZoom, mZoom, 1f)
* Matrix.CreateTranslation(new Vector3(mOrigin, 0f));
mInputManager.CameraMoved(mTransform);
}
Expand Down
5 changes: 3 additions & 2 deletions Singularity/Singularity/Map/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ public sealed class Map : IDraw, IUpdate
int height,
FogOfWar fow,
Camera camera,
ref Director director,
IEnumerable<MapResource> initialResources = null)
ref Director director)
{
mWidth = width;
mHeight = height;
Expand All @@ -63,6 +62,8 @@ public sealed class Map : IDraw, IUpdate

mFow = fow;

var initialResources = ResourceHelper.GetRandomlyDistributedResources(50);

mCollisionMap = new CollisionMap();
mStructureMap = new StructureMap(fow, ref director);
mResourceMap = new ResourceMap(initialResources);
Expand Down
4 changes: 2 additions & 2 deletions Singularity/Singularity/Map/MiniMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Singularity.Map
/// platforms are represented with dots, as are military units (in the future). The original idea was to put
/// EVERYTHING on the minimap, roads, resources, enemy units, enemy buildings, etc. The
/// "true" purpose of a minimap is to be able to see everything at once at first glance without having to
/// move the games camera to that exact location.
/// move the games camera to that exact location.
/// </summary>
public sealed class MiniMap : IWindowItem
{
Expand Down Expand Up @@ -142,7 +142,7 @@ public void Draw(SpriteBatch spriteBatch)
public void Update(GameTime gametime)
{
// only update UpdateMilliInterval milliseconds. The basic idea was to refetch all the gameobjects every second
// but I decided to just pass the reference which makes things alot easier.
// but I decided to just pass the reference which makes things alot easier.

// TODO: this could be replaced with an initialize method, that sets the reference as soons as all of them
// TODO: are actually in the memory. For now this is fine.
Expand Down
6 changes: 3 additions & 3 deletions Singularity/Singularity/Nature/Puddle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void Draw(SpriteBatch spriteBatch)
spriteBatch.DrawLine(new Vector2(mPosition.X + 89, mPosition.Y + 22), 26, 2.68f, Color.Gray);


// draw the water in the puddle
// draw the water in the puddle
for (int i = 0; i < 45; i++)
{
spriteBatch.DrawLine(
Expand All @@ -106,7 +106,7 @@ public void Draw(SpriteBatch spriteBatch)
spriteBatch.DrawLine(new Vector2(mPosition.X + 71, mPosition.Y + 16), 23, 2.7f, Color.Gray);


// draw the water in the puddle
// draw the water in the puddle
for (int i = 0; i < 38; i++)
{
spriteBatch.DrawLine(new Vector2(mPosition.X + 71 + (i * 1.959f), mPosition.Y - 20 + i), 63, 2.7f, Color.CornflowerBlue * .7f);
Expand All @@ -132,4 +132,4 @@ public void MakeDamage(int damage)
// does not obtain damage
}
}
}
}
10 changes: 5 additions & 5 deletions Singularity/Singularity/Nature/Rock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Singularity.Nature
{
public class Rock : ICollider
{
{
public bool[,] ColliderGrid { get; internal set; }

// specifies the angle of the given rock
Expand Down Expand Up @@ -65,7 +65,7 @@ public Rock(Vector2 position)
/// </summary>
private void CreateRock()
{


// create the rotation and placement chart for rocks
for (int i = 0; i < 14; i++)
Expand Down Expand Up @@ -123,14 +123,14 @@ private void CreateRock()

public void Draw(SpriteBatch spriteBatch)
{
// generate the rotation and placement matrix at the beginning
// generate the rotation and placement matrix at the beginning
if (!mNotGenerated)
{
CreateRock();
mNotGenerated = true;
}

// draw the rock formation
// draw the rock formation

for (int i = 0; i < 18; i++)
{
Expand All @@ -152,7 +152,7 @@ public void Draw(SpriteBatch spriteBatch)
mDrawSize.X / 18,
20,
(mDrawAngle[j, i] % 2 == 0) ? Color.DimGray * .9f : Color.Gray * .9f,
1f);
1f);
}

// otherwise draw a square
Expand Down
2 changes: 1 addition & 1 deletion Singularity/Singularity/Platforms/DefenseBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ internal abstract class DefenseBase : PlatformBlank, IShooting
type,
friendly: friendly)
{

mType = type;
mSpritename = "Cone";
Property = JobType.Defense;
Expand Down
2 changes: 1 addition & 1 deletion Singularity/Singularity/Platforms/Mine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Mine : PlatformBlank
-50,
friendly)
{

mIPlatformActions.Add(new ProduceMineResource(platform: this, resourceMap: resource, director: ref mDirector));
//Something like "Hello Distributionmanager I exist now(GiveBlueprint)"
//Add Costs of the platform here if you got them.
Expand Down
4 changes: 2 additions & 2 deletions Singularity/Singularity/Platforms/PlatformBlank.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ public void Deactivate(bool manually)
{
if (manually)
{
// TODO maybe need to regulate sound a little when put to action
// TODO maybe need to regulate sound a little when put to action
mDirector.GetSoundManager.PlaySound("PowerDown",
Center.X,
Center.Y,
Expand All @@ -1026,7 +1026,7 @@ public void Deactivate(bool manually)
}

mIsActive = false;
// TODO: remove this or change it to something more appropriately, this is used by @Ativelox for
// TODO: remove this or change it to something more appropriately, this is used by @Ativelox for
// TODO: debugging purposes to easily see which platforms are currently deactivated
mColor = Color.Green;
//Only unregister if this platform is a defense or production platform
Expand Down
2 changes: 1 addition & 1 deletion Singularity/Singularity/Screen/ActivationIWindowItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal sealed class ActivationIWindowItem : IWindowItem
private readonly IWindowItem mDeactiveItem;

/// <summary>
///
///
/// </summary>
/// <param name="activeItem"></param>
/// <param name="deactiveItem"></param>
Expand Down
10 changes: 5 additions & 5 deletions Singularity/Singularity/Screen/InfoBarWindowObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Singularity.Screen
{
/// <summary>
/// The InfoBar is the UI's top bar.
/// It includes the time, mission time, the pause button and buttons to close the given 6 windows
/// It includes the time, mission time, the pause button and buttons to close the given 6 windows
/// </summary>
sealed class InfoBarWindowObject : IDraw, IUpdate, IMouseClickListener
{
Expand Down Expand Up @@ -86,9 +86,9 @@ sealed class InfoBarWindowObject : IDraw, IUpdate, IMouseClickListener
/// <param name="minimapWindow">the minimapWindow to close/open</param>
/// <param name="director">director</param>
public InfoBarWindowObject(
Color borderColor,
Color fillColor,
SpriteFont spriteFont,
Color borderColor,
Color fillColor,
SpriteFont spriteFont,
IScreenManager screenManager,
WindowObject civilUnitsWindow,
WindowObject resourceWindow,
Expand Down Expand Up @@ -202,7 +202,7 @@ public void Update(GameTime gametime)
{
if (Active)
{
// changes in resolution result in changes in width of the info bar and the button locations
// changes in resolution result in changes in width of the info bar and the button locations
if (mWidthBackup != Width)
{
// update backup
Expand Down
2 changes: 1 addition & 1 deletion Singularity/Singularity/Screen/InfoBoxWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public virtual void Update(GameTime gametime)

// shifts the items from the top left corner to their position
var yShift = 2;
//
//
float maxWidth = 0;
float maxHeight = 0;

Expand Down
10 changes: 5 additions & 5 deletions Singularity/Singularity/Screen/PlatformActionIWindowItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public PlatformActionIWindowItem(IPlatformAction platformAction, SpriteFont spri
var name = platformAction.ToString().Split('.')[2];

mNameTextField = new TextField(
text: name,
position: Vector2.Zero,
text: name,
position: Vector2.Zero,
size: new Vector2(spriteFont.MeasureString(name).X, 0), // the size of the textfield should be as big as the string it contains
spriteFont: spriteFont,
spriteFont: spriteFont,
color: Color.White);

var stateTextField = new TextField(
text: platformAction.State.ToString(),
position: Vector2.Zero,
text: platformAction.State.ToString(),
position: Vector2.Zero,
size: new Vector2(spriteFont.MeasureString(platformAction.State.ToString()).X, 0), // the size of the textfield should be as big as the string it contains
spriteFont: spriteFont,
color: Color.White);
Expand Down
2 changes: 1 addition & 1 deletion Singularity/Singularity/Screen/ResourceIWindowItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void Draw(SpriteBatch spriteBatch)
text: mResourceText,
position: mTextPosition,
color: Color.White);
// draw the amount aligned to the right side
// draw the amount aligned to the right side
spriteBatch.DrawString(
spriteFont: mSpriteFont,
text: Amount.ToString(),
Expand Down
4 changes: 2 additions & 2 deletions Singularity/Singularity/Screen/ScreenClasses/DebugScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace Singularity.Screen.ScreenClasses
{
/// <summary>
/// Used to show debug information. This might not be the prettiest, but it definitely does its work...
/// Used to show debug information. This might not be the prettiest, but it definitely does its work...
/// </summary>
public sealed class DebugScreen : IScreen, IKeyListener
{
Expand Down Expand Up @@ -188,7 +188,7 @@ public void KeyPressed(KeyEvent keyEvent)

public void KeyReleased(KeyEvent keyEvent)
{

}

private void FowButtonClicked(object sender, EventArgs args)
Expand Down
4 changes: 2 additions & 2 deletions Singularity/Singularity/Screen/ScreenClasses/GameScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public void LoadContent(ContentManager content)
{
AddObject(mMap);

AddObjects(ResourceHelper.GetRandomlyDistributedResources(50));
// AddObjects(ResourceHelper.GetRandomlyDistributedResources(50));

mDirector.GetSoundManager.SetLevelThemeMusic("Tutorial");
mDirector.GetSoundManager.SetSoundPhase(SoundPhase.Build);
Expand Down Expand Up @@ -232,7 +232,7 @@ public bool AddObject<T>(T toAdd)
mDirector.GetMilitaryManager.AddPlatform(platform);
return true;
}

// subscribes the game screen the the settler event (to build a command center)
// TODO unsubscribe / delete settler when event is fired
if (settler != null)
Expand Down
Loading

0 comments on commit 7222e4b

Please sign in to comment.