当前位置: 首页>>代码示例>>C#>>正文


C# AnchorType类代码示例

本文整理汇总了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;
        }
开发者ID:FeedFestival,项目名称:VisualHack,代码行数:30,代码来源:UiUtils.cs

示例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));
 }
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:8,代码来源:Anchor.cs

示例3: OnEnable

	/// <summary>
	/// Determine the initial anchor type.
	/// </summary>

	protected virtual void OnEnable ()
	{
		instance = this;

		if (serializedObject.isEditingMultipleObjects)
		{
			mAnchorType = AnchorType.Advanced;
		}
		else ReEvaluateAnchorType();
	}
开发者ID:onelei,项目名称:ChatBubbleOfUnity,代码行数:14,代码来源:UIRectEditor.cs

示例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;
            }
        }
开发者ID:BenderRodrigez,项目名称:Summer_work,代码行数:53,代码来源:Anchor.cs

示例5: TreeUpdate

        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public override void TreeUpdate()
        {
            base.TreeUpdate();
            UpdateLayoutWithFixedSize();

            if ( vRectSize == null ) {
                Controllers.Set(RectAnchorName, this);
                RectAnchor = AnchorType.MiddleCenter;
            }

            vRectSize = null;
        }
开发者ID:yanzhao571,项目名称:Hover-VR-Interface-Kit,代码行数:14,代码来源:HoverLayoutArcRow.cs

示例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;
        }
开发者ID:Sl0vi,项目名称:PDFsharp,代码行数:16,代码来源:CodeBase.cs

示例7: WorldUIAnchor

 public WorldUIAnchor(Entity anchor)
 {
     type = AnchorType.Entity;
     entity = anchor;
 }
开发者ID:EmuDevs,项目名称:EDTerraria,代码行数:5,代码来源:WorldUIAnchor.cs

示例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;
 }
开发者ID:Celant,项目名称:TerrariaAPI-Server,代码行数:32,代码来源:WorldGen.cs

示例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;
    }
开发者ID:BackupTheBerlios,项目名称:zp7-svn,代码行数:17,代码来源:CodeBase.cs

示例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;
 }
开发者ID:Celant,项目名称:TerrariaAPI-Server,代码行数:49,代码来源:WorldGen.cs

示例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);
            }
        }
开发者ID:jrossignol,项目名称:Strategia,代码行数:29,代码来源:CurrencyPopup.cs

示例12: AnchorData

		public AnchorData(AnchorType type, int count, int start)
		{
			this.type = type;
			this.tileCount = count;
			this.checkStart = start;
		}
开发者ID:Celant,项目名称:TerrariaAPI-Server,代码行数:6,代码来源:AnchorData.cs

示例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;
     }
 }
开发者ID:truoss,项目名称:UnityGUI-Helper,代码行数:47,代码来源:RectTransformX.cs

示例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;
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:16,代码来源:CodeBase.cs

示例15: AnchorData

 public AnchorData(AnchorType t, int count, int start)
 {
     type = t;
     tileCount = count;
     checkStart = start;
 }
开发者ID:EmuDevs,项目名称:EDTerraria,代码行数:6,代码来源:AnchorData.cs


注:本文中的AnchorType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。