Esempio n. 1
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void UpdatePlane(exPlane _plane)
    {
        PlaneInfo planeInfo = null;

        for (int i = 0; i < planeInfoList.Count; ++i)
        {
            if (planeInfoList[i].plane == _plane)
            {
                planeInfo = planeInfoList[i];
                break;
            }
        }
        if (planeInfo == null)
        {
            Debug.LogWarning("Can't find plane info of " + _plane.name);
            return;
        }

        // update plane info material
        if (_plane.GetComponent <Renderer>() != null)
        {
            planeInfo.material = _plane.GetComponent <Renderer>().sharedMaterial;
        }

        // if we are in player or if we are running in editor
        if (Application.isPlaying)
        {
            exClipping clipPlane = _plane as exClipping;
            // if this is not a clip plane
            if (clipPlane == null)
            {
                ApplyClipMaterial(_plane);
            }
        }
    }
Esempio n. 2
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void InsertPlane(int _idx, exPlane _plane)
    {
        // we already have this in clipping list
        if (HasPlaneInfo(_plane))
        {
            return;
        }

        if (_plane.clippingPlane != null)
        {
            _plane.clippingPlane.RemovePlane(_plane);
        }
        InsertPlaneInfo(_idx, _plane);
        _plane.clippingPlane = this;

        // if we are in player or if we are running in editor
        if (Application.isPlaying)
        {
            exClipping clipPlane = _plane as exClipping;
            // if this is not a clip plane
            if (clipPlane == null)
            {
                ApplyClipMaterial(_plane);
            }
        }
    }
Esempio n. 3
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    void Awake()
    {
        Application.targetFrameRate = 60;

        scrollView = GetComponentInChildren <exUIScrollView>();
        clipping   = GetComponentInChildren <exClipping>();

        for (int i = 0; i < userInfos.Count; ++i)
        {
            GameObject         el            = Object.Instantiate(elementPrefab) as GameObject;
            LeaderboardElement leaderboardEL = el.GetComponent <LeaderboardElement>();
            UserInfo           userInfo      = userInfos[i];

            if (userInfo.icon != null)
            {
                leaderboardEL.Init(userInfo.icon, userInfo.name, userInfo.score);
            }
            else
            {
                leaderboardEL.Init(userInfo.iconURL, userInfo.name, userInfo.score);
            }

            AddElement(el);
        }
    }
Esempio n. 4
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void AddToClippingList(exClipping _clipping)
    {
        if (clippingList.IndexOf(_clipping) == -1)
        {
            clippingList.Add(_clipping);
        }
    }
Esempio n. 5
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    void OnPreRender()
    {
        // ========================================================
        // update sprites
        // ========================================================

        for (int i = 0; i < sprites.Count; ++i)
        {
            exPlane sp = sprites[i];
            // NOTE: it is possible the sprite has been destroyed first
            if (sp != null)
            {
                if (sp.updateFlags != exPlane.UpdateFlags.None)
                {
                    sp.Commit();
                    sp.updateFlags = exPlane.UpdateFlags.None;
                }
                sp.inCommitList = false;
            }
        }
        sprites.Clear();

        // ========================================================
        // update clip items
        // ========================================================

        for (int i = 0; i < clippingList.Count; ++i)
        {
            exClipping clipping = clippingList[i];
            if (clipping.enabled)
            {
                clipping.CommitMaterialProperties();
            }
        }
    }
Esempio n. 6
0
 // Allows drag & dropping of this sprite to change its clip in the editor
 protected void LateUpdate()
 {
     // 这里的处理方式和exLayeredSprite.LateUpdate一样
     // 如果exClipping不单单clip子物体,那就会复杂很多
     if (UnityEditor.EditorApplication.isPlaying == false)
     {
         // Run through the parents and see if this sprite attached to a clip
         Transform parentTransform = transform.parent;
         while (parentTransform != null)
         {
             exClipping parentClip = parentTransform.GetComponent <exClipping>();
             if (parentClip != null)
             {
                 SetClip(parentClip);
                 return;
             }
             else
             {
                 exSpriteBase parentSprite = parentTransform.GetComponent <exSpriteBase>();
                 if (parentSprite != null)
                 {
                     SetClip(parentSprite.clip_);
                     return;
                 }
                 else
                 {
                     parentTransform = parentTransform.parent;
                 }
             }
         }
         // No clip
         SetClip(null);
     }
 }
Esempio n. 7
0
    ///////////////////////////////////////////////////////////////////////////////
    // functions
    ///////////////////////////////////////////////////////////////////////////////

    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    protected new void Awake()
    {
        base.Awake();

        clipping   = GetComponent <exClipping>();
        lastWidth  = clipping.width;
        lastHeight = clipping.height;
    }
Esempio n. 8
0
    ///////////////////////////////////////////////////////////////////////////////
    // functions
    ///////////////////////////////////////////////////////////////////////////////

    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    protected new void OnEnable()
    {
        base.OnEnable();
        if (target != curEdit)
        {
            curEdit = target as exClipping;
        }
    }
Esempio n. 9
0
    ///////////////////////////////////////////////////////////////////////////////
    // functions
    ///////////////////////////////////////////////////////////////////////////////
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------
    protected new void Awake()
    {
        base.Awake();

        clipping = GetComponent<exClipping>();
        lastWidth = clipping.width;
        lastHeight = clipping.height;
    }
Esempio n. 10
0
    // ------------------------------------------------------------------
    /// \param _spriteFont the sprite font
    /// build the sprite font
    // ------------------------------------------------------------------

    public static void Build(this exSpriteFont _spriteFont)
    {
#if UNITY_3_4
        bool isPrefab = (EditorUtility.GetPrefabType(_spriteFont) == PrefabType.Prefab);
#else
        bool isPrefab = (PrefabUtility.GetPrefabType(_spriteFont) == PrefabType.Prefab);
#endif

        // when build, alway set dirty
        EditorUtility.SetDirty(_spriteFont);

        if (_spriteFont.fontInfo == null)
        {
            _spriteFont.clippingPlane = null;
            GameObject.DestroyImmediate(_spriteFont.meshFilter.sharedMesh, true);
            _spriteFont.meshFilter.sharedMesh   = null;
            _spriteFont.renderer.sharedMaterial = null;
            return;
        }

        // prefab do not need rebuild mesh
        if (isPrefab == false)
        {
            exClipping clipping = _spriteFont.clippingPlane;
            if (clipping != null)
            {
                clipping.RemovePlane(_spriteFont);
            }

            //
            Mesh newMesh = new Mesh();
            newMesh.hideFlags = HideFlags.DontSave;
            newMesh.Clear();

            // update material
            _spriteFont.renderer.sharedMaterial = _spriteFont.fontInfo.pageInfos[0].material;

            // update mesh
            _spriteFont.ForceUpdateMesh(newMesh);

            //
            GameObject.DestroyImmediate(_spriteFont.meshFilter.sharedMesh, true);   // delete old mesh (to avoid leaking)
            _spriteFont.meshFilter.sharedMesh = newMesh;

            //
            if (clipping != null)
            {
                clipping.AddPlaneInEditor(_spriteFont);
            }
        }

        // update collider
        if (_spriteFont.collisionHelper)
        {
            _spriteFont.collisionHelper.UpdateCollider();
        }
    }
Esempio n. 11
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public override void SetClip(exClipping _clip = null)
    {
        if (_clip != null && layer_ != null)
        {
            if (_clip.transform.IsChildOf(layer_.transform) == false)
            {
                Debug.LogError("Can not add to clip which not in current layer!");
                return;
            }
        }
        base.SetClip(_clip);
    }
Esempio n. 12
0
    // ------------------------------------------------------------------
    /// \param _clipping the clipping plane
    /// \param _plane the plane to add to clip
    /// add plane to clipping list
    // ------------------------------------------------------------------

    public static void AddPlaneInEditor(this exClipping _clipping, exPlane _plane)
    {
        _clipping.AddPlane(_plane);

        exClipping clipPlane = _plane as exClipping;

        // if this is not a clip plane
        if (clipPlane == null)
        {
            ApplyClipMaterialInEditor(_clipping, _plane);
        }
    }
Esempio n. 13
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    protected override void DoInspectorGUI()
    {
        base.DoInspectorGUI();

        foreach (Object obj in serializedObject.targetObjects)
        {
            exClipping clipping = obj as exClipping;
            if (clipping)
            {
                clipping.CheckDirty();
            }
        }
    }
Esempio n. 14
0
    ///////////////////////////////////////////////////////////////////////////////
    // Public Functions
    ///////////////////////////////////////////////////////////////////////////////

    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public virtual void SetClip(exClipping _clip = null)
    {
        if (ReferenceEquals(clip_, _clip))
        {
            return;
        }
        if (_clip != null)
        {
            _clip.Add(this);
        }
        else if (clip_ != null)
        {
            clip_.Remove(this);
        }
    }
Esempio n. 15
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public new void OnSceneGUI()
    {
        exClipping clipping = target as exClipping;

        exEditorUtility.GL_DrawWireFrame(clipping, new Color(0.0f, 1.0f, 0.5f, 1.0f), false);

        if (clipping.hasSprite == false)
        {
            Vector3 size;
            Vector3 center;
            bool    changed = ProcessSceneEditorHandles(out size, out center);
            if (changed)
            {
                exPlaneInspector.ApplyPlaneScale(clipping, size, center);
                clipping.CheckDirty();
            }
        }
    }
Esempio n. 16
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------
    protected new void LateUpdate()
    {
        base.LateUpdate();
        if ( clipping == null ) {
            clipping = GetComponent<exClipping>();
            if ( clipping == null ) {
                Debug.LogError("Can't find exClipping Component in GameObject " + gameObject.name);
                return;
            }
        }

        if ( lastWidth != clipping.width ) {
            lastWidth = clipping.width;
            clipping.updateFlags |= exPlane.UpdateFlags.Vertex;
        }
        if ( lastHeight != clipping.height ) {
            lastHeight = clipping.height;
            clipping.updateFlags |= exPlane.UpdateFlags.Vertex;
        }
    }
Esempio n. 17
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    static void ApplyClipMaterialInEditor(this exClipping _clipping, exPlane _plane)
    {
        Renderer r = _plane.renderer;

        if (r != null && r.sharedMaterial != null)
        {
            Texture2D texture = r.sharedMaterial.mainTexture as Texture2D;
            if (_clipping.textureToClipMaterialTable.ContainsKey(texture) == false)
            {
                r.sharedMaterial = exEditorHelper.GetDefaultMaterial(texture,
                                                                     texture.name
                                                                     + "-clipping-" + Mathf.Abs(_clipping.GetInstanceID()),
                                                                     "ex2D/Alpha Blended (Clipping)");
                _clipping.AddClipMaterial(texture, r.sharedMaterial);
            }
            else
            {
                r.sharedMaterial = _clipping.textureToClipMaterialTable[texture];
            }
        }
    }
Esempio n. 18
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------
    void Awake()
    {
        Application.targetFrameRate = 60;

        scrollView = GetComponentInChildren<exUIScrollView>();
        clipping = GetComponentInChildren<exClipping>();

        for ( int i = 0; i < userInfos.Count; ++i ) {
            GameObject el = Object.Instantiate( elementPrefab ) as GameObject;
            LeaderboardElement leaderboardEL = el.GetComponent<LeaderboardElement>();
            UserInfo userInfo = userInfos[i];

            if ( userInfo.icon != null ) {
                leaderboardEL.Init( userInfo.icon, userInfo.name, userInfo.score );
            }
            else {
                leaderboardEL.Init( userInfo.iconURL, userInfo.name, userInfo.score );
            }

            AddElement(el);
        }
    }
Esempio n. 19
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    protected new void LateUpdate()
    {
        base.LateUpdate();
        if (clipping == null)
        {
            clipping = GetComponent <exClipping>();
            if (clipping == null)
            {
                Debug.LogError("Can't find exClipping Component in GameObject " + gameObject.name);
                return;
            }
        }

        if (lastWidth != clipping.width)
        {
            lastWidth             = clipping.width;
            clipping.updateFlags |= exPlane.UpdateFlags.Vertex;
        }
        if (lastHeight != clipping.height)
        {
            lastHeight            = clipping.height;
            clipping.updateFlags |= exPlane.UpdateFlags.Vertex;
        }
    }
Esempio n. 20
0
    // ------------------------------------------------------------------
    /// Add a sprite to this clip.
    /// NOTE: You can also use exSpriteBase.SetClip for convenience.
    // ------------------------------------------------------------------

    public void Add(exSpriteBase _sprite)
    {
        exClipping oldClip = _sprite.clip;

        if (ReferenceEquals(oldClip, this))
        {
            return;
        }
        if (oldClip != null)
        {
            oldClip.Remove(_sprite);
        }
        exSpriteBase[] spritesToAdd = _sprite.GetComponentsInChildren <exSpriteBase> (true);
        for (int spriteIndex = 0; spriteIndex < spritesToAdd.Length; ++spriteIndex)
        {
            spritesToAdd [spriteIndex].clip = this;
        }
        if (_sprite.transform.IsChildOf(transform) == false)
        {
            _sprite.transform.parent = transform;
        }

        dirty = true;
    }
Esempio n. 21
0
 ///////////////////////////////////////////////////////////////////////////////
 // functions
 ///////////////////////////////////////////////////////////////////////////////
 // ------------------------------------------------------------------
 // Desc:
 // ------------------------------------------------------------------
 protected new void OnEnable()
 {
     base.OnEnable();
     if ( target != curEdit ) {
         curEdit = target as exClipping;
     }
 }
Esempio n. 22
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void RemoveFromClippingList(exClipping _clipping)
    {
        clippingList.Remove(_clipping);
    }
Esempio n. 23
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public static void RemovePlaneInEditor(this exClipping _clipping, exPlane _plane)
    {
        _clipping.RemovePlane(_plane);
    }
Esempio n. 24
0
    static void CreateScrollViewObject()
    {
        // create panel object
        GameObject scrollViewGO = new GameObject("ScrollView");

        //
        GameObject clipRectGO = new GameObject("ClipRect");

        clipRectGO.transform.parent = scrollViewGO.transform;
        exClipping clipRect = clipRectGO.AddComponent <exClipping>();

        clipRect.anchor = exPlane.Anchor.TopLeft;

        //
        GameObject contentAnchor = new GameObject("ContentAnchor");

        contentAnchor.transform.parent = clipRect.transform;

        //
        GameObject horizontalBarGO = new GameObject("HorizontalBar");

        horizontalBarGO.transform.parent = scrollViewGO.transform;
        exSpriteBorder horizontalBar = horizontalBarGO.AddComponent <exSpriteBorder>();

        // myBorder = AssetDatabase.LoadAssetAtPath("Assets/ex2D_GUI/Resource/GUIBorder/HorizontalScrollBar.asset",
        //                                          typeof(exGUIBorder)) as exGUIBorder;
        // elInfo = exAtlasDB.GetElementInfo(myBorder.textureGUID);
        // if ( elInfo != null ) {
        //     atlas = exEditorHelper.LoadAssetFromGUID<exAtlas>(elInfo.guidAtlas);
        //     index = elInfo.indexInAtlas;
        // }
        // horizontalBar.SetBorder( myBorder, atlas, index );
        // horizontalBar.Rebuild ();
        horizontalBar.anchor  = exPlane.Anchor.TopLeft;
        horizontalBar.enabled = false;

        //
        GameObject horizontalSliderGO = new GameObject("HorizontalSlider");

        horizontalSliderGO.transform.parent = scrollViewGO.transform;
        exSpriteBorder horizontalSlider = horizontalSliderGO.AddComponent <exSpriteBorder>();

        // myBorder = AssetDatabase.LoadAssetAtPath("Assets/ex2D_GUI/Resource/GUIBorder/HorizontalSlider.asset",
        //                                          typeof(exGUIBorder)) as exGUIBorder;
        // elInfo = exAtlasDB.GetElementInfo(myBorder.textureGUID);
        // if ( elInfo != null ) {
        //     atlas = exEditorHelper.LoadAssetFromGUID<exAtlas>(elInfo.guidAtlas);
        //     index = elInfo.indexInAtlas;
        // }
        // horizontalSlider.SetBorder( myBorder, atlas, index );
        horizontalSlider.anchor  = exPlane.Anchor.TopLeft;
        horizontalSlider.width   = 0.0f;
        horizontalSlider.height  = 0.0f;
        horizontalSlider.enabled = false;

        //
        GameObject verticalBarGO = new GameObject("VerticalBar");

        verticalBarGO.transform.parent = scrollViewGO.transform;
        exSpriteBorder verticalBar = verticalBarGO.AddComponent <exSpriteBorder>();

        // myBorder = AssetDatabase.LoadAssetAtPath("Assets/ex2D_GUI/Resource/GUIBorder/VerticalScrollBar.asset",
        //                                           typeof(exGUIBorder)) as exGUIBorder;
        // elInfo = exAtlasDB.GetElementInfo(myBorder.textureGUID);
        // if ( elInfo != null ) {
        //     atlas = exEditorHelper.LoadAssetFromGUID<exAtlas>(elInfo.guidAtlas);
        //     index = elInfo.indexInAtlas;
        // }
        // verticalBar.SetBorder( myBorder, atlas, index );
        // verticalBar.Rebuild ();
        verticalBar.anchor  = exPlane.Anchor.TopLeft;
        verticalBar.enabled = false;

        //
        GameObject verticalSliderGO = new GameObject("VerticalSlider");

        verticalSliderGO.transform.parent = scrollViewGO.transform;
        exSpriteBorder verticalSlider = verticalSliderGO.AddComponent <exSpriteBorder>();

        // myBorder = AssetDatabase.LoadAssetAtPath("Assets/ex2D_GUI/Resource/GUIBorder/verticalSlider.asset",
        //                                          typeof(exGUIBorder)) as exGUIBorder;
        // elInfo = exAtlasDB.GetElementInfo(myBorder.textureGUID);
        // if ( elInfo != null ) {
        //     atlas = exEditorHelper.LoadAssetFromGUID<exAtlas>(elInfo.guidAtlas);
        //     index = elInfo.indexInAtlas;
        // }
        // verticalSlider.SetBorder( myBorder, atlas, index );
        verticalSlider.anchor  = exPlane.Anchor.TopLeft;
        verticalSlider.width   = 0.0f;
        verticalSlider.height  = 0.0f;
        verticalSlider.enabled = false;

        //
        exUIScrollView scrollView = scrollViewGO.AddComponent <exUIScrollView>();

        scrollView.anchor           = exPlane.Anchor.TopCenter;
        scrollView.horizontalBar    = horizontalBar;
        scrollView.horizontalSlider = horizontalSlider;
        scrollView.verticalBar      = verticalBar;
        scrollView.verticalSlider   = verticalSlider;
        scrollView.contentAnchor    = contentAnchor.transform;
        scrollView.clipRect         = clipRect;

        scrollView.width  = 100.0f;
        scrollView.height = 100.0f;

        //
        Selection.activeObject = scrollViewGO;
    }
Esempio n. 25
0
    // ------------------------------------------------------------------
    /// \param _sprite the sprite
    /// \param _texture the raw texture used in the sprite
    /// build the sprite by texture
    // ------------------------------------------------------------------

    public static void Build(this exSprite _sprite, Texture2D _texture = null)
    {
#if UNITY_3_4
        bool isPrefab = (EditorUtility.GetPrefabType(_sprite) == PrefabType.Prefab);
#else
        bool isPrefab = (PrefabUtility.GetPrefabType(_sprite) == PrefabType.Prefab);
#endif
        EditorUtility.SetDirty(_sprite);

        //
        if (_sprite.atlas == null && _texture == null)
        {
            _sprite.clippingPlane = null;
            GameObject.DestroyImmediate(_sprite.meshFilter.sharedMesh, true);
            _sprite.meshFilter.sharedMesh   = null;
            _sprite.renderer.sharedMaterial = null;
            return;
        }

        exClipping clipping = _sprite.clippingPlane;
        if (clipping != null)
        {
            clipping.RemovePlane(_sprite);
        }

        // set a texture to it
        if (_sprite.atlas != null)
        {
            _sprite.renderer.sharedMaterial = _sprite.atlas.material;
        }
        else if (_texture != null)
        {
            _sprite.renderer.sharedMaterial = exEditorHelper.GetDefaultMaterial(_texture, _texture.name);
        }
        EditorUtility.UnloadUnusedAssets();

        //
        if (_sprite.useAtlas == false && _sprite.customSize == false && _sprite.trimTexture == false)
        {
            _sprite.width  = _texture.width;
            _sprite.height = _texture.height;
        }

        // prefab do not need rebuild mesh
        if (isPrefab == false)
        {
            // NOTE: it is possible user duplicate an GameObject,
            //       if we directly change the mesh, the original one will changed either.
            Mesh newMesh = new Mesh();
            newMesh.hideFlags = HideFlags.DontSave;
            newMesh.Clear();

            // build vertices, normals, uvs and colors.
            _sprite.ForceUpdateMesh(newMesh);

            // set the new mesh in MeshFilter
            GameObject.DestroyImmediate(_sprite.meshFilter.sharedMesh, true);   // delete old mesh (to avoid leaking)
            _sprite.meshFilter.sharedMesh = newMesh;
        }

        // update collider
        if (_sprite.collisionHelper)
        {
            _sprite.collisionHelper.UpdateCollider();
        }

        //
        if (clipping != null)
        {
            clipping.AddPlaneInEditor(_sprite);
        }
    }
Esempio n. 26
0
 ///////////////////////////////////////////////////////////////////////////////
 // Public Functions
 ///////////////////////////////////////////////////////////////////////////////
 // ------------------------------------------------------------------
 // Desc:
 // ------------------------------------------------------------------
 public virtual void SetClip(exClipping _clip = null)
 {
     if (ReferenceEquals(clip_, _clip)) {
         return;
     }
     if (_clip != null) {
         _clip.Add(this);
     }
     else if (clip_ != null) {
         clip_.Remove(this);
     }
 }
Esempio n. 27
0
 // ------------------------------------------------------------------
 // Desc:
 // ------------------------------------------------------------------
 public void RemoveFromClippingList( exClipping _clipping )
 {
     clippingList.Remove (_clipping);
 }
Esempio n. 28
0
 // ------------------------------------------------------------------
 // Desc:
 // ------------------------------------------------------------------
 public void AddToClippingList( exClipping _clipping )
 {
     if ( clippingList.IndexOf(_clipping) == -1 )
         clippingList.Add (_clipping);
 }
Esempio n. 29
0
 ///////////////////////////////////////////////////////////////////////////////
 // functions
 ///////////////////////////////////////////////////////////////////////////////
 // ------------------------------------------------------------------
 // Desc:
 // ------------------------------------------------------------------
 void Awake()
 {
     if ( renderType == RenderType.Clipping ) {
         clipPlane = GetComponent<exClipping>();
         if (isHorizontal) {
             total = clipPlane.width;
             clipPlane.width = total * ratio_;
         } else {
             total = clipPlane.height;
             clipPlane.height = total * ratio_;
         }
     }
     else if ( renderType == RenderType.Sprite ) {
         sprite = GetComponent<exSprite>();
         if (isHorizontal) {
             total = sprite.width;
             sprite.width = total * ratio_;
         } else {
             total = sprite.height;
             sprite.height = total * ratio_;
         }
     }
     else {
         border = GetComponent<exSpriteBorder>();
         if (isHorizontal) {
             total = border.width;
             border.width = total * ratio_;
         } else {
             total = border.height;
             border.height = total * ratio_;
         }
     }
 }