From 3a6078306ea01c63d69ca8312475cdb9a5d22acc Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 6 May 2020 17:39:01 +0200 Subject: [PATCH 1/4] Day Night Cycle --- Game1.sln | 6 + Game1/Game1.cs | 2 +- Game1/Game1.csproj | 69 +++++- Game1/Sources/Objects/DayNightCycle.cs | 43 +++- Game1/app.config | 28 +++ MigrationBackup/21c990a4/Game1/Game1.csproj | 199 ++++++++++++++++++ .../21c990a4/Game1/NuGetUpgradeLog.html | 174 +++++++++++++++ .../21c990a4/Game1/packages.config | 18 ++ 8 files changed, 531 insertions(+), 8 deletions(-) create mode 100644 Game1/app.config create mode 100644 MigrationBackup/21c990a4/Game1/Game1.csproj create mode 100644 MigrationBackup/21c990a4/Game1/NuGetUpgradeLog.html create mode 100644 MigrationBackup/21c990a4/Game1/packages.config diff --git a/Game1.sln b/Game1.sln index cc8e21a..ef74ef7 100644 --- a/Game1.sln +++ b/Game1.sln @@ -7,12 +7,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Game1", "Game1\Game1.csproj EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {650E4519-2DEF-496F-AC3B-3C794DC7CF0D}.Debug|x64.ActiveCfg = Debug|x64 + {650E4519-2DEF-496F-AC3B-3C794DC7CF0D}.Debug|x64.Build.0 = Debug|x64 {650E4519-2DEF-496F-AC3B-3C794DC7CF0D}.Debug|x86.ActiveCfg = Debug|x86 {650E4519-2DEF-496F-AC3B-3C794DC7CF0D}.Debug|x86.Build.0 = Debug|x86 + {650E4519-2DEF-496F-AC3B-3C794DC7CF0D}.Release|x64.ActiveCfg = Release|x64 + {650E4519-2DEF-496F-AC3B-3C794DC7CF0D}.Release|x64.Build.0 = Release|x64 {650E4519-2DEF-496F-AC3B-3C794DC7CF0D}.Release|x86.ActiveCfg = Release|x86 {650E4519-2DEF-496F-AC3B-3C794DC7CF0D}.Release|x86.Build.0 = Release|x86 EndGlobalSection diff --git a/Game1/Game1.cs b/Game1/Game1.cs index 41454a9..d881174 100644 --- a/Game1/Game1.cs +++ b/Game1/Game1.cs @@ -213,7 +213,7 @@ namespace Game1 for (int j = 0; j < input.getSize().Y; j++) { Rectangle tilePos = new Rectangle(i * (input.getSpacingTile()), j * (input.getSpacingTile()), input.getTileSize(), input.getTileSize()); - spriteBatch.Draw(tile[tractorUnit.getFarm().getCrop(i, j).getStatus()], tilePos, Color.White); + spriteBatch.Draw(tile[tractorUnit.getFarm().getCrop(i, j).getStatus()], tilePos, Time.GetTimeOfDay()); if (tilePos.Intersects(mousePosition)) { spriteBatch.Draw(tile[tractorUnit.getFarm().getCrop(i, j).getStatus()], tilePos, Color.FromNonPremultiplied(0, 0, 20, 40)); diff --git a/Game1/Game1.csproj b/Game1/Game1.csproj index fafc243..ba120d6 100644 --- a/Game1/Game1.csproj +++ b/Game1/Game1.csproj @@ -1,5 +1,5 @@  - + Debug @@ -13,10 +13,13 @@ Game1 512 Windows - v4.5 + v4.6.1 + + + - x86 + x64 true full false @@ -40,6 +43,26 @@ app.manifest + + true + bin\x64\Debug\ + DEBUG;TRACE;WINDOWS + full + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Release\ + TRACE;WINDOWS + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + true + @@ -71,6 +94,7 @@ $(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\Windows\MonoGame.Framework.dll + @@ -88,8 +112,47 @@ + + + + 2.3.1 + + + 1.4.0 + + + 1.4.0 + + + 1.4.0 + + + 1.4.0 + + + 12.0.3 + + + 4.7.0 + + + 1.7.0 + + + 4.5.4 + + + 4.7.0 + + + 4.7.1 + + + 4.11.0 + + + \ No newline at end of file diff --git a/MigrationBackup/21c990a4/Game1/NuGetUpgradeLog.html b/MigrationBackup/21c990a4/Game1/NuGetUpgradeLog.html new file mode 100644 index 0000000..e7157bf --- /dev/null +++ b/MigrationBackup/21c990a4/Game1/NuGetUpgradeLog.html @@ -0,0 +1,174 @@ + + + + + NuGetMigrationLog +

+ NuGet Migration Report - Game1

Overview

Migration to PackageReference was completed successfully. Please build and run your solution to verify that all packages are available.
+ If you run into any problems, have feedback, questions, or concerns, please + file an issue on the NuGet GitHub repository.
+ Changed files and this report have been backed up here: + C:\Users\Joel\source\repos\s444524\JoelForkTest\MigrationBackup\21c990a4\Game1

Packages processed

Top-level dependencies:

Package IdVersion
LightGBM + v2.3.1
Microsoft.ML + v1.4.0
Microsoft.ML.CpuMath + v1.4.0
Microsoft.ML.FastTree + v1.4.0
Microsoft.ML.LightGbm + v1.4.0
Newtonsoft.Json + v12.0.3
System.CodeDom + v4.7.0
System.Collections.Immutable + v1.7.0
System.Memory + v4.5.4
System.Reflection.Emit.Lightweight + v4.7.0
System.Runtime.CompilerServices.Unsafe + v4.7.1
System.Threading.Tasks.Dataflow + v4.11.0

Transitive dependencies:

Package IdVersion
Microsoft.ML.DataView + v1.4.0
System.Buffers + v4.5.1
System.Numerics.Vectors + v4.5.0

Package compatibility issues

Description
+ No issues were found. +
\ No newline at end of file diff --git a/MigrationBackup/21c990a4/Game1/packages.config b/MigrationBackup/21c990a4/Game1/packages.config new file mode 100644 index 0000000..3145969 --- /dev/null +++ b/MigrationBackup/21c990a4/Game1/packages.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 2.20.1 From 0063eb17f868bb0f30683b4cbdc23fbcba740851 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 6 May 2020 17:43:36 +0200 Subject: [PATCH 2/4] Day and night cycle --- Game1/Game1.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Game1/Game1.cs b/Game1/Game1.cs index d881174..e12971d 100644 --- a/Game1/Game1.cs +++ b/Game1/Game1.cs @@ -160,9 +160,9 @@ namespace Game1 - spriteBatch.Draw(house, houseUnit.GetRectangle(), Color.White); + spriteBatch.Draw(house, houseUnit.GetRectangle(), Time.GetTimeOfDay()); spriteBatch.Draw(markers, new Rectangle((int)tractorUnit.getPath().getFinalDest().getCords().X * (input.getSpacingTile()) + Convert.ToInt32(input.getTileSize() / 6), (int)tractorUnit.getPath().getFinalDest().getCords().Y * (input.getSpacingTile()) + Convert.ToInt32(input.getTileSize() / 6), Convert.ToInt32(input.getTileSize() / 1.5), Convert.ToInt32(input.getTileSize() / 1.5)), Color.Red); //Draws the current target of the tractor - spriteBatch.Draw(tractor, new Vector2((int)tractorUnit.getPos().X + input.getTileSize() / 2, (int)tractorUnit.getPos().Y + input.getTileSize() / 2), new Rectangle(0, 0, input.getTileSize(), input.getTileSize()), Color.White, tractorUnit.getRotation(), new Vector2(input.getTileSize() / 2, input.getTileSize() / 2), 1.0f, SpriteEffects.None, 1); + spriteBatch.Draw(tractor, new Vector2((int)tractorUnit.getPos().X + input.getTileSize() / 2, (int)tractorUnit.getPos().Y + input.getTileSize() / 2), new Rectangle(0, 0, input.getTileSize(), input.getTileSize()), Time.GetTimeOfDay(), tractorUnit.getRotation(), new Vector2(input.getTileSize() / 2, input.getTileSize() / 2), 1.0f, SpriteEffects.None, 1); -- 2.20.1 From 75f9eb23cabb4ac9f3591d23a5717d0b36b7aaba Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 6 May 2020 20:26:33 +0200 Subject: [PATCH 3/4] Updated the day night cycle --- Game1/Game1.cs | 8 ++++++-- Game1/Sources/Objects/DayNightCycle.cs | 17 +++++++++++++---- Game1/Sources/Objects/Tractor.cs | 5 +++++ Game1/Sources/Smart/AI.cs | 5 +++++ Game1/Sources/Smart/SmartTractor.cs | 5 +++++ 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/Game1/Game1.cs b/Game1/Game1.cs index e12971d..e028e85 100644 --- a/Game1/Game1.cs +++ b/Game1/Game1.cs @@ -176,8 +176,9 @@ namespace Game1 } spriteBatch.DrawString(Bold, "Time: ", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkRed); - spriteBatch.DrawString(Bold, Time.getDayNight(), new Vector2(60, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkBlue); - spriteBatch.DrawString(Bold, Time.GetTimeOfDayInt().ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 22), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Days " + Time.getDays(), new Vector2(60, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Day Progression: ", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 22), Color.DarkRed); + spriteBatch.DrawString(Bold, Time.GetTimeOfDayInt().ToString() + "%", new Vector2(140, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 22), Color.DarkBlue); spriteBatch.DrawString(Bold, "Tractor Properties:", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 62), Color.DarkRed); @@ -194,6 +195,9 @@ namespace Game1 spriteBatch.DrawString(Bold, "Matrix Size: " + input.getSize().X.ToString() + " X " + input.getSize().Y.ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 242), Color.DarkBlue); spriteBatch.DrawString(Bold, "House Position: " + houseUnit.getVector() / input.getSpacingTile(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 262), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Total Weight: ", new Vector2(700, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 182), Color.DarkRed); + spriteBatch.DrawString(Bold, "(" + tractorUnit.getInventory().getWeight() + "/" + tractorUnit.getInventory().getMaxWeight() + ")", new Vector2(800, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 182), Color.DarkBlue); + tractorUnit.drawInventory(input, spriteBatch, Bold, inventory.getPredefinedItems()); InspectTile(); diff --git a/Game1/Sources/Objects/DayNightCycle.cs b/Game1/Sources/Objects/DayNightCycle.cs index 9a96f65..e111ea1 100644 --- a/Game1/Sources/Objects/DayNightCycle.cs +++ b/Game1/Sources/Objects/DayNightCycle.cs @@ -10,8 +10,9 @@ class DayNightCycle private bool Time = true; private int nightTime = 0; private int dayTime = 0; - private int lengthOfDay = 6000; - private int lengthOfNight = 6000; + private int lengthOfDay = 20000; + private int lengthOfNight = 20000; + private int Days; public void updateTime(int Speed) { @@ -33,6 +34,7 @@ class DayNightCycle { Time = true; nightTime = 0; + Days++; } } } @@ -104,11 +106,18 @@ class DayNightCycle { if (Time) { - return dayTime / 60; + return (int)(100 * ((float)(dayTime + nightTime) / (lengthOfDay + lengthOfNight))) + 1; } else { - return nightTime / 60; + return (int)(100 * ((float)(lengthOfDay + nightTime) / (lengthOfDay + lengthOfNight))) + 1; } + + + } + + public int getDays() + { + return Days; } } diff --git a/Game1/Sources/Objects/Tractor.cs b/Game1/Sources/Objects/Tractor.cs index 8680b60..ba899ed 100644 --- a/Game1/Sources/Objects/Tractor.cs +++ b/Game1/Sources/Objects/Tractor.cs @@ -154,4 +154,9 @@ class Tractor { smartTractor.drawInventory(input, spriteBatch, Bold, itemStorageDefined); } + + public Inventory getInventory() + { + return smartTractor.getInventory(); + } } diff --git a/Game1/Sources/Smart/AI.cs b/Game1/Sources/Smart/AI.cs index 8c8e3a5..38410a7 100644 --- a/Game1/Sources/Smart/AI.cs +++ b/Game1/Sources/Smart/AI.cs @@ -72,4 +72,9 @@ class AI } return farm; } + + public Inventory getInventory() + { + return inventory; + } } diff --git a/Game1/Sources/Smart/SmartTractor.cs b/Game1/Sources/Smart/SmartTractor.cs index ace6fa7..74f5dae 100644 --- a/Game1/Sources/Smart/SmartTractor.cs +++ b/Game1/Sources/Smart/SmartTractor.cs @@ -74,4 +74,9 @@ class SmartTractor farm.updateFarm(Size); } } + + public Inventory getInventory() + { + return ai.getInventory(); + } } -- 2.20.1 From 7fd69946fe8069229a456aeee57876b3ca3cf69c Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 6 May 2020 21:52:30 +0200 Subject: [PATCH 4/4] CropTypes --- Game1/Game1.cs | 2 +- Game1/Game1.csproj | 2 + Game1/Sources/Crops/CropType.cs | 20 ++++ Game1/Sources/Crops/CropTypesHolder.cs | 147 +++++++++++++++++++++++++ Game1/Sources/Crops/Farm.cs | 1 + 5 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 Game1/Sources/Crops/CropType.cs create mode 100644 Game1/Sources/Crops/CropTypesHolder.cs diff --git a/Game1/Game1.cs b/Game1/Game1.cs index e028e85..eb3a5f7 100644 --- a/Game1/Game1.cs +++ b/Game1/Game1.cs @@ -168,7 +168,7 @@ namespace Game1 for (int i = 0; i < 5; i++) { - spriteBatch.Draw(ProgressionBar, new Rectangle(i * 227, (int)(input.getSize().Y * (input.getTileSize() + input.getSpacing())), 5, 300), Color.White); + spriteBatch.Draw(ProgressionBar, new Rectangle(i * 227, (int)(input.getSize().Y * (input.getTileSize() + input.getSpacing())), 5, 295), Color.White); } for (int i = 0; i < 15; i++) { diff --git a/Game1/Game1.csproj b/Game1/Game1.csproj index ba120d6..218552a 100644 --- a/Game1/Game1.csproj +++ b/Game1/Game1.csproj @@ -67,6 +67,8 @@ + + diff --git a/Game1/Sources/Crops/CropType.cs b/Game1/Sources/Crops/CropType.cs new file mode 100644 index 0000000..07faf17 --- /dev/null +++ b/Game1/Sources/Crops/CropType.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + + +class CropTypes +{ + public string[] soilType; + public int[] Times; + public float Temparature; + public float Humidity; + public float Moisture; + public float Nitrogen; + public float Potassium; + public float Phosphorous; +} + diff --git a/Game1/Sources/Crops/CropTypesHolder.cs b/Game1/Sources/Crops/CropTypesHolder.cs new file mode 100644 index 0000000..4419ea0 --- /dev/null +++ b/Game1/Sources/Crops/CropTypesHolder.cs @@ -0,0 +1,147 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +class CropTypesHolder +{ + private CropTypes[] cropTypes = new CropTypes[11]; + + public void init() + { + // Barley + cropTypes[0].soilType[0] = "Sandy"; + cropTypes[0].soilType[1] = null; + cropTypes[0].soilType[2] = null; + cropTypes[0].Temparature = 30.1f; + cropTypes[0].Humidity = 59.0f; + cropTypes[0].Moisture = 41.7f; + cropTypes[0].Nitrogen = 12.6f; + cropTypes[0].Potassium = 5.3f; + cropTypes[0].Phosphorous = 26.0f; + + + // Cotton + cropTypes[1].soilType[0] = "Red"; + cropTypes[1].Times[0] = 5; + cropTypes[1].soilType[1] = "Black"; + cropTypes[1].Times[1] = 4; + cropTypes[1].soilType[2] = "Loamy"; + cropTypes[1].Times[2] = 3; + cropTypes[1].Temparature = 30.4f; + cropTypes[1].Humidity = 59.6f; + cropTypes[1].Moisture = 63.2f; + cropTypes[1].Nitrogen = 16.4f; + cropTypes[1].Potassium = 3.3f; + cropTypes[1].Phosphorous = 23.8f; + + // Ground Nuts + cropTypes[2].soilType[0] = "Red"; + cropTypes[2].soilType[1] = null; + cropTypes[2].soilType[2] = null; + cropTypes[2].Temparature = 30.1f; + cropTypes[2].Humidity = 59.1f; + cropTypes[2].Moisture = 33.1f; + cropTypes[2].Nitrogen = 23.3f; + cropTypes[2].Potassium = 2.0f; + cropTypes[2].Phosphorous = 21.6f; + + + // Maize + cropTypes[3].soilType[0] = "Sandy"; + cropTypes[3].soilType[1] = null; + cropTypes[3].soilType[2] = null; + cropTypes[3].Temparature = 29.0f; + cropTypes[3].Humidity = 57.3f; + cropTypes[3].Moisture = 42.2f; + cropTypes[3].Nitrogen = 18.3f; + cropTypes[3].Potassium = 5.7f; + cropTypes[3].Phosphorous = 18.7f; + + // Millets + cropTypes[4].soilType[0] = "Sandy"; + cropTypes[4].Times[0] = 7; + cropTypes[4].soilType[1] = "Black"; + cropTypes[4].Times[0] = 4; + cropTypes[4].soilType[2] = null; + cropTypes[4].Temparature = 29.5f; + cropTypes[4].Humidity = 57.3f; + cropTypes[4].Moisture = 38.5f; + cropTypes[4].Nitrogen = 23.2f; + cropTypes[4].Potassium = 0; + cropTypes[4].Phosphorous = 14.4f; + + //Oil Seeds + cropTypes[5].soilType[0] = "Black"; + cropTypes[5].soilType[1] = null; + cropTypes[5].soilType[2] = null; + cropTypes[5].Temparature = 30.3f; + cropTypes[5].Humidity = 59.1f; + cropTypes[5].Moisture = 32.1f; + cropTypes[5].Nitrogen = 19.0f; + cropTypes[5].Potassium = 2.3f; + cropTypes[5].Phosphorous = 17.3f; + + //Paddys + cropTypes[6].soilType[0] = "Clayey"; + cropTypes[6].soilType[1] = null; + cropTypes[6].soilType[2] = null; + cropTypes[6].Temparature = 31.2f; + cropTypes[6].Humidity = 60.4f; + cropTypes[6].Moisture = 41.5f; + cropTypes[6].Nitrogen = 20.8f; + cropTypes[6].Potassium = 3.7f; + cropTypes[6].Phosphorous = 16.3f; + + //Pulses + cropTypes[7].soilType[0] = "Clayey"; + cropTypes[7].soilType[1] = null; + cropTypes[7].soilType[2] = null; + cropTypes[7].Temparature = 27.8f; + cropTypes[7].Humidity = 54.9f; + cropTypes[7].Moisture = 34.1f; + cropTypes[7].Nitrogen = 18.4f; + cropTypes[7].Potassium = 4.2f; + cropTypes[7].Phosphorous = 17.5f; + + //Sugarcane + cropTypes[8].soilType[0] = "Loamy"; + cropTypes[8].Times[0] = 9; + cropTypes[8].soilType[1] = "Black"; + cropTypes[8].Times[0] = 4; + cropTypes[8].soilType[2] = null; + cropTypes[8].Temparature = 30.0f; + cropTypes[8].Humidity = 58.6f; + cropTypes[8].Moisture = 51.2f; + cropTypes[8].Nitrogen = 14.6f; + cropTypes[8].Potassium = 4.2f; + cropTypes[8].Phosphorous = 17.6f; + + + //Tobacco + cropTypes[9].soilType[0] = "Red"; + cropTypes[9].soilType[1] = null; + cropTypes[9].soilType[2] = null; + cropTypes[9].Temparature = 31.9f; + cropTypes[9].Humidity = 62.4f; + cropTypes[9].Moisture = 31.6f; + cropTypes[9].Nitrogen = 19.1f; + cropTypes[9].Potassium = 4.9f; + cropTypes[9].Phosphorous = 19.3f; + + + //Wheat + cropTypes[10].soilType[0] = "Loamy"; + cropTypes[10].soilType[1] = null; + cropTypes[10].soilType[2] = null; + cropTypes[10].Temparature = 33.1f; + cropTypes[10].Humidity = 63.8f; + cropTypes[10].Moisture = 50.0f; + cropTypes[10].Nitrogen = 23.3f; + cropTypes[10].Potassium = 2.9f; + cropTypes[10].Phosphorous = 14.4f; + + } +} diff --git a/Game1/Sources/Crops/Farm.cs b/Game1/Sources/Crops/Farm.cs index 6f04ee8..f31b32e 100644 --- a/Game1/Sources/Crops/Farm.cs +++ b/Game1/Sources/Crops/Farm.cs @@ -10,6 +10,7 @@ class Farm { private Crops[,] crops; private Random r; + //initializes the crops public void init(Vector2 Size, Vector2 housepos) -- 2.20.1