コード例 #1
0
ファイル: RaceManager.cs プロジェクト: madfrog54321/Timer
 private void _timer_OnGotRace(bool success, Race race)
 {
     if (success)//got times from tack
     {
         if (race.Times.Length == _numLanes)//check for correct lane count
         {
             Dictionary<int, Time> _results = new Dictionary<int, Time>();
             for (int i = 0; i < _numLanes; i++)
             {
                 if(_raceCallBack[i] != (int)SpecialCallBack.EmptyLane)
                 {
                     _results.Add(_raceCallBack[i], race.Times[i]);//get to time of the lane, and link it with the callback number
                 }
             }
             forgetRace();//the race was finished, so remove callback
             triggerGotRace(_results);//score race
             triggerReadyForNextRace();//signal ready for next race
         }
         else
         {
             DataManager.MessageProvider.showError("Error mapping times", "The Track Timer returned more lanes than the Race Manager was told about");
         }
     }
     else
     {
         DataManager.MessageProvider.showError("Error getting times", "The Track Timer failed to get the times");
     }
 }
コード例 #2
0
ファイル: TrackTimer.cs プロジェクト: madfrog54321/Timer
 private void triggerGotRace(bool success, Race race)
 {
     gotRace handler = OnGotRace;
     if (handler != null)
     {
         handler(success, race);
     }
 }