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


C# Rect.ToString方法代码示例

本文整理汇总了C#中UnityEngine.Rect.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.ToString方法的具体用法?C# Rect.ToString怎么用?C# Rect.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Rect的用法示例。


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

示例1: AddRect

 public void AddRect(string key, Rect rect) {
     if (!otherBlockers.ContainsKey(key)) {
         Debug.Log(" added rect " + key + "["+rect.ToString()+"]");
         otherBlockers.Add(key, rect);
     }
     else {
         otherBlockers[key] = rect;
     }
 }
开发者ID:NotYours180,项目名称:Survival,代码行数:9,代码来源:MouseBlocker.cs

示例2: SetUpDisplay

        protected void SetUpDisplay(Rect viewportScreenArea, float scaling)
        {
            _textArea = new Rect(
                viewportScreenArea.x + viewportScreenArea.width * DisplayArea.x,
                (Screen.height - viewportScreenArea.height) - (viewportScreenArea.y - viewportScreenArea.height * DisplayArea.y),
                viewportScreenArea.width * DisplayArea.width,
                viewportScreenArea.height * DisplayArea.height);

            Debug.Log(_textArea.ToString());

            GuiStyle = new GUIStyle();
            GuiStyle.font = Font;
            GuiStyle.fontSize = (int)(FontSize * scaling);
            GuiStyle.wordWrap = true;
            GuiStyle.alignment = TextAnchor.MiddleCenter;
            GuiStyle.normal.textColor = Color.black;
        }
开发者ID:Ben-P-Leda,项目名称:Dogfighter,代码行数:17,代码来源:GuiText.cs

示例3: OnGUI

    void OnGUI()
    {
        Rect rect = new Rect (Input.mousePosition.x, Screen.height - Input.mousePosition.y, 32, 64);

                if (Input.GetMouseButton (0)) {
                        state = State.Clicked;
                } else {
                        state = State.Normal;
                }

                switch (state) {
                case State.Normal:
                        GUI.DrawTexture (rect, normal);
                        break;
                case State.Clicked:
                        GUI.DrawTexture (rect, clicked);
                        break;
                }

                GUI.depth = 1;
                GUILayout.Label (rect.ToString ());
    }
开发者ID:kaluluosi,项目名称:MyTestGame,代码行数:22,代码来源:Cursor.cs

示例4: HandleElementChanged

    public override void HandleElementChanged()
    {
        int tileIndex = _tileIndex;
        int cols = (int)_element.sourceSize.x/_tileSize;
        float tileSize = _tileSize;

        Vector2 textureSize = _element.atlas.textureSize;

        //		float uvTileWidth = tileSize/(textureSize.x - (_spacing * 5));
        //		float uvTileHeight = tileSize/(textureSize.y - (_spacing * 5));

        float uvTileWidth = tileSize/textureSize.x;
        float uvTileHeight = tileSize/textureSize.y;

        float uvSpacing = _spacing/textureSize.x;

        //		Debug.Log("uvTileWidth = "+uvTileWidth);
        //		Debug.Log("uvTileHeight = "+uvTileHeight);
        //		Debug.Log("cols = "+cols);

        int col = tileIndex%cols;
        int row = tileIndex/cols;

        //		Debug.Log("col = "+col);
        //		Debug.Log("row = "+row);

        Rect tileUvRect = new Rect
        (
         			_element.uvRect.x + col*uvTileWidth + ((col+1)*uvSpacing),
            _element.uvRect.y + _element.uvRect.height - ((row+1)*uvTileHeight) - ((row+1)*uvSpacing),
            uvTileWidth,
            uvTileHeight
        );

        Debug.Log("UV Rect " + tileUvRect.ToString());

        _uvTopLeft.Set(tileUvRect.xMin,tileUvRect.yMax);
        _uvTopRight.Set(tileUvRect.xMax,tileUvRect.yMax);
        _uvBottomRight.Set(tileUvRect.xMax,tileUvRect.yMin);
        _uvBottomLeft.Set(tileUvRect.xMin,tileUvRect.yMin);

        _boundsRect.width = _tileSize;
        _boundsRect.height = _tileSize;
        _boundsRect.x = 0; // AnchorPoint 0,0
        _boundsRect.y = -tileSize;

        _localVertices[0].Set(_boundsRect.xMin,_boundsRect.yMax);
        _localVertices[1].Set(_boundsRect.xMax,_boundsRect.yMax);
        _localVertices[2].Set(_boundsRect.xMax,_boundsRect.yMin);
        _localVertices[3].Set(_boundsRect.xMin,_boundsRect.yMin);
    }
开发者ID:gtco,项目名称:FutileBase,代码行数:51,代码来源:TDMapTile.cs

示例5: DoAvatarPreview2

        public void DoAvatarPreview2(Rect rect, GUIStyle background)
        {
            this.Init ();
            //			Rect position = new Rect (rect.xMax - 16f, rect.yMax - 16f, 16f, 16f);
            //			if (EditorGUI.ButtonMouseDown (position, GUIContent.none, FocusType.Passive, GUIStyle.none))
            //			{
            //				GenericMenu genericMenu = new GenericMenu ();
            //				genericMenu.AddItem (new GUIContent ("Auto"), false, new GenericMenu.MenuFunction2 (my.SetPreviewAvatarOption), AvatarPreview.PreviewPopupOptions.Auto);
            //				genericMenu.AddItem (new GUIContent ("Unity Model"), false, new GenericMenu.MenuFunction2 (my.SetPreviewAvatarOption), AvatarPreview.PreviewPopupOptions.DefaultModel);
            //				genericMenu.AddItem (new GUIContent ("Other..."), false, new GenericMenu.MenuFunction2 (my.SetPreviewAvatarOption), AvatarPreview.PreviewPopupOptions.Other);
            //				genericMenu.ShowAsContext ();
            //			}
                        Rect rect2 = rect;
            //			rect2.yMin += 21f;
            //			rect2.height = Mathf.Max (rect2.height, 64f);
            //			my.m_PreviewDir = PreviewGUI.Drag2D (my.m_PreviewDir, rect2);
            //			int controlID = GUIUtility.GetControlID (my.m_PreviewHint, FocusType.Native, rect2);
                        int controlID = GUIUtility.GetControlID (FocusType.Passive) + 1;
                        Event current = Event.current;

                        EventType typeForControl = current.GetTypeForControl (controlID);
                        if (typeForControl == EventType.Repaint) {// && my.m_IsValid)

                                lastRect = GUILayoutUtility.GetLastRect ();
                                Debug.Log ("y:" + lastRect.ToString ());
                                image = this.DoRenderPreview (rect2, background);

                                //GUI.DrawTexture (rect2, image, ScaleMode.StretchToFill, false);

                        }

                        GUILayout.Box (image);

                        //if (image != null) {
                        //GUILayout.BeginHorizontal ();

                        //GUILayout.Button("mile");
                        //GUILayout.EndHorizontal ();
                        //	}

                        lastRect.width = Screen.width;
                        this.AvatarTimeControlGUI (lastRect);
            //			GUI.DrawTexture (position, AvatarPreview.s_Styles.avatarIcon.image);
            //
            //			if (!my.m_IsValid)
            //			{
            //				Rect position2 = rect2;
            //				position2.yMax -= position2.height / 2f - 16f;
            //				EditorGUI.DropShadowLabel (position2, "No model is available for preview.\nPlease drag a model into my Preview Area.");
            //			}
            //			my.DoAvatarPreviewDrag (typeForControl);
            //			if (current.type == EventType.ExecuteCommand)
            //			{
            //				string commandName = current.commandName;
            //				if (commandName == "ObjectSelectorUpdated" && ObjectSelector.get.objectSelectorID == this.m_ModelSelectorId)
            //				{
            //					my.SetPreview (ObjectSelector.GetCurrentObject () as GameObject);
            //					current.Use ();
            //				}
            //			}
        }
开发者ID:osmanzeki,项目名称:bmachine,代码行数:61,代码来源:UnityWrapper.cs


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