本文整理汇总了C#中AnchorType类的典型用法代码示例。如果您正苦于以下问题:C# AnchorType类的具体用法?C# AnchorType怎么用?C# AnchorType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AnchorType类属于命名空间,在下文中一共展示了AnchorType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetAnchor
public static void SetAnchor(AnchorType at, RectTransform rt)
{
Vector2 anchor;
Vector2 pivot;
if (at == AnchorType.TopLeft)
{
anchor = new Vector2(0, 1);
pivot = new Vector2(0, 1);
}
else if (at == AnchorType.LeftCenter)
{
anchor = new Vector2(0, 0.5f);
pivot = new Vector2(0.5f, 0.5f);
}
else if (at == AnchorType.Center)
{
anchor = new Vector2(0.5f, 0.5f);
pivot = new Vector2(0.5f, 0.5f);
}
else
{
anchor = new Vector2(1, 1);
pivot = new Vector2(1, 1);
}
rt.anchorMin = anchor;
rt.anchorMax = anchor;
rt.pivot = pivot;
}
示例2: Anchor
public Anchor(String tag, AnchorType type, Int16 look)//, uint min, uint max)
{
this.tag = tag;
this.type = type;
this.look = look;
this.positions = new ArrayList();
this.positions.Add(new Point(0.5, 0.5));
}
示例3: OnEnable
/// <summary>
/// Determine the initial anchor type.
/// </summary>
protected virtual void OnEnable ()
{
instance = this;
if (serializedObject.isEditingMultipleObjects)
{
mAnchorType = AnchorType.Advanced;
}
else ReEvaluateAnchorType();
}
示例4: Anchor
public Anchor(AnchorType type,
float max_avulsion_force,
float max_cut_force,
bool is_throughwall,
float d,
float lenght,
Materials[] accepted_material,
float max_a,
float max_s,
float bolt_d)
{
this.type = type;
this.max_avulsion_force = max_avulsion_force;
this.max_cut_force = max_cut_force;
this.is_throughwall = is_throughwall;
this.is_selfdrill = false;
this.d = d;
this.lenght = lenght;
this.accepted_material = accepted_material;
this.max_a = max_a;
this.max_s = max_s;
switch (this.type) {
case AnchorType.Driven:
this.img_name = "Summer_work.Imgs.Anchors.drivein.png";
break;
case AnchorType.Frame:
this.img_name = "Summer_work.Imgs.Anchors.frame.png";
break;
case AnchorType.Sleeve:
this.img_name = "Summer_work.Imgs.Anchors.sleeve.png";
break;
case AnchorType.Wedged:
this.img_name = "Summer_work.Imgs.Anchors.wedgedt2.png";
break;
}
if (this.type == AnchorType.Driven) {
this.bolt_d = bolt_d;
this.bolt_class = this.max_cut_force/100;
if(this.bolt_class<=4.8)//it's bad...
this.bolt_class = (float)4.8;
else if(this.bolt_class<=5.8)
this.bolt_class = (float)5.8;
else if(this.bolt_class <= 8.8)
this.bolt_class = (float)8.8;
else if(this.bolt_class <=9.8)
this.bolt_class = (float)9.8;
else this.bolt_class = (float)12.9;
} else {
this.bolt_class = 0;
this.bolt_d = 0;
}
}
示例5: TreeUpdate
////////////////////////////////////////////////////////////////////////////////////////////////
/*--------------------------------------------------------------------------------------------*/
public override void TreeUpdate()
{
base.TreeUpdate();
UpdateLayoutWithFixedSize();
if ( vRectSize == null ) {
Controllers.Set(RectAnchorName, this);
RectAnchor = AnchorType.MiddleCenter;
}
vRectSize = null;
}
示例6: CalcDistance
/// <summary>
/// Calculates the distance between an old anchor point and a new anchor point.
/// </summary>
/// <param name="oldType"></param>
/// <param name="newType"></param>
/// <param name="size"></param>
public static XVector CalcDistance(AnchorType oldType, AnchorType newType, XSize size)
{
if (oldType == newType)
return new XVector();
XVector result;
Delta delta = Deltas[(int)oldType, (int)newType];
result = new XVector(size.Width / 2 * delta.X, size.Height / 2 * delta.Y);
return result;
}
示例7: WorldUIAnchor
public WorldUIAnchor(Entity anchor)
{
type = AnchorType.Entity;
entity = anchor;
}
示例8: CheckTileAnchors
public static bool CheckTileAnchors(int sx, int sy, int w, int h, int mode, AnchorType anchor)
{
if ((mode & 1) == 1)
{
for (int i = sy; i < sy + h; i++)
{
if (!WorldGen.AnchorValid(Framing.GetTileSafely(sx - 1, i), anchor))
{
return false;
}
if (!WorldGen.AnchorValid(Framing.GetTileSafely(sx + w, i), anchor))
{
return false;
}
}
}
if ((mode & 2) == 2)
{
for (int j = sx; j < sx + w; j++)
{
if (!WorldGen.AnchorValid(Framing.GetTileSafely(j, sy - 1), anchor))
{
return false;
}
if (!WorldGen.AnchorValid(Framing.GetTileSafely(j, sy + h), anchor))
{
return false;
}
}
}
return true;
}
示例9: CalcDistance
/// <summary>
/// Calculates the distance between an old anchor point and a new anchor point.
/// </summary>
/// <param name="oldType"></param>
/// <param name="newType"></param>
/// <param name="size"></param>
/// <returns></returns>
public static XSize CalcDistance(AnchorType oldType, AnchorType newType, XSize size)
{
if (oldType == newType)
return XSize.Empty;
XSize result = XSize.Empty;
Delta delta = CodeBase.deltas[(int)oldType, (int)newType];
result = new XSize(size.width / 2 * delta.x, size.height / 2 * delta.y);
return result;
}
示例10: AnchorValid
public static bool AnchorValid(Tile tileCache, AnchorType anchor)
{
bool flag = false;
if (tileCache.nactive())
{
if ((anchor & AnchorType.SolidTile) == AnchorType.SolidTile && Main.tileSolid[(int)tileCache.type] && !Main.tileSolidTop[(int)tileCache.type] && !Main.tileNoAttach[(int)tileCache.type] && tileCache.blockType() == 0)
{
flag = true;
}
if ((anchor & AnchorType.SolidBottom) == AnchorType.SolidBottom && !Main.tileNoAttach[(int)tileCache.type] && ((Main.tileSolid[(int)tileCache.type] && (!Main.tileSolidTop[(int)tileCache.type] || (tileCache.type == 19 && (tileCache.halfBrick() || tileCache.topSlope())))) || tileCache.topSlope() || tileCache.halfBrick()) && !TileID.Sets.NotReallySolid[(int)tileCache.type] && !tileCache.bottomSlope())
{
flag = true;
}
if (!flag && ((anchor & AnchorType.SolidWithTop) == AnchorType.SolidWithTop || (anchor & AnchorType.Table) == AnchorType.Table))
{
if (tileCache.type == 19)
{
int num = (int)tileCache.frameX / TileObjectData.PlatformFrameWidth();
if ((!tileCache.halfBrick() && num >= 0 && num <= 7) || (num >= 12 && num <= 16) || (num >= 25 && num <= 26))
{
flag = true;
}
}
else if (Main.tileSolid[(int)tileCache.type] && Main.tileSolidTop[(int)tileCache.type])
{
flag = true;
}
}
if (!flag && (anchor & AnchorType.Table) == AnchorType.Table && tileCache.type != 19 && Main.tileTable[(int)tileCache.type] && tileCache.blockType() == 0)
{
flag = true;
}
if (!flag && (anchor & AnchorType.SolidSide) == AnchorType.SolidSide && Main.tileSolid[(int)tileCache.type] && !Main.tileSolidTop[(int)tileCache.type])
{
switch (tileCache.blockType())
{
case 4:
case 5:
flag = true;
break;
}
}
}
else if (!flag && (anchor & AnchorType.EmptyTile) == AnchorType.EmptyTile)
{
flag = true;
}
return flag;
}
示例11: AddPopup
private void AddPopup(Currency currency, double amount, TransactionReasons transactionReason, string reason, Transform referencePosition, AnchorType anchorType, bool isDelta, bool isFacility = false)
{
Popup popup = new Popup();
popup.currency = currency;
popup.amount = amount;
popup.transactionReason = transactionReason;
popup.reason = reason;
popup.anchorType = anchorType;
popup.referencePosition = referencePosition;
popup.isFacility = isFacility;
popup.isDelta = isDelta;
// Special stuff
if (isFacility)
{
popup.initialized = false;
}
// Attempt to combine duplicates
Popup last = popups.LastOrDefault();
if (last != null && last.currency == currency && last.transactionReason == transactionReason && last.reason == reason)
{
last.amount += amount;
}
else
{
popups.Add(popup);
}
}
示例12: AnchorData
public AnchorData(AnchorType type, int count, int start)
{
this.type = type;
this.tileCount = count;
this.checkStart = start;
}
示例13: SetAnchorType
public static void SetAnchorType(this RectTransform RT, AnchorType type)
{
switch (type)
{
case AnchorType.TopCenter:
RT.anchorMin = new Vector2(0.5f, 1);
RT.anchorMax = new Vector2(0.5f, 1);
break;
case AnchorType.LeftCenter:
RT.anchorMin = new Vector2(0, 0.5f);
RT.anchorMax = new Vector2(0, 0.5f);
break;
case AnchorType.RightCenter:
RT.anchorMin = new Vector2(1, 0.5f);
RT.anchorMax = new Vector2(1, 0.5f);
break;
case AnchorType.BottomCenter:
RT.anchorMin = new Vector2(0.5f, 0);
RT.anchorMax = new Vector2(0.5f, 0);
break;
case AnchorType.TopLeft:
RT.anchorMin = new Vector2(0, 1);
RT.anchorMax = new Vector2(0, 1);
break;
case AnchorType.TopRight:
RT.anchorMin = new Vector2(1, 1);
RT.anchorMax = new Vector2(1, 1);
break;
case AnchorType.BottomLeft:
RT.anchorMin = new Vector2(0, 0);
RT.anchorMax = new Vector2(0, 0);
break;
case AnchorType.BottomRight:
RT.anchorMin = new Vector2(1, 0);
RT.anchorMax = new Vector2(1, 0);
break;
case AnchorType.Center:
RT.anchorMin = new Vector2(0.5f, 0.5f);
RT.anchorMax = new Vector2(0.5f, 0.5f);
break;
default:
//Center
RT.anchorMin = new Vector2(0.5f, 0.5f);
RT.anchorMax = new Vector2(0.5f, 0.5f);
break;
}
}
示例14: CalcDistance
/// <summary>
/// Calculates the distance between an old anchor point and a new anchor point.
/// </summary>
/// <param name="oldType"></param>
/// <param name="newType"></param>
/// <param name="size"></param>
public static XVector CalcDistance(AnchorType oldType, AnchorType newType, XSize size)
{
if (oldType == newType)
return new XVector();
XVector result;
Delta delta = CodeBase.deltas[(int)oldType, (int)newType];
result = new XVector(size.width / 2 * delta.x, size.height / 2 * delta.y);
return result;
}
示例15: AnchorData
public AnchorData(AnchorType t, int count, int start)
{
type = t;
tileCount = count;
checkStart = start;
}