画像の指定
Inheritance: UnityEngine.ScriptableObject
Beispiel #1
0
 /// <summary>
 /// コピー
 /// </summary>
 /// <param name="o"></param>
 public void CopyTo(CellMap o)
 {
     o.uv_          = uv_;
     o.width_       = width_;
     o.height_      = height_;
     o.pivot_       = pivot_;
     o.fragmentMap_ = fragmentMap_;
     o.texture_     = texture_;
 }
        /// <summary>
        /// セルマップの指定
        /// </summary>
        /// <param name="index"></param>
        /// <param name="mapIndex"></param>
        public void SetCellMap(int index, int mapIndex)
        {
            cellMap_   = part_.Root.CellMap(index);
            cellIndex_ = mapIndex;

            // UV
            size_ = new Vector2(cellMap_.Width(mapIndex), cellMap_.Height(mapIndex));
            uv_   = cellMap_.UV(mapIndex);

            // PIVOT
            var pivot = cellMap_.Pivot(mapIndex);

            position_           = new Vector3(size_.x * -pivot.x, size_.y * -pivot.y, 0);
            rectTransform.pivot = pivot;
            rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, size_.x);
            rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, size_.y);
            part_.GetComponent <RectTransform>().pivot = rectTransform.pivot;
            part_.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, size_.x);
            part_.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, size_.y);

            UpdateVertices();
            SetMaterialDirty();
        }
 /// <summary>
 /// コピー
 /// </summary>
 /// <param name="o"></param>
 public void CopyTo( CellMap o )
 {
     o.uv_ = uv_;
     o.width_ = width_;
     o.height_ = height_;
     o.pivot_ = pivot_;
     o.fragmentMap_ = fragmentMap_;
     o.texture_ = texture_;
 }
        /// <summary>
        /// セルマップの指定
        /// </summary>
        /// <param name="index"></param>
        /// <param name="mapIndex"></param>
        public void SetCellMap( int index, int mapIndex )
        {
            cellMap_ = part_.Root.CellMap( index );
            cellIndex_ = mapIndex;

            // UV
            size_ = new Vector2( cellMap_.Width( mapIndex ), cellMap_.Height( mapIndex ) );
            uv_ = cellMap_.UV( mapIndex );

            // PIVOT
            var pivot = cellMap_.Pivot( mapIndex );
            position_ = new Vector3( size_.x * -pivot.x, size_.y * -pivot.y, 0 );
            rectTransform.pivot = pivot;
            rectTransform.SetSizeWithCurrentAnchors( RectTransform.Axis.Horizontal, size_.x );
            rectTransform.SetSizeWithCurrentAnchors( RectTransform.Axis.Vertical, size_.y );
            part_.GetComponent<RectTransform>().pivot = rectTransform.pivot;
            part_.GetComponent<RectTransform>().SetSizeWithCurrentAnchors( RectTransform.Axis.Horizontal, size_.x );
            part_.GetComponent<RectTransform>().SetSizeWithCurrentAnchors( RectTransform.Axis.Vertical, size_.y );

            UpdateVertices();
            SetMaterialDirty();
        }