Added in arcade cabinet type. Added in seaside scramble.
This commit is contained in:
parent
9ab33bba38
commit
5af8e025bd
Binary file not shown.
After Width: | Height: | Size: 899 B |
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Revitalize.Framework.Factories.Objects.Furniture;
|
||||
using Revitalize.Framework.Objects.Extras;
|
||||
using Revitalize.Framework.Objects.InformationFiles.Furniture;
|
||||
|
||||
namespace Revitalize.Framework.Factories.Objects.Extras
|
||||
{
|
||||
public class ArcadeFactoryInfo:FactoryInfo
|
||||
{
|
||||
public ArcadeCabinetInformation arcadeInfo;
|
||||
|
||||
|
||||
public ArcadeFactoryInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ArcadeFactoryInfo(ArcadeCabinetOBJ game) : base(game)
|
||||
{
|
||||
this.arcadeInfo = null;
|
||||
}
|
||||
|
||||
public ArcadeFactoryInfo(ArcadeCabinetTile game) : base(game)
|
||||
{
|
||||
this.arcadeInfo = game.arcadeInfo;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -88,15 +88,15 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD
|
|||
{
|
||||
this.background.color = SeasideScramble.self.getPlayer(this.playerID).playerColor;
|
||||
this.healthDisplayLerp();
|
||||
if (this.Player.gun.remainingAmmo == SSCGuns.SSCGun.infiniteAmmo)
|
||||
if (this.Player.activeGun.remainingAmmo == SSCGuns.SSCGun.infiniteAmmo)
|
||||
{
|
||||
this.playerAmmo.setText("999", SeasideScramble.self.gameFont, Color.White);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.playerAmmo.setText(this.Player.gun.remainingAmmo.ToString().PadLeft(3, '0'), SeasideScramble.self.gameFont, Color.White);
|
||||
this.playerAmmo.setText(this.Player.activeGun.remainingAmmo.ToString().PadLeft(3, '0'), SeasideScramble.self.gameFont, Color.White);
|
||||
}
|
||||
this.reloadTime.setText(((int)this.Player.gun.timeRemainingUntilReload).ToString().PadLeft(4, '0'), SeasideScramble.self.gameFont, Color.White);
|
||||
this.reloadTime.setText(((int)this.Player.activeGun.timeRemainingUntilReload).ToString().PadLeft(4, '0'), SeasideScramble.self.gameFont, Color.White);
|
||||
|
||||
if(SeasideScramble.self.currentMap is ShootingGallery)
|
||||
{
|
||||
|
@ -154,7 +154,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD
|
|||
this.background.draw(b, this.background.position, new Vector2(8f, 4f), 0f);
|
||||
this.playerHealth.draw(b, new Rectangle(0, 0, 16, 16), 0f);
|
||||
this.heart.draw(b, 8f, 0f);
|
||||
if (this.Player.gun.isReloading == false)
|
||||
if (this.Player.activeGun.isReloading == false)
|
||||
{
|
||||
this.gun.draw(b, 4f, 0f);
|
||||
this.playerAmmo.draw(b, new Rectangle(0, 0, 16, 16), 0f);
|
||||
|
@ -178,7 +178,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD
|
|||
{
|
||||
this.playerHealth.setText(SeasideScramble.self.getPlayer(this.playerID).currentHealth.ToString(), SeasideScramble.self.gameFont, Color.White);
|
||||
this.showHUD = true;
|
||||
this.gun.animation = this.Player.gun.sprite.animation;
|
||||
this.gun.animation = this.Player.activeGun.sprite.animation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -78,7 +78,31 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
/// <summary>
|
||||
/// The current gun the player is holding. UPDATE THIS TO WEILD MULTIPLE GUNS!!!
|
||||
/// </summary>
|
||||
public SSCGuns.SSCGun gun;
|
||||
public SSCGuns.SSCGun activeGun
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.guns[this.currentGunIndex];
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null) return;
|
||||
this.guns.Add(value);
|
||||
this.currentGunIndex = this.guns.Count - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public List<SSCGuns.SSCGun> guns;
|
||||
public int currentGunIndex;
|
||||
|
||||
/// <summary>
|
||||
/// How long it takes for the player to swap guns.
|
||||
/// </summary>
|
||||
public int swapSpeed = 20;
|
||||
/// <summary>
|
||||
/// How many frames remain until the player is allowed to swap guns/
|
||||
/// </summary>
|
||||
public int timeUntilPlayerCanSwapGun;
|
||||
|
||||
/// <summary>
|
||||
/// The hitbox for the player.
|
||||
|
@ -216,8 +240,15 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
}
|
||||
this.mouseSensitivity = new Vector2(3f, 3f);
|
||||
|
||||
|
||||
this.currentGunIndex = 0;
|
||||
this.guns = new List<SSCGuns.SSCGun>();
|
||||
|
||||
this.getNewGun(SeasideScramble.self.guns.getGun("Icicle")); //new SSCGuns.SSCGun(new StardustCore.Animations.AnimatedSprite("MyFirstGun", this.position, new AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("Guns", "BasicGun"), new Animation(0, 0, 16, 16)), Color.White), SeasideScramble.self.entities.projectiles.getDefaultProjectile(this, this.position, Vector2.Zero, 4f, new Rectangle(0, 0, 16, 16), Color.White, 4f, 300), 10, 1000, 3000);
|
||||
|
||||
this.getNewGun(SeasideScramble.self.guns.getGun("HeatWave"));
|
||||
this.getNewGun(SeasideScramble.self.guns.getGun("Default"));
|
||||
|
||||
this.timeUntilPlayerCanSwapGun = 0;
|
||||
|
||||
this.hitBox = new Rectangle((int)this.position.X, (int)this.position.Y, 64, 64);
|
||||
|
||||
|
@ -282,7 +313,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
public void draw(SpriteBatch b, Vector2 position)
|
||||
{
|
||||
this.characterSpriteController.draw(b, SeasideScramble.GlobalToLocal(SeasideScramble.self.camera.viewport, position), this.playerColor, 4f, this.flipSprite == true ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (this.position.Y) / 10000f));
|
||||
this.gun.draw(b, SeasideScramble.GlobalToLocal(SeasideScramble.self.camera.viewport, position), 2f);
|
||||
this.activeGun.draw(b, SeasideScramble.GlobalToLocal(SeasideScramble.self.camera.viewport, position), 2f);
|
||||
}
|
||||
public void drawMouse(SpriteBatch b)
|
||||
{
|
||||
|
@ -310,8 +341,11 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
}
|
||||
if (this.currentHealth < 0) this.currentHealth = 0;
|
||||
|
||||
this.gun.update(Time);
|
||||
this.activeGun.update(Time);
|
||||
this.updateGunPosition();
|
||||
this.timeUntilPlayerCanSwapGun--;
|
||||
if (this.timeUntilPlayerCanSwapGun < 0) this.timeUntilPlayerCanSwapGun = 0;
|
||||
|
||||
this.HUD.update(Time);
|
||||
this.statusEffects.update(Time);
|
||||
|
||||
|
@ -416,6 +450,15 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
this.shoot(unit);
|
||||
//this.moveMouseCursor(state.ThumbSticks.Right);
|
||||
}
|
||||
if (state.IsButtonDown(Buttons.RightShoulder))
|
||||
{
|
||||
this.swapGun(1);
|
||||
}
|
||||
if (state.IsButtonDown(Buttons.LeftShoulder))
|
||||
{
|
||||
this.swapGun(-1);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -478,7 +521,10 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
if (this.playerID == SSCEnums.PlayerID.One)
|
||||
{
|
||||
this.checkForMovementInput(k);
|
||||
if (k == Keys.Q) this.swapGun(-1);
|
||||
if(k== Keys.E) this.swapGun(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -630,7 +676,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
//ModCore.log("Shoot: " + direction);
|
||||
//SeasideScramble.self.projectiles.spawnDefaultProjectile(this, this.position, direction, 1f, new Rectangle(0, 0, 16, 16), Color.White, 4f, 300);
|
||||
|
||||
this.gun.tryToShoot(this.position, direction);
|
||||
this.activeGun.tryToShoot(this.position, direction);
|
||||
|
||||
}
|
||||
|
||||
|
@ -700,16 +746,47 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
|
||||
public void getNewGun(SSCGuns.SSCGun gun)
|
||||
{
|
||||
this.gun = gun;
|
||||
this.activeGun = gun;
|
||||
//this.gun.Projectile.position = this.position;
|
||||
this.gun.Position = this.position;
|
||||
this.gun.Projectile.owner = this;
|
||||
this.activeGun.Position = this.position;
|
||||
this.activeGun.Projectile.owner = this;
|
||||
}
|
||||
|
||||
public void updateGunPosition()
|
||||
{
|
||||
this.gun.Projectile.position = this.position;
|
||||
this.gun.Position = this.position;
|
||||
this.activeGun.Projectile.position = this.position;
|
||||
this.activeGun.Position = this.position;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swaps the player's gun they are holding.
|
||||
/// </summary>
|
||||
/// <param name="delta"></param>
|
||||
public void swapGun(int delta)
|
||||
{
|
||||
if (this.timeUntilPlayerCanSwapGun > 0) return;
|
||||
if (delta < 0)
|
||||
{
|
||||
if (this.currentGunIndex <= 0)
|
||||
{
|
||||
this.currentGunIndex = this.guns.Count - 1;
|
||||
Game1.soundBank.PlayCue("shwip");
|
||||
this.timeUntilPlayerCanSwapGun = this.swapSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.currentGunIndex--;
|
||||
Game1.soundBank.PlayCue("shwip");
|
||||
this.timeUntilPlayerCanSwapGun = this.swapSpeed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.currentGunIndex++;
|
||||
if (this.currentGunIndex >= this.guns.Count) this.currentGunIndex = 0;
|
||||
Game1.soundBank.PlayCue("shwip");
|
||||
this.timeUntilPlayerCanSwapGun = this.swapSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using PyTK.CustomElementHandler;
|
||||
using StardewValley;
|
||||
|
||||
namespace Revitalize.Framework.Objects.Extras
|
||||
{
|
||||
public class ArcadeCabinetOBJ:MultiTiledObject
|
||||
{
|
||||
public ArcadeCabinetOBJ() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ArcadeCabinetOBJ(CustomObjectData PyTKData, BasicItemInformation Info) : base(PyTKData, Info)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ArcadeCabinetOBJ(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TilePosition) : base(PyTKData, Info, TilePosition)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ArcadeCabinetOBJ(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TilePosition, Dictionary<Vector2, MultiTiledComponent> Objects) : base(PyTKData, Info, TilePosition, Objects)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void rotate()
|
||||
{
|
||||
base.rotate();
|
||||
}
|
||||
|
||||
public override Item getOne()
|
||||
{
|
||||
Dictionary<Vector2, MultiTiledComponent> objs = new Dictionary<Vector2, MultiTiledComponent>();
|
||||
foreach (var pair in this.objects)
|
||||
{
|
||||
objs.Add(pair.Key, (MultiTiledComponent)pair.Value.getOne());
|
||||
}
|
||||
|
||||
|
||||
return new ArcadeCabinetOBJ(this.data, this.info, this.TileLocation, objs);
|
||||
}
|
||||
|
||||
|
||||
public override ICustomObject recreate(Dictionary<string, string> additionalSaveData, object replacement)
|
||||
{
|
||||
ArcadeCabinetOBJ obj = (ArcadeCabinetOBJ)Revitalize.ModCore.Serializer.DeserializeGUID<ArcadeCabinetOBJ>(additionalSaveData["GUID"]);
|
||||
if (obj == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Dictionary<Vector2, Guid> guids = new Dictionary<Vector2, Guid>();
|
||||
|
||||
foreach (KeyValuePair<Vector2, Guid> pair in obj.childrenGuids)
|
||||
{
|
||||
guids.Add(pair.Key, pair.Value);
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<Vector2, Guid> pair in guids)
|
||||
{
|
||||
obj.childrenGuids.Remove(pair.Key);
|
||||
//Revitalize.ModCore.log("DESERIALIZE: " + pair.Value.ToString());
|
||||
ArcadeCabinetTile component = Revitalize.ModCore.Serializer.DeserializeGUID<ArcadeCabinetTile>(pair.Value.ToString());
|
||||
component.InitNetFields();
|
||||
|
||||
obj.addComponent(pair.Key, component);
|
||||
|
||||
|
||||
}
|
||||
obj.InitNetFields();
|
||||
|
||||
if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["GUID"]))
|
||||
{
|
||||
Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["GUID"], obj);
|
||||
return obj;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Revitalize.ModCore.ObjectGroups[additionalSaveData["GUID"]];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public override bool canBePlacedHere(GameLocation l, Vector2 tile)
|
||||
{
|
||||
return base.canBePlacedHere(l, tile);
|
||||
}
|
||||
|
||||
public override void drawPlacementBounds(SpriteBatch spriteBatch, GameLocation location)
|
||||
{
|
||||
foreach (KeyValuePair<Vector2, StardewValley.Object> pair in this.objects)
|
||||
{
|
||||
if (!this.isPlaceable())
|
||||
return;
|
||||
int x = Game1.getOldMouseX() + Game1.viewport.X + (int)((pair.Value as MultiTiledComponent).offsetKey.X * Game1.tileSize);
|
||||
int y = Game1.getOldMouseY() + Game1.viewport.Y + (int)((pair.Value as MultiTiledComponent).offsetKey.Y * Game1.tileSize);
|
||||
if ((double)Game1.mouseCursorTransparency == 0.0)
|
||||
{
|
||||
x = ((int)Game1.player.GetGrabTile().X + (int)((pair.Value as MultiTiledComponent).offsetKey.X)) * 64;
|
||||
y = ((int)Game1.player.GetGrabTile().Y + (int)((pair.Value as MultiTiledComponent).offsetKey.Y)) * 64;
|
||||
}
|
||||
if (Game1.player.GetGrabTile().Equals(Game1.player.getTileLocation()) && (double)Game1.mouseCursorTransparency == 0.0)
|
||||
{
|
||||
Vector2 translatedVector2 = Utility.getTranslatedVector2(Game1.player.GetGrabTile(), Game1.player.FacingDirection, 1f);
|
||||
translatedVector2 += (pair.Value as MultiTiledComponent).offsetKey;
|
||||
x = (int)translatedVector2.X * 64;
|
||||
y = (int)translatedVector2.Y * 64;
|
||||
}
|
||||
bool flag = (pair.Value as MultiTiledComponent).canBePlacedHere(location, new Vector2(x / Game1.tileSize, y / Game1.tileSize));
|
||||
spriteBatch.Draw(Game1.mouseCursors, new Vector2((float)(x / 64 * 64 - Game1.viewport.X), (float)(y / 64 * 64 - Game1.viewport.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(flag ? 194 : 210, 388, 16, 16)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.01f);
|
||||
|
||||
|
||||
(pair.Value as MultiTiledComponent).draw(spriteBatch, x / Game1.tileSize, y / Game1.tileSize, 0.5f);
|
||||
//break;
|
||||
//this.draw(spriteBatch, x / 64, y / 64, 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
public override void pickUp()
|
||||
{
|
||||
|
||||
bool canPickUp = this.removeAndAddToPlayersInventory();
|
||||
if (canPickUp)
|
||||
{
|
||||
foreach (KeyValuePair<Vector2, StardewValley.Object> pair in this.objects)
|
||||
{
|
||||
(pair.Value as ArcadeCabinetTile).removeFromLocation((pair.Value as ArcadeCabinetTile).location, pair.Key);
|
||||
}
|
||||
this.location = null;
|
||||
}
|
||||
else
|
||||
Game1.showRedMessage("NOOOOOOOO");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using PyTK.CustomElementHandler;
|
||||
using Revitalize.Framework.Objects.Furniture;
|
||||
using Revitalize.Framework.Objects.InformationFiles.Furniture;
|
||||
using Revitalize.Framework.Utilities.Serialization;
|
||||
using StardewValley;
|
||||
using StardewValley.Minigames;
|
||||
|
||||
namespace Revitalize.Framework.Objects.Extras
|
||||
{
|
||||
public class ArcadeCabinetTile : FurnitureTileComponent
|
||||
{
|
||||
public ArcadeCabinetInformation arcadeInfo;
|
||||
|
||||
public ArcadeCabinetTile() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ArcadeCabinetTile(CustomObjectData PyTKData, BasicItemInformation Info, ArcadeCabinetInformation ArcadeInfo) : base(PyTKData, Info)
|
||||
{
|
||||
this.arcadeInfo = ArcadeInfo;
|
||||
}
|
||||
|
||||
public ArcadeCabinetTile(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TileLocation, ArcadeCabinetInformation ArcadeInfo) : base(PyTKData, Info, TileLocation)
|
||||
{
|
||||
this.arcadeInfo = ArcadeInfo;
|
||||
}
|
||||
|
||||
|
||||
public override bool performObjectDropInAction(Item dropInItem, bool probe, Farmer who)
|
||||
{
|
||||
return false; //this.pickUpItem()==PickUpState.DoNothing;
|
||||
//return base.performObjectDropInAction(dropInItem, probe, who);
|
||||
}
|
||||
|
||||
public override bool performDropDownAction(Farmer who)
|
||||
{
|
||||
return base.performDropDownAction(who);
|
||||
}
|
||||
|
||||
//Checks for any sort of interaction IF and only IF there is a held object on this tile.
|
||||
public override bool checkForAction(Farmer who, bool justCheckingForActivity = false)
|
||||
{
|
||||
MouseState mState = Mouse.GetState();
|
||||
KeyboardState keyboardState = Game1.GetKeyboardState();
|
||||
|
||||
if (mState.RightButton == ButtonState.Pressed && (!keyboardState.IsKeyDown(Keys.LeftShift) || !keyboardState.IsKeyDown(Keys.RightShift)))
|
||||
{
|
||||
return this.rightClicked(who);
|
||||
}
|
||||
|
||||
if (mState.RightButton == ButtonState.Pressed && (keyboardState.IsKeyDown(Keys.LeftShift) || keyboardState.IsKeyDown(Keys.RightShift)))
|
||||
return this.shiftRightClicked(who);
|
||||
|
||||
|
||||
//return base.checkForAction(who, justCheckingForActivity);
|
||||
|
||||
if (justCheckingForActivity)
|
||||
return true;
|
||||
|
||||
return true;
|
||||
|
||||
//return this.clicked(who);
|
||||
//return false;
|
||||
}
|
||||
|
||||
public override bool performToolAction(Tool t, GameLocation location)
|
||||
{
|
||||
return base.performToolAction(t, location);
|
||||
}
|
||||
|
||||
public override bool performUseAction(GameLocation location)
|
||||
{
|
||||
return base.performUseAction(location);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets called when there is no actively held item on the tile.
|
||||
/// </summary>
|
||||
/// <param name="who"></param>
|
||||
/// <returns></returns>
|
||||
public override bool clicked(Farmer who)
|
||||
{
|
||||
return base.clicked(who);
|
||||
}
|
||||
|
||||
public override bool rightClicked(Farmer who)
|
||||
{
|
||||
if (Game1.menuUp || Game1.currentMinigame != null) return false;
|
||||
if (this.arcadeInfo.minigame != null)
|
||||
{
|
||||
if (this.arcadeInfo.minigame is StardewValley.Minigames.IMinigame)
|
||||
{
|
||||
if (this.arcadeInfo.freezeState == false)
|
||||
{
|
||||
Game1.currentMinigame = (IMinigame)Activator.CreateInstance(this.arcadeInfo.minigame.GetType());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Game1.currentMinigame = this.arcadeInfo.minigame;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public override bool shiftRightClicked(Farmer who)
|
||||
{
|
||||
return base.shiftRightClicked(who);
|
||||
}
|
||||
|
||||
|
||||
public override Item getOne()
|
||||
{
|
||||
ArcadeCabinetTile component = new ArcadeCabinetTile(this.data, this.info, this.arcadeInfo);
|
||||
component.containerObject = this.containerObject;
|
||||
component.offsetKey = this.offsetKey;
|
||||
return component;
|
||||
}
|
||||
|
||||
public override ICustomObject recreate(Dictionary<string, string> additionalSaveData, object replacement)
|
||||
{
|
||||
//instead of using this.offsetkey.x use get additional save data function and store offset key there
|
||||
|
||||
Vector2 offsetKey = new Vector2(Convert.ToInt32(additionalSaveData["offsetKeyX"]), Convert.ToInt32(additionalSaveData["offsetKeyY"]));
|
||||
ArcadeCabinetTile self = Revitalize.ModCore.Serializer.DeserializeGUID<ArcadeCabinetTile>(additionalSaveData["GUID"]);
|
||||
if (self == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"]))
|
||||
{
|
||||
//Get new container
|
||||
ArcadeCabinetOBJ obj = (ArcadeCabinetOBJ)Revitalize.ModCore.Serializer.DeserializeGUID<ArcadeCabinetOBJ>(additionalSaveData["ParentGUID"]);
|
||||
self.containerObject = obj;
|
||||
obj.addComponent(offsetKey, self);
|
||||
//Revitalize.ModCore.log("ADD IN AN OBJECT!!!!");
|
||||
Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["ParentGUID"], obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
self.containerObject = Revitalize.ModCore.ObjectGroups[additionalSaveData["ParentGUID"]];
|
||||
Revitalize.ModCore.ObjectGroups[additionalSaveData["GUID"]].addComponent(offsetKey, self);
|
||||
//Revitalize.ModCore.log("READD AN OBJECT!!!!");
|
||||
}
|
||||
|
||||
return (ICustomObject)self;
|
||||
}
|
||||
|
||||
public override Dictionary<string, string> getAdditionalSaveData()
|
||||
{
|
||||
Dictionary<string, string> saveData = base.getAdditionalSaveData();
|
||||
Revitalize.ModCore.Serializer.SerializeGUID(this.containerObject.childrenGuids[this.offsetKey].ToString(), this);
|
||||
|
||||
return saveData;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>What happens when the object is drawn at a tile location.</summary>
|
||||
public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f)
|
||||
{
|
||||
/*
|
||||
if (this.info.ignoreBoundingBox == true)
|
||||
{
|
||||
x *= -1;
|
||||
y *= -1;
|
||||
}
|
||||
*/
|
||||
|
||||
if (this.info == null)
|
||||
{
|
||||
Revitalize.ModCore.log("info is null");
|
||||
if (this.syncObject == null) Revitalize.ModCore.log("DEAD SYNC");
|
||||
}
|
||||
if (this.animationManager == null) Revitalize.ModCore.log("Animation Manager Null");
|
||||
if (this.displayTexture == null) Revitalize.ModCore.log("Display texture is null");
|
||||
|
||||
//The actual planter box being drawn.
|
||||
if (this.animationManager == null)
|
||||
{
|
||||
if (this.animationManager.getExtendedTexture() == null)
|
||||
ModCore.ModMonitor.Log("Tex Extended is null???");
|
||||
|
||||
spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f));
|
||||
// Log.AsyncG("ANIMATION IS NULL?!?!?!?!");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//Log.AsyncC("Animation Manager is working!");
|
||||
float addedDepth = 0;
|
||||
|
||||
|
||||
if (Revitalize.ModCore.playerInfo.sittingInfo.SittingObject == this.containerObject && this.info.facingDirection == Enums.Direction.Up)
|
||||
{
|
||||
addedDepth += (this.containerObject.Height - 1) - ((int)(this.offsetKey.Y));
|
||||
if (this.info.ignoreBoundingBox) addedDepth += 1.5f;
|
||||
}
|
||||
else if (this.info.ignoreBoundingBox)
|
||||
{
|
||||
addedDepth += 1.0f;
|
||||
}
|
||||
this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f);
|
||||
try
|
||||
{
|
||||
this.animationManager.tickAnimation();
|
||||
// Log.AsyncC("Tick animation");
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ModCore.ModMonitor.Log(err.ToString());
|
||||
}
|
||||
if (this.heldObject.Value != null) SpriteBatchUtilities.Draw(spriteBatch, this, this.heldObject.Value, alpha, addedDepth);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StardewValley.Minigames;
|
||||
|
||||
namespace Revitalize.Framework.Objects.InformationFiles.Furniture
|
||||
{
|
||||
public class ArcadeCabinetInformation
|
||||
{
|
||||
|
||||
public IMinigame minigame;
|
||||
public bool freezeState;
|
||||
|
||||
public ArcadeCabinetInformation()
|
||||
{
|
||||
this.minigame = null;
|
||||
this.freezeState = false;
|
||||
}
|
||||
public ArcadeCabinetInformation(IMinigame Minigame, bool FreezeState)
|
||||
{
|
||||
this.minigame = Minigame;
|
||||
this.freezeState = FreezeState;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -64,6 +64,20 @@ namespace Revitalize.Framework.Utilities
|
|||
|
||||
}
|
||||
|
||||
public static float getRadiansFromVector(Vector2 vec)
|
||||
{
|
||||
Vector2 zero = new Vector2(1, 0);
|
||||
vec = vec.UnitVector();
|
||||
float dot = Vector2.Dot(zero, vec);
|
||||
float len1 = vec.Length();
|
||||
float len2 = zero.Length();
|
||||
float lenTotal = len1 * len2;
|
||||
float cosAngle = dot / lenTotal;
|
||||
|
||||
float angle = (float)((Math.Acos(cosAngle)));
|
||||
return angle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a rotation amount for xna based off the unit circle.
|
||||
/// </summary>
|
||||
|
@ -71,7 +85,7 @@ namespace Revitalize.Framework.Utilities
|
|||
/// <returns></returns>
|
||||
public static float getRotationFromVector(Vector2 vec)
|
||||
{
|
||||
return getRotationFromDegrees((int)Math.Round(getAngleFromVector(vec)));
|
||||
return getRadiansFromVector(vec);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ using StardewValley.Objects;
|
|||
using StardustCore.UIUtilities;
|
||||
using StardustCore.Animations;
|
||||
using StardewValley.Menus;
|
||||
using Revitalize.Framework.Objects.Extras;
|
||||
using Revitalize.Framework.Minigame.SeasideScrambleMinigame;
|
||||
|
||||
namespace Revitalize
|
||||
{
|
||||
|
@ -164,7 +166,6 @@ namespace Revitalize
|
|||
TextureManager.GetTextureManager(Manifest,"Furniture").searchForTextures(ModHelper,this.ModManifest,Path.Combine("Content", "Graphics", "Furniture"));
|
||||
TextureManager.AddTextureManager(Manifest, "InventoryMenu");
|
||||
TextureManager.GetTextureManager(Manifest, "InventoryMenu").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Menus","InventoryMenu"));
|
||||
|
||||
//TextureManager.addTexture("Furniture","Oak Chair", new Texture2DExtended(this.Helper, this.ModManifest, Path.Combine("Content","Graphics","Furniture", "Chairs", "Oak Chair.png")));
|
||||
|
||||
//Framework.Graphics.TextureManager.TextureManagers.Add("Furniture", new TextureManager(this.Helper.DirectoryPath, Path.Combine("Content", "Graphics", "Furniture")));
|
||||
|
@ -241,6 +242,37 @@ namespace Revitalize
|
|||
|
||||
|
||||
FurnitureFactory.LoadFurnitureFiles();
|
||||
|
||||
SeasideScramble sscGame = new SeasideScramble();
|
||||
ArcadeCabinetTile ssc1 = new ArcadeCabinetTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), typeof(ArcadeCabinetTile), Color.White), new BasicItemInformation("Seaside Scramble Arcade Game", "Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", "A arcade to play Seaside Scramble!", "Arcades", Color.LimeGreen, -300, 0, false, 100, Vector2.Zero, true, true, TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new Animation(new Rectangle(0, 0, 16, 16)), new Dictionary<string, List<Animation>>()
|
||||
{
|
||||
{"Animated",new List<Animation>()
|
||||
{
|
||||
new Animation(0,0,16,16,60),
|
||||
new Animation(16,0,16,16,60)
|
||||
}
|
||||
}
|
||||
|
||||
},"Animated"), Color.White, false, null, null),new Framework.Objects.InformationFiles.Furniture.ArcadeCabinetInformation(sscGame,false));
|
||||
ArcadeCabinetTile ssc2 = new ArcadeCabinetTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), typeof(ArcadeCabinetTile), Color.White), new BasicItemInformation("Seaside Scramble Arcade Game", "Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", "A arcade to play Seaside Scramble!", "Arcades", Color.LimeGreen, -300, 0, false, 100, Vector2.Zero, true, true, TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new Animation(new Rectangle(0, 16, 16, 16)), new Dictionary<string, List<Animation>>()
|
||||
{
|
||||
{"Animated",new List<Animation>()
|
||||
{
|
||||
new Animation(0,16,16,16,60),
|
||||
new Animation(16,16,16,16,60)
|
||||
}
|
||||
}
|
||||
|
||||
}, "Animated"), Color.White, false, null, null), new Framework.Objects.InformationFiles.Furniture.ArcadeCabinetInformation(sscGame, false));
|
||||
|
||||
ArcadeCabinetOBJ sscCabinet = new ArcadeCabinetOBJ(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), typeof(ArcadeCabinetOBJ), Color.White, true), new BasicItemInformation("Seaside Scramble Arcade Game", "Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", "A arcade to play Seaside Scramble!", "Arcades", Color.LimeGreen, -300, 0, false, 500, Vector2.Zero, true, true, TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new AnimationManager(), Color.White, true, null, null));
|
||||
sscCabinet.addComponent(new Vector2(0,0),ssc1);
|
||||
sscCabinet.addComponent(new Vector2(0, 1), ssc2);
|
||||
|
||||
|
||||
customObjects.Add("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", sscCabinet);
|
||||
|
||||
ModCore.log("Added in SSC!");
|
||||
}
|
||||
|
||||
private void createDirectories()
|
||||
|
@ -285,11 +317,13 @@ namespace Revitalize
|
|||
{
|
||||
throw new Exception("Can't run Revitalize in multiplayer due to lack of current support!");
|
||||
}
|
||||
Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.BigTiledTest"));
|
||||
// Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.BigTiledTest"));
|
||||
//Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Chairs.OakChair"));
|
||||
//Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Rugs.RugTest"));
|
||||
Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Tables.OakTable"));
|
||||
//Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Tables.OakTable"));
|
||||
Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Lamps.OakLamp"));
|
||||
|
||||
Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble"));
|
||||
/*
|
||||
StardewValley.Tools.Axe axe = new StardewValley.Tools.Axe();
|
||||
Serializer.Serialize(Path.Combine(this.Helper.DirectoryPath, "AXE.json"), axe);
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
<Compile Include="Framework\Enums\Enums.cs" />
|
||||
<Compile Include="Framework\Environment\DarkerNight.cs" />
|
||||
<Compile Include="Framework\Environment\DarkerNightConfig.cs" />
|
||||
<Compile Include="Framework\Factories\Objects\Extras\ArcadeFactoryInfo.cs" />
|
||||
<Compile Include="Framework\Factories\Objects\Furniture\FurnitureFactory.cs" />
|
||||
<Compile Include="Framework\Factories\Objects\Furniture\ChairFactoryInfo.cs" />
|
||||
<Compile Include="Framework\Factories\Objects\FactoryInfo.cs" />
|
||||
|
@ -101,6 +102,8 @@
|
|||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCStatusEffects\StatusEffect.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCStatusEffects\StatusEffectManager.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCTextureUtilities.cs" />
|
||||
<Compile Include="Framework\Objects\Extras\ArcadeCabinetOBJ.cs" />
|
||||
<Compile Include="Framework\Objects\Extras\ArcadeCabinetTile.cs" />
|
||||
<Compile Include="Framework\Objects\BasicItemInformation.cs" />
|
||||
<Compile Include="Framework\Objects\CustomObject.cs" />
|
||||
<Compile Include="Framework\Objects\Furniture\Bench.cs" />
|
||||
|
@ -114,6 +117,7 @@
|
|||
<Compile Include="Framework\Objects\Furniture\RugTileComponent.cs" />
|
||||
<Compile Include="Framework\Objects\Furniture\TableMultiTiledObject.cs" />
|
||||
<Compile Include="Framework\Objects\Furniture\TableTileComponent.cs" />
|
||||
<Compile Include="Framework\Objects\InformationFiles\Furniture\ArcadeCabinetInformation.cs" />
|
||||
<Compile Include="Framework\Objects\InformationFiles\Furniture\ChairInformation.cs" />
|
||||
<Compile Include="Framework\Objects\InformationFiles\Furniture\FurnitureInformation.cs" />
|
||||
<Compile Include="Framework\Objects\InformationFiles\Furniture\TableInformation.cs" />
|
||||
|
@ -153,6 +157,9 @@
|
|||
<None Include="manifest.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Content\Graphics\Furniture\Arcade\SeasideScrambleArcade.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Furniture\Chairs\Oak Chair.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
@ -277,6 +284,8 @@
|
|||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Folder Include="Framework\Objects\InformationFiles\Extras\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Loading…
Reference in New Issue