Ejemplo n.º 1
0
        CreateRearCord
            (JackType rearJackType, string rearJackName)
        {
            switch (rearJackType)
            {
            case JackType.Event:
                return(CreateUnityEventDelegate(rearJackName));

            case JackType.Method:
                return(CreateMethodDelegate(rearJackName));

            default:
                throw new UnexpectedEnumValueException <JackType>(rearJackType);
            }
        }
        public JackType RandomJack()
        {
            var      random = new Random();
            JackType jack   = JackType.喜神;

            while (true)
            {
                var n1 = random.Next(1, collect[JackType.喜神]);
                var n2 = random.Next(1, collect[JackType.寿星]);
                var n3 = random.Next(1, collect[JackType.禄星]);
                var n4 = random.Next(1, collect[JackType.福星]);
                var n5 = random.Next(1, collect[JackType.财神]);

                if (n1 == (int)JackType.喜神)
                {
                    jack = JackType.喜神;
                    break;
                }
                if (n2 == (int)JackType.寿星)
                {
                    jack = JackType.寿星;
                    break;
                }
                if (n3 == (int)JackType.禄星)
                {
                    jack = JackType.禄星;
                    break;
                }
                if (n4 == (int)JackType.福星)
                {
                    jack = JackType.福星;
                    break;
                }
                if (n5 == (int)JackType.财神)
                {
                    jack = JackType.财神;
                    break;
                }
            }
            return(jack);
        }
Ejemplo n.º 3
0
        private void wrapper_SessionInfoUpdated(object sender, SdkWrapper.SessionInfoUpdatedEventArgs e)
        {
            // Indicate that we are updating the drivers list
            isUpdatingDrivers = true;

            // Parse the Drivers section of the session info into a list of drivers
            this.ParseDrivers(e.SessionInfo);

            Driver me = drivers.FirstOrDefault(d => d.Id == Wrapper.DriverId);

            try
            {
                string session_info = e.SessionInfo;
                string pos = YamlParser.Parse(session_info, "DriverInfo:DriverPitTrkPct:");

                if (pos != null)
                {
                    if (pos.Length > 0)
                    {
                        PitPosition = (float)Convert.ToDecimal(pos);
                    }
                }

                SessionType = YamlParser.Parse(session_info, "SessionInfo:SessionType:");

                if (me != null)
                    CarName = me.CarPath;
                else
                    CarName = YamlParser.Parse(session_info, "DriverInfo:CarPath:");

                string category = YamlParser.Parse(session_info, "WeekendInfo:Category:");
                if (category == "Oval")
                    IsOvalTrack = true;
                else
                    IsOvalTrack = false;

                switch (CarName)    // by default cars are oval so only overwrite the road ones.
                {
                    case "c6r":
                        IsOvalCar = false;
                        JT = JackType.GT;
                        break;
                    case "cadillacctsvr":
                        IsOvalCar = false;
                        JT = JackType.GT;
                        break;
                    case "dallara":
                        IsOvalCar = false;
                        JT = JackType.GT;
                        break;
                    case "fordgt":
                        IsOvalCar = false;
                        JT = JackType.GT;
                        break;
                    case "formulamazda":
                        IsOvalCar = false;
                        JT = JackType.GT;
                        break;
                    case "fr500s":
                        IsOvalCar = false;
                        JT = JackType.Street;
                        break;
                    case "hpdarx01c":
                        IsOvalCar = false;
                        JT = JackType.GT;
                        break;
                    case "jettatdi":
                        IsOvalCar = false;
                        JT = JackType.TBD;
                        break;
                    case "kiaoptima":
                        IsOvalCar = false;
                        JT = JackType.TBD;
                        break;
                    case "latemodel":
                        JT = JackType.NASCAR;
                        break;
                    case "lotus49":
                        IsOvalCar = false;
                        JT = JackType.Street;
                        break;
                    case "lotus79":
                        IsOvalCar = false;
                        JT = JackType.GT;
                        break;
                    case "mclarenmp4":
                        IsOvalCar = false;
                        JT = JackType.GT;
                        break;
                    case "mx5 cup":
                        JT = JackType.Street;
                        IsOvalCar = false;
                        break;
                    case "mx5 roadster":
                        JT = JackType.Street;
                        IsOvalCar = false;
                        break;
                    case "radical sr8":
                        JT = JackType.GT;
                        IsOvalCar = false;
                        break;
                    case "rileydp":
                        JT = JackType.GT;
                        IsOvalCar = false;
                        break;
                    case "rt2000":
                        IsOvalCar = false;
                        JT = JackType.Street;
                        break;
                    case "specracer":
                        IsOvalCar = false;
                        JT = JackType.Street;
                        break;
                    case "stockcars chevyss":
                        IsOvalCar = true;
                        JT = JackType.NASCAR;
                        break;
                    case "stockcars fordfusion":
                        IsOvalCar = true;
                        JT = JackType.NASCAR;
                        break;
                    case "stockcars impala":
                        IsOvalCar = true;
                        JT = JackType.NASCAR;
                        break;
                    case "stockcars2 chevy":
                        IsOvalCar = true;
                        JT = JackType.NASCAR;
                        break;
                    case "stockcars2 chevy cot":
                        IsOvalCar = true;
                        JT = JackType.NASCAR;
                        break;
                    case "streetstock":
                        JT = JackType.Street;
                        IsOvalCar = false;
                        break;
                    case "trucks silverado":
                        IsOvalCar = true;
                        JT = JackType.NASCAR;
                        break;
                    case "williamsfw31":
                        IsOvalCar = false;
                        JT = JackType.GT;
                        break;
                    case "legends ford34c":
                        IsOvalCar = true;
                        JT = JackType.TBD;
                        break;
                    case "legends ford34c rookie":
                        IsOvalCar = true;
                        JT = JackType.TBD;
                        break;
                    case "solstice":
                        IsOvalCar = true;
                        JT = JackType.TBD;
                        break;
                    case "solstice rookie":
                        IsOvalCar = true;
                        JT = JackType.TBD;
                        break;
                    case "fordv8sc":
                        IsOvalCar = false;
                        JT = JackType.GT;
                        break;
                    case "silvercrown":
                        IsOvalCar = true;
                        JT = JackType.NASCAR;
                        break;
                    case "skmodified":
                        IsOvalCar = true;
                        JT = JackType.NASCAR;
                        break;
                    case "skmodified tour":
                        IsOvalCar = true;
                        JT = JackType.NASCAR;
                        break;
                    case "sprint":
                        IsOvalCar = true;
                        JT = JackType.NASCAR;
                        break;
                    default:
                        IsOvalCar = true;
                        JT = JackType.TBD;
                        break;
                }
            }
            catch(Exception)
            {
                Console.Write("Caught exception in SessionInfoUpdated");
            }
            isUpdatingDrivers = false;
        }