コード例 #1
0
        private static Session GetSessionToUpdate(StaticRaceWeekend.Weekend w, TelemetryEvents.SessionInfo e)
        {
            Session ret = null;

            switch (e.SessionType)
            {
            case TelemetryEvents.SessionInfo.eSessionType.kSessionTypePractice:
                ret = w.Practice;
                break;

            case TelemetryEvents.SessionInfo.eSessionType.kSessionTypeQualifyLone:
            case TelemetryEvents.SessionInfo.eSessionType.kSessionTypeQualifyOpen:
                ret = w.Qualify;
                break;

            case TelemetryEvents.SessionInfo.eSessionType.kSessionTypeTesting:
                ret = w.HappyHour;
                break;

            case TelemetryEvents.SessionInfo.eSessionType.kSessionTypeRace:
                ret = w.Race;
                break;

            default:
                throw new NotImplementedException();
            }

            return(ret);
        }
コード例 #2
0
        internal static void Update(StaticRaceWeekend.Weekend w, TelemetryEvents.SessionInfo e, out Session changedSession)
        {
            w.CurrentSessionType = GetSessionType(e.SessionType);
            Session s = GetSessionToUpdate(w, e);

            s.SessionNum = e.SessionNum;

            if (s is NonRaceSession)
            {
                UpdateNonRaceSession(s as NonRaceSession, e);
            }
            else
            {
                UpdateRaceSession(s as RaceSession, e);
            }

            w.SetCurrentSession(s);
            changedSession = s;
        }