diff --git a/Subsurface/Source/DebugConsole.cs b/Subsurface/Source/DebugConsole.cs index bd98b5e8a..93b8f8047 100644 --- a/Subsurface/Source/DebugConsole.cs +++ b/Subsurface/Source/DebugConsole.cs @@ -158,8 +158,8 @@ 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.AddCharacter(Character.Controlled); + mode.CrewManager.SelectCharacter(Character.Controlled); } } else diff --git a/Subsurface/Source/GameSession/GameMode.cs b/Subsurface/Source/GameSession/GameModes/GameMode.cs similarity index 80% rename from Subsurface/Source/GameSession/GameMode.cs rename to Subsurface/Source/GameSession/GameModes/GameMode.cs index ad4a8f883..af887f5b8 100644 --- a/Subsurface/Source/GameSession/GameMode.cs +++ b/Subsurface/Source/GameSession/GameModes/GameMode.cs @@ -6,39 +6,9 @@ using System.Reflection; namespace Subsurface { - class GameModePreset - { - public static List list = new List(); - - public ConstructorInfo Constructor; - public string Name; - public bool IsSinglePlayer; - - public string Description; - - public GameModePreset(string name, Type type, bool isSinglePlayer = false) - { - this.Name = name; - //Constructor = constructor; - - - Constructor = type.GetConstructor(new Type[] { typeof(GameModePreset)}); - - IsSinglePlayer = isSinglePlayer; - - list.Add(this); - } - - public GameMode Instantiate() - { - object[] lobject = new object[] { this }; - return(GameMode)Constructor.Invoke(lobject); - } - } - class GameMode { - public static List presetList = new List(); + public static List PresetList = new List(); TimeSpan duration; protected DateTime startTime; @@ -94,9 +64,6 @@ namespace Subsurface public GameMode(GameModePreset preset) { this.preset = preset; - - - //list.Add(this); } public virtual void Draw(SpriteBatch spriteBatch) diff --git a/Subsurface/Source/GameSession/GameModes/GameModePreset.cs b/Subsurface/Source/GameSession/GameModes/GameModePreset.cs new file mode 100644 index 000000000..fbd6964a2 --- /dev/null +++ b/Subsurface/Source/GameSession/GameModes/GameModePreset.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; + +namespace Subsurface +{ + class GameModePreset + { + public static List list = new List(); + + public ConstructorInfo Constructor; + public string Name; + public bool IsSinglePlayer; + + public string Description; + + public GameModePreset(string name, Type type, bool isSinglePlayer = false) + { + this.Name = name; + //Constructor = constructor; + + + Constructor = type.GetConstructor(new Type[] { typeof(GameModePreset) }); + + IsSinglePlayer = isSinglePlayer; + + list.Add(this); + } + + public GameMode Instantiate() + { + object[] lobject = new object[] { this }; + return (GameMode)Constructor.Invoke(lobject); + } + } +} diff --git a/Subsurface/Source/GameSession/QuestMode.cs b/Subsurface/Source/GameSession/GameModes/QuestMode.cs similarity index 100% rename from Subsurface/Source/GameSession/QuestMode.cs rename to Subsurface/Source/GameSession/GameModes/QuestMode.cs diff --git a/Subsurface/Source/GameSession/SinglePlayerMode.cs b/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs similarity index 80% rename from Subsurface/Source/GameSession/SinglePlayerMode.cs rename to Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs index 09e1dcbf0..fcb4e90c4 100644 --- a/Subsurface/Source/GameSession/SinglePlayerMode.cs +++ b/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs @@ -12,14 +12,14 @@ namespace Subsurface { //private const int StartCharacterAmount = 3; - public readonly CrewManager crewManager; + public readonly CrewManager CrewManager; //public readonly HireManager hireManager; private GUIButton endShiftButton; public readonly CargoManager CargoManager; - public Map map; + public Map Map; private bool crewDead; private float endTimer; @@ -30,20 +30,20 @@ namespace Subsurface { get { - return map.SelectedConnection.Quest; + return Map.SelectedConnection.Quest; } } public int Money { - get { return crewManager.Money; } - set { crewManager.Money = value; } + get { return CrewManager.Money; } + set { CrewManager.Money = value; } } public SinglePlayerMode(GameModePreset preset) : base(preset) { - crewManager = new CrewManager(); + CrewManager = new CrewManager(); CargoManager = new CargoManager(); @@ -68,7 +68,7 @@ namespace Subsurface CharacterInfo characterInfo = new CharacterInfo(Character.HumanConfigFile, "", Gender.None, jobPrefab); - crewManager.characterInfos.Add(characterInfo); + CrewManager.characterInfos.Add(characterInfo); } } @@ -80,19 +80,19 @@ namespace Subsurface GenerateMap(mapSeed); - map.SetLocation(ToolBox.GetAttributeInt(element, "currentlocation", 0)); + Map.SetLocation(ToolBox.GetAttributeInt(element, "currentlocation", 0)); foreach (XElement subElement in element.Elements()) { if (subElement.Name.ToString().ToLower() != "crew") continue; - crewManager = new CrewManager(subElement); + CrewManager = new CrewManager(subElement); } } public void GenerateMap(string seed) { - map = new Map(seed, 500); + Map = new Map(seed, 500); } public override void Start(TimeSpan duration) @@ -107,24 +107,24 @@ namespace Subsurface endTimer = 5.0f; - crewManager.StartShift(); + CrewManager.StartShift(); } public bool TryHireCharacter(HireManager hireManager, CharacterInfo characterInfo) { - if (crewManager.Money < characterInfo.Salary) return false; + if (CrewManager.Money < characterInfo.Salary) return false; hireManager.availableCharacters.Remove(characterInfo); - crewManager.characterInfos.Add(characterInfo); + CrewManager.characterInfos.Add(characterInfo); - crewManager.Money -= characterInfo.Salary; + CrewManager.Money -= characterInfo.Salary; return true; } public string GetMoney() { - return ("Money: " + crewManager.Money); + return "Money: " + CrewManager.Money; } @@ -132,16 +132,16 @@ namespace Subsurface { base.Draw(spriteBatch); - crewManager.Draw(spriteBatch); + CrewManager.Draw(spriteBatch); if (Level.Loaded.AtEndPosition) { - endShiftButton.Text = "Enter " + map.SelectedLocation.Name; + endShiftButton.Text = "Enter " + Map.SelectedLocation.Name; endShiftButton.Draw(spriteBatch); } else if (Level.Loaded.AtStartPosition) { - endShiftButton.Text = "Enter " + map.CurrentLocation.Name; + endShiftButton.Text = "Enter " + Map.CurrentLocation.Name; endShiftButton.Draw(spriteBatch); } @@ -157,13 +157,13 @@ namespace Subsurface { base.Update(deltaTime); - crewManager.Update(deltaTime); + CrewManager.Update(deltaTime); endShiftButton.Update(deltaTime); if (!crewDead) { - if (crewManager.characters.Find(c => !c.IsDead) == null) + if (CrewManager.characters.Find(c => !c.IsDead) == null) { crewDead = true; } @@ -185,9 +185,9 @@ namespace Subsurface StringBuilder sb = new StringBuilder(); - List casualties = crewManager.characters.FindAll(c => c.IsDead); + List casualties = CrewManager.characters.FindAll(c => c.IsDead); - if (casualties.Count == crewManager.characters.Count) + if (casualties.Count == CrewManager.characters.Count) { sb.Append("Your entire crew has died!"); @@ -214,13 +214,13 @@ namespace Subsurface if (Level.Loaded.AtEndPosition) { - map.MoveToNextLocation(); + Map.MoveToNextLocation(); } SaveUtil.SaveGame(Game1.GameSession.SaveFile); } - crewManager.EndShift(); + CrewManager.EndShift(); for (int i = Character.CharacterList.Count - 1; i >= 0; i--) { Character.CharacterList[i].Remove(); @@ -241,10 +241,10 @@ namespace Subsurface //element.Add(new XAttribute("day", day)); XElement modeElement = new XElement("gamemode"); - modeElement.Add(new XAttribute("currentlocation", map.CurrentLocationIndex)); - modeElement.Add(new XAttribute("mapseed", map.Seed)); + modeElement.Add(new XAttribute("currentlocation", Map.CurrentLocationIndex)); + modeElement.Add(new XAttribute("mapseed", Map.Seed)); - crewManager.Save(modeElement); + CrewManager.Save(modeElement); element.Add(modeElement); diff --git a/Subsurface/Source/GameSession/TraitorMode.cs b/Subsurface/Source/GameSession/GameModes/TraitorMode.cs similarity index 100% rename from Subsurface/Source/GameSession/TraitorMode.cs rename to Subsurface/Source/GameSession/GameModes/TraitorMode.cs diff --git a/Subsurface/Source/GameSession/GameModes/TutorialMode.cs b/Subsurface/Source/GameSession/GameModes/TutorialMode.cs new file mode 100644 index 000000000..5a14bd865 --- /dev/null +++ b/Subsurface/Source/GameSession/GameModes/TutorialMode.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Subsurface +{ + //class TutorialMode : GameMode + //{ + //} +} diff --git a/Subsurface/Source/GameSession/GameSession.cs b/Subsurface/Source/GameSession/GameSession.cs index fc3e13e4a..6ea2a2f8d 100644 --- a/Subsurface/Source/GameSession/GameSession.cs +++ b/Subsurface/Source/GameSession/GameSession.cs @@ -51,7 +51,7 @@ namespace Subsurface get { SinglePlayerMode mode = (gameMode as SinglePlayerMode); - return (mode == null) ? null : mode.map; + return (mode == null) ? null : mode.Map; } } @@ -151,7 +151,7 @@ namespace Subsurface { SinglePlayerMode singlePlayerMode = gameMode as SinglePlayerMode; if (singlePlayerMode == null) return; - singlePlayerMode.crewManager.KillCharacter(character); + singlePlayerMode.CrewManager.KillCharacter(character); } public bool LoadPrevious(GUIButton button, object obj) diff --git a/Subsurface/Source/Screens/LobbyScreen.cs b/Subsurface/Source/Screens/LobbyScreen.cs index ef49403e9..04160fa25 100644 --- a/Subsurface/Source/Screens/LobbyScreen.cs +++ b/Subsurface/Source/Screens/LobbyScreen.cs @@ -230,7 +230,7 @@ namespace Subsurface private void UpdateCharacterLists() { characterList.ClearChildren(); - foreach (CharacterInfo c in gameMode.crewManager.characterInfos) + foreach (CharacterInfo c in gameMode.CrewManager.characterInfos) { GUITextBlock textBlock = new GUITextBlock( new Rectangle(0, 0, 0, 25), @@ -282,7 +282,7 @@ namespace Subsurface CreateItemFrame(prefab, selectedItemList); - buyButton.Enabled = gameMode.crewManager.Money >= selectedItemCost; + buyButton.Enabled = gameMode.CrewManager.Money >= selectedItemCost; return false; } @@ -301,9 +301,9 @@ namespace Subsurface { int cost = selectedItemCost; - if (gameMode.crewManager.Money < cost) return false; + if (gameMode.CrewManager.Money < cost) return false; - gameMode.crewManager.Money -= cost; + gameMode.CrewManager.Money -= cost; for (int i = selectedItemList.children.Count-1; i>=0; i--) { @@ -336,7 +336,7 @@ namespace Subsurface public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch) { - if (characterList.CountChildren != gameMode.crewManager.characterInfos.Count) + if (characterList.CountChildren != gameMode.CrewManager.characterInfos.Count) { UpdateCharacterLists(); } @@ -380,7 +380,7 @@ namespace Subsurface private string GetMoney() { - return "Money: " + ((Game1.GameSession == null) ? "" : gameMode.crewManager.Money.ToString()); + return "Money: " + ((Game1.GameSession == null) ? "" : gameMode.CrewManager.Money.ToString()); } private bool SelectCharacter(object selection) diff --git a/Subsurface/StyleCop.Cache b/Subsurface/StyleCop.Cache index 1e523edb5..c2264d137 100644 --- a/Subsurface/StyleCop.Cache +++ b/Subsurface/StyleCop.Cache @@ -1413,40 +1413,6 @@ - - - 2014.04.01 10:18:24.000 - 2015.07.02 21:22:42.115 - 2015.07.02 21:12:45.676 - 2014.04.01 10:18:24.000 - 2014.04.01 10:18:24.000 - -1945363787 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - - - - Public and internal fields must start with an upper-case letter: list. - 11 - False - - - Public and internal fields must start with an upper-case letter: presetList. - 39 - False - - - 2014.04.01 10:18:24.000 @@ -1525,84 +1491,6 @@ - - - 2014.04.01 10:18:24.000 - 2015.07.02 21:22:42.115 - 2015.07.02 21:17:30.529 - 2014.04.01 10:18:24.000 - 2014.04.01 10:18:24.000 - -1945363787 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - - - - Public and internal fields must start with an upper-case letter: crewManager. - 13 - False - - - Readonly variables that are not declared private must start with an upper-case letter: crewManager. - 13 - False - - - Public and internal fields must start with an upper-case letter: hireManager. - 14 - False - - - Readonly variables that are not declared private must start with an upper-case letter: hireManager. - 14 - False - - - The line contains unnecessary parenthesis. - 76 - 2178 - 2208 - 76 - 20 - 76 - 50 - False - - - - - - 2014.04.01 10:18:24.000 - 2015.07.02 21:22:42.115 - 2015.07.02 21:16:54.762 - 2014.04.01 10:18:24.000 - 2014.04.01 10:18:24.000 - -1945363787 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - 2014.04.01 10:18:24.000 - 0 - - - 2014.04.01 10:18:24.000 @@ -6213,9 +6101,6 @@ - - DEBUG;TRACE;WINDOWS - 2014.04.01 10:18:24.000 @@ -6451,4 +6336,132 @@ + + DEBUG;TRACE;WINDOWS + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.08.07 23:11:01.623 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: presetList. + 11 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.30 01:59:55.431 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.31 15:33:04.816 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: crewManager. + 15 + False + + + Readonly variables that are not declared private must start with an upper-case letter: crewManager. + 15 + False + + + Public and internal fields must start with an upper-case letter: map. + 22 + False + + + The line contains unnecessary parenthesis. + 127 + 3775 + 3805 + 127 + 20 + 127 + 50 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.08.04 21:18:39.811 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + \ No newline at end of file diff --git a/Subsurface/Subsurface.csproj b/Subsurface/Subsurface.csproj index e87bafdce..406950bd3 100644 --- a/Subsurface/Subsurface.csproj +++ b/Subsurface/Subsurface.csproj @@ -70,7 +70,9 @@ - + + + @@ -85,11 +87,11 @@ - + - - + + diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index 7bf7a7e1d..8cb8cfcd6 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ