yea, load game works. cool

This commit is contained in:
Joshua Navarro 2017-03-07 00:57:51 -08:00
parent 294f5cee65
commit f2782ebad3
9 changed files with 115 additions and 26 deletions

View File

@ -30,6 +30,8 @@ namespace MenuControllerCompatability
private void MenuCompatability(object sender, EventArgs e) private void MenuCompatability(object sender, EventArgs e)
{ {
if (Game1.activeClickableMenu == null) return;
//Log.AsyncC(Game1.activeClickableMenu.GetType());
GamePadState currentState = GamePad.GetState(PlayerIndex.One); GamePadState currentState = GamePad.GetState(PlayerIndex.One);
if (currentState.IsConnected == false||Game1.options.gamepadControls==false) return; if (currentState.IsConnected == false||Game1.options.gamepadControls==false) return;
// if (Game1.options.gamepadControls == false && useMenuFocus==false) return; // if (Game1.options.gamepadControls == false && useMenuFocus==false) return;

View File

@ -47,6 +47,7 @@
<Compile Include="Menus\Compatability\CompatInterface.cs" /> <Compile Include="Menus\Compatability\CompatInterface.cs" />
<Compile Include="Menus\Compatability\MenuCompatabilityBase.cs" /> <Compile Include="Menus\Compatability\MenuCompatabilityBase.cs" />
<Compile Include="Menus\Compatability\Vanilla\AboutMenu.cs" /> <Compile Include="Menus\Compatability\Vanilla\AboutMenu.cs" />
<Compile Include="Menus\Compatability\Vanilla\LoadGameMenu.cs" />
<Compile Include="Menus\Compatability\Vanilla\TitleMenu.cs" /> <Compile Include="Menus\Compatability\Vanilla\TitleMenu.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
@ -69,12 +70,12 @@
</Target> </Target>
--> -->
<Target Name="AfterBuild"> <Target Name="AfterBuild">
<PropertyGroup> <PropertyGroup>
<ModPath>$(GamePath)\Mods\$(TargetName)</ModPath> <ModPath>$(GamePath)\Mods\$(TargetName)</ModPath>
</PropertyGroup> </PropertyGroup>
<Copy SourceFiles="$(TargetDir)\$(TargetName).dll" DestinationFolder="$(ModPath)" /> <Copy SourceFiles="$(TargetDir)\$(TargetName).dll" DestinationFolder="$(ModPath)" />
<Copy SourceFiles="$(TargetDir)\$(TargetName).pdb" DestinationFolder="$(ModPath)" Condition="Exists('$(TargetDir)\$(TargetName).pdb')" /> <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="$(TargetDir)\$(TargetName).dll.mdb" DestinationFolder="$(ModPath)" Condition="Exists('$(TargetDir)\$(TargetName).dll.mdb')" />
<Copy SourceFiles="$(ProjectDir)manifest.json" DestinationFolder="$(ModPath)" /> <Copy SourceFiles="$(ProjectDir)manifest.json" DestinationFolder="$(ModPath)" />
</Target> </Target>
</Project> </Project>

View File

@ -155,7 +155,7 @@ namespace Compatability
public virtual void updateMouse(Point p) public virtual void updateMouse(Point p)
{ {
if (p.X == 0 && p.Y == 0) p = startingPositionIndex; if (p.X == 0 || p.Y == 0) p = startingPositionIndex;
Game1.setMousePosition(p); Game1.setMousePosition(p);
} }

View File

@ -23,7 +23,11 @@ namespace Compatability.Vanilla
componentList = new Dictionary<Point, Rectangle>(); componentList = new Dictionary<Point, Rectangle>();
CurrentLocationIndex = startingPositionIndex = new Point(1, 1); componentList.Add(new Point(-1, -1), new Rectangle(-999, -999, 2, 2));
CurrentLocationIndex = new Point(-1, -1);
startingPositionIndex = new Point(1, 1);
componentList.Clear(); componentList.Clear();
Vector2 topLeftPositionForCenteringOnScreen = Utility.getTopLeftPositionForCenteringOnScreen(800, 600, 0, 0); Vector2 topLeftPositionForCenteringOnScreen = Utility.getTopLeftPositionForCenteringOnScreen(800, 600, 0, 0);
componentList.Add(new Point(1, 1), new Rectangle((int)topLeftPositionForCenteringOnScreen.X + Game1.tileSize / 2, (int)topLeftPositionForCenteringOnScreen.Y + 600 - 100 - Game1.tileSize * 3 - Game1.pixelZoom * 4, 800 - Game1.tileSize, Game1.tileSize)); componentList.Add(new Point(1, 1), new Rectangle((int)topLeftPositionForCenteringOnScreen.X + Game1.tileSize / 2, (int)topLeftPositionForCenteringOnScreen.Y + 600 - 100 - Game1.tileSize * 3 - Game1.pixelZoom * 4, 800 - Game1.tileSize, Game1.tileSize));

View File

@ -1,10 +1,12 @@
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input;
using StardewModdingAPI;
using StardewValley; using StardewValley;
using StardewValley.Menus; using StardewValley.Menus;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -14,35 +16,47 @@ namespace Compatability.Vanilla
{ {
public LoadGameMenu() public LoadGameMenu()
{ {
minY = 0; minY = 1;
maxY = 4; maxY = 4;
minX = 1; minX = 1;
maxX = 2; maxX = 3;
canMoveInMenu = true; canMoveInMenu = true;
this.width = Game1.viewport.Width / 2 - (1100 + IClickableMenu.borderWidth * 2) / 2; this.width = Game1.viewport.Width / 2 - (1100 + IClickableMenu.borderWidth * 2) / 2;
this.height = Game1.viewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2; this.height = Game1.viewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2;
componentList = new Dictionary<Point, Rectangle>(); componentList = new Dictionary<Point, Rectangle>();
CurrentLocationIndex = startingPositionIndex = new Point(1, 1);
componentList.Add(new Point(-1, -1), new Rectangle(-999, -999, 2, 2));
CurrentLocationIndex = new Point(-1, -1);
startingPositionIndex = new Point(1, 1);
componentList.Clear(); componentList.Clear();
Vector2 topLeftPositionForCenteringOnScreen = Utility.getTopLeftPositionForCenteringOnScreen(800, 600, 0, 0); Vector2 topLeftPositionForCenteringOnScreen = Utility.getTopLeftPositionForCenteringOnScreen(800, 600, 0, 0);
//componentList.Add(new Point(1, 1), new Rectangle((int)topLeftPositionForCenteringOnScreen.X + Game1.tileSize / 2, (int)topLeftPositionForCenteringOnScreen.Y + 600 - 100 - Game1.tileSize * 3 - Game1.pixelZoom * 4, 800 - Game1.tileSize, Game1.tileSize)); //componentList.Add(new Point(1, 1), new Rectangle((int)topLeftPositionForCenteringOnScreen.X + Game1.tileSize / 2, (int)topLeftPositionForCenteringOnScreen.Y + 600 - 100 - Game1.tileSize * 3 - Game1.pixelZoom * 4, 800 - Game1.tileSize, Game1.tileSize));
//componentList.Add(new Point(1, 2), new Rectangle((int)topLeftPositionForCenteringOnScreen.X + Game1.tileSize / 2, (int)topLeftPositionForCenteringOnScreen.Y + 600 - 100 - Game1.tileSize * 2 - Game1.pixelZoom * 4, 800 - Game1.tileSize, Game1.tileSize)); //componentList.Add(new Point(1, 2), new Rectangle((int)topLeftPositionForCenteringOnScreen.X + Game1.tileSize / 2, (int)topLeftPositionForCenteringOnScreen.Y + 600 - 100 - Game1.tileSize * 2 - Game1.pixelZoom * 4, 800 - Game1.tileSize, Game1.tileSize));
//componentList.Add(new Point(1, 3), new Rectangle((int)topLeftPositionForCenteringOnScreen.X + Game1.tileSize / 2, (int)topLeftPositionForCenteringOnScreen.Y + 600 - 100 - Game1.tileSize * 1 - Game1.pixelZoom * 4, 800 - Game1.tileSize, Game1.tileSize)); //componentList.Add(new Point(1, 3), new Rectangle((int)topLeftPositionForCenteringOnScreen.X + Game1.tileSize / 2, (int)topLeftPositionForCenteringOnScreen.Y + 600 - 100 - Game1.tileSize * 1 - Game1.pixelZoom * 4, 800 - Game1.tileSize, Game1.tileSize));
for (int i = 0; i < 4; i++)
{ componentList.Add(new Point(1,1),new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + Game1.tileSize *10, Game1.activeClickableMenu.yPositionOnScreen + Game1.tileSize+ 1 * (int)(this.height*1.75f), this.width - Game1.tileSize / 2, this.height / 4 + Game1.pixelZoom));
componentList.Add(new Point(1,i),new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + Game1.tileSize / 4, Game1.activeClickableMenu.yPositionOnScreen + Game1.tileSize / 4 + i * (this.height / 4), this.width - Game1.tileSize / 2, this.height / 4 + Game1.pixelZoom)); componentList.Add(new Point(1, 2), new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + Game1.tileSize * 10, Game1.activeClickableMenu.yPositionOnScreen + Game1.tileSize + 2 * (int)(this.height * 1.75f), this.width - Game1.tileSize / 2, this.height / 4 + Game1.pixelZoom));
componentList.Add(new Point(2, i), new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + this.width - Game1.tileSize - Game1.pixelZoom, Game1.activeClickableMenu.yPositionOnScreen + Game1.tileSize / 2 + Game1.pixelZoom + i * (this.height / 4), 12 * Game1.pixelZoom, 12 * Game1.pixelZoom)); componentList.Add(new Point(1, 3), new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + Game1.tileSize * 10, Game1.activeClickableMenu.yPositionOnScreen + Game1.tileSize + 3 * (int)(this.height * 1.75f), this.width - Game1.tileSize / 2, this.height / 4 + Game1.pixelZoom));
// this.deleteButtons.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width - Game1.tileSize - Game1.pixelZoom, this.yPositionOnScreen + Game1.tileSize / 2 + Game1.pixelZoom + i * (this.height / 4), 12 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "Delete File", Game1.mouseCursors, new Rectangle(322, 498, 12, 12), (float)Game1.pixelZoom * 3f / 4f, false)); componentList.Add(new Point(1, 4), new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + Game1.tileSize * 10, Game1.activeClickableMenu.yPositionOnScreen + Game1.tileSize + 4 * (int)(this.height * 1.75f), this.width - Game1.tileSize / 2, this.height / 4 + Game1.pixelZoom));
}
componentList.Add(new Point(2, 1), new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + this.width + (int)(Game1.tileSize*17.5f) - Game1.pixelZoom, (int)(Game1.viewport.Height * .15f), 12 * Game1.pixelZoom, 12 * Game1.pixelZoom));
componentList.Add(new Point(2, 2), new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + this.width + (int)(Game1.tileSize * 17.5f) - Game1.pixelZoom, (int)(Game1.viewport.Height * .35f), 12 * Game1.pixelZoom, 12 * Game1.pixelZoom));
componentList.Add(new Point(2, 3), new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + this.width + (int)(Game1.tileSize * 17.5f) - Game1.pixelZoom, (int)(Game1.viewport.Height * .55f), 12 * Game1.pixelZoom, 12 * Game1.pixelZoom));
componentList.Add(new Point(2, 4), new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + this.width + (int)(Game1.tileSize * 17.5f) - Game1.pixelZoom, (int)(Game1.viewport.Height * .75f) , 12 * Game1.pixelZoom, 12 * Game1.pixelZoom));
// this.deleteButtons.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width - Game1.tileSize - Game1.pixelZoom, this.yPositionOnScreen + Game1.tileSize / 2 + Game1.pixelZoom + i * (this.height / 4), 12 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "Delete File", Game1.mouseCursors, new Rectangle(322, 498, 12, 12), (float)Game1.pixelZoom * 3f / 4f, false));
//back button //back button
componentList.Add(new Point(3, 1), new Rectangle(this.width + -198 - 48, this.height - 81 - 24, 198, 81)); componentList.Add(new Point(3, 1), new Rectangle(Game1.viewport.Width + -198 - 48, Game1.viewport.Height- 81 - 24, 198, 81));
componentList.Add(new Point(3,2), new Rectangle(this.width + -198 - 48, this.height - 81 - 24, 198, 81)); componentList.Add(new Point(3,2), new Rectangle(Game1.viewport.Width + -198 - 48, Game1.viewport.Height - 81 - 24, 198, 81));
componentList.Add(new Point(3, 3), new Rectangle(this.width + -198 - 48, this.height - 81 - 24, 198, 81)); componentList.Add(new Point(3, 3), new Rectangle(Game1.viewport.Width + -198 - 48, Game1.viewport.Height - 81 - 24, 198, 81));
componentList.Add(new Point(3, 4), new Rectangle(this.width + -198 - 48, this.height - 81 - 24, 198, 81)); componentList.Add(new Point(3, 4), new Rectangle(Game1.viewport.Width + -198 - 48, Game1.viewport.Height - 81 - 24, 198, 81));
/* /*
componentList.Add(new Point(2, 2), new Rectangle(width / 2 - 333 - 48, height - 174 - 24, 222, 174));//play componentList.Add(new Point(2, 2), new Rectangle(width / 2 - 333 - 48, height - 174 - 24, 222, 174));//play
componentList.Add(new Point(3, 2), new Rectangle(this.width / 2 - 111 - 24, this.height - 174 - 24, 222, 174));//load componentList.Add(new Point(3, 2), new Rectangle(this.width / 2 - 111 - 24, this.height - 174 - 24, 222, 174));//load
@ -83,17 +97,82 @@ namespace Compatability.Vanilla
} }
public override void moveRight() public override void moveRight()
{ {
Log.AsyncG(CurrentLocationIndex);
base.moveRight(); base.moveRight();
} }
public override void moveDown() public override void moveDown()
{ {
base.moveDown(); if (canMoveInMenu == false) return;
activateTimer();
CurrentLocationIndex.Y++;
Rectangle p;
if (CurrentLocationIndex.Y >= maxY)
{
CurrentLocationIndex.Y = maxY;
try
{
object l = Game1.activeClickableMenu;
l = (StardewValley.Menus.LoadGameMenu)Game1.activeClickableMenu.GetType().GetField("subMenu", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Game1.activeClickableMenu);
// FieldInfo f = Game1.activeClickableMenu.GetType().GetField("subMenu", BindingFlags.NonPublic | BindingFlags.Instance);
//Log.AsyncG(l.GetType());
// Game1.activeClickableMenu.GetType().GetProperty("subMenu").GetValue(Game1.activeClickableMenu, null);
MethodInfo dynMethod = l.GetType().GetMethod("receiveScrollWheelAction",
BindingFlags.Public | BindingFlags.Instance);
dynMethod.Invoke(l, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Public, null, new object[] { -1 }, null);
}
catch (Exception e)
{
Log.AsyncO(e);
}
}
// Log.AsyncC("CRY");
componentList.TryGetValue(CurrentLocationIndex, out p);
updateMouse(getComponentCenter(p));
} }
public override void moveUp() public override void moveUp()
{ {
base.moveUp(); if (canMoveInMenu == false) return;
activateTimer();
CurrentLocationIndex.Y--;
Rectangle p;
// Log.AsyncC("CRY");
componentList.TryGetValue(CurrentLocationIndex, out p);
if (CurrentLocationIndex.Y < minY)
{
CurrentLocationIndex.Y = minY;
try
{
object l = Game1.activeClickableMenu;
l = (StardewValley.Menus.LoadGameMenu)Game1.activeClickableMenu.GetType().GetField("subMenu", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Game1.activeClickableMenu);
// FieldInfo f = Game1.activeClickableMenu.GetType().GetField("subMenu", BindingFlags.NonPublic | BindingFlags.Instance);
//Log.AsyncG(l.GetType());
// Game1.activeClickableMenu.GetType().GetProperty("subMenu").GetValue(Game1.activeClickableMenu, null);
MethodInfo dynMethod = l.GetType().GetMethod("receiveScrollWheelAction",
BindingFlags.Public | BindingFlags.Instance);
dynMethod.Invoke(l, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Public, null, new object[] { 1 }, null);
}
catch (Exception e)
{
Log.AsyncO(e);
}
}
updateMouse(getComponentCenter(p));
} }
public override void resize() public override void resize()

View File

@ -25,8 +25,10 @@ namespace Compatability.Vanilla
componentList = new Dictionary<Point, Rectangle>(); componentList = new Dictionary<Point, Rectangle>();
CurrentLocationIndex =startingPositionIndex= new Point(2, 2);
componentList.Add(new Point(-1, -1), new Rectangle(-999, -999, 2, 2));
CurrentLocationIndex = new Point(-1, -1);
startingPositionIndex = new Point(2, 2);
componentList.Clear(); componentList.Clear();
componentList.Add(new Point(2, 2), new Rectangle(width / 2 - 333 - 48, height - 174 - 24, 222, 174));//play componentList.Add(new Point(2, 2), new Rectangle(width / 2 - 333 - 48, height - 174 - 24, 222, 174));//play

View File

@ -2,3 +2,4 @@ C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\Ge
C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\GeneralMods\MenuControllerCompatability\MenuControllerCompatability\bin\Debug\MenuControllerCompatability.pdb C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\GeneralMods\MenuControllerCompatability\MenuControllerCompatability\bin\Debug\MenuControllerCompatability.pdb
C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\GeneralMods\MenuControllerCompatability\MenuControllerCompatability\obj\Debug\MenuControllerCompatability.dll C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\GeneralMods\MenuControllerCompatability\MenuControllerCompatability\obj\Debug\MenuControllerCompatability.dll
C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\GeneralMods\MenuControllerCompatability\MenuControllerCompatability\obj\Debug\MenuControllerCompatability.pdb C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\GeneralMods\MenuControllerCompatability\MenuControllerCompatability\obj\Debug\MenuControllerCompatability.pdb
C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\GeneralMods\MenuControllerCompatability\MenuControllerCompatability\obj\Debug\MenuControllerCompatability.csprojResolveAssemblyReference.cache