/ / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 / /   U T A G E :   U n i t y   T e x t   A d v e n t u r e   G a m e   E n g i n e 
 / /   C o p y r i g h t   2 0 1 4   R y o h e i   T o k i m u r a 
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 u s i n g   S y s t e m . C o l l e c t i o n s ; 
 u s i n g   S y s t e m . C o l l e c t i o n s . G e n e r i c ; 
 u s i n g   l i v e 2 d ; 
 u s i n g   l i v e 2 d . f r a m e w o r k ; 
 
 n a m e s p a c e   U t a g e 
 { 
 	 / * 
 	   *   000n0R0fH00{tY000
 	   * 
 	   * / 
 	 p u b l i c   c l a s s   L i v e 2 D P o s e   :   L 2 D P o s e 
 	 { 
 	 	 p r i v a t e   l o n g   l a s t T i m e ; 
 	 	 / /                 p r i v a t e   A L i v e 2 D M o d e l   l a s t M o d e l   =   n u l l ; / /   00000000000L0RgSU00f00K0i0F0K0n00000(u0
 
 
 	 	 / * 
 	 	   *   000n0000000fe0
 	 	   *   @ p a r a m   m o d e l 
 	 	   * / 
 	 	 p u b l i c   v o i d   u p d a t e P a r a m C u s t o m ( A L i v e 2 D M o d e l   m o d e l ) 
 	 	 { 
 	 	 	 i f   ( m o d e l   = =   n u l l )   r e t u r n ; 
 
 	 	 	 l o n g   c u r T i m e   =   U t S y s t e m . g e t U s e r T i m e M S e c ( ) ; 
 	 	 	 f l o a t   d e l t a T i m e S e c   =   ( ( l a s t T i m e   = =   0 )   ?   0   :   ( c u r T i m e   -   l a s t T i m e )   /   1 0 0 0 . 0 f ) ; 
 	 	 	 l a s t T i m e   =   c u r T i m e ; 
 
 	 	 	 / /   -[K00Bf0	YfY00h00L}NBfL00000k0j00S0h0L0B00n0g00L}NBf0 h0W0f0[_0
 	 	 	 i f   ( d e l t a T i m e S e c   <   0 )   d e l t a T i m e S e c   =   0 ; 
 
 	 	 	 f o r   ( i n t   i   =   0 ;   i   <   p a r t s G r o u p L i s t . C o u n t ;   i + + ) 
 	 	 	 { 
 	 	 	 	 n o r m a l i z e P a r t s O p a c i t y G r o u p ( m o d e l ,   p a r t s G r o u p L i s t [ i ] ,   d e l t a T i m e S e c ) ; 
 	 	 	 	 c o p y O p a c i t y O t h e r P a r t s ( m o d e l ,   p a r t s G r o u p L i s t [ i ] ) ; 
 	 	 	 } 
 	 	 } 
 	 	 p u b l i c   v o i d   i n i t M o d e l ( A L i v e 2 D M o d e l   m o d e l ) 
 	 	 { 
 	 	 	 i f   ( m o d e l   = =   n u l l )   r e t u r n ; 
 	 	 	 / /     00000000000n0RgS
 	 	 	 i n i t P a r a m ( m o d e l ) ; 
 	 	 	 / / 	 	 	 l a s t M o d e l   =   m o d e l ; 
 	 	 	 f o r   ( i n t   i   =   0 ;   i   <   p a r t s G r o u p L i s t . C o u n t ;   i + + ) 
 	 	 	 { 
 	 	 	 	 n o r m a l i z e P a r t s O p a c i t y G r o u p N o F a d e ( m o d e l ,   p a r t s G r o u p L i s t [ i ] ) ; 
 	 	 	 	 c o p y O p a c i t y O t h e r P a r t s ( m o d e l ,   p a r t s G r o u p L i s t [ i ] ) ; 
 	 	 	 } 
 	 	 } 
 
 	 	 p u b l i c   v o i d   u p d a t e P a r a m N o F a d e ( A L i v e 2 D M o d e l   m o d e l ) 
 	 	 { 
 	 	 	 i f   ( m o d e l   = =   n u l l )   r e t u r n ; 
 
 	 	 	 l a s t T i m e   =   U t S y s t e m . g e t U s e r T i m e M S e c ( ) ; 
 	 	 	 f o r   ( i n t   i   =   0 ;   i   <   p a r t s G r o u p L i s t . C o u n t ;   i + + ) 
 	 	 	 { 
 	 	 	 	 n o r m a l i z e P a r t s O p a c i t y G r o u p N o F a d e ( m o d e l ,   p a r t s G r o u p L i s t [ i ] ) ; 
 	 	 	 	 c o p y O p a c i t y O t h e r P a r t s ( m o d e l ,   p a r t s G r o u p L i s t [ i ] ) ; 
 	 	 	 } 
 	 	 } 
 
 	 	 p u b l i c   v o i d   n o r m a l i z e P a r t s O p a c i t y G r o u p N o F a d e ( A L i v e 2 D M o d e l   m o d e l ,   L 2 D P a r t s P a r a m [ ]   p a r t s G r o u p ) 
 	 	 { 
 	 	 	 i n t   v i s i b l e P a r t s   =   - 1 ; 
 	 	 	 / /     s(W0h:yrKak0j0c0f0D000000S_
 	 	 	 f o r   ( i n t   i   =   0 ;   i   <   p a r t s G r o u p . L e n g t h ;   i + + ) 
 	 	 	 { 
 	 	 	 	 i n t   p a r t s I n d e x   =   p a r t s G r o u p [ i ] . p a r t s I n d e x ; 
 	 	 	 	 i n t   p a r a m I n d e x   =   p a r t s G r o u p [ i ] . p a r a m I n d e x ; 
 
 	 	 	 	 i f   ( p a r t s I n d e x   <   0 )   c o n t i n u e ; / /   X[(WW0j0D0000g0Y0
 
 	 	 	 	 i f   ( m o d e l . g e t P a r a m F l o a t ( p a r a m I n d e x )   ! =   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 i f   ( v i s i b l e P a r t s   > =   0 ) 
 	 	 	 	 	 { 
 	 	 	 	 	 	 b r e a k ; 
 	 	 	 	 	 } 
 	 	 	 	 	 v i s i b l e P a r t s   =   i ; 
 	 	 	 	 } 
 	 	 	 } 
 
 	 	 	 i f   ( v i s i b l e P a r t s   <   0 ) 
 	 	 	 { 
 	 	 	 	 v i s i b l e P a r t s   =   0 ; 
 	 	 	 } 
 
 	 	 	 / /     h:y0000^h:y000n0f^0-[Y00
 	 	 	 f o r   ( i n t   i   =   0 ;   i   <   p a r t s G r o u p . L e n g t h ;   i + + ) 
 	 	 	 { 
 	 	 	 	 i n t   p a r t s I n d e x   =   p a r t s G r o u p [ i ] . p a r t s I n d e x ; 
 	 	 	 	 i f   ( p a r t s I n d e x   <   0 )   c o n t i n u e ; / /   X[(WW0j0D0000g0Y0
 
 	 	 	 	 / /     h:y000n0-[
 	 	 	 	 i f   ( v i s i b l e P a r t s   = =   i ) 
 	 	 	 	 { 
 	 	 	 	 	 m o d e l . s e t P a r t s O p a c i t y ( p a r t s I n d e x ,   1 ) ; / /   HQk0-[
 	 	 	 	 } 
 	 	 	 	 / /     ^h:y000n0-[
 	 	 	 	 e l s e 
 	 	 	 	 { 
 	 	 	 	 	 / / 	 	 	 	 	 f l o a t   o p a c i t y   =   m o d e l . g e t P a r t s O p a c i t y ( p a r t s I n d e x ) ; 
 	 	 	 	 	 m o d e l . s e t P a r t s O p a c i t y ( p a r t s I n d e x ,   0 ) ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 } 
 
 	 	 p u b l i c   s t a t i c   L i v e 2 D P o s e   L o a d C u s t o m ( s t r i n g   b u f ) 
 	 	 { 
 	 	 	 r e t u r n   L o a d C u s t o m ( b u f . T o C h a r A r r a y ( ) ) ; 
 	 	 } 
 
 
 	 	 / * 
 	 	   *   J S O N 0000K0000
 	 	   *   Nik0d0D0f0o000000Sgq0J S O N 0000n0b__n0NiL0B000
 	 	   *   @ p a r a m   b u f 
 	 	   *   @ r e t u r n 
 	 	   * / 
 	 	 p u b l i c   s t a t i c   L i v e 2 D P o s e   L o a d C u s t o m ( c h a r [ ]   b u f ) 
 	 	 { 
 	 	 	 L i v e 2 D P o s e   r e t   =   n e w   L i v e 2 D P o s e ( ) ; 
 
 	 	 	 V a l u e   j s o n   =   J s o n . p a r s e F r o m B y t e s ( b u f ) ; 
 
 	 	 	 / /   0000Bfn0c[0V i e w e r 2 . 1 . 8 00c[S0
 	 	 	 i f   ( j s o n . g e t M a p ( n u l l ) . C o n t a i n s K e y ( " f a d e _ i n " ) ) 
 	 	 	 { 
 	 	 	 	 r e t . f a d e I n M S   =   j s o n . g e t ( " f a d e _ i n " ) . t o I n t ( ) ; 
 	 	 	 } 
 
 	 	 	 / /   000R0fH0 N
 	 	 	 L i s t < V a l u e >   p o s e L i s t I n f o   =   j s o n . g e t ( " p a r t s _ v i s i b l e " ) . g e t V e c t o r ( n u l l ) ; 
 	 	 	 i n t   p o s e N u m   =   p o s e L i s t I n f o . C o u n t ; 
 
 	 	 	 f o r   ( i n t   i _ p o s e   =   0 ;   i _ p o s e   <   p o s e N u m ;   i _ p o s e + + ) 
 	 	 	 { 
 	 	 	 	 V a l u e   p o s e I n f o   =   p o s e L i s t I n f o [ i _ p o s e ] ; 
 
 	 	 	 	 / /   I D 000n0-[
 	 	 	 	 L i s t < V a l u e >   i d L i s t I n f o   =   p o s e I n f o . g e t ( " g r o u p " ) . g e t V e c t o r ( n u l l ) ; 
 	 	 	 	 i n t   i d N u m   =   i d L i s t I n f o . C o u n t ; 
 	 	 	 	 L 2 D P a r t s P a r a m [ ]   p a r t s G r o u p   =   n e w   L 2 D P a r t s P a r a m [ i d N u m ] ; 
 	 	 	 	 f o r   ( i n t   i _ g r o u p   =   0 ;   i _ g r o u p   <   i d N u m ;   i _ g r o u p + + ) 
 	 	 	 	 { 
 	 	 	 	 	 V a l u e   p a r t s I n f o   =   i d L i s t I n f o [ i _ g r o u p ] ; 
 	 	 	 	 	 L 2 D P a r t s P a r a m   p a r t s   =   n e w   L 2 D P a r t s P a r a m ( p a r t s I n f o . g e t ( " i d " ) . t o S t r i n g ( ) ) ; 
 	 	 	 	 	 p a r t s G r o u p [ i _ g r o u p ]   =   p a r t s ; 
 
 	 	 	 	 	 / /   000Y00000n0-[
 	 	 	 	 	 i f   ( ! p a r t s I n f o . g e t M a p ( n u l l ) . C o n t a i n s K e y ( " l i n k " ) )   c o n t i n u e ; / /   000L0!qD0h0M00B00
 	 	 	 	 	 L i s t < V a l u e >   l i n k L i s t I n f o   =   p a r t s I n f o . g e t ( " l i n k " ) . g e t V e c t o r ( n u l l ) ; 
 	 	 	 	 	 i n t   l i n k N u m   =   l i n k L i s t I n f o . C o u n t ; 
 	 	 	 	 	 p a r t s . l i n k   =   n e w   L i s t < L 2 D P a r t s P a r a m > ( ) ; 
 	 	 	 	 	 f o r   ( i n t   i _ l i n k   =   0 ;   i _ l i n k   <   l i n k N u m ;   i _ l i n k + + ) 
 	 	 	 	 	 { 
 	 	 	 	 	 	 / / 	 	 	 	 	 s t r i n g   l i n k I D   =   i d L i s t I n f o . g e t ( i _ g r o u p ) . t o s t r i n g ( ) ; / / p a r t s   I D 
 	 	 	 	 	 	 L 2 D P a r t s P a r a m   l i n k P a r t s   =   n e w   L 2 D P a r t s P a r a m ( l i n k L i s t I n f o [ i _ l i n k ] . t o S t r i n g ( ) ) ; 
 	 	 	 	 	 	 p a r t s . l i n k . A d d ( l i n k P a r t s ) ; 
 	 	 	 	 	 } 
 	 	 	 	 } 
 	 	 	 	 r e t . a d d P a r t s G r o u p ( p a r t s G r o u p ) ; 
 	 	 	 } 
 	 	 	 r e t u r n   r e t ; 
 	 	 } 
 	 } 
 } 