More UI
This commit is contained in:
parent
dd96c58976
commit
e2ac5f3572
@ -17,7 +17,7 @@ class Controller
|
||||
public Vector2 updateWindow(int tileSize, int Spacing, Vector2 Size)
|
||||
{
|
||||
KeyboardState state = Keyboard.GetState();
|
||||
if (state.IsKeyDown(Keys.D) && Size.X < 100)
|
||||
if (state.IsKeyDown(Keys.D) && Size.X < 90)
|
||||
{
|
||||
Size.X++;
|
||||
graphics.PreferredBackBufferWidth = (tileSize + Spacing) * (int)Size.X - Spacing;
|
||||
|
@ -302,6 +302,28 @@ class Crops
|
||||
//ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Temperature, Sample.Temparature));
|
||||
//ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Moisture, Sample.Moisture));
|
||||
//ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Humidity, Sample.Humidity));
|
||||
if (DataSet.soilType[0] != null)
|
||||
{
|
||||
if (Sample.soilType[0] == soilProperties.soilType)
|
||||
{
|
||||
ProductionRate = ProductionRate + 0.1f;
|
||||
}
|
||||
if (DataSet.soilType[1] != null)
|
||||
{
|
||||
if (Sample.soilType[1] == soilProperties.soilType)
|
||||
{
|
||||
ProductionRate = ProductionRate + 0.08f;
|
||||
}
|
||||
if (DataSet.soilType[2] != null)
|
||||
{
|
||||
if (Sample.soilType[2] == soilProperties.soilType)
|
||||
{
|
||||
ProductionRate = ProductionRate + 0.5f;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
min = Math.Min(compareToDatset(soilProperties.Phosphorous, Sample.Phosphorous), Math.Min(compareToDatset(soilProperties.Potassium, Sample.Potassium), compareToDatset(soilProperties.Nitrogen, Sample.Nitrogen)));
|
||||
ProductionRate = ProductionRate + (ProductionRate * min);
|
||||
if (ProductionRate < 0)
|
||||
|
@ -46,7 +46,7 @@ class SoilProperties
|
||||
soilType = "Clayey";
|
||||
}
|
||||
Temperature = GetRandomNumber(22, 30);
|
||||
Humidity = Temperature * GetRandomNumber(1.9, 2.1);
|
||||
Humidity = Temperature * GetRandomNumber(1.9f, 2.1f);
|
||||
Moisture = GetRandomNumber(20, 70);
|
||||
Nitrogen = GetRandomNumber(4 , 42); //was 4, 60
|
||||
Potassium = GetRandomNumber(0.01f, 19); // was 0, 28
|
||||
|
@ -12,6 +12,8 @@ class Inventory
|
||||
{
|
||||
private int Weight = 0;
|
||||
private int maxWeight = 350;
|
||||
private int[] totalHarvested = new int[11];
|
||||
private int[] totalFertilizerUsed = new int[8];
|
||||
private Cargo cargo = new Cargo();
|
||||
private Cargo itemStorage = new Cargo();
|
||||
|
||||
@ -59,6 +61,10 @@ class Inventory
|
||||
public bool addItem(int newItemIndex, int Type)
|
||||
{
|
||||
Items newItem;
|
||||
if (Type == 1)
|
||||
{
|
||||
totalHarvested[newItemIndex]++;
|
||||
}
|
||||
newItem = itemStorage.getItemByIndex(newItemIndex, Type);
|
||||
if (maxWeight >= Weight + newItem.getWeight())
|
||||
{
|
||||
@ -76,10 +82,14 @@ class Inventory
|
||||
// Uses an item from the tractor.
|
||||
// 0 = Fertilizer
|
||||
// 1 = Crops
|
||||
public bool useItem(int Index, int Type)
|
||||
public bool useItem(int Index, int Type, bool isClearing)
|
||||
{
|
||||
if (cargo.itemExists(Index, Type))
|
||||
{
|
||||
if (Type == 0 && !isClearing)
|
||||
{
|
||||
totalFertilizerUsed[Index]++;
|
||||
}
|
||||
removeItem(Index, Type);
|
||||
return true;
|
||||
}
|
||||
@ -101,6 +111,7 @@ class Inventory
|
||||
|
||||
public void removeItem(int Index, int Type)
|
||||
{
|
||||
|
||||
Weight = Weight - itemStorage.getItemByIndex(Index, Type).getWeight();
|
||||
cargo.removeItem(Index, Type);
|
||||
}
|
||||
@ -113,10 +124,10 @@ class Inventory
|
||||
public void clearInventory()
|
||||
{
|
||||
for (int i = 0; i <= 6; i++)
|
||||
while (useItem(i, 0)) ;
|
||||
while (useItem(i, 0, true)) ;
|
||||
|
||||
for (int i = 0; i <= 10; i++)
|
||||
while (useItem(i, 1)) ;
|
||||
while (useItem(i, 1, true)) ;
|
||||
}
|
||||
|
||||
public void fillWithFertilizer()
|
||||
@ -145,15 +156,21 @@ class Inventory
|
||||
{
|
||||
|
||||
spriteBatch.DrawString(Bold, "Crops: ", new Vector2(470, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkRed);
|
||||
spriteBatch.DrawString(Bold, "Harvested:", new Vector2(600, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkRed);
|
||||
for (int i = 0; i < 11; i++) //Print Crops
|
||||
{
|
||||
spriteBatch.DrawString(Bold, cargo.getCount(i, 1) + " " + itemStorage.getItemByIndex(i, 1).getItemType(), new Vector2(470, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20 * i + 22), Color.DarkBlue);
|
||||
spriteBatch.DrawString(Bold, totalHarvested[i].ToString(), new Vector2(620, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20 * i + 22), Color.DarkBlue);
|
||||
}
|
||||
|
||||
spriteBatch.DrawString(Bold, "Fertilizers: ", new Vector2(700, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkRed);
|
||||
spriteBatch.DrawString(Bold, "Used ", new Vector2(830, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkRed);
|
||||
for (int i = 0; i < 7; i++) //Print Fertilizers
|
||||
{
|
||||
spriteBatch.DrawString(Bold, cargo.getCount(i, 0) + " " + itemStorage.getItemByIndex(i, 0).getItemType(), new Vector2(700, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20 * i + 22), Color.DarkBlue);
|
||||
spriteBatch.DrawString(Bold, totalFertilizerUsed[i].ToString(), new Vector2(835, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20 * i + 22), Color.DarkBlue);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ class AI
|
||||
if (farm.getCrop(x, y).getStatus() >= 2)
|
||||
{
|
||||
fertilizer = fertilizerHolder.GetFertilizer(Engine.PredictFertilizer(farm.getCrop(x, y), farm.getPresetCropTypes(farm.getCrop(x, y).getCropType())));
|
||||
while (!(farm.getCrop(x, y).isSaturated(-1)) && farm.getCrop(x, y).belowCapacity() && inventory.useItem(fertilizerHolder.GetFertilizerID(fertilizer.Name), 0))
|
||||
while (!(farm.getCrop(x, y).isSaturated(-1)) && farm.getCrop(x, y).belowCapacity() && inventory.useItem(fertilizerHolder.GetFertilizerID(fertilizer.Name), 0, false))
|
||||
{
|
||||
farm.getCrop(x, y).Fertilize(fertilizer);
|
||||
fertilizer = fertilizerHolder.GetFertilizer(Engine.PredictFertilizer(farm.getCrop(x, y), farm.getPresetCropTypes(farm.getCrop(x, y).getCropType())));
|
||||
|
Loading…
Reference in New Issue
Block a user