本文整理汇总了C#中Structure类的典型用法代码示例。如果您正苦于以下问题:C# Structure类的具体用法?C# Structure怎么用?C# Structure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Structure类属于命名空间,在下文中一共展示了Structure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnGo_Click
private void btnGo_Click(object sender, EventArgs e)
{
int StructureNumber;
try
{
StructureNumber = this.numStructure.IntValue;
}
catch(FormatException )
{
return;
}
StructureObj structure = Store.Structures.GetObjectByID((long)StructureNumber);
if (structure == null)
{
MessageBox.Show(this, "No structure found with that ID", "Error", MessageBoxButtons.OK);
return;
}
Structure structView = new Structure(structure);
structView.ShowProperties();
this.Close();
}
示例2: Awake
// Use this for initialization
void Awake()
{
dependencyLines = new Dictionary<GameObject, VectorLine>();
planet = null;
structure = null;
neighbors = new List<Structure>();
}
示例3: GetSliceArea
/// <summary>
/// Calculates the slice area inside of a contour definition for a given slice Z
/// </summary>
private static double GetSliceArea(Image image, int sliceZ, Structure psoas)
{
var area = double.NaN;
var contour = psoas.GetContoursOnImagePlane(sliceZ);
if (contour.Count() > 0)
{
var inside = 0;
for (int x = 0; x < image.XSize; x++)
{
for (int y = 0; y < image.XSize; y++)
{
var dx = (x * image.XRes * image.XDirection + image.Origin).x;
var dy = (y * image.YRes * image.YDirection + image.Origin).y;
var dz = (sliceZ * image.ZRes * image.ZDirection + image.Origin).z;
if (psoas.IsPointInsideSegment(new VVector(dx, dy, dz)))
{
inside++;
}
}
}
var vxArea = image.XRes / 10 * image.YRes / 10;
var contourArea = inside * vxArea;
area = contourArea;
}
return area;
}
示例4: ConfigBuilder
public ConfigBuilder(string pattern, Structure structure, ConfigBuilt builtEvent)
{
_pattern = pattern;
_builtEvent = builtEvent;
_structure = structure;
SimpleBuild = false;
}
示例5: Creature
public Creature()
{
genome = new GenomeTree();
startPosition = new Vector3();
creatureStructure = genome.Generate(startPosition);
}
示例6: Structure
public Structure(Structure TargetCopy)
{
Type = TargetCopy.Type;
Name = TargetCopy.Name;
Description = TargetCopy.Description;
CostTime = TargetCopy.CostTime;
CostFuel = TargetCopy.CostFuel;
CostMetal = TargetCopy.CostMetal;
CostOrganic = TargetCopy.CostOrganic;
CostTime = TargetCopy.CostTime;
StructureLimit = TargetCopy.StructureLimit;
BonusStructures = TargetCopy.BonusStructures;
BonusFuel = TargetCopy.BonusFuel;
BonusMetal = TargetCopy.BonusMetal;
BonusCrystal = TargetCopy.BonusCrystal;
BonusOrganic = TargetCopy.BonusOrganic;
ModifierBuildTime = TargetCopy.ModifierBuildTime;
ModifierFuel = TargetCopy.ModifierFuel;
ModifierMetal = TargetCopy.ModifierMetal;
ModifierOrganic = TargetCopy.ModifierOrganic;
RequiredStructures = new List<string> (TargetCopy.RequiredStructures);
RestrictedEnvironments = new List<Planet.PlanetType> (TargetCopy.RestrictedEnvironments);
}
示例7: Field
/**
* Default constsructor for custom fields.
* @param field An array of field parameters (package, type, name, array/size, value)
* @param filename The name of the file in which the field is defined
*/
public Field(Structure structure, string filename, string[] field)
: base(filename, field[0])
{
this.typename = field[1];
this.type = TypeID(field[1]);
this.element = null;
this.structure = structure;
if (field[3] == null)
{
this.array = -1;
}
else if (field[3].Length == 0)
{
this.array = 0;
}
else
{
this.array = Int32.Parse(field[3]);
}
this.field_value = field[4];
Name = field[2];
// TODO: Default value functionality not yet implemented!
// DefaultValue = fi.value;
}
示例8: TryQueryStructure
public static bool TryQueryStructure(
Structure term,
PrologContext context,
out ELNode foundNode,
out ELNodeEnumerator enumerator)
{
//
// Dispatch based on the functor and arity.
//
// Handle root queries, i.e. /Key
if (term.IsFunctor(Symbol.Slash, 1))
return TryRootQuery(term, context, out foundNode, out enumerator);
if (!IsELTerm(term))
throw new Exception("Malformed EL query: " + ISOPrologWriter.WriteToString(term));
if (term.IsFunctor(SBindNodeOperator, 2))
{
var variableToBind = term.Argument(1) as LogicVariable;
if (variableToBind == null)
throw new ArgumentException("RHS of >> must be an uninstantiated variable: "+ ISOPrologWriter.WriteToString(term.Argument(1)));
foundNode = null;
return TryNodeBindingQuery(out enumerator, term.Argument(0), variableToBind, context);
}
return TryChildQuery(
out foundNode,
out enumerator,
term.Argument(0),
term.Argument(1),
term.Functor == Symbol.Colon,
context);
}
示例9: AddType
public void AddType(Structure type)
{
// Find the previous group.
ScopeMember oldMember = FindMember(type.GetName());
if(oldMember != null)
{
if(!oldMember.IsTypeGroup())
throw new ModuleException("expected type group.");
// Find the previous definition.
TypeGroup oldGroup = (TypeGroup)oldMember;
if(oldGroup.Find(type.GetGenericPrototype()) != null)
throw new ModuleException("matching type already exists.");
// Add the type into the group.
oldGroup.Insert(type);
}
else
{
// Create a new type group.
TypeGroup newGroup = new TypeGroup(type.GetName(), this);
newGroup.Insert(type);
AddMember(newGroup);
}
}
示例10: FUNCTIONAL
private void FUNCTIONAL(Structure tp, string termname, int options)
{
if ((options & NUMBERVARS) != 0 && USDVAR(termname) && __ARITY(tp) == 1)
{
int varno;
Object tp2;
tp2 = __LASTARG(tp, 1);
tp2 = Term.Deref(tp2);
if (tp2 is int)
{
varno = (int) tp2;
if (lastitem == IDENTIFIER_ITEM) PUTCHAR(' ');
PUTCHAR((char)(varno%26 + 'A'));
if ((varno = varno/26) != 0)
{
LowLevelWrite(varno);
}
lastitem = IDENTIFIER_ITEM;
return;
}
}
showname(termname, options);
PUTSOLO('(');
for (int i = 1; i < __ARITY(tp); i++)
{
recwriteterm(__ARG(tp, i), options, 1000, 1201);
PUTSOLO(',');
}
if (__ARITY(tp)>0)
recwriteterm(__LASTARG(tp, __ARITY(tp)), options, 1000, 1201);
PUTSOLO(')');
}
示例11: DrawDependencyInfo
/// <summary>
/// Draw lines and colors related to dependency.
/// </summary>
public void DrawDependencyInfo(Planet planet, Structure structure)
{
this.planet = planet;
this.structure = structure;
List<Structure> neighbors = planet.GetNeigboringStructures(transform.position);
this.neighbors = neighbors;
bool isValid = false;
ClearDependencyLines();
foreach(Structure neighbor in neighbors)
{
if(structure.CheckRequirements(neighbor.GetOutput()))
{
UpdateDependencyLine(neighbor.gameObject);
isValid = true;
}
else
ClearDependencyLine(neighbor.gameObject);
}
if(isValid)
renderer.material.color = Color.green;
else
{
renderer.material.color = Color.red;
}
}
示例12: StructureInstance
public StructureInstance(Structure template, GenericInstance instance,
ScopeMember factory, ChelaModule module)
: base(module)
{
this.factory = factory;
Initialize(template, instance);
}
示例13: LinkStructureToParentCommand
public LinkStructureToParentCommand(Viking.UI.Controls.SectionViewerControl parent,
Structure structure,
Location_CanvasViewModel location)
: base(parent)
{
this.putativeStruct = structure;
this.putativeLoc = location;
StructureType LocType = this.putativeStruct.Type;
if (LocType != null)
{
linecolor = new Microsoft.Xna.Framework.Color(LocType.Color.R,
LocType.Color.G,
LocType.Color.B,
128);
}
else
{
linecolor = Microsoft.Xna.Framework.Color.Green;
}
//Transform the location position to the correct coordinates
transformedPos = parent.SectionToVolume(new GridVector2(putativeLoc.X, putativeLoc.Y));
parent.Cursor = Cursors.Cross;
}
示例14: GenerateFromGenome
public void GenerateFromGenome(WheelGene gene,Structure parent)
{
//var wg:WheelGenome;
//if( genome.WheelGenomes.Length > genome.wheelPositions.Length) {
// var newWheelPositions = new Vector3[genome.WheelGenomes.Length];
// for (var k = 0; k<genome.wheelPositions.Length; k++) {
// newWheelPositions[k] = genome.wheelPositions[k];
// }
// for (var j = k; j<newWheelPositions.Length; j++) {
// newWheelPositions[j] = genome.randomVector3();
// }
// genome.wheelPositions = newWheelPositions;
// //}
//
// for(var i=0; i<genome.WheelGenomes.Length; i++) {
// wg = genome.WheelGenomes[i];
// GameObject wheel = Utilities.loadObject(wg.wheelType,position + genome.wheelPositions[i]*structuralDistance,false);
// wheel.transform.Rotate(wg.initialAngle);
// ConfigurableJoint joint = gaController.j.createJoint(wheel,cartbase,Vector3(0,0,0),Vector3(1,0,0));
// joint.angularYMotion=ConfigurableJointMotion.Free;
// joint.targetAngularVelocity=Vector3(0,5,0);
// joint.angularYZDrive.mode=JointDriveMode.Velocity;
// thiscart.components[i] = wheel;
// }
}
示例15: CanBuyStructure
public bool CanBuyStructure(Structure struc)
{
bool tmpCanBuy = true;
foreach(Cost cst in struc.costs)
if(GM.resourceManager.GetResource (cst.resource).amount < (cst.amount * struc.costMultiplier) + (struc.amount * cst.scaling))
tmpCanBuy = false;
return tmpCanBuy;
}