2019-08-29 20:33:23 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Syroot.Maths;
|
|
|
|
|
using Toolbox.Library.IO;
|
2019-09-28 21:27:48 +00:00
|
|
|
|
using Toolbox.Library.Animations;
|
2019-08-29 21:17:24 +00:00
|
|
|
|
using Toolbox.Library;
|
2019-08-29 23:01:47 +00:00
|
|
|
|
using WeifenLuo.WinFormsUI.Docking;
|
2019-08-31 01:53:00 +00:00
|
|
|
|
using System.ComponentModel;
|
2019-08-29 20:33:23 +00:00
|
|
|
|
|
|
|
|
|
namespace LayoutBXLYT
|
|
|
|
|
{
|
|
|
|
|
public class BasePane : SectionCommon
|
|
|
|
|
{
|
2019-10-06 01:15:19 +00:00
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public BxlytHeader LayoutFile;
|
|
|
|
|
|
2019-09-28 21:27:48 +00:00
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public PaneAnimController animController = new PaneAnimController();
|
|
|
|
|
|
2019-10-05 17:25:28 +00:00
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public TreeNodeCustom NodeWrapper;
|
|
|
|
|
|
2019-09-28 21:27:48 +00:00
|
|
|
|
[DisplayName("Is Visible"), CategoryAttribute("Flags")]
|
|
|
|
|
public virtual bool Visible { get; set; }
|
2019-09-06 23:12:39 +00:00
|
|
|
|
|
2019-10-06 01:15:19 +00:00
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public bool IsRoot
|
|
|
|
|
{
|
|
|
|
|
get { return Parent == null; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
2019-09-06 23:12:39 +00:00
|
|
|
|
public bool ParentIsRoot
|
|
|
|
|
{
|
|
|
|
|
get { return Parent != null && Parent.IsRoot; }
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 22:52:47 +00:00
|
|
|
|
internal RenderablePane renderablePane;
|
|
|
|
|
|
2019-09-02 21:10:24 +00:00
|
|
|
|
[DisplayName("Alpha"), CategoryAttribute("Alpha")]
|
|
|
|
|
public byte Alpha { get; set; }
|
|
|
|
|
|
|
|
|
|
[DisplayName("Influence Alpha"), CategoryAttribute("Alpha")]
|
|
|
|
|
public virtual bool InfluenceAlpha { get; set; }
|
|
|
|
|
|
2019-08-31 01:53:00 +00:00
|
|
|
|
[Browsable(false)]
|
2019-09-05 20:24:03 +00:00
|
|
|
|
public virtual bool DisplayInEditor { get; set; } = true;
|
2019-08-29 20:33:23 +00:00
|
|
|
|
|
2019-10-06 01:15:19 +00:00
|
|
|
|
private string name;
|
|
|
|
|
|
2019-08-31 01:53:00 +00:00
|
|
|
|
[DisplayName("Name"), CategoryAttribute("Pane")]
|
2019-10-06 01:15:19 +00:00
|
|
|
|
public string Name
|
|
|
|
|
{
|
|
|
|
|
get { return name; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (name != null && LayoutFile != null && LayoutFile.PaneLookup.ContainsKey(name))
|
|
|
|
|
LayoutFile.PaneLookup.Remove(name);
|
|
|
|
|
|
|
|
|
|
name = value;
|
|
|
|
|
|
|
|
|
|
if (LayoutFile != null)
|
|
|
|
|
LayoutFile.PaneLookup.Add(name, this);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-29 20:33:23 +00:00
|
|
|
|
|
2019-08-31 01:53:00 +00:00
|
|
|
|
[DisplayName("Translate"), CategoryAttribute("Pane")]
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public Vector3F Translate { get; set; }
|
2019-08-31 01:53:00 +00:00
|
|
|
|
|
|
|
|
|
[DisplayName("Rotate"), CategoryAttribute("Pane")]
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public Vector3F Rotate { get; set; }
|
2019-08-31 01:53:00 +00:00
|
|
|
|
|
|
|
|
|
[DisplayName("Scale"), CategoryAttribute("Pane")]
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public Vector2F Scale { get; set; }
|
2019-08-31 01:53:00 +00:00
|
|
|
|
|
|
|
|
|
[DisplayName("Width"), CategoryAttribute("Pane")]
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public float Width { get; set; }
|
2019-08-31 01:53:00 +00:00
|
|
|
|
|
2019-09-08 19:15:42 +00:00
|
|
|
|
[DisplayName("Height"), CategoryAttribute("Pane")]
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public float Height { get; set; }
|
|
|
|
|
|
2019-08-31 01:53:00 +00:00
|
|
|
|
[DisplayName("Origin X"), CategoryAttribute("Origin")]
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public virtual OriginX originX { get; set; }
|
2019-08-31 01:53:00 +00:00
|
|
|
|
|
|
|
|
|
[DisplayName("Origin X"), CategoryAttribute("Origin")]
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public virtual OriginY originY { get; set; }
|
2019-08-31 01:53:00 +00:00
|
|
|
|
|
2019-09-06 23:12:39 +00:00
|
|
|
|
[DisplayName("Parent Origin X"), CategoryAttribute("Origin")]
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public virtual OriginX ParentOriginX { get; set; }
|
2019-08-31 01:53:00 +00:00
|
|
|
|
|
2019-09-06 23:12:39 +00:00
|
|
|
|
[DisplayName("Parent Origin Y"), CategoryAttribute("Origin")]
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public virtual OriginY ParentOriginY { get; set; }
|
|
|
|
|
|
2019-08-31 01:53:00 +00:00
|
|
|
|
[Browsable(false)]
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public BasePane Parent { get; set; }
|
|
|
|
|
|
2019-08-31 01:53:00 +00:00
|
|
|
|
[Browsable(false)]
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public List<BasePane> Childern { get; set; } = new List<BasePane>();
|
|
|
|
|
|
2019-08-31 01:53:00 +00:00
|
|
|
|
[Browsable(false)]
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public bool HasChildern
|
|
|
|
|
{
|
|
|
|
|
get { return Childern.Count > 0; }
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-30 22:53:45 +00:00
|
|
|
|
public BasePane()
|
|
|
|
|
{
|
|
|
|
|
originX = OriginX.Center;
|
|
|
|
|
originY = OriginY.Center;
|
|
|
|
|
ParentOriginX = OriginX.Center;
|
|
|
|
|
ParentOriginY = OriginY.Center;
|
|
|
|
|
}
|
2019-08-29 20:33:23 +00:00
|
|
|
|
|
2019-10-05 18:05:37 +00:00
|
|
|
|
public bool IsNullPane
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (this is IPicturePane)
|
|
|
|
|
return false;
|
|
|
|
|
else if (this is IWindowPane)
|
|
|
|
|
return false;
|
|
|
|
|
else if (this is ITextPane)
|
|
|
|
|
return false;
|
|
|
|
|
else if (this is IBoundryPane)
|
|
|
|
|
return false;
|
2019-10-05 19:32:48 +00:00
|
|
|
|
else if (this is IPartPane)
|
2019-10-05 18:05:37 +00:00
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-05 17:25:28 +00:00
|
|
|
|
public CustomRectangle TransformParent(CustomRectangle rect)
|
|
|
|
|
{
|
2019-10-06 01:15:19 +00:00
|
|
|
|
return rect.GetTransformedRectangle(Parent, Translate,Rotate, Scale);
|
2019-10-05 17:25:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-02 23:48:47 +00:00
|
|
|
|
private CustomRectangle rectangle;
|
2019-09-08 19:15:42 +00:00
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
2019-09-02 23:48:47 +00:00
|
|
|
|
public CustomRectangle Rectangle
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2019-09-06 23:12:39 +00:00
|
|
|
|
UpdateRectangle();
|
2019-09-02 23:48:47 +00:00
|
|
|
|
return rectangle;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-16 23:56:41 +00:00
|
|
|
|
private void UpdateRectangle()
|
|
|
|
|
{
|
2019-09-02 23:48:47 +00:00
|
|
|
|
rectangle = CreateRectangle();
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-10 22:42:48 +00:00
|
|
|
|
public CustomRectangle CreateRectangle(uint width, uint height)
|
|
|
|
|
{
|
|
|
|
|
//Do origin transforms
|
|
|
|
|
var transformed = TransformOrientation((int)width, (int)height, originX, originY);
|
|
|
|
|
var parentTransform = ParentOriginTransform(transformed);
|
|
|
|
|
|
|
|
|
|
return new CustomRectangle(
|
|
|
|
|
parentTransform.X,
|
|
|
|
|
parentTransform.Y,
|
|
|
|
|
parentTransform.Z,
|
|
|
|
|
parentTransform.W);
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-05 17:25:28 +00:00
|
|
|
|
public void TransformRectangle(LayoutViewer.PickAction pickAction, float pickMouseX, float pickMouseY)
|
|
|
|
|
{
|
|
|
|
|
float posX = Translate.X;
|
|
|
|
|
float posY = Translate.Y;
|
|
|
|
|
float posZ = Translate.Z;
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("pickMouseX " + pickMouseX);
|
|
|
|
|
|
|
|
|
|
switch (pickAction)
|
|
|
|
|
{
|
|
|
|
|
case LayoutViewer.PickAction.DragLeft:
|
|
|
|
|
Width += pickMouseX;
|
|
|
|
|
posX = Translate.X - (pickMouseX / 2);
|
|
|
|
|
break;
|
|
|
|
|
case LayoutViewer.PickAction.DragRight:
|
|
|
|
|
Width -= pickMouseX;
|
|
|
|
|
posX = Translate.X - (pickMouseX / 2);
|
|
|
|
|
break;
|
|
|
|
|
case LayoutViewer.PickAction.DragTop:
|
|
|
|
|
Height -= pickMouseY;
|
|
|
|
|
posY = Translate.Y - (pickMouseY / 2);
|
|
|
|
|
break;
|
|
|
|
|
case LayoutViewer.PickAction.DragBottom:
|
|
|
|
|
Height += pickMouseY;
|
|
|
|
|
posY = Translate.Y - (pickMouseY / 2);
|
|
|
|
|
break;
|
|
|
|
|
case LayoutViewer.PickAction.DragTopLeft:
|
|
|
|
|
Width += pickMouseX;
|
|
|
|
|
Height -= pickMouseY;
|
|
|
|
|
posX = Translate.X - (pickMouseX / 2);
|
|
|
|
|
posY = Translate.Y - (pickMouseY / 2);
|
|
|
|
|
break;
|
|
|
|
|
case LayoutViewer.PickAction.DragBottomLeft:
|
|
|
|
|
Width += pickMouseX;
|
|
|
|
|
Height += pickMouseY;
|
|
|
|
|
posX = Translate.X - (pickMouseX / 2);
|
|
|
|
|
posY = Translate.Y - (pickMouseY / 2);
|
|
|
|
|
break;
|
|
|
|
|
case LayoutViewer.PickAction.DragBottomRight:
|
|
|
|
|
Width -= pickMouseX;
|
|
|
|
|
Height += pickMouseY;
|
|
|
|
|
posX = Translate.X - (pickMouseX / 2);
|
|
|
|
|
posY = Translate.Y - (pickMouseY / 2);
|
|
|
|
|
break;
|
|
|
|
|
case LayoutViewer.PickAction.DragTopRight:
|
|
|
|
|
Width -= pickMouseX;
|
|
|
|
|
Height -= pickMouseY;
|
|
|
|
|
posX = Translate.X - (pickMouseX / 2);
|
|
|
|
|
posY = Translate.Y - (pickMouseY / 2);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Translate = new Vector3F(posX, posY, posZ);
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public CustomRectangle CreateRectangle()
|
|
|
|
|
{
|
|
|
|
|
//Do origin transforms
|
2019-09-28 21:27:48 +00:00
|
|
|
|
var transformed = new Vector4();
|
|
|
|
|
int paneWidth = (int)Width;
|
|
|
|
|
int paneHeight = (int)Height;
|
|
|
|
|
if (animController.PaneSRT.ContainsKey(LPATarget.SizeX))
|
|
|
|
|
paneWidth = (int)animController.PaneSRT[LPATarget.SizeX];
|
|
|
|
|
if (animController.PaneSRT.ContainsKey(LPATarget.SizeY))
|
|
|
|
|
paneHeight = (int)animController.PaneSRT[LPATarget.SizeY];
|
|
|
|
|
|
|
|
|
|
transformed = TransformOrientation(paneWidth, paneHeight, originX, originY);
|
2019-09-06 23:12:39 +00:00
|
|
|
|
var parentTransform = ParentOriginTransform(transformed);
|
2019-08-29 20:33:23 +00:00
|
|
|
|
|
2019-09-06 23:12:39 +00:00
|
|
|
|
return new CustomRectangle(
|
|
|
|
|
parentTransform.X,
|
|
|
|
|
parentTransform.Y,
|
|
|
|
|
parentTransform.Z,
|
|
|
|
|
parentTransform.W);
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-19 22:02:10 +00:00
|
|
|
|
public static float MixColors(params float[] c)
|
|
|
|
|
{
|
|
|
|
|
float a = c[0];
|
|
|
|
|
for (int i = 1; i < c.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
a *= c[i];
|
|
|
|
|
}
|
|
|
|
|
for (int i = 1; i < c.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
a /= 255f;
|
|
|
|
|
}
|
|
|
|
|
return a / 255f;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-06 23:12:39 +00:00
|
|
|
|
//Get the previous transform from the parent origin
|
|
|
|
|
private Vector4 ParentOriginTransform(Vector4 points)
|
|
|
|
|
{
|
|
|
|
|
//Dont shift the root or the first child of the root
|
|
|
|
|
//The parent setting shouldn't be set, but it doesn't hurt to do this
|
|
|
|
|
if (IsRoot || ParentIsRoot || Parent == null)
|
|
|
|
|
return points;
|
2019-08-29 20:33:23 +00:00
|
|
|
|
|
2019-09-06 23:12:39 +00:00
|
|
|
|
var transformedPosition = TransformOrientationPosition((int)Parent.Width, (int)Parent.Height, ParentOriginX, ParentOriginY);
|
|
|
|
|
var transformed = ShiftRectangle(transformedPosition, points);
|
|
|
|
|
if (Parent != null)
|
|
|
|
|
return Parent.ParentOriginTransform(transformed);
|
2019-08-29 20:33:23 +00:00
|
|
|
|
|
2019-09-06 23:12:39 +00:00
|
|
|
|
return transformed;
|
|
|
|
|
}
|
2019-08-29 20:33:23 +00:00
|
|
|
|
|
2019-09-06 23:12:39 +00:00
|
|
|
|
private static Vector4 ShiftRectangle(Vector2 position, Vector4 points)
|
|
|
|
|
{
|
|
|
|
|
int left = points[0] + position.X;
|
|
|
|
|
int right = points[1] + position.X;
|
|
|
|
|
int top = points[2] + position.Y;
|
|
|
|
|
int bottom = points[3] + position.Y;
|
|
|
|
|
return new Vector4(left, right, top, bottom);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Vector2 TransformOrientationPosition(int Width, int Height, OriginX originX, OriginY originY)
|
|
|
|
|
{
|
|
|
|
|
int x = 0;
|
|
|
|
|
int y = 0;
|
|
|
|
|
|
|
|
|
|
if (originX == OriginX.Left)
|
|
|
|
|
x = -(Width / 2);
|
|
|
|
|
else if (originX == OriginX.Right)
|
|
|
|
|
x = (Width / 2);
|
|
|
|
|
|
|
|
|
|
if (originY == OriginY.Top)
|
|
|
|
|
y = Height / 2;
|
|
|
|
|
else if (originY == OriginY.Bottom)
|
|
|
|
|
y = -(Height / 2);
|
|
|
|
|
|
2019-09-16 23:56:41 +00:00
|
|
|
|
return new Vector2(x, y);
|
2019-08-29 20:33:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-06 23:12:39 +00:00
|
|
|
|
private static Vector4 TransformOrientation(int Width, int Height, OriginX originX, OriginY originY)
|
2019-08-29 20:33:23 +00:00
|
|
|
|
{
|
|
|
|
|
int left = 0;
|
|
|
|
|
int right = 0;
|
|
|
|
|
int top = 0;
|
|
|
|
|
int bottom = 0;
|
|
|
|
|
|
|
|
|
|
if (originX == OriginX.Left)
|
|
|
|
|
right = Width;
|
|
|
|
|
else if (originX == OriginX.Right)
|
|
|
|
|
left = -Width;
|
|
|
|
|
else //To center
|
|
|
|
|
{
|
|
|
|
|
left = -Width / 2;
|
|
|
|
|
right = Width / 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (originY == OriginY.Top)
|
2019-09-08 19:15:42 +00:00
|
|
|
|
bottom = -Height;
|
2019-08-29 20:33:23 +00:00
|
|
|
|
else if (originY == OriginY.Bottom)
|
2019-09-08 19:15:42 +00:00
|
|
|
|
top = Height;
|
2019-08-29 20:33:23 +00:00
|
|
|
|
else //To center
|
|
|
|
|
{
|
2019-09-09 22:37:33 +00:00
|
|
|
|
top = Height / 2;
|
|
|
|
|
bottom = -Height / 2;
|
2019-08-29 20:33:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new Vector4(left, right, top, bottom);
|
|
|
|
|
}
|
2019-09-02 23:48:47 +00:00
|
|
|
|
|
|
|
|
|
public bool IsHit(int X, int Y)
|
|
|
|
|
{
|
2019-10-05 17:25:28 +00:00
|
|
|
|
var rect = CreateRectangle();
|
2019-10-06 01:15:19 +00:00
|
|
|
|
var transformed = rect.GetTransformedRectangle(Parent, Translate, Rotate, Scale);
|
|
|
|
|
|
|
|
|
|
bool isInBetweenX = (X > transformed.LeftPoint) && (X < transformed.RightPoint) ||
|
|
|
|
|
(X < transformed.LeftPoint) && (X > transformed.RightPoint);
|
|
|
|
|
|
|
|
|
|
bool isInBetweenY = (Y > transformed.BottomPoint) && (Y < transformed.TopPoint) ||
|
|
|
|
|
(Y < transformed.BottomPoint) && (Y > transformed.TopPoint);
|
2019-10-05 17:25:28 +00:00
|
|
|
|
|
2019-10-06 01:15:19 +00:00
|
|
|
|
if (isInBetweenX && isInBetweenY)
|
2019-09-02 23:48:47 +00:00
|
|
|
|
return true;
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2019-09-28 21:27:48 +00:00
|
|
|
|
|
|
|
|
|
public BasePane SearchPane(string name)
|
|
|
|
|
{
|
|
|
|
|
if (Name == name)
|
|
|
|
|
return this;
|
|
|
|
|
|
|
|
|
|
foreach (var child in Childern)
|
|
|
|
|
{
|
|
|
|
|
var matchPane = child.SearchPane(name);
|
|
|
|
|
if (matchPane != null) return matchPane;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class VertexColorHelper
|
|
|
|
|
{
|
|
|
|
|
public static System.Drawing.Color Mix(System.Drawing.Color colorA, System.Drawing.Color colorB, float value)
|
|
|
|
|
{
|
|
|
|
|
byte R = (byte)InterpolationHelper.Lerp(colorA.R, colorB.R, value);
|
|
|
|
|
byte G = (byte)InterpolationHelper.Lerp(colorA.G, colorB.G, value);
|
|
|
|
|
byte B = (byte)InterpolationHelper.Lerp(colorA.B, colorB.B, value);
|
|
|
|
|
byte A = (byte)InterpolationHelper.Lerp(colorA.A, colorB.A, value);
|
|
|
|
|
return System.Drawing.Color.FromArgb(A, R, G, B);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class PaneAnimController
|
|
|
|
|
{
|
|
|
|
|
public Dictionary<LPATarget, float> PaneSRT = new Dictionary<LPATarget, float>();
|
|
|
|
|
public Dictionary<LVCTarget, float> PaneVertexColors = new Dictionary<LVCTarget, float>();
|
|
|
|
|
public bool Visibile = true;
|
|
|
|
|
|
|
|
|
|
public void ResetAnim()
|
|
|
|
|
{
|
|
|
|
|
Visibile = true;
|
|
|
|
|
PaneSRT.Clear();
|
|
|
|
|
PaneVertexColors.Clear();
|
|
|
|
|
}
|
2019-08-29 20:33:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-09 00:47:19 +00:00
|
|
|
|
public enum FilterMode
|
|
|
|
|
{
|
|
|
|
|
Near = 0,
|
|
|
|
|
Linear = 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum WrapMode
|
|
|
|
|
{
|
|
|
|
|
Clamp = 0,
|
|
|
|
|
Repeat = 1,
|
|
|
|
|
Mirror = 2
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public enum OriginX : byte
|
|
|
|
|
{
|
|
|
|
|
Center = 0,
|
|
|
|
|
Left = 1,
|
|
|
|
|
Right = 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public enum OriginY : byte
|
|
|
|
|
{
|
|
|
|
|
Center = 0,
|
|
|
|
|
Top = 1,
|
|
|
|
|
Bottom = 2
|
|
|
|
|
};
|
|
|
|
|
|
2019-09-03 22:58:58 +00:00
|
|
|
|
public interface IUserDataContainer
|
|
|
|
|
{
|
|
|
|
|
UserData UserData { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-09 00:47:19 +00:00
|
|
|
|
public class BxlytTextureRef
|
|
|
|
|
{
|
2019-09-10 22:42:48 +00:00
|
|
|
|
public short ID { get; set; }
|
|
|
|
|
|
2019-09-09 00:47:19 +00:00
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
|
|
|
|
public virtual WrapMode WrapModeU { get; set; }
|
|
|
|
|
public virtual WrapMode WrapModeV { get; set; }
|
|
|
|
|
public virtual FilterMode MinFilterMode { get; set; }
|
|
|
|
|
public virtual FilterMode MaxFilterMode { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-03 22:58:58 +00:00
|
|
|
|
public class UserData : SectionCommon
|
|
|
|
|
{
|
|
|
|
|
public List<UserDataEntry> Entries { get; set; }
|
|
|
|
|
|
|
|
|
|
public UserData()
|
|
|
|
|
{
|
|
|
|
|
Entries = new List<UserDataEntry>();
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-09 22:37:33 +00:00
|
|
|
|
public override void Write(FileWriter writer, LayoutHeader header)
|
2019-09-03 22:58:58 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class UserDataEntry
|
|
|
|
|
{
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
public UserDataType Type { get; set; }
|
|
|
|
|
public byte Unknown { get; set; }
|
|
|
|
|
|
|
|
|
|
public object data;
|
|
|
|
|
|
|
|
|
|
public string GetString()
|
|
|
|
|
{
|
|
|
|
|
return (string)data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float[] GetFloats()
|
|
|
|
|
{
|
|
|
|
|
return (float[])data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int[] GetInts()
|
|
|
|
|
{
|
|
|
|
|
return (int[])data;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-03 23:23:04 +00:00
|
|
|
|
public void SetValue(string value)
|
2019-09-03 22:58:58 +00:00
|
|
|
|
{
|
|
|
|
|
data = value;
|
|
|
|
|
Type = UserDataType.String;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetValue(float[] value)
|
|
|
|
|
{
|
|
|
|
|
data = value;
|
|
|
|
|
Type = UserDataType.Float;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetValue(int[] value)
|
|
|
|
|
{
|
|
|
|
|
data = value;
|
|
|
|
|
Type = UserDataType.Int;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal long _pos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum UserDataType : byte
|
|
|
|
|
{
|
|
|
|
|
String,
|
|
|
|
|
Int,
|
|
|
|
|
Float,
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-09 22:37:33 +00:00
|
|
|
|
public enum AnimationTarget : byte
|
|
|
|
|
{
|
|
|
|
|
Pane = 0,
|
|
|
|
|
Material = 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum LPATarget : byte
|
|
|
|
|
{
|
|
|
|
|
TranslateX = 0x00,
|
|
|
|
|
TranslateY = 0x01,
|
|
|
|
|
TranslateZ = 0x02,
|
|
|
|
|
RotateX = 0x03,
|
|
|
|
|
RotateY = 0x04,
|
|
|
|
|
RotateZ = 0x05,
|
|
|
|
|
ScaleX = 0x06,
|
|
|
|
|
ScaleY = 0x07,
|
|
|
|
|
SizeX = 0x08,
|
2019-09-28 21:27:48 +00:00
|
|
|
|
SizeY = 0x09,
|
2019-09-09 22:37:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum LTSTarget : byte
|
|
|
|
|
{
|
|
|
|
|
TranslateS = 0x00,
|
|
|
|
|
TranslateT = 0x01,
|
|
|
|
|
Rotate = 0x02,
|
|
|
|
|
ScaleS = 0x03,
|
|
|
|
|
ScaleT = 0x04,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum LVITarget : byte
|
|
|
|
|
{
|
|
|
|
|
Visibility = 0x00,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum LVCTarget : byte
|
|
|
|
|
{
|
|
|
|
|
LeftTopRed = 0x00,
|
|
|
|
|
LeftTopGreen = 0x01,
|
|
|
|
|
LeftTopBlue = 0x02,
|
|
|
|
|
LeftTopAlpha = 0x03,
|
|
|
|
|
|
|
|
|
|
RightTopRed = 0x04,
|
|
|
|
|
RightTopGreen = 0x05,
|
|
|
|
|
RightTopBlue = 0x06,
|
|
|
|
|
RightTopAlpha = 0x07,
|
|
|
|
|
|
|
|
|
|
LeftBottomRed = 0x08,
|
|
|
|
|
LeftBottomGreen = 0x09,
|
|
|
|
|
LeftBottomBlue = 0x0A,
|
|
|
|
|
LeftBottomAlpha = 0x0B,
|
|
|
|
|
|
|
|
|
|
RightBottomRed = 0x0C,
|
|
|
|
|
RightBottomGreen = 0x0D,
|
|
|
|
|
RightBottomBlue = 0x0E,
|
|
|
|
|
RightBottomAlpha = 0x0F,
|
|
|
|
|
|
|
|
|
|
PaneAlpha = 0x10,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum LTPTarget : byte
|
|
|
|
|
{
|
2019-09-28 21:27:48 +00:00
|
|
|
|
Image1 = 0x00,
|
|
|
|
|
Image2 = 0x01, //Unsure if mutliple are used but just in case
|
|
|
|
|
Image3 = 0x02,
|
2019-09-09 22:37:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum LMCTarget : byte
|
|
|
|
|
{
|
2019-09-12 22:52:47 +00:00
|
|
|
|
BlackColorRed,
|
|
|
|
|
BlackColorGreen,
|
|
|
|
|
BlackColorBlue,
|
|
|
|
|
BlackColorAlpha,
|
|
|
|
|
WhiteColorRed,
|
|
|
|
|
WhiteColorGreen,
|
|
|
|
|
WhiteColorBlue,
|
|
|
|
|
WhiteColorAlpha,
|
2019-09-23 22:16:50 +00:00
|
|
|
|
TextureColorBlendRatio,
|
|
|
|
|
TexColor0Red,
|
|
|
|
|
TexColor0Green,
|
|
|
|
|
TexColor0Blue,
|
|
|
|
|
TexColor0Alpha,
|
|
|
|
|
TexColor1Red,
|
|
|
|
|
TexColor1Green,
|
|
|
|
|
TexColor1Blue,
|
|
|
|
|
TexColor1Alpha,
|
|
|
|
|
TexColor2Red,
|
|
|
|
|
TexColor2Green,
|
|
|
|
|
TexColor2Blue,
|
|
|
|
|
TexColor2Alpha,
|
|
|
|
|
TevKonstantColor0Red,
|
|
|
|
|
TevKonstantColor0Green,
|
|
|
|
|
TevKonstantColor0Blue,
|
|
|
|
|
TevKonstantColor0Alpha,
|
|
|
|
|
TevKonstantColor1Red,
|
|
|
|
|
TevKonstantColor1Green,
|
|
|
|
|
TevKonstantColor1Blue,
|
|
|
|
|
TevKonstantColor1Alpha,
|
|
|
|
|
TevKonstantColor2Red,
|
|
|
|
|
TevKonstantColor2Green,
|
|
|
|
|
TevKonstantColor2Blue,
|
|
|
|
|
TevKonstantColor2Alpha,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum LIMTarget : byte
|
|
|
|
|
{
|
|
|
|
|
Rotation,
|
|
|
|
|
ScaleU,
|
|
|
|
|
ScaleV,
|
2019-09-12 22:52:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum LFSTarget : byte
|
|
|
|
|
{
|
|
|
|
|
FontShadowBlackColorRed,
|
|
|
|
|
FontShadowBlackColorGreen,
|
|
|
|
|
FontShadowBlackColorBlue,
|
|
|
|
|
FontShadowBlackColorAlpha,
|
|
|
|
|
FontShadowWhiteColorRed,
|
|
|
|
|
FontShadowWhiteColorGreen,
|
|
|
|
|
FontShadowWhiteColorBlue,
|
|
|
|
|
FontShadowWhiteColorAlpha,
|
|
|
|
|
}
|
2019-09-09 22:37:33 +00:00
|
|
|
|
|
2019-09-12 22:52:47 +00:00
|
|
|
|
public enum LCTTarget : byte
|
|
|
|
|
{
|
|
|
|
|
FontShadowBlackColorRed,
|
|
|
|
|
FontShadowBlackColorGreen,
|
|
|
|
|
FontShadowBlackColorBlue,
|
|
|
|
|
FontShadowBlackColorAlpha,
|
|
|
|
|
FontShadowWhiteColorRed,
|
|
|
|
|
FontShadowWhiteColorGreen,
|
|
|
|
|
FontShadowWhiteColorBlue,
|
|
|
|
|
FontShadowWhiteColorAlpha,
|
2019-09-09 22:37:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-10 22:42:48 +00:00
|
|
|
|
public enum WindowKind
|
|
|
|
|
{
|
|
|
|
|
Around = 0,
|
|
|
|
|
Horizontal = 1,
|
|
|
|
|
HorizontalNoContent = 2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum WindowFrameTexFlip : byte
|
|
|
|
|
{
|
|
|
|
|
None = 0,
|
|
|
|
|
FlipH = 1,
|
|
|
|
|
FlipV = 2,
|
|
|
|
|
Rotate90 = 3,
|
|
|
|
|
Rotate180 = 4,
|
|
|
|
|
Rotate270 = 5
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-28 21:27:48 +00:00
|
|
|
|
public enum GfxAlphaFunction : byte
|
|
|
|
|
{
|
|
|
|
|
Never = 0,
|
|
|
|
|
Less = 1,
|
|
|
|
|
LessOrEqual = 2,
|
|
|
|
|
Equal = 3,
|
|
|
|
|
NotEqual = 4,
|
|
|
|
|
GreaterOrEqual = 5,
|
|
|
|
|
Greater = 6,
|
|
|
|
|
Always = 7,
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-19 22:02:10 +00:00
|
|
|
|
public enum TevMode : byte
|
|
|
|
|
{
|
|
|
|
|
Replace,
|
|
|
|
|
Modulate,
|
|
|
|
|
Add,
|
|
|
|
|
AddSigned,
|
|
|
|
|
Interpolate,
|
|
|
|
|
Subtract,
|
|
|
|
|
AddMultiplicate,
|
|
|
|
|
MultiplcateAdd,
|
|
|
|
|
Overlay,
|
|
|
|
|
Indirect,
|
|
|
|
|
BlendIndirect,
|
|
|
|
|
EachIndirect,
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-28 21:27:48 +00:00
|
|
|
|
|
|
|
|
|
public enum TevScale
|
|
|
|
|
{
|
|
|
|
|
Scale1,
|
|
|
|
|
Scale2,
|
|
|
|
|
Scale4
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum TevSource
|
|
|
|
|
{
|
|
|
|
|
Tex0 = 0,
|
|
|
|
|
Tex1 = 1,
|
|
|
|
|
Tex2 = 2,
|
|
|
|
|
Tex3 = 3,
|
|
|
|
|
Constant = 4,
|
|
|
|
|
Primary = 5,
|
|
|
|
|
Previous = 6,
|
|
|
|
|
Register = 7
|
|
|
|
|
}
|
|
|
|
|
public enum TevColorOp
|
|
|
|
|
{
|
|
|
|
|
RGB = 0,
|
|
|
|
|
InvRGB = 1,
|
|
|
|
|
Alpha = 2,
|
|
|
|
|
InvAlpha = 3,
|
|
|
|
|
RRR = 4,
|
|
|
|
|
InvRRR = 5,
|
|
|
|
|
GGG = 6,
|
|
|
|
|
InvGGG = 7,
|
|
|
|
|
BBB = 8,
|
|
|
|
|
InvBBB = 9
|
|
|
|
|
}
|
|
|
|
|
public enum TevAlphaOp
|
|
|
|
|
{
|
|
|
|
|
Alpha = 0,
|
|
|
|
|
InvAlpha = 1,
|
|
|
|
|
R = 2,
|
|
|
|
|
InvR = 3,
|
|
|
|
|
G = 4,
|
|
|
|
|
InvG = 5,
|
|
|
|
|
B = 6,
|
|
|
|
|
InvB = 7
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public interface IPicturePane
|
|
|
|
|
{
|
2019-10-05 17:25:28 +00:00
|
|
|
|
System.Drawing.Color[] GetVertexColors();
|
2019-09-28 21:27:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public interface IBoundryPane
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public interface ITextPane
|
|
|
|
|
{
|
|
|
|
|
string Text { get; set; }
|
|
|
|
|
OriginX HorizontalAlignment { get; set; }
|
|
|
|
|
OriginX VerticalAlignment { get; set; }
|
|
|
|
|
|
|
|
|
|
ushort TextLength { get; set; }
|
|
|
|
|
ushort MaxTextLength { get; set; }
|
|
|
|
|
|
|
|
|
|
BxlytMaterial Material { get; set; }
|
|
|
|
|
Toolbox.Library.Rendering.RenderableTex RenderableFont { get; set; }
|
|
|
|
|
|
|
|
|
|
byte TextAlignment { get; set; }
|
|
|
|
|
LineAlign LineAlignment { get; set; }
|
|
|
|
|
|
|
|
|
|
float ItalicTilt { get; set; }
|
|
|
|
|
|
|
|
|
|
STColor8 FontForeColor { get; set; }
|
|
|
|
|
STColor8 FontBackColor { get; set; }
|
|
|
|
|
Vector2F FontSize { get; set; }
|
|
|
|
|
|
|
|
|
|
float CharacterSpace { get; set; }
|
|
|
|
|
float LineSpace { get; set; }
|
|
|
|
|
|
|
|
|
|
Vector2F ShadowXY { get; set; }
|
|
|
|
|
Vector2F ShadowXYSize { get; set; }
|
|
|
|
|
|
|
|
|
|
STColor8 ShadowForeColor { get; set; }
|
|
|
|
|
STColor8 ShadowBackColor { get; set; }
|
|
|
|
|
|
|
|
|
|
float ShadowItalic { get; set; }
|
|
|
|
|
|
|
|
|
|
string TextBoxName { get; set; }
|
|
|
|
|
|
|
|
|
|
bool PerCharTransform { get; set; }
|
|
|
|
|
bool RestrictedTextLengthEnabled { get; set; }
|
|
|
|
|
bool ShadowEnabled { get; set; }
|
|
|
|
|
string FontName { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-05 18:05:37 +00:00
|
|
|
|
public interface IPartPane
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-10 22:42:48 +00:00
|
|
|
|
public interface IWindowPane
|
|
|
|
|
{
|
2019-10-05 17:25:28 +00:00
|
|
|
|
System.Drawing.Color[] GetVertexColors();
|
|
|
|
|
|
2019-09-10 22:42:48 +00:00
|
|
|
|
bool UseOneMaterialForAll { get; set; }
|
|
|
|
|
bool UseVertexColorForAll { get; set; }
|
|
|
|
|
WindowKind WindowKind { get; set; }
|
|
|
|
|
bool NotDrawnContent { get; set; }
|
|
|
|
|
ushort StretchLeft { get; set; }
|
|
|
|
|
ushort StretchRight { get; set; }
|
|
|
|
|
ushort StretchTop { get; set; }
|
|
|
|
|
ushort StretchBottm { get; set; }
|
|
|
|
|
ushort FrameElementLeft { get; set; }
|
|
|
|
|
ushort FrameElementRight { get; set; }
|
|
|
|
|
ushort FrameElementTop { get; set; }
|
|
|
|
|
ushort FrameElementBottm { get; set; }
|
|
|
|
|
byte FrameCount { get; set; }
|
|
|
|
|
|
|
|
|
|
BxlytWindowContent Content { get; set; }
|
|
|
|
|
|
2019-09-16 23:56:41 +00:00
|
|
|
|
[Browsable(false)]
|
2019-09-10 22:42:48 +00:00
|
|
|
|
List<BxlytWindowFrame> WindowFrames { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-28 21:27:48 +00:00
|
|
|
|
public class BXLAN
|
|
|
|
|
{
|
|
|
|
|
public BxlanHeader BxlanHeader;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-10 22:42:48 +00:00
|
|
|
|
public class BxlytWindowContent
|
|
|
|
|
{
|
|
|
|
|
public STColor8 ColorTopLeft { get; set; }
|
|
|
|
|
public STColor8 ColorTopRight { get; set; }
|
|
|
|
|
public STColor8 ColorBottomLeft { get; set; }
|
|
|
|
|
public STColor8 ColorBottomRight { get; set; }
|
|
|
|
|
|
|
|
|
|
public ushort MaterialIndex { get; set; }
|
|
|
|
|
|
|
|
|
|
[TypeConverter(typeof(ExpandableObjectConverter))]
|
|
|
|
|
public virtual BxlytMaterial Material { get; set; }
|
|
|
|
|
|
|
|
|
|
public List<TexCoord> TexCoords = new List<TexCoord>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class BxlytWindowFrame
|
|
|
|
|
{
|
|
|
|
|
[TypeConverter(typeof(ExpandableObjectConverter))]
|
|
|
|
|
public BxlytMaterial Material { get; set; }
|
|
|
|
|
|
|
|
|
|
public ushort MaterialIndex;
|
2019-09-18 22:23:27 +00:00
|
|
|
|
public WindowFrameTexFlip TextureFlip { get; set; }
|
2019-09-10 22:42:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class TexCoord
|
|
|
|
|
{
|
|
|
|
|
public Vector2F TopLeft { get; set; }
|
|
|
|
|
public Vector2F TopRight { get; set; }
|
|
|
|
|
public Vector2F BottomLeft { get; set; }
|
|
|
|
|
public Vector2F BottomRight { get; set; }
|
|
|
|
|
|
|
|
|
|
public TexCoord()
|
|
|
|
|
{
|
|
|
|
|
TopLeft = new Vector2F(0, 0);
|
|
|
|
|
TopRight = new Vector2F(1, 0);
|
|
|
|
|
BottomLeft = new Vector2F(0, 1);
|
|
|
|
|
BottomRight = new Vector2F(1, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-09 22:37:33 +00:00
|
|
|
|
public class LayoutHeader : IDisposable
|
2019-08-29 20:33:23 +00:00
|
|
|
|
{
|
2019-10-05 17:25:28 +00:00
|
|
|
|
public PartsManager PartsManager = new PartsManager();
|
|
|
|
|
|
2019-09-04 18:10:17 +00:00
|
|
|
|
[Browsable(false)]
|
2019-08-30 22:53:45 +00:00
|
|
|
|
public string FileName
|
|
|
|
|
{
|
|
|
|
|
get { return FileInfo.FileName; }
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-04 18:10:17 +00:00
|
|
|
|
[DisplayName("Use Big Endian"), CategoryAttribute("File Settings")]
|
2019-09-01 17:02:48 +00:00
|
|
|
|
public bool IsBigEndian { get; set; }
|
|
|
|
|
|
2019-09-04 18:10:17 +00:00
|
|
|
|
[Browsable(false)]
|
2019-08-29 23:01:47 +00:00
|
|
|
|
internal IFileFormat FileInfo;
|
|
|
|
|
|
2019-09-04 18:10:17 +00:00
|
|
|
|
[Browsable(false)]
|
2019-08-29 20:33:23 +00:00
|
|
|
|
internal uint Version;
|
|
|
|
|
|
2019-09-04 18:10:17 +00:00
|
|
|
|
[DisplayName("Version"), CategoryAttribute("File Settings")]
|
2019-08-29 20:33:23 +00:00
|
|
|
|
public string VersionFull
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2019-09-04 18:10:17 +00:00
|
|
|
|
return $"{VersionMajor},{VersionMinor},{VersionMicro},{VersionMicro2}";
|
2019-08-29 20:33:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-04 18:10:17 +00:00
|
|
|
|
[RefreshProperties(RefreshProperties.All)]
|
|
|
|
|
public uint VersionMajor { get; set; }
|
|
|
|
|
[RefreshProperties(RefreshProperties.All)]
|
|
|
|
|
public uint VersionMinor { get; set; }
|
|
|
|
|
[RefreshProperties(RefreshProperties.All)]
|
|
|
|
|
public uint VersionMicro { get; set; }
|
|
|
|
|
[RefreshProperties(RefreshProperties.All)]
|
|
|
|
|
public uint VersionMicro2 { get; set; }
|
2019-08-29 20:33:23 +00:00
|
|
|
|
|
2019-09-04 18:10:17 +00:00
|
|
|
|
internal void SetVersionInfo()
|
2019-08-29 20:33:23 +00:00
|
|
|
|
{
|
2019-09-04 18:10:17 +00:00
|
|
|
|
VersionMajor = Version >> 24;
|
|
|
|
|
VersionMinor = Version >> 16 & 0xFF;
|
|
|
|
|
VersionMicro = Version >> 8 & 0xFF;
|
|
|
|
|
VersionMicro2 = Version & 0xFF;
|
2019-08-29 20:33:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-04 18:10:17 +00:00
|
|
|
|
internal uint SaveVersion()
|
2019-08-29 20:33:23 +00:00
|
|
|
|
{
|
2019-09-04 18:10:17 +00:00
|
|
|
|
return VersionMajor << 24 | VersionMinor << 16 | VersionMicro << 8 | VersionMicro2;
|
2019-08-29 20:33:23 +00:00
|
|
|
|
}
|
2019-08-29 23:01:47 +00:00
|
|
|
|
|
2019-09-09 22:37:33 +00:00
|
|
|
|
public static void WriteSection(FileWriter writer, string magic, SectionCommon section, Action WriteMethod = null)
|
|
|
|
|
{
|
|
|
|
|
long startPos = writer.Position;
|
|
|
|
|
writer.WriteSignature(magic);
|
|
|
|
|
writer.Write(uint.MaxValue);
|
|
|
|
|
WriteMethod?.Invoke();
|
|
|
|
|
writer.Align(4);
|
|
|
|
|
|
|
|
|
|
long endPos = writer.Position;
|
|
|
|
|
|
|
|
|
|
using (writer.TemporarySeek(startPos + 4, System.IO.SeekOrigin.Begin))
|
|
|
|
|
{
|
|
|
|
|
writer.Write((uint)(endPos - startPos));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-29 23:01:47 +00:00
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
2019-10-05 17:25:28 +00:00
|
|
|
|
PartsManager?.Dispose();
|
2019-08-29 23:01:47 +00:00
|
|
|
|
FileInfo.Unload();
|
|
|
|
|
}
|
2019-08-29 20:33:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-09 22:37:33 +00:00
|
|
|
|
public class BxlanHeader : LayoutHeader
|
|
|
|
|
{
|
2019-09-18 22:23:27 +00:00
|
|
|
|
public BxlanPAT1 AnimationTag;
|
|
|
|
|
public BxlanPAI1 AnimationInfo;
|
2019-09-28 21:27:48 +00:00
|
|
|
|
|
|
|
|
|
public virtual void Read(FileReader reader, BXLAN header)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void Write(FileWriter writer)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-05 17:25:28 +00:00
|
|
|
|
public LytAnimation GetGenericAnimation()
|
|
|
|
|
{
|
|
|
|
|
return animation;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-28 21:27:48 +00:00
|
|
|
|
private LytAnimation animation;
|
|
|
|
|
public LytAnimation ToGenericAnimation(BxlytHeader parentLayout)
|
|
|
|
|
{
|
|
|
|
|
if (animation == null)
|
|
|
|
|
animation = new LytAnimation(this, parentLayout);
|
2019-09-28 23:13:32 +00:00
|
|
|
|
else
|
|
|
|
|
animation.UpdateLayout(parentLayout);
|
2019-09-28 21:27:48 +00:00
|
|
|
|
return animation;
|
|
|
|
|
}
|
2019-09-18 22:23:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class BxlanPAT1 : SectionCommon
|
|
|
|
|
{
|
|
|
|
|
[DisplayName("Name"), CategoryAttribute("Animation")]
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
|
|
|
|
[DisplayName("Groups"), CategoryAttribute("Animation")]
|
|
|
|
|
public List<string> Groups { get; set; }
|
|
|
|
|
|
|
|
|
|
[DisplayName("Start"), CategoryAttribute("Frames")]
|
|
|
|
|
public short StartFrame { get; set; }
|
|
|
|
|
|
|
|
|
|
[DisplayName("End"), CategoryAttribute("Frames")]
|
|
|
|
|
public short EndFrame { get; set; }
|
2019-09-16 23:56:41 +00:00
|
|
|
|
|
2019-09-18 22:23:27 +00:00
|
|
|
|
[DisplayName("Animation Order"), CategoryAttribute("Parameters")]
|
|
|
|
|
public ushort AnimationOrder { get; set; }
|
|
|
|
|
|
|
|
|
|
[DisplayName("Child Binding"), CategoryAttribute("Parameters")]
|
|
|
|
|
public bool ChildBinding { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class BxlanPAI1 : SectionCommon
|
|
|
|
|
{
|
|
|
|
|
public ushort FrameSize;
|
|
|
|
|
public bool Loop;
|
|
|
|
|
|
|
|
|
|
public List<string> Textures { get; set; }
|
|
|
|
|
public List<BxlanPaiEntry> Entries = new List<BxlanPaiEntry>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class BxlanPaiEntry
|
|
|
|
|
{
|
|
|
|
|
[DisplayName("Name"), CategoryAttribute("Animation")]
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
|
|
|
|
[DisplayName("Target"), CategoryAttribute("Animation")]
|
|
|
|
|
public AnimationTarget Target { get; set; }
|
|
|
|
|
|
|
|
|
|
public List<BxlanPaiTag> Tags = new List<BxlanPaiTag>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class BxlanPaiTag
|
|
|
|
|
{
|
2019-10-05 17:25:28 +00:00
|
|
|
|
public BxlanPaiTag()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BxlanPaiTag(string tag)
|
|
|
|
|
{
|
|
|
|
|
Tag = tag;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-18 22:23:27 +00:00
|
|
|
|
public List<BxlanPaiTagEntry> Entries = new List<BxlanPaiTagEntry>();
|
|
|
|
|
|
|
|
|
|
public string Tag;
|
|
|
|
|
|
|
|
|
|
public string Type
|
|
|
|
|
{
|
|
|
|
|
get { return TypeDefine.ContainsKey(Tag) ? TypeDefine[Tag] : Tag; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Dictionary<string, string> TypeDefine = new Dictionary<string, string>()
|
|
|
|
|
{
|
|
|
|
|
{"FLPA","PaneSRT" },
|
|
|
|
|
{"FLVI","Visibility" },
|
|
|
|
|
{"FLTS","TextureSRT" },
|
|
|
|
|
{"FLVC","VertexColor" },
|
|
|
|
|
{"FLMC","MaterialColor" },
|
|
|
|
|
{"FLTP","TexturePattern" },
|
|
|
|
|
{"FLIM","IndTextureSRT" },
|
|
|
|
|
{"FLAC","AlphaTest" },
|
|
|
|
|
{"FLCT","FontShadow" },
|
|
|
|
|
{"FLCC","PerCharacterTransformCurve" },
|
|
|
|
|
|
|
|
|
|
{"RLPA","PaneSRT" },
|
|
|
|
|
{"RLVI","Visibility" },
|
|
|
|
|
{"RLTS","TextureSRT" },
|
|
|
|
|
{"RLVC","VertexColor" },
|
|
|
|
|
{"RLMC","MaterialColor" },
|
|
|
|
|
{"RLTP","TexturePattern" },
|
|
|
|
|
{"RLIM","IndTextureSRT" },
|
|
|
|
|
{"RLAC","AlphaTest" },
|
|
|
|
|
{"RLCT","FontShadow" },
|
|
|
|
|
{"RLCC","PerCharacterTransformCurve" },
|
|
|
|
|
|
|
|
|
|
{"CLPA","PaneSRT" },
|
|
|
|
|
{"CLVI","Visibility" },
|
|
|
|
|
{"CLTS","TextureSRT" },
|
|
|
|
|
{"CLVC","VertexColor" },
|
|
|
|
|
{"CLMC","MaterialColor" },
|
|
|
|
|
{"CLTP","TexturePattern" },
|
|
|
|
|
{"CLIM","IndTextureSRT" },
|
|
|
|
|
{"CLAC","AlphaTest" },
|
|
|
|
|
{"CLCT","FontShadow" },
|
|
|
|
|
{"CLCC","PerCharacterTransformCurve" },
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-28 21:27:48 +00:00
|
|
|
|
|
|
|
|
|
public class LPATagEntry : BxlanPaiTagEntry
|
|
|
|
|
{
|
|
|
|
|
public override string TargetName => Target.ToString();
|
|
|
|
|
[DisplayName("Target"), CategoryAttribute("Tag")]
|
|
|
|
|
public LPATarget Target
|
|
|
|
|
{
|
|
|
|
|
get { return (LPATarget)AnimationTarget; }
|
|
|
|
|
set { AnimationTarget = (byte)value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LPATagEntry(FileReader reader, BxlanHeader header) : base(reader, header) { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class LTSTagEntry : BxlanPaiTagEntry
|
|
|
|
|
{
|
|
|
|
|
public override string TargetName => Target.ToString();
|
|
|
|
|
[DisplayName("Target"), CategoryAttribute("Tag")]
|
|
|
|
|
public LTSTarget Target
|
|
|
|
|
{
|
|
|
|
|
get { return (LTSTarget)AnimationTarget; }
|
|
|
|
|
set { AnimationTarget = (byte)value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LTSTagEntry(FileReader reader, BxlanHeader header) : base(reader, header) { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class LVITagEntry : BxlanPaiTagEntry
|
|
|
|
|
{
|
|
|
|
|
public override string TargetName => Target.ToString();
|
|
|
|
|
[DisplayName("Target"), CategoryAttribute("Tag")]
|
|
|
|
|
public LVITarget Target
|
|
|
|
|
{
|
|
|
|
|
get { return (LVITarget)AnimationTarget; }
|
|
|
|
|
set { AnimationTarget = (byte)value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LVITagEntry(FileReader reader, BxlanHeader header) : base(reader, header) { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class LVCTagEntry : BxlanPaiTagEntry
|
|
|
|
|
{
|
|
|
|
|
public override string TargetName => Target.ToString();
|
|
|
|
|
[DisplayName("Target"), CategoryAttribute("Tag")]
|
|
|
|
|
public LVCTarget Target
|
|
|
|
|
{
|
|
|
|
|
get { return (LVCTarget)AnimationTarget; }
|
|
|
|
|
set { AnimationTarget = (byte)value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LVCTagEntry(FileReader reader, BxlanHeader header) : base(reader, header) { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class LMCTagEntry : BxlanPaiTagEntry
|
|
|
|
|
{
|
|
|
|
|
public override string TargetName => Target.ToString();
|
|
|
|
|
[DisplayName("Target"), CategoryAttribute("Tag")]
|
|
|
|
|
public LMCTarget Target
|
|
|
|
|
{
|
|
|
|
|
get { return (LMCTarget)AnimationTarget; }
|
|
|
|
|
set { AnimationTarget = (byte)value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LMCTagEntry(FileReader reader, BxlanHeader header) : base(reader, header) { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class LTPTagEntry : BxlanPaiTagEntry
|
|
|
|
|
{
|
|
|
|
|
public override string TargetName => Target.ToString();
|
|
|
|
|
[DisplayName("Target"), CategoryAttribute("Tag")]
|
|
|
|
|
public LTPTarget Target
|
|
|
|
|
{
|
|
|
|
|
get { return (LTPTarget)AnimationTarget; }
|
|
|
|
|
set { AnimationTarget = (byte)value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LTPTagEntry(FileReader reader, BxlanHeader header) : base(reader, header) { }
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-18 22:23:27 +00:00
|
|
|
|
public class BxlanPaiTagEntry
|
|
|
|
|
{
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public virtual string TargetName
|
|
|
|
|
{
|
|
|
|
|
get { return AnimationTarget.ToString(); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public byte AnimationTarget;
|
|
|
|
|
|
|
|
|
|
[DisplayName("Index"), CategoryAttribute("Tag")]
|
|
|
|
|
public byte Index { get; set; }
|
|
|
|
|
|
2019-09-28 21:27:48 +00:00
|
|
|
|
[DisplayName("Curve Type"), CategoryAttribute("Tag")]
|
|
|
|
|
public CurveType CurveType { get; set; }
|
2019-09-18 22:23:27 +00:00
|
|
|
|
|
|
|
|
|
public List<KeyFrame> KeyFrames = new List<KeyFrame>();
|
2019-09-28 21:27:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BxlanPaiTagEntry(FileReader reader, BxlanHeader header)
|
|
|
|
|
{
|
|
|
|
|
long startPos = reader.Position;
|
|
|
|
|
Index = reader.ReadByte();
|
|
|
|
|
AnimationTarget = reader.ReadByte();
|
|
|
|
|
CurveType = reader.ReadEnum<CurveType>(true);
|
|
|
|
|
reader.ReadByte(); //padding
|
|
|
|
|
var KeyFrameCount = reader.ReadUInt16();
|
|
|
|
|
reader.ReadUInt16(); //Padding
|
|
|
|
|
uint keyFrameOffset = reader.ReadUInt32();
|
|
|
|
|
|
|
|
|
|
reader.SeekBegin(startPos + keyFrameOffset);
|
|
|
|
|
for (int i = 0; i < KeyFrameCount; i++)
|
|
|
|
|
KeyFrames.Add(new KeyFrame(reader, CurveType));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Write(FileWriter writer, LayoutHeader header)
|
|
|
|
|
{
|
|
|
|
|
long startPos = writer.Position;
|
|
|
|
|
|
|
|
|
|
writer.Write(Index);
|
|
|
|
|
writer.Write(AnimationTarget);
|
|
|
|
|
writer.Write(CurveType, true);
|
|
|
|
|
writer.Write((byte)0); //padding
|
|
|
|
|
writer.Write((ushort)KeyFrames.Count);
|
|
|
|
|
writer.Write((ushort)0); //padding
|
|
|
|
|
writer.Write(0); //key offset
|
|
|
|
|
|
|
|
|
|
if (KeyFrames.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
writer.WriteUint32Offset(startPos + 8, startPos);
|
|
|
|
|
for (int i = 0; i < KeyFrames.Count; i++)
|
|
|
|
|
KeyFrames[i].Write(writer, CurveType);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum BorderType : byte
|
|
|
|
|
{
|
|
|
|
|
Standard = 0,
|
|
|
|
|
DeleteBorder = 1,
|
|
|
|
|
RenderTwoCycles = 2,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public enum LineAlign : byte
|
|
|
|
|
{
|
|
|
|
|
Unspecified = 0,
|
|
|
|
|
Left = 1,
|
|
|
|
|
Center = 2,
|
|
|
|
|
Right = 3,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public enum CurveType : byte
|
|
|
|
|
{
|
|
|
|
|
Constant,
|
|
|
|
|
Step,
|
|
|
|
|
Hermite,
|
2019-09-18 22:23:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class KeyFrame
|
|
|
|
|
{
|
2019-09-28 21:27:48 +00:00
|
|
|
|
[DisplayName("Slope"), CategoryAttribute("Key Frame")]
|
|
|
|
|
public float Slope { get; set; }
|
2019-09-18 22:23:27 +00:00
|
|
|
|
[DisplayName("Frame"), CategoryAttribute("Key Frame")]
|
|
|
|
|
public float Frame { get; set; }
|
|
|
|
|
[DisplayName("Value"), CategoryAttribute("Key Frame")]
|
|
|
|
|
public float Value { get; set; }
|
|
|
|
|
|
2019-09-28 21:27:48 +00:00
|
|
|
|
public KeyFrame(FileReader reader, CurveType curveType)
|
2019-09-18 22:23:27 +00:00
|
|
|
|
{
|
2019-09-28 21:27:48 +00:00
|
|
|
|
switch (curveType)
|
2019-09-18 22:23:27 +00:00
|
|
|
|
{
|
2019-09-28 21:27:48 +00:00
|
|
|
|
case CurveType.Hermite:
|
|
|
|
|
Frame = reader.ReadSingle();
|
2019-09-18 22:23:27 +00:00
|
|
|
|
Value = reader.ReadSingle();
|
2019-09-28 21:27:48 +00:00
|
|
|
|
Slope = reader.ReadSingle();
|
2019-09-18 22:23:27 +00:00
|
|
|
|
break;
|
2019-09-28 21:27:48 +00:00
|
|
|
|
default:
|
|
|
|
|
Frame = reader.ReadSingle();
|
|
|
|
|
Value = reader.ReadInt16();
|
|
|
|
|
reader.ReadInt16(); //padding
|
2019-09-18 22:23:27 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-28 21:27:48 +00:00
|
|
|
|
public void Write(FileWriter writer, CurveType curveType)
|
2019-09-18 22:23:27 +00:00
|
|
|
|
{
|
2019-09-28 21:27:48 +00:00
|
|
|
|
switch (curveType)
|
2019-09-18 22:23:27 +00:00
|
|
|
|
{
|
2019-09-28 21:27:48 +00:00
|
|
|
|
case CurveType.Hermite:
|
|
|
|
|
writer.Write(Frame);
|
2019-09-18 22:23:27 +00:00
|
|
|
|
writer.Write(Value);
|
2019-09-28 21:27:48 +00:00
|
|
|
|
writer.Write(Slope);
|
2019-09-18 22:23:27 +00:00
|
|
|
|
break;
|
2019-09-28 21:27:48 +00:00
|
|
|
|
default:
|
|
|
|
|
writer.Write(Frame);
|
2019-09-18 22:23:27 +00:00
|
|
|
|
writer.Write((ushort)Value);
|
2019-09-28 21:27:48 +00:00
|
|
|
|
writer.Write((ushort)0);
|
2019-09-18 22:23:27 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-09-09 22:37:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class BxlytHeader : LayoutHeader
|
|
|
|
|
{
|
2019-09-28 21:27:48 +00:00
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public Dictionary<string, BasePane> PaneLookup = new Dictionary<string, BasePane>();
|
|
|
|
|
|
2019-09-09 22:37:33 +00:00
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public BasePane RootPane { get; set; }
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public BasePane RootGroup { get; set; }
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public virtual Dictionary<string, STGenericTexture> GetTextures { get; }
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public virtual List<string> Textures { get; }
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public virtual List<string> Fonts { get; }
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public virtual List<BxlytMaterial> GetMaterials()
|
|
|
|
|
{
|
|
|
|
|
return new List<BxlytMaterial>();
|
|
|
|
|
}
|
2019-09-28 21:27:48 +00:00
|
|
|
|
|
|
|
|
|
public BxlytMaterial SearchMaterial(string name)
|
|
|
|
|
{
|
|
|
|
|
var materials = GetMaterials();
|
|
|
|
|
for (int i = 0; i < materials.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (materials[i].Name == name)
|
|
|
|
|
return materials[i];
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddPaneToTable(BasePane pane)
|
|
|
|
|
{
|
|
|
|
|
if (!PaneLookup.ContainsKey(pane.Name))
|
|
|
|
|
PaneLookup.Add(pane.Name, pane);
|
|
|
|
|
}
|
2019-10-05 22:37:28 +00:00
|
|
|
|
|
2019-10-06 01:15:19 +00:00
|
|
|
|
public void AddPane(BasePane pane, string parent)
|
|
|
|
|
{
|
|
|
|
|
if (PaneLookup.ContainsKey(parent))
|
|
|
|
|
AddPane(pane, PaneLookup[parent]);
|
|
|
|
|
else
|
|
|
|
|
throw new Exception($"Failed to find parent pane! [{parent}]");
|
|
|
|
|
}
|
2019-10-05 22:37:28 +00:00
|
|
|
|
|
|
|
|
|
public void AddPane(BasePane pane, BasePane parent)
|
|
|
|
|
{
|
|
|
|
|
if (!PaneLookup.ContainsKey(pane.Name))
|
|
|
|
|
PaneLookup.Add(pane.Name, pane);
|
|
|
|
|
|
2019-10-06 01:15:19 +00:00
|
|
|
|
pane.Parent = parent;
|
2019-10-05 22:37:28 +00:00
|
|
|
|
parent.Childern.Add(pane);
|
|
|
|
|
parent.NodeWrapper.Nodes.Add(pane.NodeWrapper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemovePanes(List<BasePane> panes)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < panes.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (PaneLookup.ContainsKey(panes[i].Name))
|
|
|
|
|
PaneLookup.Remove(panes[i].Name);
|
|
|
|
|
|
|
|
|
|
var parent = panes[i].Parent;
|
|
|
|
|
parent.Childern.Remove(panes[i]);
|
|
|
|
|
|
|
|
|
|
parent.NodeWrapper.Nodes.Remove(panes[i].NodeWrapper);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-09-09 22:37:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-05 20:24:03 +00:00
|
|
|
|
public class BxlytMaterial
|
|
|
|
|
{
|
2019-09-28 21:27:48 +00:00
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public MaterialAnimController animController = new MaterialAnimController();
|
|
|
|
|
|
2019-09-05 20:24:03 +00:00
|
|
|
|
[DisplayName("Name"), CategoryAttribute("General")]
|
|
|
|
|
public virtual string Name { get; set; }
|
2019-09-08 19:15:42 +00:00
|
|
|
|
|
2019-09-19 22:02:10 +00:00
|
|
|
|
[DisplayName("Thresholding Alpha Interpolation"), CategoryAttribute("Alpha")]
|
|
|
|
|
public virtual bool ThresholdingAlphaInterpolation { get; set; }
|
|
|
|
|
|
2019-09-08 19:15:42 +00:00
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public virtual BxlytShader Shader { get; set; }
|
2019-09-10 22:42:48 +00:00
|
|
|
|
|
|
|
|
|
[DisplayName("Texture Maps"), CategoryAttribute("Texture")]
|
|
|
|
|
public BxlytTextureRef[] TextureMaps { get; set; }
|
2019-09-05 20:24:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-28 21:27:48 +00:00
|
|
|
|
public class MaterialAnimController
|
|
|
|
|
{
|
|
|
|
|
public Dictionary<LMCTarget, float> MaterialColors = new Dictionary<LMCTarget, float>();
|
|
|
|
|
public Dictionary<LTPTarget, string> TexturePatterns = new Dictionary<LTPTarget, string>();
|
|
|
|
|
public Dictionary<LTSTarget, float> TextureSRTS = new Dictionary<LTSTarget, float>();
|
|
|
|
|
public Dictionary<LIMTarget, float> IndTextureSRTS = new Dictionary<LIMTarget, float>();
|
|
|
|
|
|
|
|
|
|
public void ResetAnim()
|
|
|
|
|
{
|
|
|
|
|
MaterialColors.Clear();
|
|
|
|
|
TexturePatterns.Clear();
|
|
|
|
|
TextureSRTS.Clear();
|
|
|
|
|
IndTextureSRTS.Clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class BxlytTextureTransform
|
|
|
|
|
{
|
|
|
|
|
public Vector2F Translate { get; set; }
|
|
|
|
|
public float Rotate { get; set; }
|
|
|
|
|
public Vector2F Scale { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class BxlytIndTextureTransform
|
|
|
|
|
{
|
|
|
|
|
public float Rotation { get; set; }
|
|
|
|
|
public float ScaleX { get; set; }
|
|
|
|
|
public float ScaleY { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-16 23:56:41 +00:00
|
|
|
|
public class SectionCommon
|
2019-08-29 20:33:23 +00:00
|
|
|
|
{
|
2019-09-08 19:15:42 +00:00
|
|
|
|
[Browsable(false)]
|
2019-09-01 17:02:48 +00:00
|
|
|
|
public virtual string Signature { get; }
|
2019-08-29 20:33:23 +00:00
|
|
|
|
|
2019-09-08 19:15:42 +00:00
|
|
|
|
internal uint SectionSize { get; set; }
|
|
|
|
|
internal long StartPosition { get; set; }
|
2019-08-29 20:33:23 +00:00
|
|
|
|
internal byte[] Data { get; set; }
|
|
|
|
|
|
2019-09-01 21:21:36 +00:00
|
|
|
|
public SectionCommon()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public SectionCommon(string signature)
|
|
|
|
|
{
|
|
|
|
|
Signature = signature;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-09 22:37:33 +00:00
|
|
|
|
public virtual void Write(FileWriter writer, LayoutHeader header)
|
2019-08-29 20:33:23 +00:00
|
|
|
|
{
|
|
|
|
|
if (Data != null)
|
|
|
|
|
writer.Write(Data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class CustomRectangle
|
|
|
|
|
{
|
|
|
|
|
public int LeftPoint;
|
|
|
|
|
public int RightPoint;
|
|
|
|
|
public int TopPoint;
|
|
|
|
|
public int BottomPoint;
|
|
|
|
|
|
|
|
|
|
public CustomRectangle(int left, int right, int top, int bottom)
|
|
|
|
|
{
|
|
|
|
|
LeftPoint = left;
|
|
|
|
|
RightPoint = right;
|
|
|
|
|
TopPoint = top;
|
|
|
|
|
BottomPoint = bottom;
|
|
|
|
|
}
|
2019-09-02 23:48:47 +00:00
|
|
|
|
|
2019-10-05 19:32:48 +00:00
|
|
|
|
public CustomRectangle RotateZ(float rotate)
|
|
|
|
|
{
|
2019-10-06 01:15:19 +00:00
|
|
|
|
var topLeft = RotateZPoint(LeftPoint, TopPoint, rotate);
|
|
|
|
|
var bottomRight = RotateZPoint(RightPoint, BottomPoint, rotate);
|
2019-10-05 19:32:48 +00:00
|
|
|
|
|
2019-10-06 01:15:19 +00:00
|
|
|
|
return new CustomRectangle(
|
|
|
|
|
(int)topLeft.X,
|
|
|
|
|
(int)bottomRight.X,
|
|
|
|
|
(int)topLeft.Y,
|
|
|
|
|
(int)bottomRight.Y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private OpenTK.Vector2 RotateZPoint(float p1, float p2, float rotate)
|
|
|
|
|
{
|
|
|
|
|
double angleInRadians = rotate * (Math.PI / 180);
|
|
|
|
|
double cosTheta = Math.Cos(angleInRadians);
|
|
|
|
|
double sinTheta = Math.Sin(angleInRadians);
|
|
|
|
|
var centerPoint = new OpenTK.Vector2(0,0);
|
|
|
|
|
return new OpenTK.Vector2(
|
|
|
|
|
(int)
|
|
|
|
|
(cosTheta * (p1 - centerPoint.X) -
|
|
|
|
|
sinTheta * (p2 - centerPoint.Y) + centerPoint.X),
|
|
|
|
|
(int)
|
|
|
|
|
(sinTheta * (p1 - centerPoint.X) +
|
|
|
|
|
cosTheta * (p2 - centerPoint.Y) + centerPoint.Y));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CustomRectangle GetTransformedRectangle(BasePane parent, Vector3F Transform, Vector3F Rotate, Vector2F Scale)
|
|
|
|
|
{
|
|
|
|
|
var rect = this.RotateZ(Rotate.Z);
|
|
|
|
|
rect = new CustomRectangle(
|
|
|
|
|
(int)(rect.LeftPoint + Transform.X * Scale.X),
|
|
|
|
|
(int)(rect.RightPoint + Transform.X * Scale.X),
|
|
|
|
|
(int)(rect.TopPoint + Transform.Y * Scale.Y),
|
|
|
|
|
(int)(rect.BottomPoint + Transform.Y * Scale.Y));
|
2019-10-05 17:25:28 +00:00
|
|
|
|
|
|
|
|
|
if (parent != null)
|
|
|
|
|
return parent.TransformParent(rect);
|
|
|
|
|
else
|
|
|
|
|
return rect;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-02 23:48:47 +00:00
|
|
|
|
public float Width
|
|
|
|
|
{
|
|
|
|
|
get { return LeftPoint - RightPoint; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float Height
|
|
|
|
|
{
|
|
|
|
|
get { return TopPoint - BottomPoint; }
|
|
|
|
|
}
|
2019-08-29 20:33:23 +00:00
|
|
|
|
}
|
2019-08-30 22:53:45 +00:00
|
|
|
|
|
2019-09-28 21:27:48 +00:00
|
|
|
|
public class LayoutControlDocked : Toolbox.Library.Forms.STUserControl
|
|
|
|
|
{
|
|
|
|
|
public DockContent DockContent;
|
2019-09-09 22:37:33 +00:00
|
|
|
|
|
2019-09-28 21:27:48 +00:00
|
|
|
|
public DockPane Pane => DockContent?.Pane;
|
|
|
|
|
}
|
2019-09-09 22:37:33 +00:00
|
|
|
|
|
2019-08-30 22:53:45 +00:00
|
|
|
|
public class LayoutDocked : DockContent
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2019-08-29 20:33:23 +00:00
|
|
|
|
}
|