• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# AnchorType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AnchorType的典型用法代码示例。如果您正苦于以下问题:C# AnchorType类的具体用法?C# AnchorType怎么用?C# AnchorType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AnchorType类属于命名空间,在下文中一共展示了AnchorType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: doesAnchorMatch

        private bool doesAnchorMatch(AnchorType anchorType, ArrayConsList<char> currentPos, int afterLastMatchIndex)
        {
            switch (anchorType)
            {
                case AnchorType.StartOfString:
                    return currentPos.IsStartOfArray;

                case AnchorType.StartOfLine:
                    return currentPos.IsStartOfArray || currentPos.Prev == '\n';

                case AnchorType.EndOfString:
                    return currentPos.IsEmpty;

                case AnchorType.EndOfLine:
                    return currentPos.IsEmpty || currentPos.Head == '\n';

                case AnchorType.EndOfStringOrBeforeEndingNewline:
                    return currentPos.DropWhile(c => c == '\n').IsEmpty;

                case AnchorType.ContiguousMatch:
                    return currentPos.ArrayIndex == afterLastMatchIndex;

                case AnchorType.WordBoundary:
                    return isWordBoundary(currentPos);

                case AnchorType.NonWordBoundary:
                    return !isWordBoundary(currentPos);

                default:
                    throw new ApplicationException(
                        string.Format("BacktrackingMatcher: illegal anchor type ({0}).",
                                      anchorType.ToString()));
            }
        }
开发者ID:aistrate,项目名称:RegexParser,代码行数:34,代码来源:BacktrackingMatcher.cs


示例17: DrawAnchorTransform

	public void DrawAnchorTransform ()
	{
		if (NGUIEditorTools.DrawHeader("Anchors"))
		{
			NGUIEditorTools.BeginContents();
			NGUIEditorTools.SetLabelWidth(NGUISettings.minimalisticLook ? 69f : 62f);

			EditorGUI.BeginDisabledGroup(!((target as UIRect).canBeAnchored));
			GUILayout.BeginHorizontal();
			AnchorType type = (AnchorType)EditorGUILayout.EnumPopup("Type", mAnchorType);
			NGUIEditorTools.DrawPadding();
			GUILayout.EndHorizontal();

			SerializedProperty[] tg = new SerializedProperty[4];
			for (int i = 0; i < 4; ++i) tg[i] = serializedObject.FindProperty(FieldName[i] + ".target");

			if (mAnchorType == AnchorType.None && type != AnchorType.None)
			{
				if (type == AnchorType.Unified)
				{
					if (mTarget[0] == null && mTarget[1] == null && mTarget[2] == null && mTarget[3] == null)
					{
						UIRect rect = target as UIRect;
						UIRect parent = NGUITools.FindInParents<UIRect>(rect.cachedTransform.parent);

						if (parent != null)
							for (int i = 0; i < 4; ++i)
								mTarget[i] = parent.cachedTransform;
					}
				}

				for (int i = 0; i < 4; ++i)
				{
					tg[i].objectReferenceValue = mTarget[i];
					mTarget[i] = null;
				}
				UpdateAnchors(true);
			}

			if (type != AnchorType.None)
			{
				NGUIEditorTools.DrawPaddedProperty("Execute", serializedObject, "updateAnchors");
			}

			if (type == AnchorType.Advanced)
			{
				DrawAnchor(0, true);
				DrawAnchor(1, true);
				DrawAnchor(2, true);
				DrawAnchor(3, true);
			}
			else if (type == AnchorType.Unified)
			{
				DrawSingleAnchorSelection();

				DrawAnchor(0, false);
				DrawAnchor(1, false);
				DrawAnchor(2, false);
				DrawAnchor(3, false);
			}
			else if (type == AnchorType.None && mAnchorType != type)
			{
				// Save values to make it easy to "go back"
				for (int i = 0; i < 4; ++i)
				{
					mTarget[i] = tg[i].objectReferenceValue as Transform;
					tg[i].objectReferenceValue = null;
				}

				serializedObject.FindProperty("leftAnchor.relative").floatValue = 0f;
				serializedObject.FindProperty("bottomAnchor.relative").floatValue = 0f;
				serializedObject.FindProperty("rightAnchor.relative").floatValue = 1f;
				serializedObject.FindProperty("topAnchor.relative").floatValue = 1f;
			}

			mAnchorType = type;
			OnDrawFinalProperties();
			EditorGUI.EndDisabledGroup();
			NGUIEditorTools.EndContents();
		}
	}
开发者ID:onelei,项目名称:ChatBubbleOfUnity,代码行数:81,代码来源:UIRectEditor.cs


示例18: DrawMarker

        /// <summary>
        /// Draws the marker
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="bHorizontal"></param>
        /// <param name="anchorType"></param>
        private void DrawMarker(Graphics g, int x, int y, bool bHorizontal, AnchorType anchorType)
        {
            Pen pen = (anchorType == AnchorType.None) ? Pens.LightGray : Pens.Black;
            if (bHorizontal)
            {
                g.DrawLine(pen, x - mMargin / 2, y, x + mMargin / 2, y);
                g.DrawLine(pen, x - mMargin / 2, y - 2, x - mMargin / 2, y + 2);
                g.DrawLine(pen, x + mMargin / 2, y - 2, x + mMargin / 2, y + 2);
            }
            else
            {
                g.DrawLine(pen, x, y - mMargin / 2, x, y + mMargin / 2);
                g.DrawLine(pen, x - 2, y - mMargin / 2, x + 2, y - mMargin / 2);
                g.DrawLine(pen, x - 2, y + mMargin / 2, x + 2, y + mMargin / 2);
            }

            if (anchorType == AnchorType.Relative)
            {
                string str = "%";
                SizeF dim = g.MeasureString(str, this.Font);

                g.FillRectangle(Brushes.White, x - dim.Width / 2, y - dim.Height / 2, dim.Width, dim.Height);
                g.DrawString(str, this.Font, Brushes.Black, x - dim.Width / 2, y - dim.Height / 2);
            }
        }
开发者ID:RasterCode,项目名称:OtterUI,代码行数:32,代码来源:AnchorEditor.cs


示例19: ReEvaluateAnchorType

	/// <summary>
	/// Manually re-evaluate the current anchor type.
	/// </summary>

	protected void ReEvaluateAnchorType ()
	{
		UIRect rect = target as UIRect;

		if (rect.leftAnchor.target == rect.rightAnchor.target &&
			rect.leftAnchor.target == rect.bottomAnchor.target &&
			rect.leftAnchor.target == rect.topAnchor.target)
		{
			if (rect.leftAnchor.target == null)
			{
				mAnchorType = AnchorType.None;
			}
			else
			{
				mAnchorType = AnchorType.Unified;
			}
		}
		else mAnchorType = AnchorType.Advanced;
	}
开发者ID:onelei,项目名称:ChatBubbleOfUnity,代码行数:23,代码来源:UIRectEditor.cs


示例20: DrawFinalProperties

	/// <summary>
	/// Draw the "Anchors" property block.
	/// </summary>

	protected virtual void DrawFinalProperties ()
	{
		if (NGUIEditorTools.DrawHeader("Anchors"))
		{
			NGUIEditorTools.BeginContents();
			NGUIEditorTools.SetLabelWidth(62f);

			GUILayout.BeginHorizontal();
			AnchorType type = (AnchorType)EditorGUILayout.EnumPopup("Type", mAnchorType);
			GUILayout.Space(18f);
			GUILayout.EndHorizontal();

			SerializedProperty[] tg = new SerializedProperty[4];
			for (int i = 0; i < 4; ++i) tg[i] = serializedObject.FindProperty(FieldName[i] + ".target");

			if (mAnchorType == AnchorType.None && type != AnchorType.None)
			{
				if (mTarget[0] == null && mTarget[1] == null && mTarget[2] == null && mTarget[3] == null)
				{
					UIRect rect = target as UIRect;
					UIRect parent = NGUITools.FindInParents<UIRect>(rect.cachedTransform.parent);
					
					if (parent != null)
						for (int i = 0; i < 4; ++i)
							mTarget[i] = parent.cachedTransform;
				}

				for (int i = 0; i < 4; ++i)
				{
					tg[i].objectReferenceValue = mTarget[i];
					mTarget[i] = null;
				}

				serializedObject.ApplyModifiedProperties();
				serializedObject.Update();
			}

			if (type == AnchorType.Advanced)
			{
				if (mAnchorType == AnchorType.None) UpdateAnchors(false, true, true);

				DrawAnchor(0, true);
				DrawAnchor(1, true);
				DrawAnchor(2, true);
				DrawAnchor(3, true);
			}
			else if (type == AnchorType.Unified)
			{
				if (mAnchorType == AnchorType.None) UpdateAnchors(false, true, true);
				
				DrawSingleAnchorSelection(false);

				DrawAnchor(0, false);
				DrawAnchor(1, false);
				DrawAnchor(2, false);
				DrawAnchor(3, false);
			}
			else if (type == AnchorType.None && mAnchorType != type)
			{
				// Save values to make it easy to "go back"
				for (int i = 0; i < 4; ++i)
				{
					mTarget[i] = tg[i].objectReferenceValue as Transform;
					tg[i].objectReferenceValue = null;
				}

				serializedObject.FindProperty("leftAnchor.relative").floatValue = 0f;
				serializedObject.FindProperty("bottomAnchor.relative").floatValue = 0f;
				serializedObject.FindProperty("rightAnchor.relative").floatValue = 1f;
				serializedObject.FindProperty("topAnchor.relative").floatValue = 1f;
			}

			mAnchorType = type;
			OnDrawFinalProperties();
			NGUIEditorTools.EndContents();
		}
	}
开发者ID:Henry-T,项目名称:UnityPG,代码行数:81,代码来源:UIRectEditor.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Android类代码示例发布时间:2022-05-24
下一篇:
C# AnchorStyles类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap