/ / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 / /   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 . G e n e r i c ; 
 u s i n g   S y s t e m . I O ; 
 u s i n g   S y s t e m ; 
 u s i n g   U n i t y E n g i n e ; 
 
 n a m e s p a c e   U t a g e 
 { 
 
 	 / / /   < s u m m a r y > 
 	 / / /   0000{t
 	 / / /   < / s u m m a r y > 
 	 p u b l i c   c l a s s   A d x 2 L e S o u n d M a n a g e r S y s t e m   :   S o u n d M a n a g e r S y s y t e m I n t e r f a c e 
 	 { 
 	 	 / / 000[an000000000
 	 	 L i s t < s t r i n g >   S a v e S t r e a m N a m e L i s t   {   g e t   {   r e t u r n   s a v e S t r e a m N a m e L i s t ;   }   } 
 	 	 L i s t < s t r i n g >   s a v e S t r e a m N a m e L i s t   =   n e w   L i s t < s t r i n g > ( ) ; 
 	 	 D i c t i o n a r y < s t r i n g ,   A d x 2 P l a y e r >   s t r e a m T b l   =   n e w   D i c t i o n a r y < s t r i n g ,   A d x 2 P l a y e r > ( ) ; 	 / / B G M I{n000000
 
 	 	 / / 0000000000
 	 	 S o u n d M a n a g e r   S o u n d M a n g a e r   {   g e t ;   s e t ;   } 
 
 	 	 T r a n s f o r m   C a c h e d T r a n s f o r m   {   g e t ;   s e t ;   } 
 	 	 L i s t < C r i A t o m S o u r c e >   s e L i s t   =   n e w   L i s t < C r i A t o m S o u r c e > ( ) ; 	 	 	 	 / / s(W{t-Nn0S E 000
 	 	 A d x 2 L e F o r U t a g e   A d x 2 L e F o r U t a g e   {   g e t ;   s e t ;   } 
 
 	 	 p u b l i c   A d x 2 L e S o u n d M a n a g e r S y s t e m ( A d x 2 L e F o r U t a g e   a d x 2 L e F o r U t a g e ) 
 	 	 { 
 	 	 	 t h i s . A d x 2 L e F o r U t a g e   =   a d x 2 L e F o r U t a g e ; 
 	 	 } 
 
 	 	 p u b l i c   v o i d   I n i t ( S o u n d M a n a g e r   s o u n d M a n g a e r ,   L i s t < s t r i n g >   s a v e S t r e a m N a m e L i s t ) 
 	 	 { 
 	 	 	 S o u n d M a n g a e r   =   s o u n d M a n g a e r ; 
 	 	 	 C a c h e d T r a n s f o r m   =   S o u n d M a n g a e r . t r a n s f o r m ; 
 	 	 	 t h i s . s a v e S t r e a m N a m e L i s t   =   s a v e S t r e a m N a m e L i s t ; 
 	 	 } 
 
 	 	 p u b l i c   v o i d   P l a y ( s t r i n g   s t r e a m N a m e ,   A s s e t F i l e   f i l e ,   f l o a t   v o l u m e ,   b o o l   i s L o o p ,   f l o a t   f a d e I n T i m e ,   f l o a t   f a d e O u t T i m e ,   b o o l   i s R e p l a y ,   F u n c < f l o a t >   c a l l b a c k M a s t e r V o l u m e ) 
 	 	 { 
 	 	 	 b o o l   i s S t r e a m i n g   =   ( f i l e . L o a d F l a g s   &   A s s e t F i l e L o a d F l a g s . S t r e a m i n g )   = =   A s s e t F i l e L o a d F l a g s . S t r e a m i n g ; 
 
 	 	 	 P l a y S u b ( s t r e a m N a m e ,   f i l e   a s   A d x 2 A s s e t F i l e ,   v o l u m e ,   i s L o o p ,   i s S t r e a m i n g ,   f a d e I n T i m e ,   f a d e O u t T i m e ,   i s R e p l a y ,   c a l l b a c k M a s t e r V o l u m e ) ; 
 	 	 } 
 
 	 	 p u b l i c   v o i d   P l a y ( s t r i n g   s t r e a m N a m e ,   A u d i o C l i p   c l i p ,   f l o a t   v o l u m e ,   b o o l   i s L o o p ,   b o o l   i s S t r e a m i n g ,   f l o a t   f a d e I n T i m e ,   f l o a t   f a d e O u t T i m e ,   b o o l   i s R e p l a y ,   F u n c < f l o a t >   c a l l b a c k M a s t e r V o l u m e ) 
 	 	 { 
 	 	 	 D e b u g . L o g E r r o r ( " A u d i o C l i p   i s   n o t   s u p p o r t   p l e a s e   u s e   A d x 2 " ) ; 
 	 	 } 
 
 	 	 v o i d   P l a y S u b ( s t r i n g   s t r e a m N a m e ,   A d x 2 A s s e t F i l e   a d x 2 F i l e ,   f l o a t   v o l u m e ,   b o o l   i s L o o p ,   b o o l   i s S t r e a m i n g ,   f l o a t   f a d e I n T i m e ,   f l o a t   f a d e O u t T i m e ,   b o o l   i s R e p l a y ,   F u n c < f l o a t >   c a l l b a c k M a s t e r V o l u m e ) 
 	 	 { 
 	 	 	 A d x 2 P l a y e r   s t r e a m   =   G e t S t r e a m A n d C r e a t e I f M i s s i n g ( s t r e a m N a m e ) ; 
 	 	 	 i f   ( i s R e p l a y   | |   ! s t r e a m . I s P l a y i n g ( a d x 2 F i l e . C u e N a m e ) ) 
 	 	 	 { 
 	 	 	 	 s t r e a m . P l a y ( a d x 2 F i l e . C u e S h e e t ,   a d x 2 F i l e . C u e N a m e ,   f a d e I n T i m e ,   f a d e O u t T i m e ,   v o l u m e ,   i s L o o p ,   i s S t r e a m i n g ,   c a l l b a c k M a s t e r V o l u m e ) ; 
 	 	 	 } 
 	 	 } 
 
 	 	 p u b l i c   v o i d   S t o p ( s t r i n g   s t r e a m N a m e ,   f l o a t   f a d e T i m e ) 
 	 	 { 
 	 	 	 A d x 2 P l a y e r   s t r e a m   =   G e t S t r e a m A n d C r e a t e I f M i s s i n g ( s t r e a m N a m e ) ; 
 	 	 	 s t r e a m . S t o p   ( f a d e T i m e ) ; 
 	 	 } 
 
 	 	 p u b l i c   b o o l   I s P l a y i n g ( s t r i n g   s t r e a m N a m e ) 
 	 	 { 
 	 	 	 i f   ( ! C r i W a r e I n i t i a l i z e r . I s I n i t i a l i z e d ( ) )   r e t u r n   f a l s e ; 
 	 	 	 A d x 2 P l a y e r   s t r e a m   =   G e t S t r e a m A n d C r e a t e I f M i s s i n g ( s t r e a m N a m e ) ; 
 	 	 	 r e t u r n   s t r e a m . I s P l a y i n g   ( ) ; 
 	 	 } 
 
 	 	 p u b l i c   b o o l   I s P l a y i n g L o o p ( s t r i n g   s t r e a m N a m e ) 
 	 	 { 
 	 	 	 i f   ( ! C r i W a r e I n i t i a l i z e r . I s I n i t i a l i z e d ( ) )   r e t u r n   f a l s e ; 
 	 	 	 A d x 2 P l a y e r   s t r e a m   =   G e t S t r e a m A n d C r e a t e I f M i s s i n g ( s t r e a m N a m e ) ; 
 	 	 	 r e t u r n   s t r e a m . I s P l a y i n g ( ) ; 
 	 	 } 
 
 	 	 p u b l i c   f l o a t   G e t C u r r e n t S a m p l e s V o l u m e ( s t r i n g   s t r e a m N a m e ) 
 	 	 { 
 	 	 	 A d x 2 P l a y e r   s t r e a m   =   G e t S t r e a m A n d C r e a t e I f M i s s i n g ( s t r e a m N a m e ) ; 
 	 	 	 r e t u r n   s t r e a m . t i m e S a m p l e s ; 
 	 	 } 
 
 	 	 p u b l i c   v o i d   S t o p A l l ( f l o a t   f a d e T i m e ) 
 	 	 { 
 	 	 	 f o r e a c h   ( v a r   s t r e a m   i n   s t r e a m T b l . V a l u e s )   
 	 	 	 { 
 	 	 	 	 s t r e a m . S t o p ( f a d e T i m e ) ; 
 	 	 	 } 
 	 	 } 
 
 	 	 p u b l i c   v o i d   P l a y S e ( A s s e t F i l e   f i l e ,   f l o a t   v o l u m e ,   s t r i n g   l a b e l ,   S o u n d P l a y M o d e   p l a y M o d e   =   S o u n d P l a y M o d e . A d d ,   b o o l   i s L o o p   =   f a l s e ) 
 	 	 { 
 	 	 	 / / ϑ0 j0n0g000U0j0D0
 	 	 	 i f   ( v o l u m e   < =   0 )   r e t u r n ; 
 
 	 	 	 A d x 2 A s s e t F i l e   a d x 2 F i l e   =   f i l e   a s   A d x 2 A s s e t F i l e ; 
 	 	 	 C r i A t o m S o u r c e   s e   =   P l a y S e ( a d x 2 F i l e . C u e S h e e t ,   a d x 2 F i l e . C u e N a m e ,   v o l u m e ,   i s L o o p ) ; 
 	 	 	 s e L i s t . A d d ( s e ) ; 
 	 	 } 
 
 	 	 p u b l i c   v o i d   P l a y S e ( A u d i o C l i p   c l i p ,   f l o a t   v o l u m e ,   s t r i n g   l a b e l ,   S o u n d P l a y M o d e   p l a y M o d e   =   S o u n d P l a y M o d e . A d d ,   b o o l   i s L o o p   =   f a l s e ) 
 	 	 { 
 	 	 	 D e b u g . L o g E r r o r ( " A u d i o C l i p   i s   n o t   s u p p o r t   p l e a s e   u s e   A d x 2 " ) ; 
 	 	 } 
 
 	 	 p u b l i c   v o i d   S t o p S e ( s t r i n g   c l i p N a m e ,   f l o a t   f a d e T i m e ) 
 	 	 { 
 	 	 	 v a r   c h i l d   =   C a c h e d T r a n s f o r m . F i n d C h i l d ( c l i p N a m e ) ; 
 	 	 	 i f   ( c h i l d   = =   n u l l )   r e t u r n ; 
 
 	 	 	 C r i A t o m S o u r c e   a u d i o   =   c h i l d . G e t C o m p o n e n t < C r i A t o m S o u r c e > ( ) ; 
 	 	 	 a u d i o . S t o p ( ) ; 
 	 	 } 
 
 	 	 p u b l i c   b o o l   I s P l a y i n g S e ( A u d i o C l i p   c l i p ) 
 	 	 { 
 	 	 	 D e b u g . L o g E r r o r ( " A u d i o C l i p   i s   n o t   s u p p o r t   p l e a s e   u s e   A d x 2 " ) ; 
 	 	 	 r e t u r n   f a l s e ; 
 	 	 } 
 
 	 	 / / S E h0W0f0Qu
 	 	 C r i A t o m S o u r c e   P l a y S e ( s t r i n g   c u e S h e e t ,   s t r i n g   c u e N a m e ,   f l o a t   v o l u m e ,   b o o l   i s L o o p ) 
 	 	 { 
 	 	 	 C r i A t o m S o u r c e   a u d i o   =   U t a g e T o o l K i t . A d d C h i l d G a m e O b j e c t C o m p o n e n t < C r i A t o m S o u r c e > ( C a c h e d T r a n s f o r m ,   c u e N a m e ) ; 
 	 	 	 a u d i o . c u e S h e e t   =   c u e S h e e t ; 
 	 	 	 a u d i o . c u e N a m e   =   c u e N a m e ; 
 	 	 	 a u d i o . v o l u m e   =   v o l u m e ; 
 	 	 	 a u d i o . l o o p   =   i s L o o p ; 
 	 	 	 a u d i o . P l a y ( ) ; 
 	 	 	 r e t u r n   a u d i o ; 
 	 	 } 
 
 	 	 / / c[n0
TMRn0000000S_0j0Q00p0\Ob0
 	 	 A d x 2 P l a y e r   G e t S t r e a m A n d C r e a t e I f M i s s i n g ( s t r i n g   n a m e ) 
 	 	 { 
 	 	 	 A d x 2 P l a y e r   s t r e a m ; 
 	 	 	 i f   ( ! s t r e a m T b l . T r y G e t V a l u e ( n a m e ,   o u t   s t r e a m ) ) 
 	 	 	 { 
 	 	 	 	 s t r e a m   =   U t a g e T o o l K i t . A d d C h i l d G a m e O b j e c t C o m p o n e n t < A d x 2 P l a y e r > ( C a c h e d T r a n s f o r m ,   n a m e ) ; 
 	 	 	 	 s t r e a m . I n i t ( A d x 2 L e F o r U t a g e ) ; 
 	 	 	 	 s t r e a m T b l . A d d ( n a m e ,   s t r e a m ) ; 
 	 	 	 } 
 	 	 	 r e t u r n   s t r e a m ; 
 	 	 } 
 
 	 	 p u b l i c   b o o l   I s L o a d i n g 
 	 	 { 
 	 	 	 g e t 
 	 	 	 { 
 	 	 	 	 r e t u r n   f a l s e ; 
 	 	 	 } 
 	 	 } 
 
 	 	 p u b l i c   v o i d   C h a n g e M a s t e r V o l u m e ( s t r i n g   n a m e ,   f l o a t   v o l u m e ) 
 	 	 { 
 	 	 	 i f   ( ! C r i W a r e I n i t i a l i z e r . I s I n i t i a l i z e d ( ) )   r e t u r n ; 
 
 	 	 	 i f   ( A d x 2 L e F o r U t a g e . I g n o r e C o n f i g M a s t e r V o l u m e )   r e t u r n ; 
 / / 	 	 	 D e b u g . L o g (   n a m e   + "   V o l u m e   "   +   C r i A t o m . G e t C a t e g o r y V o l u m e ( n a m e )   +   "   - >   "   +   v o l u m e   ) ; 
 	 	 	 C r i A t o m . S e t C a t e g o r y V o l u m e ( n a m e ,   v o l u m e ) ; 
 	 	 } 
 
 
 	 	 p u b l i c   v o i d   L a t e U p d a t e ( ) 
 	 	 { 
 	 	 } 
 	 	 / / 000000(un00000fM00
 	 	 p u b l i c   v o i d   W r i t e S a v e D a t a ( B i n a r y W r i t e r   w r i t e r ) 
 	 	 { 
 / / 	 	 	 D e b u g . L o g E r r o r ( " A d x 2   n o t   s u p p o r t   S a v e   I O " ) ; 
 	 	 } 
 
 	 	 / / 000000(un0000000
 	 	 p u b l i c   v o i d   R e a d S a v e D a t a B u f f e r ( B i n a r y R e a d e r   r e a d e r ) 
 	 	 { 
 / / 	 	 	 D e b u g . L o g E r r o r ( " A d x 2   n o t   s u p p o r t   S a v e   I O " ) ; 
 	 	 } 
 	 } 
 } 