Пример #1
0
        private void Awake()
        {
            m_originalSize = (this.transform as RectTransform).sizeDelta;   //原尺寸
            m_size         = m_originalSize;

            KImage image = GetComponentInChildren <KImage>();

            m_fillMethod   = image.fillMethod;
            m_slicedFilled = image.slicedFilled;
        }
Пример #2
0
        /// <summary>
        /// StateImage所有状态图片应该保持同类型
        /// </summary>
        /// <returns></returns>
        bool HasFilledImage()
        {
            KImage image = GetComponentInChildren <KImage>();

            if (image != null)
            {
                return(image.type == Image.Type.Filled ||                        //进度填充
                       (image.slicedFilled && image.type == Image.Type.Sliced)); //九宫格
            }
            return(false);
        }
Пример #3
0
 static public int LoadFromNet(IntPtr l)
 {
     try {
         mg.org.KUI.KImage self = (mg.org.KUI.KImage)checkSelf(l);
         System.String     a1;
         checkType(l, 2, out a1);
         self.LoadFromNet(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #4
0
 public void Align()
 {
     RectTransform[] rects = GetComponentsInChildren <RectTransform>();
     foreach (RectTransform rect in rects)
     {
         KImage image = rect.GetComponent <KImage>();
         if (image)
         {
             // 加个判断 因为被包了一层
             Vector2 position = rect.anchoredPosition;
             if (image.fillMethod == Image.FillMethod.Horizontal && image.fillOrigin == (int)Image.OriginHorizontal.Right)
             {
                 position.x = -m_originalSize.x * (1 - m_scale.x);
             }
             if (image.fillMethod == Image.FillMethod.Vertical && image.fillOrigin == (int)Image.OriginVertical.Bottom)
             {
                 position.y = m_originalSize.y * (1 - m_scale.y);
             }
             rect.anchoredPosition = position;
         }
     }
 }