package Ġcom . ly ee ed ar . Board . Completion Condition Ċ Ċ import Ġcom . badlogic . gdx . graphics . Color Ċ import Ġcom . badlogic . gdx . scenes . scene 2 d . ui . Label Ċ import Ġcom . badlogic . gdx . scenes . scene 2 d . ui . Table Ċ import Ġcom . ly ee ed ar . Board . Grid Ċ import Ġcom . ly ee ed ar . Board . Or b Desc Ċ import Ġcom . ly ee ed ar . Components . Entity Ċ import Ġcom . ly ee ed ar . Components . match able Ċ import Ġcom . ly ee ed ar . Game . Global Ċ import Ġcom . ly ee ed ar . UI . Sprite Widget Ċ import Ġcom . ly ee ed ar . UI . Tutorial Ċ import Ġcom . ly ee ed ar . Util .* Ċ Ċ @ Data Class ( name Ġ= Ġ" Custom Or b ") Ċ class ĠCompletion Condition Custom Or b Data Ġ: ĠAbstract Completion Condition Data () Ċ { Ċ ĉ override Ġval Ġclass ID : ĠString Ġ= Ġ" Custom Or b " ĊĉĊ ĉ late init Ġvar Ġor b Name : ĠString Ċ ĉ var Ġcount : ĠInt Ġ= Ġ 0 Ċ ĉ var Ġchance : ĠFloat Ġ= Ġ 0 f ĊĊ ĉ override Ġfun Ġload ( xml Data : ĠXml Data ) Ċ ĉ { Ċ ĉ /* ĠAutogenerated Ġmethod Ġcontents . ĠDo Ġnot Ġmodify . Ġ*/ Ċĉ ĉ super . load ( xml Data ) Ċĉ ĉ orb Name Ġ= Ġxml Data . get (" Or b Name ") Ċĉ ĉ count Ġ= Ġxml Data . getInt (" Count ", Ġ 0 ) Ċĉ ĉ chance Ġ= Ġxml Data . get Float (" Chance ", Ġ 0 f ) Ċ ĉ } Ċ } Ċ Ċ class ĠCompletion Condition Custom Or b ( data : ĠCompletion Condition Custom Or b Data ) Ġ: ĠAbstract Completion Condition < Completion Condition Custom Or b Data >( data ) Ċ { Ċ ĉ val Ġtick Ġ= ĠAsset Manager . load Sprite (" O ry x / uf _ split / uf _ interface / uf _ interface _ 6 8 0 ", Ġcolour Ġ= ĠColour ( Color . FO REST )) Ċ ĉ var Ġremaining Count Ġ= Ġdata . count ĊĊ ĉ val Ġtable Ġ= ĠTable () ĊĊ ĉ override Ġfun Ġattach Handlers ( grid : ĠGrid ) Ċ ĉ { Ċĉ ĉ grid . on Pop Ġ+= Ġfun ( orb : ĠEntity , Ġdelay : ĠFloat ) Ġ: ĠHandler Action Ġ{ ĊĊĉĉ ĉ if Ġ( orb . match able ()?. desc ?. name Ġ== Ġdata . orb Name ) Ċĉĉ ĉ { Ċĉĉĉ ĉ if Ġ( remaining Count Ġ> Ġ 0 ) Ġremaining Count -- Ċĉĉĉ ĉ rebuild Widget () Ċĉĉ ĉ } ĊĊĉĉ ĉ return ĠHandler Action . Keep Attached Ċĉ ĉ } ĊĊĉ ĉ if Ġ(! Global . resolve Instant ly ) Ċĉ ĉ { Ċĉĉ ĉ Future . call ( Ċĉĉĉ ĉ { Ċĉĉĉĉ ĉ val Ġtutorial Ġ= ĠTutorial (" Custom Or b Complete ") Ċĉĉĉĉ ĉ tutorial . add Popup ( Local isation . getText (" completion condition . custom orb . tutorial ", Ġ" UI "), Ġtable ) Ċĉĉĉĉ ĉ tutorial . show () Ċĉĉĉ ĉ }, Ġ 0 . 5 f ) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ override Ġfun Ġis Completed (): ĠBoolean Ċ ĉ { Ċĉ ĉ return Ġremaining Count Ġ== Ġ 0 Ċ ĉ } ĊĊ ĉ override Ġfun Ġcreate Table ( grid : ĠGrid ): ĠTable Ċ ĉ { Ċĉ ĉ rebuild Widget () ĊĊĉ ĉ return Ġtable Ċ ĉ } ĊĊ ĉ fun Ġrebuild Widget () Ċ ĉ { Ċĉ ĉ table . clear () ĊĊĉ ĉ val Ġtarget Desc Ġ= ĠO rb Desc . getName d Or b ( data . orb Name ) Ċĉ ĉ val Ġsprite Ġ= Ġtarget Desc . sprite ĊĊĉ ĉ table . add ( Sprite Widget ( sprite , Ġ 2 4 f , Ġ 2 4 f )). pad Left ( 5 f ) ĊĊĉ ĉ if Ġ( remaining Count Ġ== Ġ 0 ) Ċĉ ĉ { Ċĉĉ ĉ table . add ( Sprite Widget ( tick , Ġ 2 4 f , Ġ 2 4 f )) Ċĉ ĉ } Ċĉ ĉ else Ċĉ ĉ { Ċĉĉ ĉ table . add ( Label (" Ġx Ġ$ remaining Count ", ĠStatic s . skin )) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ override Ġfun ĠgetDescription ( grid : ĠGrid ): ĠTable Ċ ĉ { Ċĉ ĉ val Ġtable Ġ= ĠTable () ĊĊĉ ĉ table . add ( Label ( Local isation . getText (" completion condition . custom orb . description ", Ġ" UI "), ĠStatic s . skin )) ĊĊĉ ĉ val Ġtarget Desc Ġ= ĠO rb Desc . getName d Or b ( data . orb Name ) Ċĉ ĉ val Ġsprite Ġ= Ġtarget Desc . sprite ĊĊĉ ĉ table . add ( Sprite Widget ( sprite , Ġ 2 4 f , Ġ 2 4 f )). pad Left ( 5 f ) Ċĉ ĉ table . add ( Label (" Ġx Ġ${ data . count }", ĠStatic s . skin )) ĊĊĉ ĉ return Ġtable Ċ ĉ } Ċ }