/// <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 ); }
/// <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); }