2018-08-07 05:01:44 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
|
using Netcode;
|
|
|
|
|
using StardewValley;
|
|
|
|
|
using StardustCore.UIUtilities;
|
|
|
|
|
|
|
|
|
|
namespace StardustCore.NetCode
|
|
|
|
|
{
|
|
|
|
|
public class NetTexture2DExtended : Netcode.NetField<UIUtilities.Texture2DExtended, NetTexture2DExtended>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public NetTexture2DExtended()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public NetTexture2DExtended(Texture2DExtended value) : base(value)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-08 01:07:33 +08:00
|
|
|
|
public void ReadData(BinaryReader reader, NetVersion version)
|
|
|
|
|
{
|
|
|
|
|
ReadDelta(reader, version);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void WriteData(BinaryWriter writer)
|
|
|
|
|
{
|
|
|
|
|
WriteDelta(writer);
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-07 05:01:44 +08:00
|
|
|
|
protected override void ReadDelta(BinaryReader reader, NetVersion version)
|
|
|
|
|
{
|
2018-08-08 01:07:33 +08:00
|
|
|
|
NetString name = new NetString();
|
|
|
|
|
name.Read(reader, version);
|
|
|
|
|
|
2018-08-09 04:18:51 +08:00
|
|
|
|
NetString iD = new NetString();
|
|
|
|
|
iD.Read(reader, version);
|
2018-08-08 01:07:33 +08:00
|
|
|
|
|
|
|
|
|
//Texture2D texture = new Texture2D(Game1.graphics.GraphicsDevice,width,height);
|
2018-08-09 04:18:51 +08:00
|
|
|
|
Texture2DExtended texture = ModCore.TextureManagers[iD.Value].getTexture(name.Value);
|
2018-08-08 01:07:33 +08:00
|
|
|
|
this.Value = texture;
|
|
|
|
|
|
2018-08-07 05:01:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void WriteDelta(BinaryWriter writer)
|
|
|
|
|
{
|
2018-08-08 01:07:33 +08:00
|
|
|
|
NetString name = new NetString(Value.Name);
|
|
|
|
|
name.Write(writer);
|
2018-08-09 04:18:51 +08:00
|
|
|
|
|
|
|
|
|
NetString iD = new NetString(Value.modID);
|
|
|
|
|
iD.Write(writer);
|
2018-08-08 01:07:33 +08:00
|
|
|
|
|
2018-08-07 05:01:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|