Created the colorless sprite font asset. Revitalize got the spriteFontObject. Need to delete bleh.

This commit is contained in:
Joshua Navarro 2017-03-07 15:16:16 -08:00
parent f2782ebad3
commit a68097e542
311 changed files with 3219 additions and 6 deletions

View File

@ -46,6 +46,7 @@
<Compile Include="Menus\Compatability\CompatabilityManager.cs" />
<Compile Include="Menus\Compatability\CompatInterface.cs" />
<Compile Include="Menus\Compatability\MenuCompatabilityBase.cs" />
<Compile Include="Menus\Compatability\SpriteKeyboard.cs" />
<Compile Include="Menus\Compatability\Vanilla\AboutMenu.cs" />
<Compile Include="Menus\Compatability\Vanilla\LoadGameMenu.cs" />
<Compile Include="Menus\Compatability\Vanilla\TitleMenu.cs" />

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MenuControllerCompatability.Menus.Compatability
{
class SpriteKeyboard
{
}
}

22
GeneralMods/blah/blah.sln Normal file
View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 14 for Windows Desktop
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "blah", "blah\blah.csproj", "{50094931-455F-468C-9AB1-C39CAD555431}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{50094931-455F-468C-9AB1-C39CAD555431}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50094931-455F-468C-9AB1-C39CAD555431}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50094931-455F-468C-9AB1-C39CAD555431}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50094931-455F-468C-9AB1-C39CAD555431}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StardewValley;
using StardewModdingAPI;
namespace blah
{
public class Class1 : Mod
{
public override void Entry(IModHelper helper)
{
StardewModdingAPI.Events.LocationEvents.CurrentLocationChanged += LocationEvents_CurrentLocationChanged;
}
private void LocationEvents_CurrentLocationChanged(object sender, StardewModdingAPI.Events.EventArgsCurrentLocationChanged e)
{
Game1.showGlobalMessage("Hey I'm modding");
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("blah")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("blah")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("50094931-455f-468c-9ab1-c39cad555431")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Binary file not shown.

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{50094931-455F-468C-9AB1-C39CAD555431}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>blah</RootNamespace>
<AssemblyName>blah</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.1.5.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.1.5.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.1.5.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.1.5.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Target Name="AfterBuild">
<PropertyGroup>
<ModPath>$(GamePath)\Mods\$(TargetName)</ModPath>
</PropertyGroup>
<Copy SourceFiles="$(TargetDir)\$(TargetName).dll" DestinationFolder="$(ModPath)" />
<Copy SourceFiles="$(TargetDir)\$(TargetName).pdb" DestinationFolder="$(ModPath)" Condition="Exists('$(TargetDir)\$(TargetName).pdb')" />
<Copy SourceFiles="$(TargetDir)\$(TargetName).dll.mdb" DestinationFolder="$(ModPath)" Condition="Exists('$(TargetDir)\$(TargetName).dll.mdb')" />
<Copy SourceFiles="$(ProjectDir)manifest.json" DestinationFolder="$(ModPath)" />
</Target>
</Project>

View File

@ -0,0 +1,14 @@
{
"Name": "blah",
"Authour": "Alpha_Omegasis",
"Version": {
"MajorVersion": 1,
"MinorVersion": 0,
"PatchVersion": 1,
"Build": ""
},
"Description": "bla",
"UniqueID": "4be88c18-b6f3-49b0-ba96-f94b1a5be890",
"PerSaveConfigs": false,
"EntryDll": "blah.dll"
}

View File

@ -0,0 +1,5 @@
C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\GeneralMods\blah\blah\bin\Debug\blah.dll
C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\GeneralMods\blah\blah\bin\Debug\blah.pdb
C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\GeneralMods\blah\blah\obj\Debug\blah.csprojResolveAssemblyReference.cache
C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\GeneralMods\blah\blah\obj\Debug\blah.dll
C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\GeneralMods\blah\blah\obj\Debug\blah.pdb

Binary file not shown.

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="1.5.0" targetFramework="net45" />
</packages>

View File

@ -29,6 +29,7 @@ using Revitalize.Aesthetics;
using Revitalize.Aesthetics.WeatherDebris;
using System.Reflection;
using StardewValley.Menus;
using Revitalize.Resources.DataNodes;
namespace Revitalize
{
@ -305,8 +306,10 @@ namespace Revitalize
List<Item> objShopList = new List<Item>();
List<Item> newInventory = new List<Item>();
TextureDataNode font;
Dictionaries.spriteFontList.TryGetValue("0", out font);
objShopList.Add(new SpriteFontObject(0, Vector2.Zero, font.path, Color.White));
// objShopList.Add(new Spawner(3, Vector2.Zero, 9));
objShopList.Add(new Light(0, Vector2.Zero, LightColors.Aquamarine,LightColors.Aquamarine,false));
objShopList.Add(new Quarry(3, Vector2.Zero,9,"copper"));

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Revitalize.Menus
{
class SpriteKeyboard
{
}
}

View File

@ -0,0 +1,833 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Revitalize.Resources;
using StardewModdingAPI;
using StardewValley;
using StardewValley.Locations;
using StardewValley.Menus;
using StardewValley.Objects;
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace Revitalize.Objects
{
/// <summary>
/// Original Stardew Furniture Class but rewritten to be placed anywhere.
/// </summary>
public class SpriteFontObject : CoreObject
{
public new bool flipped;
[XmlIgnore]
public bool flaggedForPickUp;
private bool lightGlowAdded;
public string texturePath;
public override string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}
public SpriteFontObject()
{
this.updateDrawPosition();
}
public SpriteFontObject(bool f)
{
//does nothng
}
public SpriteFontObject(int which, Vector2 tile, string TexturePath, Color DrawColor,bool randomColor=true)
{
this.drawColor = DrawColor;
if (randomColor == true)
{
this.drawColor = LightColors.randomColor();
}
this.tileLocation = tile;
this.InitializeBasics(0, tile);
if (TextureSheet == null)
{
TextureSheet = Game1.content.Load<Texture2D>(TexturePath);
texturePath = TexturePath;
}
Dictionary<int, string> dictionary = Game1.content.Load<Dictionary<int, string>>("Data\\Furniture");
string[] array = dictionary[which].Split(new char[]
{
'/'
});
this.name = array[0];
this.Decoration_type = this.getTypeNumberFromName(array[1]);
this.description = "Can be placed inside your house.";
this.defaultSourceRect = new Rectangle(which * 16 % TextureSheet.Width, which * 16 / TextureSheet.Width * 16, 1, 1);
if (array[2].Equals("-1"))
{
this.sourceRect = this.getDefaultSourceRectForType(which, this.Decoration_type);
this.defaultSourceRect = this.sourceRect;
}
else
{
this.defaultSourceRect.Width = Convert.ToInt32(array[2].Split(new char[]
{
' '
})[0]);
this.defaultSourceRect.Height = Convert.ToInt32(array[2].Split(new char[]
{
' '
})[1]);
this.sourceRect = new Rectangle(which * 16 % TextureSheet.Width, which * 16 / TextureSheet.Width * 16, this.defaultSourceRect.Width * 16, this.defaultSourceRect.Height * 16);
this.defaultSourceRect = this.sourceRect;
}
this.defaultBoundingBox = new Rectangle((int)this.tileLocation.X, (int)this.tileLocation.Y, 1, 1);
if (array[3].Equals("-1"))
{
this.boundingBox = this.getDefaultBoundingBoxForType(this.Decoration_type);
this.defaultBoundingBox = this.boundingBox;
}
else
{
this.defaultBoundingBox.Width = Convert.ToInt32(array[3].Split(new char[]
{
' '
})[0]);
this.defaultBoundingBox.Height = Convert.ToInt32(array[3].Split(new char[]
{
' '
})[1]);
this.boundingBox = new Rectangle((int)this.tileLocation.X * Game1.tileSize, (int)this.tileLocation.Y * Game1.tileSize, this.defaultBoundingBox.Width * Game1.tileSize, this.defaultBoundingBox.Height * Game1.tileSize);
this.defaultBoundingBox = this.boundingBox;
}
this.updateDrawPosition();
this.rotations = Convert.ToInt32(array[4]);
this.price = Convert.ToInt32(array[5]);
this.parentSheetIndex = which;
}
public override string getDescription()
{
return this.description;
}
public override bool performDropDownAction(Farmer who)
{
this.resetOnPlayerEntry((who == null) ? Game1.currentLocation : who.currentLocation);
return false;
}
public override void hoverAction()
{
base.hoverAction();
if (!Game1.player.isInventoryFull())
{
Game1.mouseCursor = 2;
}
}
public override bool checkForAction(Farmer who, bool justCheckingForActivity = false)
{
var mState = Microsoft.Xna.Framework.Input.Mouse.GetState();
if (mState.RightButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
{
// Game1.showRedMessage("YOOO");
//do some stuff when the right button is down
// Game1.activeClickableMenu = new StardewValley.Menus.ShopMenu(this.inventory);
// rotate();
// Game1.playSound("coin");
return true;
}
else
{
//Game1.showRedMessage("CRY");
}
if (justCheckingForActivity)
{
return true;
}
return this.clicked(who);
}
public override bool clicked(Farmer who)
{
// Game1.showRedMessage("THIS IS CLICKED!!!");
Game1.haltAfterCheck = false;
if (this.Decoration_type == 11 && who.ActiveObject != null && who.ActiveObject != null && this.heldObject == null)
{
// Game1.showRedMessage("Why1?");
return false;
}
if (this.heldObject == null && (who.ActiveObject == null || !(who.ActiveObject is SpriteFontObject)))
{
if (Game1.player.currentLocation is FarmHouse)
{
// Game1.showRedMessage("Why2?");
//this.heldObject = new SpriteFontObject(parentSheetIndex, Vector2.Zero);
Util.addItemToInventoryAndCleanTrackedList(this);
this.flaggedForPickUp = true;
this.thisLocation = null;
return true;
}
else
{
// return true;
this.flaggedForPickUp = true;
if (this is TV)
{
this.heldObject = new TV(parentSheetIndex, Vector2.Zero);
}
else
{
// this.heldObject = new SpriteFontObject(parentSheetIndex, Vector2.Zero);
Util.addItemToInventoryAndCleanTrackedList(this);
// this.heldObject.performRemoveAction(this.tileLocation, who.currentLocation);
// this.heldObject = null;
Game1.playSound("coin");
this.thisLocation = null;
return true;
}
}
}
if (this.heldObject != null && who.addItemToInventoryBool(this.heldObject, false))
{
// Game1.showRedMessage("Why3?");
this.heldObject.performRemoveAction(this.tileLocation, who.currentLocation);
this.heldObject = null;
Util.addItemToInventoryAndCleanTrackedList(this);
Game1.playSound("coin");
this.thisLocation = null;
return true;
}
return false;
}
public override void DayUpdate(GameLocation location)
{
base.DayUpdate(location);
this.lightGlowAdded = false;
if (!Game1.isDarkOut() || (Game1.newDay && !Game1.isRaining))
{
this.removeLights(location);
return;
}
this.addLights(location);
}
public void resetOnPlayerEntry(GameLocation environment)
{
this.removeLights(environment);
if (Game1.isDarkOut())
{
this.addLights(environment);
}
}
public override bool performObjectDropInAction(StardewValley.Object dropIn, bool probe, Farmer who)
{
if ((this.Decoration_type == 11 || this.Decoration_type == 5) && this.heldObject == null && !dropIn.bigCraftable && (!(dropIn is SpriteFontObject) || ((dropIn as SpriteFontObject).getTilesWide() == 1 && (dropIn as SpriteFontObject).getTilesHigh() == 1)))
{
this.heldObject = (StardewValley.Object)dropIn.getOne();
this.heldObject.tileLocation = this.tileLocation;
this.heldObject.boundingBox.X = this.boundingBox.X;
this.heldObject.boundingBox.Y = this.boundingBox.Y;
// Log.AsyncO(getDefaultBoundingBoxForType((dropIn as SpriteFontObject).Decoration_type));
this.heldObject.performDropDownAction(who);
if (!probe)
{
Game1.playSound("woodyStep");
// Log.AsyncC("HUH?");
if (who != null)
{
who.reduceActiveItemByOne();
}
}
return true;
}
return false;
}
private void addLights(GameLocation environment)
{
// this.lightSource.lightTexture = Game1.content.Load<Texture2D>("LooseSprites\\Lighting\\lantern");
if (this.Decoration_type == 7)
{
if (this.sourceIndexOffset == 0)
{
this.sourceRect = this.defaultSourceRect;
this.sourceRect.X = this.sourceRect.X + this.sourceRect.Width;
}
this.sourceIndexOffset = 1;
if (this.lightSource == null)
{
Utility.removeLightSource((int)(this.tileLocation.X * 2000f + this.tileLocation.Y));
this.lightSource = new LightSource(4, new Vector2((float)(this.boundingBox.X + Game1.tileSize / 2), (float)(this.boundingBox.Y - Game1.tileSize)), 2f, Color.Black, (int)(this.tileLocation.X * 2000f + this.tileLocation.Y));
Game1.currentLightSources.Add(this.lightSource);
return;
}
}
else if (this.Decoration_type == 13)
{
if (this.sourceIndexOffset == 0)
{
this.sourceRect = this.defaultSourceRect;
this.sourceRect.X = this.sourceRect.X + this.sourceRect.Width;
}
this.sourceIndexOffset = 1;
if (this.lightGlowAdded)
{
environment.lightGlows.Remove(new Vector2((float)(this.boundingBox.X + Game1.tileSize / 2), (float)(this.boundingBox.Y + Game1.tileSize)));
this.lightGlowAdded = false;
}
}
}
private void removeLights(GameLocation environment)
{
if (this.Decoration_type == 7)
{
if (this.sourceIndexOffset == 1)
{
this.sourceRect = this.defaultSourceRect;
}
this.sourceIndexOffset = 0;
Utility.removeLightSource((int)(this.tileLocation.X * 2000f + this.tileLocation.Y));
this.lightSource = null;
return;
}
if (this.Decoration_type == 13)
{
if (this.sourceIndexOffset == 1)
{
this.sourceRect = this.defaultSourceRect;
}
this.sourceIndexOffset = 0;
if (Game1.isRaining)
{
this.sourceRect = this.defaultSourceRect;
this.sourceRect.X = this.sourceRect.X + this.sourceRect.Width;
this.sourceIndexOffset = 1;
return;
}
if (!this.lightGlowAdded && !environment.lightGlows.Contains(new Vector2((float)(this.boundingBox.X + Game1.tileSize / 2), (float)(this.boundingBox.Y + Game1.tileSize))))
{
environment.lightGlows.Add(new Vector2((float)(this.boundingBox.X + Game1.tileSize / 2), (float)(this.boundingBox.Y + Game1.tileSize)));
}
this.lightGlowAdded = true;
}
}
public override bool minutesElapsed(int minutes, GameLocation environment)
{
if (Game1.isDarkOut())
{
this.addLights(environment);
}
else
{
this.removeLights(environment);
}
return false;
}
public override void performRemoveAction(Vector2 tileLocation, GameLocation environment)
{
this.removeLights(environment);
if (this.Decoration_type == 13 && this.lightGlowAdded)
{
environment.lightGlows.Remove(new Vector2((float)(this.boundingBox.X + Game1.tileSize / 2), (float)(this.boundingBox.Y + Game1.tileSize)));
this.lightGlowAdded = false;
}
base.performRemoveAction(tileLocation, environment);
}
public bool isGroundFurniture()
{
return this.Decoration_type != 13 && this.Decoration_type != 6 && this.Decoration_type != 13;
}
public override bool canBeGivenAsGift()
{
return false;
}
public override bool canBePlacedHere(GameLocation l, Vector2 tile)
{
if ((l is FarmHouse))
{
for (int i = 0; i < this.boundingBox.Width / Game1.tileSize; i++)
{
for (int j = 0; j < this.boundingBox.Height / Game1.tileSize; j++)
{
Vector2 vector = tile * (float)Game1.tileSize + new Vector2((float)i, (float)j) * (float)Game1.tileSize;
vector.X += (float)(Game1.tileSize / 2);
vector.Y += (float)(Game1.tileSize / 2);
foreach (KeyValuePair<Vector2, StardewValley.Object> something in l.objects)
{
StardewValley.Object obj = something.Value;
if ((obj.GetType()).ToString().Contains("SpriteFontObject"))
{
SpriteFontObject current = (SpriteFontObject)obj;
if (current.Decoration_type == 11 && current.getBoundingBox(current.tileLocation).Contains((int)vector.X, (int)vector.Y) && current.heldObject == null && this.getTilesWide() == 1)
{
bool result = true;
return result;
}
if ((current.Decoration_type != 12 || this.Decoration_type == 12) && current.getBoundingBox(current.tileLocation).Contains((int)vector.X, (int)vector.Y))
{
bool result = false;
return result;
}
}
}
}
}
return base.canBePlacedHere(l, tile);
}
else
{
// Game1.showRedMessage("NOT FARMHOUSE");
for (int i = 0; i < this.boundingBox.Width / Game1.tileSize; i++)
{
for (int j = 0; j < this.boundingBox.Height / Game1.tileSize; j++)
{
Vector2 vector = tile * (float)Game1.tileSize + new Vector2((float)i, (float)j) * (float)Game1.tileSize;
vector.X += (float)(Game1.tileSize / 2);
vector.Y += (float)(Game1.tileSize / 2);
/*
foreach (SpriteFontObject current in (l as FarmHouse).SpriteFontObject)
{
if (current.Decoration_type == 11 && current.getBoundingBox(current.tileLocation).Contains((int)vector.X, (int)vector.Y) && current.heldObject == null && this.getTilesWide() == 1)
{
bool result = true;
return result;
}
if ((current.Decoration_type != 12 || this.Decoration_type == 12) && current.getBoundingBox(current.tileLocation).Contains((int)vector.X, (int)vector.Y))
{
bool result = false;
return result;
}
}
*/
}
}
return base.canBePlacedHere(l, tile);
}
}
public void updateDrawPosition()
{
this.drawPosition = new Vector2((float)this.boundingBox.X, (float)(this.boundingBox.Y - (this.sourceRect.Height * Game1.pixelZoom - this.boundingBox.Height)));
}
public int getTilesWide()
{
return this.boundingBox.Width / Game1.tileSize;
}
public int getTilesHigh()
{
return this.boundingBox.Height / Game1.tileSize;
}
public override bool placementAction(GameLocation location, int x, int y, Farmer who = null)
{
if (location is FarmHouse)
{
Point point = new Point(x / Game1.tileSize, y / Game1.tileSize);
List<Rectangle> walls = FarmHouse.getWalls((location as FarmHouse).upgradeLevel);
this.tileLocation = new Vector2((float)point.X, (float)point.Y);
bool flag = false;
if (this.Decoration_type == 6 || this.Decoration_type == 13 || this.parentSheetIndex == 1293)
{
int num = (this.parentSheetIndex == 1293) ? 3 : 0;
bool flag2 = false;
foreach (Rectangle current in walls)
{
if ((this.Decoration_type == 6 || this.Decoration_type == 13 || num != 0) && current.Y + num == point.Y && current.Contains(point.X, point.Y - num))
{
flag2 = true;
break;
}
}
if (!flag2)
{
Game1.showRedMessage("Must be placed on wall");
return false;
}
flag = true;
}
for (int i = point.X; i < point.X + this.getTilesWide(); i++)
{
for (int j = point.Y; j < point.Y + this.getTilesHigh(); j++)
{
if (location.doesTileHaveProperty(i, j, "NoFurniture", "Back") != null)
{
Game1.showRedMessage("Furniture can't be placed here");
return false;
}
if (!flag && Utility.pointInRectangles(walls, i, j))
{
Game1.showRedMessage("Can't place on wall");
return false;
}
if (location.getTileIndexAt(i, j, "Buildings") != -1)
{
return false;
}
}
}
this.boundingBox = new Rectangle(x / Game1.tileSize * Game1.tileSize, y / Game1.tileSize * Game1.tileSize, this.boundingBox.Width, this.boundingBox.Height);
foreach (KeyValuePair<Vector2, StardewValley.Object> c in location.objects)
{
StardewValley.Object ehh = c.Value;
if (((ehh.GetType()).ToString()).Contains("Spawner"))
{
Decoration current2 = (Decoration)ehh;
if (current2.Decoration_type == 11 && current2.heldObject == null && current2.getBoundingBox(current2.tileLocation).Intersects(this.boundingBox))
{
current2.performObjectDropInAction(this, false, (who == null) ? Game1.player : who);
bool result = true;
return result;
}
}
}
foreach (Farmer current3 in location.getFarmers())
{
if (current3.GetBoundingBox().Intersects(this.boundingBox))
{
Game1.showRedMessage("Can't place on top of a person.");
bool result = false;
return result;
}
}
this.updateDrawPosition();
// Log.AsyncO(this.boundingBox);
// Log.AsyncO(x);
// Log.AsyncY(y);
for (int i = 0; i <= this.boundingBox.X / Game1.tileSize; i++)
{
Util.placementAction(this, location, x + 1, y, who);
}
for (int i = 0; i <= this.boundingBox.Y / Game1.tileSize; i++)
{
Util.placementAction(this, location, x + 1, y, who);
}
return true;
}
else
{
Point point = new Point(x / Game1.tileSize, y / Game1.tileSize);
// List<Rectangle> walls = FarmHouse.getWalls((location as FarmHouse).upgradeLevel);
this.tileLocation = new Vector2((float)point.X, (float)point.Y);
bool flag = false;
if (this.Decoration_type == 6 || this.Decoration_type == 13 || this.parentSheetIndex == 1293)
{
int num = (this.parentSheetIndex == 1293) ? 3 : 0;
bool flag2 = false;
if (!flag2)
{
Game1.showRedMessage("Must be placed on wall");
return false;
}
flag = true;
}
for (int i = point.X; i < point.X + this.getTilesWide(); i++)
{
for (int j = point.Y; j < point.Y + this.getTilesHigh(); j++)
{
if (location.doesTileHaveProperty(i, j, "NoFurniture", "Back") != null)
{
Game1.showRedMessage("Furniture can't be placed here");
return false;
}
/*
if (!flag && Utility.pointInRectangles(walls, i, j))
{
Game1.showRedMessage("Can't place on wall");
return false;
}
*/
if (location.getTileIndexAt(i, j, "Buildings") != -1)
{
return false;
}
}
}
this.boundingBox = new Rectangle(x / Game1.tileSize * Game1.tileSize, y / Game1.tileSize * Game1.tileSize, this.boundingBox.Width, this.boundingBox.Height);
foreach (Farmer current3 in location.getFarmers())
{
if (current3.GetBoundingBox().Intersects(this.boundingBox))
{
Game1.showRedMessage("Can't place on top of a person.");
bool result = false;
return result;
}
}
this.updateDrawPosition();
this.thisLocation = Game1.player.currentLocation;
return Util.placementAction(this, location, x, y, who);
}
}
public override bool isPlaceable()
{
return true;
}
public override Rectangle getBoundingBox(Vector2 tileLocation)
{
return this.boundingBox;
}
private Rectangle getDefaultSourceRectForType(int tileIndex, int type)
{
return new Rectangle(tileIndex * 16 % TextureSheet.Width, tileIndex * 16 / TextureSheet.Width * 16, 1 * 16, 1 * 16);
}
private Rectangle getDefaultBoundingBoxForType(int type)
{
int num;
int num2;
switch (type)
{
case 0:
num = 1;
num2 = 1;
goto IL_94;
case 1:
num = 2;
num2 = 1;
goto IL_94;
case 2:
num = 3;
num2 = 1;
goto IL_94;
case 3:
num = 2;
num2 = 1;
goto IL_94;
case 4:
num = 2;
num2 = 1;
goto IL_94;
case 5:
num = 5;
num2 = 2;
goto IL_94;
case 6:
num = 2;
num2 = 2;
goto IL_94;
case 7:
num = 1;
num2 = 1;
goto IL_94;
case 8:
num = 1;
num2 = 1;
goto IL_94;
case 10:
num = 2;
num2 = 1;
goto IL_94;
case 11:
num = 2;
num2 = 2;
goto IL_94;
case 12:
num = 3;
num2 = 2;
goto IL_94;
case 13:
num = 1;
num2 = 2;
goto IL_94;
}
num = 1;
num2 = 1;
IL_94:
return new Rectangle((int)this.tileLocation.X * Game1.tileSize, (int)this.tileLocation.Y * Game1.tileSize, num * Game1.tileSize, num2 * Game1.tileSize);
}
private int getTypeNumberFromName(string typeName)
{
string key;
switch (key = typeName.ToLower())
{
case "chair":
return 0;
case "bench":
return 1;
case "couch":
return 2;
case "armchair":
return 3;
case "dresser":
return 4;
case "long table":
return 5;
case "painting":
return 6;
case "lamp":
return 7;
case "decor":
return 8;
case "bookcase":
return 10;
case "table":
return 11;
case "rug":
return 12;
case "window":
return 13;
}
return 9;
}
public override int salePrice()
{
return this.price;
}
public override int maximumStackSize()
{
return 1;
}
public override int getStack()
{
return this.stack;
}
public override int addToStack(int amount)
{
return 1;
}
private float getScaleSize()
{
int num = this.sourceRect.Width / 16;
int num2 = this.sourceRect.Height / 16;
if (num >= 5)
{
return 0.75f;
}
if (num2 >= 3)
{
return 1f;
}
if (num <= 2)
{
return 2f;
}
if (num <= 4)
{
return 1f;
}
return 0.1f;
}
public override void drawWhenHeld(SpriteBatch spriteBatch, Vector2 objectPosition, Farmer f)
{
spriteBatch.Draw(this.TextureSheet, objectPosition, new Microsoft.Xna.Framework.Rectangle?(Game1.currentLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Util.invertColor(this.drawColor), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
}
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber)
{
spriteBatch.Draw(TextureSheet, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Rectangle?(this.defaultSourceRect), Util.invertColor(this.drawColor), 0f, new Vector2((float)(this.defaultSourceRect.Width / 2), (float)(this.defaultSourceRect.Height / 2)), 1f * this.getScaleSize() * scaleSize, SpriteEffects.None, layerDepth);
}
public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f)
{
if (x == -1)
{
spriteBatch.Draw(TextureSheet, Game1.GlobalToLocal(Game1.viewport, this.drawPosition), new Rectangle?(this.sourceRect), Util.invertColor(this.drawColor) * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.Decoration_type == 12) ? 0f : ((float)(this.boundingBox.Bottom - 8) / 10000f));
}
else
{
spriteBatch.Draw(TextureSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), (float)(y * Game1.tileSize - (this.sourceRect.Height * Game1.pixelZoom - this.boundingBox.Height)))), new Rectangle?(this.sourceRect), Util.invertColor(this.drawColor) * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.Decoration_type == 12) ? 0f : ((float)(this.boundingBox.Bottom - 8) / 10000f));
}
if (this.heldObject != null)
{
if (this.heldObject is Light)
{
(this.heldObject as Light).drawAtNonTileSpot(spriteBatch, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - (this.heldObject as Spell).sourceRect.Height * Game1.pixelZoom - Game1.tileSize / 4))), (float)(this.boundingBox.Bottom - 7) / 10000f, alpha);
return;
}
spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - Game1.tileSize * 4 / 3))) + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize * 5 / 6)), new Rectangle?(Game1.shadowTexture.Bounds), Util.invertColor(this.drawColor) * alpha, 0f, new Vector2((float)Game1.shadowTexture.Bounds.Center.X, (float)Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, (float)this.boundingBox.Bottom / 10000f);
spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - Game1.tileSize * 4 / 3))), new Rectangle?(Game1.currentLocation.getSourceRectForObject(this.heldObject.ParentSheetIndex)), Util.invertColor(this.drawColor) * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)(this.boundingBox.Bottom + 1) / 10000f);
}
}
public override void drawAtNonTileSpot(SpriteBatch spriteBatch, Vector2 location, float layerDepth, float alpha = 1f)
{
spriteBatch.Draw(TextureSheet, location, new Rectangle?(this.sourceRect), Util.invertColor(this.drawColor) * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth);
}
public override Item getOne()
{
SpriteFontObject SpriteFontObject = new SpriteFontObject(this.parentSheetIndex, this.tileLocation, this.texturePath, this.drawColor);
/*
drawPosition = this.drawPosition;
defaultBoundingBox = this.defaultBoundingBox;
boundingBox = this.boundingBox;
currentRotation = this.currentRotation - 1;
rotations = this.rotations;
rotate();
*/
return SpriteFontObject;
}
public override string getCategoryName()
{
return "Sprite Font";
// return base.getCategoryName();
}
public override Color getCategoryColor()
{
return Util.invertColor(LightColors.SaddleBrown);
}
}
}

View File

@ -0,0 +1,22 @@
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Revitalize.Resources.DataNodes
{
public class TextureDataNode
{
public Texture2D texture;
public string path;
public TextureDataNode(Texture2D Texture, string Path)
{
texture = Texture;
path = Path;
}
}
}

View File

@ -8,6 +8,8 @@ using Revitalize.Resources.DataNodes;
using Revitalize.Objects;
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using Microsoft.Xna.Framework.Graphics;
using System.IO;
namespace Revitalize.Resources
{
@ -26,6 +28,7 @@ namespace Revitalize.Resources
public static Dictionary<string, QuarryDataNode> quarryList;
public static Dictionary<string, SeedDataNode> seedList;
public static Dictionary<int, Spell> spellList;
public static Dictionary<string, TextureDataNode> spriteFontList;
public static Dictionary<string, WeatherDebris> weatherDebrisDictionary;
@ -37,6 +40,7 @@ namespace Revitalize.Resources
seedList = new Dictionary<string, SeedDataNode>();
spellList = new Dictionary<int, Spell>();
weatherDebrisDictionary = new Dictionary<string, WeatherDebris>();
spriteFontList = new Dictionary<string, TextureDataNode>();
fillAllDictionaries();
}
@ -48,6 +52,7 @@ namespace Revitalize.Resources
fillSeedList();
fillSpellList();
fillWeatherDebrisList();
fillSpriteFontList();
}
@ -55,6 +60,7 @@ namespace Revitalize.Resources
{
acceptedTypes.Add("Revitalize.Objects.Decoration", new SerializerDataNode(new ser(Serialize.serializeDecoration) ,new par(Serialize.parseDecoration),new world(Serialize.serializeDecorationFromWorld)));
acceptedTypes.Add("Revitalize.Objects.Light", new SerializerDataNode(new ser(Serialize.serializeLight), new par(Serialize.parseLight),new world(Serialize.serializeLightFromWorld)));
acceptedTypes.Add("Revitalize.Objects.SpriteFontObject", new SerializerDataNode(new ser(Serialize.serializeSpriteFontObject), new par(Serialize.parseSpriteFontObject), new world(Serialize.serializeSpriteFontObjectFromWorld)));
acceptedTypes.Add("Revitalize.Objects.shopObject", new SerializerDataNode(new ser(Serialize.serializeShopObject), new par(Serialize.parseShopObject), new world(Serialize.serializeShopObjectFromWorld)));
acceptedTypes.Add("Revitalize.Objects.Machines.Quarry", new SerializerDataNode(new ser(Serialize.serializeQuarry), new par(Serialize.parseQuarry),new world(Serialize.serializeQuarryFromWorld)));
acceptedTypes.Add("Revitalize.Objects.Machines.Spawner", new SerializerDataNode(new ser(Serialize.serializeSpawner), new par(Serialize.parseSpawner), new world(Serialize.serializeSpawnerFromWorld)));
@ -153,5 +159,12 @@ namespace Revitalize.Resources
weatherDebrisDictionary.Add("Pink Flower Petal", w);
}
public static void fillSpriteFontList()
{
spriteFontList.Add("0", new TextureDataNode(Game1.content.Load<Texture2D>(Path.Combine("Revitalize", "Fonts", "colorlessSpriteFont", "vanilla", "0")), Path.Combine("Revitalize", "Fonts", "colorlessSpriteFont", "vanilla", "0")));
}
}
}

View File

@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using StardewValley;
using System;
using System.Collections.Generic;
using System.Linq;
@ -319,6 +320,15 @@ namespace Revitalize.Resources
//Custom Colors go beneath here
public static Color randomColor()
{
Random r = new Random(Game1.player.money + Game1.tileSize + Game1.dayOfMonth);
int R = r.Next(0, 255);
int G = r.Next(0, 255);
int B = r.Next(0, 255);
int A = 255;
return new Color(R, G, B, A);
}
}
}

View File

@ -64,6 +64,7 @@
<Compile Include="Menus\FarmOptionsMenu.cs" />
<Compile Include="Menus\GameMenu.cs" />
<Compile Include="Menus\InventoryPage.cs" />
<Compile Include="Menus\SpriteKeyboard.cs" />
<Compile Include="Objects\Decoration.cs" />
<Compile Include="Objects\ExtraSeeds.cs" />
<Compile Include="Objects\GiftPackage.cs" />
@ -73,6 +74,7 @@
<Compile Include="Objects\Machines\Spawner.cs" />
<Compile Include="Menus\LightCustomizer.cs" />
<Compile Include="Objects\shopObject.cs" />
<Compile Include="Objects\SpriteFontObject.cs" />
<Compile Include="Persistance\MapSwapData.cs" />
<Compile Include="Persistance\PlayerVariables.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@ -80,6 +82,7 @@
<Compile Include="Resources\DataNodes\SeedDataNode.cs" />
<Compile Include="Resources\DataNodes\SerializerDataNode.cs" />
<Compile Include="Resources\DataNodes\SpellFunctionDataNode.cs" />
<Compile Include="Resources\DataNodes\TextureDataNode.cs" />
<Compile Include="Resources\DataNodes\TrackedTerrainDataNode.cs" />
<Compile Include="Resources\DataNodes\TrackedTerrainDummyDataNode.cs" />
<Compile Include="Resources\Dictionaries.cs" />

View File

@ -888,6 +888,111 @@ namespace Revitalize
Serialize.WriteToJsonFile(Path.Combine(objectsInWorldPath, d.thisLocation.name, d.Name + ".json"), (Light)d);
}
public static SpriteFontObject parseSpriteFontObject(string data)
{
dynamic obj = JObject.Parse(data);
// Log.AsyncC(data);
// Log.AsyncC(obj.thisType);
SpriteFontObject d = new SpriteFontObject(false);
d.price = obj.price;
d.Decoration_type = obj.Decoration_type;
d.rotations = obj.rotations;
d.currentRotation = obj.currentRotation;
string s1 = Convert.ToString(obj.sourceRect);
d.sourceRect = Util.parseRectFromJson(s1);
string s2 = Convert.ToString(obj.defaultSourceRect);
d.defaultSourceRect = Util.parseRectFromJson(s2);
string s3 = Convert.ToString(obj.defaultBoundingBox);
d.defaultBoundingBox = Util.parseRectFromJson(s3);
d.description = obj.description;
d.flipped = obj.flipped;
d.flaggedForPickUp = obj.flaggedForPickUp;
d.tileLocation = obj.tileLocation;
d.parentSheetIndex = obj.parentSheetIndex;
d.owner = obj.owner;
d.name = obj.name;
d.type = obj.type;
d.canBeSetDown = obj.canBeSetDown;
d.canBeGrabbed = obj.canBeGrabbed;
d.isHoedirt = obj.isHoedirt;
d.isSpawnedObject = obj.isSpawnedObject;
d.questItem = obj.questItem;
d.isOn = obj.isOn;
d.fragility = obj.fragility;
d.edibility = obj.edibility;
d.stack = obj.stack;
d.quality = obj.quality;
d.bigCraftable = obj.bigCraftable;
d.setOutdoors = obj.setOutdoors;
d.setIndoors = obj.setIndoors;
d.readyForHarvest = obj.readyForHarvest;
d.showNextIndex = obj.showNextIndex;
d.hasBeenPickedUpByFarmer = obj.hasBeenPickedUpByFarmer;
d.isRecipe = obj.isRecipe;
d.isLamp = obj.isLamp;
d.heldObject = obj.heldObject;
d.minutesUntilReady = obj.minutesUntilReady;
string s4 = Convert.ToString(obj.boundingBox);
d.boundingBox = Util.parseRectFromJson(s4);
d.scale = obj.scale;
d.lightSource = obj.lightSource;
d.shakeTimer = obj.shakeTimer;
d.internalSound = obj.internalSound;
d.specialVariable = obj.specialVariable;
d.category = obj.category;
d.specialItem = obj.specialItem;
d.hasBeenInInventory = obj.hasBeenInInventory;
string t = obj.texturePath;
// Log.AsyncC(t);
d.TextureSheet = Game1.content.Load<Texture2D>(t);
d.texturePath = t;
JArray array = obj.inventory;
d.inventory = array.ToObject<List<Item>>();
d.inventoryMaxSize = obj.inventoryMaxSize;
d.itemReadyForHarvest = obj.itemReadyForHarvest;
d.lightsOn = obj.lightsOn;
// d.thisLocation = Game1.getLocationFromName(loc);
// d.thisLocation = obj.thisLocation;
Log.AsyncC(d.thisLocation);
d.lightColor = obj.lightColor;
d.thisType = obj.thisType;
d.removable = obj.removable;
d.locationsName = obj.locationsName;
d.drawColor = obj.drawColor;
try
{
return d;
}
catch (Exception e)
{
Log.AsyncM(e);
return null;
}
}
public static void serializeSpriteFontObject(Item d)
{
Serialize.WriteToJsonFile(Path.Combine(InvPath, d.Name + ".json"), (SpriteFontObject)d);
}
public static void serializeSpriteFontObjectFromWorld(CoreObject d)
{
Serialize.WriteToJsonFile(Path.Combine(objectsInWorldPath, d.thisLocation.name, d.Name + ".json"), (SpriteFontObject)d);
}
public static Quarry parseQuarry(string data)
{

Some files were not shown because too many files have changed in this diff Show More