package Ġcom . ly ee ed ar . UI Ċ Ċ import Ġcom . badlogic . gdx . graphics . Color Ċ import Ġcom . badlogic . gdx . graphics . g 2 d . N ine Patch Ċ import Ġcom . badlogic . gdx . math . Rectangle Ċ import Ġcom . badlogic . gdx . scenes . scene 2 d . Actor Ċ import Ġcom . badlogic . gdx . scenes . scene 2 d . Touchable Ċ import Ġcom . badlogic . gdx . scenes . scene 2 d . actions . Actions .* Ċ import Ġcom . badlogic . gdx . scenes . scene 2 d . ui . Label Ċ import Ġcom . badlogic . gdx . scenes . scene 2 d . ui . Table Ċ import Ġcom . badlogic . gdx . scenes . scene 2 d . utils . N ine Patch Drawable Ċ import Ġcom . badlogic . gdx . scenes . scene 2 d . utils . Texture Region Drawable Ċ import Ġcom . ly ee ed ar . Global Ċ import Ġcom . ly ee ed ar . Util . Asset Manager Ċ import Ġk tx . actors . alpha Ċ import Ġk tx . actors . then Ċ Ċ class ĠTutorial Popup ( val Ġtext : ĠString , Ġval Ġemp hasis Source : ĠAny , Ġval Ġadvance : Ġ() Ġ-> ĠUnit ) Ġ: ĠTable () Ċ { Ċ ĉ fun Ġevaluate Bounds (): ĠRectangle Ċ ĉ { Ċĉ ĉ return Ġwhen Ġ( emp hasis Source ) Ċĉ ĉ { Ċĉĉ ĉ is ĠRectangle Ġ-> Ġemp hasis Source Ċĉĉ ĉ is ĠActor Ġ-> Ġemp hasis Source . get Bounds () Ċĉĉ ĉ // is ĠArray < *> Ġ-> ĠGrid Widget . instance . get Rect ( emp hasis Source Ġas ĠArray < Point >) Ċĉĉ ĉ else Ġ-> ĠRectangle ( Global . stage . width Ġ/ Ġ 2 f , ĠGlobal . stage . height Ġ/ Ġ 2 f , Ġ 0 f , Ġ 0 f ) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ fun Ġshow ( gre yout On Enter : ĠBoolean , Ġclear On Exit : ĠBoolean ) Ċ ĉ { Ċĉ ĉ val Ġemp hasis Ġ= Ġevaluate Bounds () ĊĊĉ ĉ if Ġ( emp hasis . width Ġ> Ġ 0 f Ġ&& Ġemp hasis . height Ġ> Ġ 0 f ) Ċĉ ĉ { Ċĉĉ ĉ val Ġpad Ġ= Ġ 5 f Ċĉĉ ĉ emp hasis . x Ġ-= Ġpad Ċĉĉ ĉ emp hasis . y Ġ-= Ġpad Ċĉĉ ĉ emp hasis . width Ġ+= Ġpad Ġ* Ġ 2 f Ċĉĉ ĉ emp hasis . height Ġ+= Ġpad Ġ* Ġ 2 f Ċĉ ĉ } ĊĊĉ ĉ val Ġanim Speed Ġ= Ġ 0 . 3 f ĊĊĉ ĉ val Ġgre yout alpha Ġ= Ġ 0 . 9 f ĊĊĉ ĉ // Ġadd Ġgre yout ĊĊĉ ĉ if Ġ( gre yout On Enter ) Ċĉ ĉ { Ċĉĉ ĉ top G re yout Ġ= ĠTable () Ċĉĉ ĉ top G re yout . alpha Ġ= Ġ 0 f Ċĉĉ ĉ top G re yout . touch able Ġ= ĠTouch able . enabled Ċĉĉ ĉ top G re yout . background Ġ= ĠTexture Region Drawable ( Asset Manager . load Texture Region (" white ")). tint ( Color ( 0 f , Ġ 0 f , Ġ 0 f , Ġgre yout alpha )) Ċĉĉ ĉ top G re yout . setBounds ( 0 f , Ġ 0 f , ĠGlobal . stage . width , Ġemp hasis . y ) Ċĉĉ ĉ top G re yout . addAction ( alpha ( 0 f ) Ġthen ĠfadeIn ( anim Speed )) Ċĉĉ ĉ Global . stage . add Actor ( top G re yout ) ĊĊĉĉ ĉ bottom G re yout Ġ= ĠTable () Ċĉĉ ĉ bottom G re yout . alpha Ġ= Ġ 0 f Ċĉĉ ĉ bottom G re yout . touch able Ġ= ĠTouch able . enabled Ċĉĉ ĉ bottom G re yout . background Ġ= ĠTexture Region Drawable ( Asset Manager . load Texture Region (" white ")). tint ( Color ( 0 f , Ġ 0 f , Ġ 0 f , Ġgre yout alpha )) Ċĉĉ ĉ bottom G re yout . setBounds ( 0 f , Ġemp hasis . y Ġ+ Ġemp hasis . height , ĠGlobal . stage . width , ĠGlobal . stage . height Ġ- Ġ( emp hasis . y Ġ+ Ġemp hasis . height )) Ċĉĉ ĉ bottom G re yout . addAction ( alpha ( 0 f ) Ġthen ĠfadeIn ( anim Speed )) Ċĉĉ ĉ Global . stage . add Actor ( bottom G re yout ) ĊĊĉĉ ĉ left G re yout Ġ= ĠTable () Ċĉĉ ĉ left G re yout . alpha Ġ= Ġ 0 f Ċĉĉ ĉ left G re yout . touch able Ġ= ĠTouch able . enabled Ċĉĉ ĉ left G re yout . background Ġ= ĠTexture Region Drawable ( Asset Manager . load Texture Region (" white ")). tint ( Color ( 0 f , Ġ 0 f , Ġ 0 f , Ġgre yout alpha )) Ċĉĉ ĉ left G re yout . setBounds ( 0 f , Ġemp hasis . y , Ġemp hasis . x , Ġemp hasis . height ) Ċĉĉ ĉ left G re yout . addAction ( alpha ( 0 f ) Ġthen ĠfadeIn ( anim Speed )) Ċĉĉ ĉ Global . stage . add Actor ( left G re yout ) ĊĊĉĉ ĉ right G re yout Ġ= ĠTable () Ċĉĉ ĉ right G re yout . alpha Ġ= Ġ 0 f Ċĉĉ ĉ right G re yout . touch able Ġ= ĠTouch able . enabled Ċĉĉ ĉ right G re yout . background Ġ= ĠTexture Region Drawable ( Asset Manager . load Texture Region (" white ")). tint ( Color ( 0 f , Ġ 0 f , Ġ 0 f , Ġgre yout alpha )) Ċĉĉ ĉ right G re yout . setBounds ( emp hasis . x Ġ+ Ġemp hasis . width , Ġemp hasis . y , ĠGlobal . stage . width Ġ- Ġ( emp hasis . x Ġ+ Ġemp hasis . width ), Ġemp hasis . height ) Ċĉĉ ĉ right G re yout . addAction ( alpha ( 0 f ) Ġthen ĠfadeIn ( anim Speed )) Ċĉĉ ĉ Global . stage . add Actor ( right G re yout ) ĊĊĉĉ ĉ center Block Ġ= ĠTable () Ċĉĉ ĉ center Block . alpha Ġ= Ġ 0 f Ċĉĉ ĉ center Block . touch able Ġ= ĠTouch able . enabled Ċĉĉ ĉ center Block . background Ġ= ĠN ine Patch Drawable ( N ine Patch ( Asset Manager . load Texture Region (" GUI / border "), Ġ 8 , Ġ 8 , Ġ 8 , Ġ 8 )). tint ( Color . G OLD ) Ċĉĉ ĉ center Block . setBounds ( emp hasis . x , Ġemp hasis . y , Ġemp hasis . width , Ġemp hasis . height ) Ċĉĉ ĉ if Ġ( emp hasis . width Ġ!= Ġ 0 f Ġ&& Ġemp hasis . height Ġ!= Ġ 0 f ) Ġcenter Block . addAction ( alpha ( 0 f ) Ġthen ĠfadeIn ( anim Speed )) Ċĉĉ ĉ Global . stage . add Actor ( center Block ) Ċĉ ĉ } ĊĊĉ ĉ // Ġadd Ġpopup Ċĉ ĉ background Ġ= ĠN ine Patch Drawable ( N ine Patch ( Asset Manager . load Texture Region (" Sprites / GUI / background . png "), Ġ 2 4 , Ġ 2 4 , Ġ 2 4 , Ġ 2 4 )). tint ( Color ( 1 f , Ġ 1 f , Ġ 1 f , Ġ 0 . 7 f )) Ċĉ ĉ touch able Ġ= ĠTouch able . enabled ĊĊĉ ĉ val Ġlabel Ġ= ĠLabel ( text , ĠGlobal . skin ) Ċĉ ĉ label . set Wrap ( true ) ĊĊĉ ĉ this . alpha Ġ= Ġ 0 f Ċĉ ĉ add ( label ). grow (). width ( Global . stage . width Ġ* Ġ 0 . 7 5 f ) ĊĊĉ ĉ addAction ( alpha ( 0 f ) Ġthen ĠfadeIn ( anim Speed )) ĊĊĉ ĉ val Ġclick Ġ= Ġ{ Ċĉĉ ĉ clear Listeners () Ċĉĉ ĉ top G re yout . clear Listeners () Ċĉĉ ĉ bottom G re yout . clear Listeners () Ċĉĉ ĉ left G re yout . clear Listeners () Ċĉĉ ĉ right G re yout . clear Listeners () Ċĉĉ ĉ center Block . clear Listeners () ĊĊĉĉ ĉ addAction ( fadeOut ( 0 . 1 f ) Ġthen Ġremove Actor ()) ĊĊĉĉ ĉ if Ġ( clear On Exit ) Ċĉĉ ĉ { Ċĉĉĉ ĉ top G re yout . addAction ( alpha ( 1 f ) Ġthen Ġfade Out ( anim Speed ) Ġthen Ġremove Actor ()) Ċĉĉĉ ĉ bottom G re yout . addAction ( alpha ( 1 f ) Ġthen Ġfade Out ( anim Speed ) Ġthen Ġremove Actor ()) Ċĉĉĉ ĉ left G re yout . addAction ( alpha ( 1 f ) Ġthen Ġfade Out ( anim Speed ) Ġthen Ġremove Actor ()) Ċĉĉĉ ĉ right G re yout . addAction ( alpha ( 1 f ) Ġthen Ġfade Out ( anim Speed ) Ġthen Ġremove Actor ()) ĊĊĉĉĉ ĉ center Block . addAction ( fadeOut ( 0 . 1 f ) Ġthen Ġremove Actor ()) Ċĉĉ ĉ } ĊĊĉĉ ĉ advance . invoke () Ċĉ ĉ } Ċĉ ĉ add ClickListener ( click ) ĊĊĉ ĉ top G re yout . clear Listeners () Ċĉ ĉ bottom G re yout . clear Listeners () Ċĉ ĉ left G re yout . clear Listeners () Ċĉ ĉ right G re yout . clear Listeners () Ċĉ ĉ center Block . clear Listeners () ĊĊĉ ĉ top G re yout . add ClickListener ( click ) Ċĉ ĉ bottom G re yout . add ClickListener ( click ) Ċĉ ĉ left G re yout . add ClickListener ( click ) Ċĉ ĉ right G re yout . add ClickListener ( click ) Ċĉ ĉ center Block . add ClickListener ( click ) ĊĊĉ ĉ pack () ĊĊĉ ĉ val Ġplace Top Ġ= Ġemp hasis . y Ġ> ĠGlobal . stage . height Ġ/ Ġ 2 f ĊĊĉ ĉ val Ġpx Ġ= Ġ( emp hasis . x Ġ+ Ġemp hasis . width Ġ/ Ġ 2 f ) Ġ- Ġwidth Ġ/ Ġ 2 f Ċĉ ĉ var Ġpy Ġ= Ġ 0 f Ċĉ ĉ if Ġ( place Top ) Ċĉ ĉ { Ċĉĉ ĉ py Ġ= Ġemp hasis . y Ġ- Ġheight Ġ- Ġ 2 0 Ċĉ ĉ } Ċĉ ĉ else Ċĉ ĉ { Ċĉĉ ĉ py Ġ= Ġemp hasis . y Ġ+ Ġemp hasis . height Ġ+ Ġ 2 0 Ċĉ ĉ } ĊĊĉ ĉ setPosition ( px , Ġpy ) Ċĉ ĉ Global . stage . add Actor ( this ) Ċĉ ĉ ensure On Screen ( 5 f ) Ċ ĉ } ĊĊ ĉ comp anion Ġobject Ċ ĉ { Ċĉ ĉ var Ġtop G re yout Ġ= ĠTable () Ċĉ ĉ var Ġbottom G re yout Ġ= ĠTable () Ċĉ ĉ var Ġleft G re yout Ġ= ĠTable () Ċĉ ĉ var Ġright G re yout Ġ= ĠTable () Ċĉ ĉ var Ġcenter Block Ġ= ĠTable () Ċ ĉ } Ċ }