/// <summary>
        /// 処理
        /// </summary>
        /// <param name="part"></param>
        public static void OnUpdate( SpritePart part, AttributeBase attribute )
        {
            bool hasInt = attribute.@bool( 0 );
            bool hasPoint = attribute.@bool( 1 );
            bool hasRect = attribute.@bool( 2 );
            bool hasString = attribute.@bool( 3 );

            Vector2 point = Vector2.zero;
            Rect rect = new Rect();

            int index = 0;

            if ( hasPoint ) {
                point = new Vector2( attribute.@float( 0 ), attribute.@float( 1 ) );
                index = 2;
            }
            if ( hasRect ) {
                rect = new Rect(
                        attribute.@float( index + 0 ),
                        attribute.@float( index + 1 ),
                        attribute.@float( index + 2 ),
                        attribute.@float( index + 3 ) );
            }

            var data = new UserData() {
                integer = attribute.@int( 0 ),
                text = hasString ? attribute.@string( 0 ) : null,
                point = point,
                rect = rect,
            };
            part.Root.NotifyUserData( part, data );
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="isVisible"></param>
 public static AttributeBase Create( bool isFlip, bool isHorizontal )
 {
     var self = new AttributeBase(
             isHorizontal ? AttributeBase.Target.kFliperH : AttributeBase.Target.kFliperV,
             null, null,
             new bool[] { isFlip } );
     return self;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="part"></param>
 /// <param name="attribute"></param>
 public static void OnUpdateZ( SpritePart part, AttributeBase attribute )
 {
     var rotation = part.transform.localRotation;
     var angles = rotation.eulerAngles;
     angles.z = attribute.@float( 0 );
     rotation.eulerAngles = angles;
     part.transform.localRotation = rotation;
 }
        /// <summary>
        /// 処理
        /// </summary>
        /// <param name="part"></param>
        public static void OnUpdate( SpritePart part, AttributeBase attribute )
        {
            Vector2 lt = new Vector2( attribute.@float( 0 ), attribute.@float( 1 ) );
            Vector2 rt = new Vector2( attribute.@float( 2 ), attribute.@float( 3 ) );
            Vector2 lb = new Vector2( attribute.@float( 4 ), attribute.@float( 5 ) );
            Vector2 rb = new Vector2( attribute.@float( 6 ), attribute.@float( 7 ) );

            part.TransformVertices( lt, rt, lb, rb );
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="target"></param>
 /// <param name="value"></param>
 public static AttributeBase Create( int target, float value )
 {
     var self = new AttributeBase(
         target == kTargetX
             ? AttributeBase.Target.kScalingX
             : AttributeBase.Target.kScalingY,
        null, new float[] { value }, null );
     return self;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="part"></param>
 /// <param name="attribute"></param>
 public static void OnUpdateY( SpritePart part, AttributeBase attribute )
 {
     float value = attribute.@float( 0 );
     var scaling = part.transform.localScale;
     float old = scaling.y;
     float v = old < 0 ? -value : value;
     scaling.y = v;
     //scaling.z = v;
     part.transform.localScale = scaling;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 処理
 /// 縦反転
 /// </summary>
 /// <param name="part"></param>
 /// <param name="attribute"></param>
 public static void OnUpdateV( SpritePart part, AttributeBase attribute )
 {
     bool isFlip = attribute.@bool( 0 );
     var scale = part.transform.localScale;
     if ( isFlip ) {
         scale.y = -Mathf.Abs( scale.y );
     } else {
         scale.y = Mathf.Abs( scale.y );
     }
     part.transform.localScale = scale;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="target"></param>
 /// <param name="value"></param>
 public static AttributeBase Create( int target, float value )
 {
     var self = new AttributeBase(
         target == kTargetX
             ? AttributeBase.Target.kRotationX
             : target == kTargetY
                 ? AttributeBase.Target.kRotationY
                 : AttributeBase.Target.kRotationZ,
         null, new float[] { value }, null );
     return self;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="lt"></param>
 /// <param name="rt"></param>
 /// <param name="lb"></param>
 /// <param name="rb"></param>
 /// <returns></returns>
 public static AttributeBase Create( float[] lt, float[] rt, float[] lb, float[] rb )
 {
     System.Collections.Generic.List<float> values = new System.Collections.Generic.List<float>( 2 * 4 );
     values.AddRange( lt );
     values.AddRange( rt );
     values.AddRange( lb );
     values.AddRange( rb );
     var self = new AttributeBase( AttributeBase.Target.kVertex, null,
         values.ToArray(), null );
     return self;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="target"></param>
 /// <param name="value"></param>
 public static AttributeBase Create( int target, float value )
 {
     var self = new AttributeBase(
         target == kTargetS
             ? AttributeBase.Target.kUVS
             : target == kTargetT
                 ? AttributeBase.Target.kUVT
                 : target == kTargetU
                     ? AttributeBase.Target.kUVU
                     : AttributeBase.Target.kUVV,
        null, new float[] { value }, null );
     return self;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="isVisible"></param>
 public static AttributeBase Create( int? integer, float[] point, float[] rect, string message )
 {
     bool[] has = { integer.HasValue, point != null, rect != null, message != null };
     int[] iValues = new int[1];
     if ( integer.HasValue ) {
         iValues[0] = integer.Value;
     }
     var floats = new System.Collections.Generic.List<float>( 6 );
     if ( point != null ) {
         floats.AddRange( point );
     }
     if ( rect != null ) {
         floats.AddRange( rect );
     }
     string[] texts = null;
     if ( message != null ) {
         texts = new string[] { message };
     }
     var self = new AttributeBase( AttributeBase.Target.kUserNotify, iValues, floats.ToArray(), has, texts );
     return self;
 }
 /// <summary>
 /// 処理
 /// </summary>
 /// <param name="part"></param>
 public static void OnUpdate( SpritePart part, AttributeBase attribute )
 {
     part.IsVisible = attribute.@bool( 0 );
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="isVisible"></param>
 public static AttributeBase Create( bool isVisible )
 {
     var self = new AttributeBase( AttributeBase.Target.kVisibility, null, null, new bool[] { isVisible } );
     return self;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// キーフレームの追加
 /// </summary>
 /// <param name="frame"></param>
 /// <param name="attribute"></param>
 public void AddKey( int frame, AttributeBase attribute )
 {
     if ( frame >= keyFrames_.Length ) {
         // SSの不具合で範囲外のキーフレームが存在するので無視する
         Debug.LogWarning( "Key frame '" + attribute + "(" + frame + ")' is out of range in " + keyFrames_.Length );
         return;
     }
     keyFrames_[frame].Add( attribute );
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="value"></param>
 public static AttributeBase Create( float value )
 {
     var self = new AttributeBase( AttributeBase.Target.kTransparency, null, new float[] { value }, null );
     return self;
 }
Ejemplo n.º 16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="isVisible"></param>
        public static AttributeBase Create(bool isVisible)
        {
            var self = new AttributeBase(AttributeBase.Target.kVisibility, null, null, new bool[] { isVisible });

            return(self);
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="part"></param>
 /// <param name="attribute"></param>
 public static void OnUpdateZ( SpritePart part, AttributeBase attribute )
 {
     var position = part.transform.localPosition;
     position.z = attribute.@float( 0 );
     part.transform.localPosition = position;
 }
 /// <summary>
 /// 処理
 /// </summary>
 /// <param name="part"></param>
 public static void OnUpdate( SpritePart part, AttributeBase attribute )
 {
     part.SetCellMap( attribute.@int( 0 ), attribute.@int( 1 ) );
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="part"></param>
 /// <param name="attribute"></param>
 public static void OnUpdateY(SpritePart part, AttributeBase attribute)
 {
     float value = attribute.@float(0);
 }
 /// <summary>
 /// 処理
 /// </summary>
 /// <param name="part"></param>
 public static void OnUpdate( SpritePart part, AttributeBase attribute )
 {
     part.Alpha = attribute.@float( 0 );
 }
Ejemplo n.º 21
0
 /// <summary>
 /// 処理
 /// </summary>
 /// <param name="part"></param>
 public static void OnUpdate(SpritePart part, AttributeBase attribute)
 {
     part.IsVisible = attribute.@bool(0);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="value"></param>
 public static AttributeBase Create( int value )
 {
     var self = new AttributeBase( AttributeBase.Target.kPriority, new int[] { value }, null, null );
     return self;
 }
 /// <summary>
 /// 処理
 /// </summary>
 /// <param name="part"></param>
 public static void OnUpdate(SpritePart part, AttributeBase attribute)
 {
     part.SetCellMap(attribute.@int(0), attribute.@int(1));
 }
 /// <summary>
 /// 処理
 /// </summary>
 /// <param name="part"></param>
 public static void OnUpdate( SpritePart part, AttributeBase attribute )
 {
     part.Priority = attribute.@int( 0 );
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="part"></param>
        /// <param name="attribute"></param>
        public static void OnUpdateV(SpritePart part, AttributeBase attribute)
        {
            float value = attribute.@float(0);

            part.UpdateTexCoordV(value);
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="cellIndex"></param>
 /// <param name="mapIndex"></param>
 public static AttributeBase Create( int cellIndex, int mapIndex )
 {
     var self = new AttributeBase( AttributeBase.Target.kCell,
         new int[] { cellIndex, mapIndex }, null, null );
     return self;
 }
 /// <summary>
 /// 追加
 /// </summary>
 /// <param name="attribute"></param>
 public void Add(attribute.AttributeBase attribute)
 {
     attributes_.Add(attribute);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="part"></param>
 /// <param name="attribute"></param>
 public static void OnUpdateV( SpritePart part, AttributeBase attribute )
 {
     float value = attribute.@float( 0 );
     part.UpdateTexCoordV( value );
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="part"></param>
 /// <param name="attribute"></param>
 public static void OnUpdateY( SpritePart part, AttributeBase attribute )
 {
     float value = attribute.@float( 0 );
 }