# CoinRaceActivity_View_CoinRaceHudButton_903.luac
; fn @CoinRaceHudButton.lua  line 0-0 np=0 va=1 ms=3 code=27 consts=10 upvals=1 protos=6
;   K[0]='CoinRaceHudButton'
;   K[1]='setmetatable'
;   K[2]='HudPropertyButton'
;   K[3]='__index'
;   K[4]='Init'
;   K[5]='_AddListeners'
;   K[6]='OnCoinRaceStateChanged'
;   K[7]='SyncToModelValue'
;   K[8]='UpdateContent'
;   K[9]='UpdateValueText'
;   upvals: _ENV
0000  GETTABUP  R0 = _ENV[K1('setmetatable')]
0001  NEWTABLE  R1 = {} (0 items)
0002  GETTABUP  R2 = _ENV[K2('HudPropertyButton')]
0003  CALL      R0 = call(R0, 1 args, 2 rets)
0004  SETTABUP  _ENV[K0('CoinRaceHudButton')] = R0
0005  GETTABUP  R0 = _ENV[K0('CoinRaceHudButton')]
0006  GETTABUP  R1 = _ENV[K0('CoinRaceHudButton')]
0007  SETTABLE  R0[K3('__index')] = R1
0008  GETTABUP  R0 = _ENV[K0('CoinRaceHudButton')]
0009  CLOSURE   R1 = closure proto0
0010  SETTABLE  R0[K4('Init')] = R1
0011  GETTABUP  R0 = _ENV[K0('CoinRaceHudButton')]
0012  CLOSURE   R1 = closure proto1
0013  SETTABLE  R0[K5('_AddListeners')] = R1
0014  GETTABUP  R0 = _ENV[K0('CoinRaceHudButton')]
0015  CLOSURE   R1 = closure proto2
0016  SETTABLE  R0[K6('OnCoinRaceStateChanged')] = R1
0017  GETTABUP  R0 = _ENV[K0('CoinRaceHudButton')]
0018  CLOSURE   R1 = closure proto3
0019  SETTABLE  R0[K7('SyncToModelValue')] = R1
0020  GETTABUP  R0 = _ENV[K0('CoinRaceHudButton')]
0021  CLOSURE   R1 = closure proto4
0022  SETTABLE  R0[K8('UpdateContent')] = R1
0023  GETTABUP  R0 = _ENV[K0('CoinRaceHudButton')]
0024  CLOSURE   R1 = closure proto5
0025  SETTABLE  R0[K9('UpdateValueText')] = R1
0026  RETURN    return R0..R-1
; ---------- proto0 [Init] ----------
  ; fn ?  line 4-8 np=2 va=0 ms=5 code=16 consts=9 upvals=1 protos=0
  ;   K[0]='m_model'
  ;   K[1]='GM'
  ;   K[2]='ActivityManager'
  ;   K[3]='GetModel'
  ;   K[4]='m_activityDefinition'
  ;   K[5]='CoinRaceActivityDefinition'
  ;   K[6]='HudPropertyButton'
  ;   K[7]='Init'
  ;   K[8]='ActivityTokenPropertyType'
  ;   upvals: _ENV
  ;   locals: self(0-16), activityType(0-16)
  0000  GETTABUP  R2 = _ENV[K1('GM')]
  0001  GETTABLE  R2 = R2[K2('ActivityManager')]
  0002  SELF      R3 = R2[K3('GetModel')] (self)
  0003  MOVE      R4 = R0
  0004  CALL      R2 = call(R2, 1 args, 2 rets)
  0005  SETTABLE  R0[K0('m_model')] = R2
  0006  GETTABUP  R2 = _ENV[K5('CoinRaceActivityDefinition')]
  0007  GETTABLE  R2 = R2[R1]
  0008  SETTABLE  R0[K4('m_activityDefinition')] = R2
  0009  GETTABUP  R2 = _ENV[K6('HudPropertyButton')]
  0010  GETTABLE  R2 = R2[K7('Init')]
  0011  MOVE      R3 = R0
  0012  GETTABLE  R4 = R0[K4('m_activityDefinition')]
  0013  GETTABLE  R4 = R4[K8('ActivityTokenPropertyType')]
  0014  CALL      R2 = call(R2, 0 args, 2 rets)
  0015  RETURN    return R0..R-1
; ---------- proto1 [_AddListeners] ----------
  ; fn ?  line 10-18 np=1 va=0 ms=6 code=25 consts=11 upvals=1 protos=0
  ;   K[0]='HudPropertyButton'
  ;   K[1]='_AddListeners'
  ;   K[2]='EventDispatcher'
  ;   K[3]='AddListener'
  ;   K[4]='EEventType'
  ;   K[5]='ChangeGameModeFinished'
  ;   K[6]='UpdateContent'
  ;   K[7]='m_activityDefinition'
  ;   K[8]=nil
  ;   K[9]='StateChangedEvent'
  ;   K[10]='OnCoinRaceStateChanged'
  ;   upvals: _ENV
  ;   locals: self(0-25)
  0000  GETTABUP  R1 = _ENV[K0('HudPropertyButton')]
  0001  GETTABLE  R1 = R1[K1('_AddListeners')]
  0002  MOVE      R2 = R0
  0003  CALL      R1 = call(R1, 1 args, 1 rets)
  0004  TEST      if not R1 then   -> -131066
  0005  JMP       (jump)   -> 13
  0006  GETTABUP  R1 = _ENV[K2('EventDispatcher')]
  0007  GETTABLE  R1 = R1[K3('AddListener')]
  0008  GETTABUP  R2 = _ENV[K4('EEventType')]
  0009  GETTABLE  R2 = R2[K5('ChangeGameModeFinished')]
  0010  MOVE      R3 = R0
  0011  GETTABLE  R4 = R0[K6('UpdateContent')]
  0012  CALL      R1 = call(R1, 0 args, 3 rets)
  0013  GETTABLE  R1 = R0[K7('m_activityDefinition')]
  0014  EQ        if R1 eq K8(nil)   -> -130280
  0015  JMP       (jump)   -> 24
  0016  GETTABUP  R1 = _ENV[K2('EventDispatcher')]
  0017  GETTABLE  R1 = R1[K3('AddListener')]
  0018  GETTABLE  R2 = R0[K7('m_activityDefinition')]
  0019  GETTABLE  R2 = R2[K9('StateChangedEvent')]
  0020  MOVE      R3 = R0
  0021  GETTABLE  R4 = R0[K10('OnCoinRaceStateChanged')]
  0022  LOADBOOL  R5 = true
  0023  CALL      R1 = call(R1, 0 args, 4 rets)
  0024  RETURN    return R0..R-1
; ---------- proto2 [OnCoinRaceStateChanged] ----------
  ; fn ?  line 20-24 np=1 va=0 ms=3 code=10 consts=5 upvals=1 protos=0
  ;   K[0]='m_model'
  ;   K[1]='GetState'
  ;   K[2]='ActivityState'
  ;   K[3]='Ended'
  ;   K[4]='UpdateContent'
  ;   upvals: _ENV
  ;   locals: self(0-10)
  0000  GETTABLE  R1 = R0[K0('m_model')]
  0001  SELF      R2 = R1[K1('GetState')] (self)
  0002  CALL      R1 = call(R1, 1 args, 1 rets)
  0003  GETTABUP  R2 = _ENV[K2('ActivityState')]
  0004  GETTABLE  R2 = R2[K3('Ended')]
  0005  EQ        if R1 eq R2   -> -130551
  0006  JMP       (jump)   -> 9
  0007  SELF      R2 = R0[K4('UpdateContent')] (self)
  0008  CALL      R1 = call(R1, 0 args, 1 rets)
  0009  RETURN    return R0..R-1
; ---------- proto3 [SyncToModelValue] ----------
  ; fn ?  line 26-29 np=1 va=0 ms=3 code=8 consts=4 upvals=1 protos=0
  ;   K[0]='HudPropertyButton'
  ;   K[1]='SyncToModelValue'
  ;   K[2]='m_model'
  ;   K[3]='UpdateScoreProgress'
  ;   upvals: _ENV
  ;   locals: self(0-8)
  0000  GETTABUP  R1 = _ENV[K0('HudPropertyButton')]
  0001  GETTABLE  R1 = R1[K1('SyncToModelValue')]
  0002  MOVE      R2 = R0
  0003  CALL      R1 = call(R1, 0 args, 1 rets)
  0004  GETTABLE  R1 = R0[K2('m_model')]
  0005  SELF      R2 = R1[K3('UpdateScoreProgress')] (self)
  0006  CALL      R1 = call(R1, 0 args, 1 rets)
  0007  RETURN    return R0..R-1
; ---------- proto4 [UpdateContent] ----------
  ; fn ?  line 31-33 np=1 va=0 ms=3 code=5 consts=2 upvals=1 protos=0
  ;   K[0]='HudPropertyButton'
  ;   K[1]='SyncToModelValue'
  ;   upvals: _ENV
  ;   locals: self(0-5)
  0000  GETTABUP  R1 = _ENV[K0('HudPropertyButton')]
  0001  GETTABLE  R1 = R1[K1('SyncToModelValue')]
  0002  MOVE      R2 = R0
  0003  CALL      R1 = call(R1, 0 args, 1 rets)
  0004  RETURN    return R0..R-1
; ---------- proto5 [UpdateValueText] ----------
  ; fn ?  line 35-41 np=1 va=0 ms=7 code=27 consts=14 upvals=1 protos=0
  ;   K[0]='HudPropertyButton'
  ;   K[1]='UpdateValueText'
  ;   K[2]='math'
  ;   K[3]='floor'
  ;   K[4]='m_value'
  ;   K[5]=0.5
  ;   K[6]='m_model'
  ;   K[7]='GetTargetScore'
  ;   K[8]='m_slider'
  ;   K[9]='value'
  ;   K[10]=0
  ;   K[11]='m_valueText'
  ;   K[12]='text'
  ;   K[13]='/'
  ;   upvals: _ENV
  ;   locals: self(0-27), score(9-27), targetScore(12-27)
  0000  GETTABUP  R1 = _ENV[K0('HudPropertyButton')]
  0001  GETTABLE  R1 = R1[K1('UpdateValueText')]
  0002  MOVE      R2 = R0
  0003  CALL      R1 = call(R1, 0 args, 1 rets)
  0004  GETTABUP  R1 = _ENV[K2('math')]
  0005  GETTABLE  R1 = R1[K3('floor')]
  0006  GETTABLE  R2 = R0[K4('m_value')]
  0007  ADD       R2 = K5(0.5) add R2
  0008  CALL      R1 = call(R1, 1 args, 1 rets)
  0009  GETTABLE  R2 = R0[K6('m_model')]
  0010  SELF      R3 = R2[K7('GetTargetScore')] (self)
  0011  CALL      R2 = call(R2, 1 args, 1 rets)
  0012  GETTABLE  R3 = R0[K8('m_slider')]
  0013  LT        if R0 lt R2   -> 5137
  0014  JMP       (jump)   -> 18
  0015  DIV       R4 = R2 div R1
  0016  TEST      if not R4 then   -> -131053
  0017  JMP       (jump)   -> 19
  0018  LOADK     R4 = K10 0
  0019  SETTABLE  R3[K9('value')] = R4
  0020  GETTABLE  R3 = R0[K11('m_valueText')]
  0021  MOVE      R4 = R0
  0022  LOADK     R5 = K13 '/'
  0023  MOVE      R6 = R0
  0024  CONCAT    R4 = concat(R4..R4)
  0025  SETTABLE  R3[K12('text')] = R4
  0026  RETURN    return R0..R-1
