actortemplate hax
This commit is contained in:
17
OpenRA.Editor/ActorTemplate.cs
Normal file
17
OpenRA.Editor/ActorTemplate.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Drawing;
|
||||||
|
using OpenRA.GameRules;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace OpenRA.Editor
|
||||||
|
{
|
||||||
|
class ActorTemplate
|
||||||
|
{
|
||||||
|
public Bitmap Bitmap;
|
||||||
|
public ActorInfo Info;
|
||||||
|
public bool Centered;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -84,12 +84,12 @@ namespace OpenRA.Editor
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var info = Rules.Info[a];
|
var info = Rules.Info[a];
|
||||||
var bitmap = RenderActor(info, tsinfo.First, palette);
|
var template = RenderActor(info, tsinfo.First, palette);
|
||||||
var ibox = new PictureBox
|
var ibox = new PictureBox
|
||||||
{
|
{
|
||||||
Image = bitmap,
|
Image = template.Bitmap,
|
||||||
Width = bitmap.Width / 2,
|
Width = template.Bitmap.Width / 2,
|
||||||
Height = bitmap.Height / 2,
|
Height = template.Bitmap.Height / 2,
|
||||||
SizeMode = PictureBoxSizeMode.StretchImage
|
SizeMode = PictureBoxSizeMode.StretchImage
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ namespace OpenRA.Editor
|
|||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bitmap RenderActor(ActorInfo info, string ext, Palette p)
|
static ActorTemplate RenderActor(ActorInfo info, string ext, Palette p)
|
||||||
{
|
{
|
||||||
var image = info.Traits.Get<RenderSimpleInfo>().Image ?? info.Name;
|
var image = info.Traits.Get<RenderSimpleInfo>().Image ?? info.Name;
|
||||||
using (var s = FileSystem.OpenWithExts(image, "." + ext, ".shp"))
|
using (var s = FileSystem.OpenWithExts(image, "." + ext, ".shp"))
|
||||||
@@ -183,7 +183,7 @@ namespace OpenRA.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
bitmap.UnlockBits(data);
|
bitmap.UnlockBits(data);
|
||||||
return bitmap;
|
return new ActorTemplate { Bitmap = bitmap, Info = info, Centered = !info.Traits.Contains<Building>() };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="ActorTemplate.cs" />
|
||||||
<Compile Include="Form1.cs">
|
<Compile Include="Form1.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
Reference in New Issue
Block a user