freeso/TSOClient/FSO.IDE/EditorComponent/Primitives/GetDirectionToDescriptor.cs
riperiperi b57ebbd141 Cleanup: Remove most unused usings and MPL per-file licenses
MPL per-file was used in older project files, but should apply to the whole project, so having it there was redundant.
2023-11-25 03:45:29 +00:00

39 lines
1.8 KiB
C#

using FSO.IDE.EditorComponent.Model;
using FSO.IDE.EditorComponent.OperandForms;
using FSO.IDE.EditorComponent.OperandForms.DataProviders;
using FSO.SimAntics.Primitives;
using System;
using System.Text;
using System.Windows.Forms;
namespace FSO.IDE.EditorComponent.Primitives
{
public class GetDirectionToDescriptor : PrimitiveDescriptor
{
public override PrimitiveGroup Group { get { return PrimitiveGroup.Math; } }
public override PrimitiveReturnTypes Returns { get { return PrimitiveReturnTypes.Done; } }
public override Type OperandType { get { return typeof(VMGetDirectionToOperand); } }
public override string GetBody(EditorScope scope)
{
var op = (VMGetDirectionToOperand)Operand;
var result = new StringBuilder();
result.Append("From object with ID: ");
result.Append(scope.GetVarName(op.ObjectScope, (short)op.OScopeData));
result.Append("\r\nto the Stack Object\r\nStore in: ");
result.Append(scope.GetVarName(op.ResultOwner, (short)op.ResultData));
return result.ToString();
}
public override void PopulateOperandView(BHAVEditor master, EditorScope escope, TableLayoutPanel panel)
{
panel.Controls.Add(new OpLabelControl(master, escope, Operand, new OpStaticTextProvider("Finds the direction between the specified object to the Stack Object and stores it in the specified Variable Scope. Result is 0-7 inclusive, 0 being North and the following going clockwise in 45 degree increments.")));
panel.Controls.Add(new OpScopeControl(master, escope, Operand, "From Object:", "ObjectScope", "OScopeData"));
panel.Controls.Add(new OpScopeControl(master, escope, Operand, "Store in:", "ResultOwner", "ResultData"));
}
}
}