Exemplo n.º 1
0
 public ItemFrame(ItemFrameData itemFrameData, Vector2 tile, IMonitor monitor, Item dispItem = null) : base(itemFrameData.id, tile)
 {
     this.monitor = monitor;
     if (dispItem != null)
     {
         this.displayItem = new NetRef <Item>(dispItem.getOne());
         this.setDisplayType();
     }
     this.setDataFromJson();
 }
Exemplo n.º 2
0
        public void setDataFromJson()
        {
            ItemFrameData itemFrameData = ItemFrameMod.IFDataByName(this.name);

            if (itemFrameData != null)
            {
                this.xOffset.Set(itemFrameData.displayLocation.X * 4);
                this.yOffset.Set(itemFrameData.displayLocation.Y * 4);
                ItemFrameMod.instance.Monitor.Log($"Offsets taken from IFD");
                this.displayName = itemFrameData.displayName;
                this.description.Set(itemFrameData.description);
            }
            else
            {
                ItemFrameMod.instance.Monitor.Log($"Offsets calculated from width {sourceRect.Value.Width} & height {this.sourceRect.Value.Height}.");
                this.xOffset.Set((64 * this.sourceRect.Value.Width / 16 - 64) / 2);
                this.yOffset.Set((64 * this.sourceRect.Value.Height / 16 - 64) / 2);
            }
            ItemFrameMod.instance.Monitor.Log($"{this.Name} offsets: {this.xOffset.Get()} {this.yOffset.Get()}");
        }