Added in AboutMenu controller compatability
This commit is contained in:
parent
929e113ef1
commit
38453852f0
|
@ -142,7 +142,8 @@ namespace Revitalize
|
|||
if (Game1.activeClickableMenu is StardewValley.Menus.TitleMenu && Revitalize.Menus.Compatability.CompatabilityManager.aboutMenu == true)
|
||||
{
|
||||
Log.AsyncO("BOOOO");
|
||||
// compatabilityMenu = new Menus.Compatability.Vanilla.TitleMenu();
|
||||
Menus.Compatability.CompatabilityManager.compatabilityMenu = new Menus.Compatability.Vanilla.AboutMenu();
|
||||
Menus.Compatability.CompatabilityManager.doUpdate = true;
|
||||
// compatabilityMenu.Compatability();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -7,13 +7,14 @@ using Microsoft.Xna.Framework;
|
|||
using StardewValley;
|
||||
using System.Timers;
|
||||
using StardewModdingAPI;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
|
||||
namespace Revitalize.Menus.Compatability
|
||||
{
|
||||
class MenuCompatabilityBase : CompatInterface
|
||||
{
|
||||
|
||||
public static Point startingPositionIndex = new Point(0, 1);
|
||||
public static Point startingPositionIndex;
|
||||
public static Point CurrentLocationIndex;
|
||||
public Dictionary<Point, Rectangle> componentList;
|
||||
public int width;
|
||||
|
@ -80,24 +81,75 @@ namespace Revitalize.Menus.Compatability
|
|||
|
||||
public virtual void Compatability()
|
||||
{
|
||||
// throw new NotImplementedException();
|
||||
GamePadState currentState = GamePad.GetState(PlayerIndex.One);
|
||||
if ((double)currentState.ThumbSticks.Left.X < 0 || currentState.IsButtonDown(Buttons.LeftThumbstickLeft))
|
||||
{
|
||||
moveLeft();
|
||||
}
|
||||
if ((double)currentState.ThumbSticks.Left.X > 0 || currentState.IsButtonDown(Buttons.LeftThumbstickRight))
|
||||
{
|
||||
moveRight();
|
||||
}
|
||||
|
||||
if ((double)currentState.ThumbSticks.Left.Y < 0 || currentState.IsButtonDown(Buttons.LeftThumbstickRight))
|
||||
{
|
||||
moveDown();
|
||||
}
|
||||
|
||||
if ((double)currentState.ThumbSticks.Left.Y > 0 || currentState.IsButtonDown(Buttons.LeftThumbstickRight))
|
||||
{
|
||||
moveUp();
|
||||
}
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public virtual void moveLeft()
|
||||
{
|
||||
// throw new NotImplementedException();
|
||||
if (canMoveInMenu == false) return;
|
||||
activateTimer();
|
||||
CurrentLocationIndex.X--;
|
||||
|
||||
Rectangle p;
|
||||
if (CurrentLocationIndex.X <= minX)
|
||||
{
|
||||
CurrentLocationIndex.X = minX;
|
||||
}
|
||||
// Log.AsyncC("CRY");
|
||||
componentList.TryGetValue(CurrentLocationIndex, out p);
|
||||
|
||||
|
||||
|
||||
updateMouse(getComponentCenter(p));
|
||||
}
|
||||
|
||||
public virtual void moveRight()
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
if (canMoveInMenu == false) return;
|
||||
activateTimer();
|
||||
CurrentLocationIndex.X++;
|
||||
|
||||
Rectangle p;
|
||||
|
||||
if (CurrentLocationIndex.X >= maxX)
|
||||
{
|
||||
CurrentLocationIndex.X = maxX;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Log.AsyncC("CRY");
|
||||
componentList.TryGetValue(CurrentLocationIndex, out p);
|
||||
updateMouse(getComponentCenter(p));
|
||||
}
|
||||
|
||||
public virtual void Update()
|
||||
{
|
||||
// throw new NotImplementedException();
|
||||
Rectangle p;
|
||||
componentList.TryGetValue(CurrentLocationIndex, out p);
|
||||
updateMouse(getComponentCenter(p));
|
||||
}
|
||||
|
||||
public virtual void updateMouse(Point p)
|
||||
|
@ -116,12 +168,39 @@ namespace Revitalize.Menus.Compatability
|
|||
|
||||
public virtual void moveUp()
|
||||
{
|
||||
// throw new NotImplementedException();
|
||||
if (canMoveInMenu == false) return;
|
||||
activateTimer();
|
||||
CurrentLocationIndex.Y--;
|
||||
|
||||
Rectangle p;
|
||||
|
||||
// Log.AsyncC("CRY");
|
||||
componentList.TryGetValue(CurrentLocationIndex, out p);
|
||||
|
||||
if (CurrentLocationIndex.Y < minY)
|
||||
{
|
||||
CurrentLocationIndex.Y = minY;
|
||||
}
|
||||
|
||||
updateMouse(getComponentCenter(p));
|
||||
}
|
||||
|
||||
public virtual void moveDown()
|
||||
{
|
||||
// throw new NotImplementedException();
|
||||
if (canMoveInMenu == false) return;
|
||||
activateTimer();
|
||||
CurrentLocationIndex.Y++;
|
||||
|
||||
Rectangle p;
|
||||
if (CurrentLocationIndex.Y > maxY)
|
||||
{
|
||||
CurrentLocationIndex.Y = maxY;
|
||||
}
|
||||
// Log.AsyncC("CRY");
|
||||
componentList.TryGetValue(CurrentLocationIndex, out p);
|
||||
|
||||
|
||||
updateMouse(getComponentCenter(p));
|
||||
}
|
||||
|
||||
public virtual void resize()
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Revitalize.Menus.Compatability.Vanilla
|
||||
{
|
||||
class AboutMenu : MenuCompatabilityBase
|
||||
{
|
||||
public AboutMenu()
|
||||
{
|
||||
minY = 1;
|
||||
maxY = 4;
|
||||
minX = 1;
|
||||
maxX = 1;
|
||||
canMoveInMenu = true;
|
||||
this.width = Game1.viewport.Width;
|
||||
this.height = Game1.viewport.Height;
|
||||
|
||||
componentList = new Dictionary<Point, Rectangle>();
|
||||
|
||||
CurrentLocationIndex = startingPositionIndex = new Point(1, 1);
|
||||
componentList.Clear();
|
||||
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, 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, 4), new Rectangle(this.width + -198 - 48, this.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(3, 2), new Rectangle(this.width / 2 - 111 - 24, this.height - 174 - 24, 222, 174));//load
|
||||
componentList.Add(new Point(4, 2), new Rectangle(this.width / 2 + 111, this.height - 174 - 24, 222, 174));//exit
|
||||
componentList.Add(new Point(5, 2), new Rectangle(this.width + -66 - 48, this.height - 75 - 24, 66, 75)); //about
|
||||
//int end = componentList.Count+1;
|
||||
|
||||
//full screen button
|
||||
for (int i = 4; i <= 5; i++)
|
||||
{
|
||||
componentList.Add(new Point(i, 1), new Rectangle(Game1.viewport.Width - 9 * Game1.pixelZoom - Game1.tileSize / 4, Game1.tileSize / 4, 9 * Game1.pixelZoom, 9 * Game1.pixelZoom));
|
||||
}
|
||||
//MUTE BUTTON
|
||||
componentList.Add(new Point(1, 1), new Rectangle(Game1.tileSize / 4, Game1.tileSize / 4, 9 * Game1.pixelZoom, 9 * Game1.pixelZoom));
|
||||
componentList.Add(new Point(2, 1), new Rectangle(Game1.tileSize / 4, Game1.tileSize / 4, 9 * Game1.pixelZoom, 9 * Game1.pixelZoom));
|
||||
componentList.Add(new Point(3, 1), new Rectangle(Game1.tileSize / 4, Game1.tileSize / 4, 9 * Game1.pixelZoom, 9 * Game1.pixelZoom));
|
||||
//add in menu secrets here
|
||||
|
||||
|
||||
CompatabilityManager.characterCustomizer = false;
|
||||
*/
|
||||
Menus.Compatability.MenuCompatabilityBase.millisecondMoveDelay = 100;
|
||||
}
|
||||
|
||||
|
||||
public override void Compatability()
|
||||
{
|
||||
base.Compatability();
|
||||
}
|
||||
|
||||
|
||||
//same code as movement but no change
|
||||
|
||||
|
||||
public override void moveLeft()
|
||||
{
|
||||
base.moveLeft();
|
||||
}
|
||||
public override void moveRight()
|
||||
{
|
||||
base.moveRight();
|
||||
}
|
||||
|
||||
public override void moveDown()
|
||||
{
|
||||
base.moveDown();
|
||||
}
|
||||
|
||||
public override void moveUp()
|
||||
{
|
||||
base.moveUp();
|
||||
}
|
||||
|
||||
public override void resize()
|
||||
{
|
||||
Menus.Compatability.CompatabilityManager.compatabilityMenu = new TitleMenu();
|
||||
}
|
||||
public override void Update()
|
||||
{
|
||||
GamePadState currentState = GamePad.GetState(PlayerIndex.One);
|
||||
if (currentState.Buttons.A == ButtonState.Pressed && CurrentLocationIndex.X == 1 && CurrentLocationIndex.Y == 1)
|
||||
{
|
||||
|
||||
// Menus.Compatability.CompatabilityManager.doUpdate = false;
|
||||
// Log.AsyncC("A pressed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentState.Buttons.A == ButtonState.Pressed && CurrentLocationIndex.X == 1 && CurrentLocationIndex.Y == 2)
|
||||
{
|
||||
|
||||
// Menus.Compatability.CompatabilityManager.doUpdate = false;
|
||||
//CompatabilityManager.loadMenu = true;
|
||||
|
||||
// Log.AsyncC("A pressed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentState.Buttons.A == ButtonState.Pressed && CurrentLocationIndex.X == 1 && CurrentLocationIndex.Y == 3)
|
||||
{
|
||||
|
||||
// Menus.Compatability.CompatabilityManager.doUpdate = false;
|
||||
|
||||
|
||||
// Log.AsyncC("A pressed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentState.Buttons.A == ButtonState.Pressed && CurrentLocationIndex.X == 1 && CurrentLocationIndex.Y == 4)
|
||||
{
|
||||
|
||||
// Menus.Compatability.CompatabilityManager.doUpdate = false;
|
||||
CompatabilityManager.aboutMenu = false;
|
||||
CompatabilityManager.compatabilityMenu = new Menus.Compatability.Vanilla.TitleMenu();
|
||||
|
||||
// Log.AsyncC("A pressed");
|
||||
return;
|
||||
}
|
||||
|
||||
base.Update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -28,7 +28,7 @@ namespace Revitalize.Menus.Compatability.Vanilla
|
|||
CurrentLocationIndex =startingPositionIndex= new Point(2, 2);
|
||||
|
||||
|
||||
|
||||
componentList.Clear();
|
||||
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(4, 2), new Rectangle(this.width / 2 + 111, this.height - 174 - 24, 222, 174));//exit
|
||||
|
@ -49,48 +49,41 @@ namespace Revitalize.Menus.Compatability.Vanilla
|
|||
|
||||
CompatabilityManager.characterCustomizer = false;
|
||||
Menus.Compatability.MenuCompatabilityBase.millisecondMoveDelay = 100;
|
||||
//Log.AsyncC("WTF");
|
||||
}
|
||||
|
||||
|
||||
public override void Compatability()
|
||||
{
|
||||
// Get the current gamepad state.
|
||||
GamePadState currentState = GamePad.GetState(PlayerIndex.One);
|
||||
|
||||
// Log.AsyncG("DOES THIS WORK???");
|
||||
|
||||
if ((double)currentState.ThumbSticks.Left.X < 0 || currentState.IsButtonDown(Buttons.LeftThumbstickLeft))
|
||||
{
|
||||
// Log.AsyncC(currentState.ThumbSticks.Left);
|
||||
moveLeft();
|
||||
}
|
||||
if ((double)currentState.ThumbSticks.Left.X > 0 || currentState.IsButtonDown(Buttons.LeftThumbstickRight))
|
||||
{
|
||||
// Log.AsyncC(currentState.ThumbSticks.Left);
|
||||
moveRight();
|
||||
}
|
||||
|
||||
if ((double)currentState.ThumbSticks.Left.Y < 0 || currentState.IsButtonDown(Buttons.LeftThumbstickRight))
|
||||
{
|
||||
// Log.AsyncC(currentState.ThumbSticks.Left);
|
||||
moveDown();
|
||||
}
|
||||
|
||||
if ((double)currentState.ThumbSticks.Left.Y > 0 || currentState.IsButtonDown(Buttons.LeftThumbstickRight))
|
||||
{
|
||||
// Log.AsyncC(currentState.ThumbSticks.Left);
|
||||
moveUp();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Update();
|
||||
base.Compatability();
|
||||
}
|
||||
|
||||
|
||||
//same code as movement but no change
|
||||
|
||||
|
||||
public override void moveLeft()
|
||||
{
|
||||
base.moveLeft();
|
||||
}
|
||||
public override void moveRight()
|
||||
{
|
||||
base.moveRight();
|
||||
}
|
||||
|
||||
public override void moveDown()
|
||||
{
|
||||
base.moveDown();
|
||||
}
|
||||
|
||||
public override void moveUp()
|
||||
{
|
||||
base.moveUp();
|
||||
}
|
||||
|
||||
public override void resize()
|
||||
{
|
||||
Menus.Compatability.CompatabilityManager.compatabilityMenu = new TitleMenu();
|
||||
}
|
||||
public override void Update()
|
||||
{
|
||||
|
||||
|
@ -98,7 +91,7 @@ namespace Revitalize.Menus.Compatability.Vanilla
|
|||
if (currentState.Buttons.A == ButtonState.Pressed && CurrentLocationIndex.X == 2 && CurrentLocationIndex.Y == 2)
|
||||
{
|
||||
|
||||
Menus.Compatability.CompatabilityManager.doUpdate = false;
|
||||
// Menus.Compatability.CompatabilityManager.doUpdate = false;
|
||||
CompatabilityManager.characterCustomizer = true;
|
||||
|
||||
// Log.AsyncC("A pressed");
|
||||
|
@ -108,7 +101,7 @@ namespace Revitalize.Menus.Compatability.Vanilla
|
|||
if (currentState.Buttons.A == ButtonState.Pressed && CurrentLocationIndex.X == 3 && CurrentLocationIndex.Y == 2)
|
||||
{
|
||||
|
||||
Menus.Compatability.CompatabilityManager.doUpdate = false;
|
||||
// Menus.Compatability.CompatabilityManager.doUpdate = false;
|
||||
CompatabilityManager.loadMenu = true;
|
||||
|
||||
// Log.AsyncC("A pressed");
|
||||
|
@ -118,104 +111,14 @@ namespace Revitalize.Menus.Compatability.Vanilla
|
|||
if (currentState.Buttons.A == ButtonState.Pressed && CurrentLocationIndex.X == 5 && CurrentLocationIndex.Y == 2)
|
||||
{
|
||||
|
||||
Menus.Compatability.CompatabilityManager.doUpdate = false;
|
||||
CompatabilityManager.compatabilityMenu = new Menus.Compatability.Vanilla.AboutMenu();
|
||||
CompatabilityManager.aboutMenu = true;
|
||||
|
||||
// Log.AsyncC("A pressed");
|
||||
return;
|
||||
}
|
||||
|
||||
Rectangle p;
|
||||
|
||||
|
||||
componentList.TryGetValue(CurrentLocationIndex, out p);
|
||||
|
||||
|
||||
updateMouse(getComponentCenter(p));
|
||||
}
|
||||
|
||||
public override void moveLeft()
|
||||
{
|
||||
if (canMoveInMenu == false) return;
|
||||
activateTimer();
|
||||
CurrentLocationIndex.X--;
|
||||
|
||||
Rectangle p;
|
||||
if (CurrentLocationIndex.X <= minX)
|
||||
{
|
||||
CurrentLocationIndex.X = minX;
|
||||
}
|
||||
// Log.AsyncC("CRY");
|
||||
componentList.TryGetValue(CurrentLocationIndex, out p);
|
||||
|
||||
|
||||
|
||||
updateMouse(getComponentCenter(p));
|
||||
|
||||
}
|
||||
public override void moveRight()
|
||||
{
|
||||
|
||||
if (canMoveInMenu == false) return;
|
||||
activateTimer();
|
||||
CurrentLocationIndex.X++;
|
||||
|
||||
Rectangle p;
|
||||
|
||||
if (CurrentLocationIndex.X >= maxX)
|
||||
{
|
||||
CurrentLocationIndex.X = maxX;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Log.AsyncC("CRY");
|
||||
componentList.TryGetValue(CurrentLocationIndex, out p);
|
||||
updateMouse(getComponentCenter(p));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void moveDown()
|
||||
{
|
||||
if (canMoveInMenu == false) return;
|
||||
activateTimer();
|
||||
CurrentLocationIndex.Y++;
|
||||
|
||||
Rectangle p;
|
||||
if (CurrentLocationIndex.Y > maxY)
|
||||
{
|
||||
CurrentLocationIndex.Y = maxY;
|
||||
}
|
||||
// Log.AsyncC("CRY");
|
||||
componentList.TryGetValue(CurrentLocationIndex, out p);
|
||||
|
||||
|
||||
updateMouse(getComponentCenter(p));
|
||||
}
|
||||
|
||||
public override void 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;
|
||||
}
|
||||
|
||||
updateMouse(getComponentCenter(p));
|
||||
}
|
||||
|
||||
public override void resize()
|
||||
{
|
||||
Menus.Compatability.CompatabilityManager.compatabilityMenu = new TitleMenu();
|
||||
base.Update();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
<Compile Include="Menus\Compatability\CompatabilityManager.cs" />
|
||||
<Compile Include="Menus\Compatability\CompatInterface.cs" />
|
||||
<Compile Include="Menus\Compatability\MenuCompatabilityBase.cs" />
|
||||
<Compile Include="Menus\Compatability\Vanilla\AboutMenu.cs" />
|
||||
<Compile Include="Menus\Compatability\Vanilla\TitleMenu.cs" />
|
||||
<Compile Include="Menus\FarmOptionsMenu.cs" />
|
||||
<Compile Include="Menus\GameMenu.cs" />
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue