protected override void OnInitDeciderElements () { timerElDecider = new TimerButtonElement (GetButton ("timer_button_decider"), Duration, () => { Game.Dispatcher.ScheduleMessage ("StartTimer"); Game.Audio.Play ("timer_start"); }, () => { Advance (); Game.Audio.Play ("alarm"); }); Elements.Add ("timer_button", timerElDecider); // The skip button is only shown if a client was dropped (so that players don't need to wait for the timer to run down again) Elements.Add ("skip", new ButtonElement (GetButton ("skip"), () => { Advance (); }) { Active = droppedClient }); }
/// <summary> /// On a screen with timers, checks how much time has elapsed /// </summary> /// <returns>The amount of time that has elapsed</returns> protected int GetElapsedTime() { float e; if (IsDecider) { TimerButtonElement t = GetScreenElement <TimerButtonElement> ("timer_button"); e = t.Progress * t.Duration; } else { TimerElement t = GetScreenElement <TimerElement> ("timer"); e = t.Progress * t.Duration; } return((int)e); }
protected override void OnInitDeciderElements() { timerElDecider = new TimerButtonElement(GetButton("timer_button_decider"), Duration, () => { Game.Dispatcher.ScheduleMessage("StartTimer"); Game.Audio.Play("timer_start"); }, () => { Advance(); Game.Audio.Play("alarm"); }); Elements.Add("timer_button", timerElDecider); // The skip button is only shown if a client was dropped (so that players don't need to wait for the timer to run down again) Elements.Add("skip", new ButtonElement(GetButton("skip"), () => { Advance(); }) { Active = droppedClient }); }
protected void SyncElapsedTime() { float e; if (IsDecider) { TimerButtonElement t = GetScreenElement <TimerButtonElement> ("timer_button"); e = t.Remaining; Debug.Log(t.Progress); } else { TimerElement t = GetScreenElement <TimerElement> ("timer"); e = t.Remaining; Debug.Log(t.Progress); } Debug.Log("SyncElapsedTime: " + e); Game.Multiplayer.SyncDuration(e); }