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


C# UIRect类代码示例

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


UIRect类属于命名空间,在下文中一共展示了UIRect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Awake

    void Awake()
	{
        _uiItem = this.GetSafeComponent<UIRect>();

        float w = Screen.width ;
        float h = Screen.height;

	    float res = h/w;
        //Debug.LogWarning(res);

	    if (res > 1.55) //16:10
	    {
            _uiItem.leftAnchor.Set(0f, 32f);
            _uiItem.rightAnchor.Set(0f, 284f);
            _uiItem.bottomAnchor.Set(0.5f, -126f);
            _uiItem.topAnchor.Set(0.5f, 126f);
	    }

        //228
        if (res > 1.45 && res < 1.55) //3:2
        {
            _uiItem.leftAnchor.Set(0f, 32f);
            _uiItem.rightAnchor.Set(0f, 260f);
            _uiItem.bottomAnchor.Set(0.5f, -114f);
            _uiItem.topAnchor.Set(0.5f, 114f);
        }

        //не нужно
        //if (res < 1.45) //4:3
	}
开发者ID:upsky,项目名称:domru,代码行数:30,代码来源:GuiScreenTutorialLogoIconFix.cs

示例2: UICheckButton

 /// <summary>
 /// Constructs a UIElement with selected and unselected states 
 /// param rect[] takes an array of UIRect dimentions for drawing of all options
 /// param path[] takes an array of path names to load appropriate assets from Resources
 /// param selected specifies whether the element is in selected or unselected state
 /// </param>
 public UICheckButton(UIRect rect, bool selected, string[] path)
 {
     this.mRect = rect;
     mSelected = selected;
     mStyle = new GUIStyle();
     mStyle.normal.background = Resources.Load(path[0]) as Texture2D;
     mStyle.active.background = Resources.Load(path[1]) as Texture2D;
     mStyle.onNormal.background = Resources.Load(path[1]) as Texture2D;
 }
开发者ID:alleeclark,项目名称:Vuforia,代码行数:15,代码来源:UICheckButton.cs

示例3: SetToTarget

    private void SetToTarget()
    {
        var uiCamera = transform.root.GetComponentInChildren<Camera>();

        _uiItem = this.GetSafeComponent<UIRect>();
        Vector3 offset = new Vector3(0, _yOffset, 0);
        Vector3 pos = uiCamera.ScreenToWorldPoint(Camera.main.WorldToScreenPoint(_bottomMarker.position + offset));
        _uiItem.transform.position = pos;
        _uiItem.transform.SetLocalZ(0);
    }
开发者ID:upsky,项目名称:domru,代码行数:10,代码来源:GuiScreenDownBackFix.cs

示例4: Start

    private void Start()
    {
        
        _uiItem = this.GetSafeComponent<UIRect>();
        _uiItem.enabled = false;

        EventMessenger.Subscribe(GameEvent.OnTutorialCompleteShowText, this, () => Invoke("ShowSprite", _clickInterval));
        EventMessenger.Subscribe(GameEvent.OnTutorial_ClickByTarget, this, () => Invoke("MoveToButtonStart", 0f));

        Invoke("SetStartPos", 2f);
    }
开发者ID:upsky,项目名称:domru,代码行数:11,代码来源:HandControllerForTutorial2.cs

示例5: Cache

	void Cache ()
	{
		mCached = true;
		mRect = GetComponent<UIRect>();

		if (mRect == null)
		{
			Renderer ren = GetComponent<Renderer>();
			if (ren != null) mMat = ren.material;
			if (mMat == null) mRect = GetComponentInChildren<UIRect>();
		}
	}
开发者ID:GameSparksLtd,项目名称:GameSparks-Tappy,代码行数:12,代码来源:TweenAlpha.cs

示例6: Start

	void Start ()
	{
        _uiItem = this.GetSafeComponent<UIRect>();

        //float w = Screen.width ;
        //float h = Screen.height;

	    //float res = h/w;
        //Debug.LogWarning(res);

        _uiItem.leftAnchor.target = _uiItem.rightAnchor.target = transform.root.Find("Panel1");

	    _uiItem.leftAnchor.Set(0f, 0f);
	    _uiItem.rightAnchor.Set(1f, 0f);

        _uiItem.ResetAnchors();
	}
开发者ID:upsky,项目名称:domru,代码行数:17,代码来源:GuiScreenRecordLineFix.cs

示例7: UIRadioButton

 /// <summary>
 /// Constructs a UIElement with series of options to choose from; 
 /// Only one option is selected at a time. param index specifies which option is set to true
 /// param rect[] takes an array of UIRect dimentions for drawing of all options
 /// param path[,] takes an array of path names to load appropriate assets from Resources
 /// </param>
 public UIRadioButton(UIRect[] rect, int index, string[,] path)
 {
     if(index > rect.Length)
     {
         return; 
     }
     
     this.mRect = rect;
     mStyle = new GUIStyle[rect.Length];
     
     for(int i = 0; i < mStyle.Length; i++)
     {
         mStyle[i] = new GUIStyle();
         mStyle[i].normal.background = Resources.Load(path[i,0]) as Texture2D;
         mStyle[i].active.background = Resources.Load(path[i,1]) as Texture2D;
         mStyle[i].onNormal.background = Resources.Load(path[i,1]) as Texture2D;
     }
 
     mOptionsTapped = new bool[rect.Length];
     mOptionsSelected = new bool[rect.Length];
     
     mOptionsSelected[index] = true;
 }
开发者ID:alleeclark,项目名称:Vuforia,代码行数:29,代码来源:UIRadioButton.cs

示例8: UILabel

 /// <summary>
 /// Initializes a new instance for label
 /// <param name='rect'> specifies label size
 /// <param name='path'> specifies path for assets to load from Resources
 public UILabel(UIRect rect, string path)
 {
     this.mRect = rect;
     mStyle = new GUIStyle();
     mStyle.normal.background = Resources.Load(path) as Texture2D;
 }
开发者ID:alleeclark,项目名称:Vuforia,代码行数:10,代码来源:UILabel.cs

示例9: Awake

	void Awake () { mRect = GetComponent<UIRect>(); }
开发者ID:jixiang111,项目名称:TTUI-Framework,代码行数:1,代码来源:TweenPosition.cs

示例10: IsVisible

	/// <summary>
	/// Returns whether the specified widget is visible by the panel.
	/// </summary>

	public bool IsVisible (UIRect w)
	{
		Vector3[] corners = w.worldCorners;
		return IsVisible(corners[0], corners[1], corners[2], corners[3]);
	}
开发者ID:hcutler,项目名称:24hoursofgood,代码行数:9,代码来源:UIPanel.cs

示例11: ParentHasChanged

 public virtual void ParentHasChanged()
 {
     this.mParentFound = false;
     UIRect y = NGUITools.FindInParents<UIRect>(this.cachedTransform.parent);
     if (this.mParent != y)
     {
         if (this.mParent)
         {
             this.mParent.mChildren.Remove(this);
         }
         this.mParent = y;
         if (this.mParent)
         {
             this.mParent.mChildren.Add(this);
         }
         this.mRootSet = false;
     }
 }
开发者ID:floatyears,项目名称:Decrypt,代码行数:18,代码来源:UIRect.cs

示例12: Awake

        void Awake()
        {
            // This will allow to set the view in the inspector if we want to
            ViewRoot = ViewRoot ?? GetComponent<UIRect>();

            // Set the alpha to cero so the item is created
            // invisible. When the show method is called
            // the view will be made visible using a transition.
            #if UNITY_EDITOR
            if (UnityEditor.EditorApplication.isPlaying)
                UpdateAlpha(0);
            #else
            ViewRoot.alpha = 0f;
            #endif

            AwakeUnityMsg();
        }
开发者ID:hyrio,项目名称:engineering-blog-examples,代码行数:17,代码来源:ViewPresenter.cs

示例13: MoveRect

	/// <summary>
	/// Adjust the rectangle's position using the specified local delta coordinates.
	/// </summary>

	static public void MoveRect (UIRect rect, float x, float y)
	{
		int ix = Mathf.FloorToInt(x + 0.5f);
		int iy = Mathf.FloorToInt(y + 0.5f);

		Transform t = rect.cachedTransform;
		t.localPosition += new Vector3(ix, iy);
		int anchorCount = 0;

		if (rect.leftAnchor.target)
		{
			++anchorCount;
			rect.leftAnchor.absolute += ix;
		}

		if (rect.rightAnchor.target)
		{
			++anchorCount;
			rect.rightAnchor.absolute += ix;
		}

		if (rect.bottomAnchor.target)
		{
			++anchorCount;
			rect.bottomAnchor.absolute += iy;
		}

		if (rect.topAnchor.target)
		{
			++anchorCount;
			rect.topAnchor.absolute += iy;
		}

#if UNITY_EDITOR
		NGUITools.SetDirty(rect);
#endif

		// If all sides were anchored, we're done
		if (anchorCount != 0) rect.UpdateAnchors();
	}
开发者ID:fengqk,项目名称:Art,代码行数:44,代码来源:NGUIMath.cs

示例14: ParentHasChanged

	/// <summary>
	/// Call this function when the rectangle's parent has changed.
	/// </summary>

	public virtual void ParentHasChanged ()
	{
		mParentFound = false;
		UIRect pt = NGUITools.FindInParents<UIRect>(cachedTransform.parent);

		if (mParent != pt)
		{
			if (mParent) mParent.mChildren.Remove(this);
			mParent = pt;
			if (mParent) mParent.mChildren.Add(this);
			mRootSet = false;
		}
	}
开发者ID:zhang00lei,项目名称:2048,代码行数:17,代码来源:UIRect.cs

示例15: Awake

 private void Awake()
 {
     this.mRect = base.GetComponent<UIRect>();
 }
开发者ID:floatyears,项目名称:Decrypt,代码行数:4,代码来源:TweenPosition.cs


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