Esempio n. 1
0
        private static void StoreStaredShooters(List <int> staredList, RangeClass rangeClass)
        {
            var filenameforrange = string.Format("StarShooters{0}.txt", rangeClass.ToString());
            var filename         = Path.Combine(m_starsDir, filenameforrange);
            var staredShooters   = staredList.Select(i => i.ToString()).ToArray();

            File.WriteAllLines(filename, staredShooters);
        }
Esempio n. 2
0
        public static List <int> StaredShooters(RangeClass rangeClass)
        {
            if (rangeClass == RangeClass.Range100m)
            {
                return(m_staredShooters100m);
            }

            return(m_staredShooters200m);
        }
Esempio n. 3
0
        public MainResultViewModelForRange(RangeClass rangeClass)
        {
            RangeClass       = rangeClass;
            m_serviceClient  = new FestResultServiceClient();
            CompetitionsList = m_serviceClient.GetCompetitions(RangeClass).ToList();
            var selectedStarValues = StarredValues;

            SelectedStarredValue      = selectedStarValues.First();
            SelectedResultsAfterRange = 5;
        }
Esempio n. 4
0
 public List <Registration> GetRegistrations(RangeClass rangeClass, string competition)
 {
     if (rangeClass == RangeClass.Range100m)
     {
         return(GetRegistrations100m(competition));
     }
     else
     {
         return(GetRegistrations200m(competition));
     }
 }
Esempio n. 5
0
 public List <string> GetCompetitions(RangeClass rangeClass)
 {
     if (rangeClass == RangeClass.Range100m)
     {
         return(DatabaseApi.GetAllCompetitions100m());
     }
     else
     {
         return(DatabaseApi.GetAllCompetitions200m());
     }
 }
Esempio n. 6
0
    /**
    * FR:
    * Constructeur de la classe NPC
    * Les paramètres hp, damage, movementSpeed, attackType et name sont transmis lors de la construction à la classe mère (Unit) de NPC.
    * @see Unit
    *
    * EN:
    * NPC class constructor
    * Parameters hp, damage, movementSpeed, attackType and name are sent to the mother class (Unit) during the build of an NPC
    * @see Unit
    * @version 1.0
    **/
    public NPC(float aggroDistance, float attackRange, float distanceToDisappear, float attackSpeed, float xpGain, Blocking blocking, float hp, float damage, float movementSpeed, string attackType, string name)
        : base(hp, damage, movementSpeed, attackType, name)
    {
        AttackSpeed = attackSpeed;
        XpGain = xpGain;
        this.aggroDistance = aggroDistance;
        this.attackRange = attackRange;
        this.distanceToDisappear = distanceToDisappear;
        this.blocking = blocking;

        if(attackType == "CaC")
        {
            rangeType = RangeClass.CAC;
        }
        else
        {
            rangeType = RangeClass.LONGRANGE;
        }
    }
Esempio n. 7
0
        private static List <int> GetStoredStarShooter(RangeClass rangeClass)
        {
            var result           = new List <int>();
            var filenameforrange = string.Format("StarShooters{0}.txt", rangeClass.ToString());
            var filename         = Path.Combine(m_starsDir, filenameforrange);

            if (File.Exists(filename))
            {
                var allRegs = File.ReadAllLines(filename);
                foreach (var reg in allRegs)
                {
                    int shooterId;
                    if (int.TryParse(reg, out shooterId))
                    {
                        result.Add(shooterId);
                    }
                }
            }

            return(result);
        }
            public static void Main()
            {
                EventTest e = new EventTest(5);

                e.SetValue(7);
                e.SetValue(11);
                Console.ReadKey();

                RangeClass myRangeObject = new RangeClass();
                uint       myTotal;

                // Question #15 - jhow to initialize a strng without needing backslash each \ character - use the @ modifier
                //Initialize with a regular string literal.
                string oldPath = "c:\\Program Files\\Microsoft Visual Studio 8.0";
                // Initialize with a verbatim string literal.
                string newPath = @"c:\Program Files\Microsoft Visual Studio 9.0";

                myTotal = myRangeObject.AddRange(1, 4);
                Console.WriteLine("Total from {0} to {1} is: {2}", 1, 4, myTotal);
                Console.ReadKey();
            }
Esempio n. 9
0
        public static void RemoveStaredShooter(int shooterId, RangeClass rangeClass)
        {
            if (rangeClass == RangeClass.Range100m)
            {
                if (!m_staredShooters100m.Contains(shooterId))
                {
                    return;
                }

                m_staredShooters100m.Remove(shooterId);
                StoreStaredShooters(m_staredShooters100m, rangeClass);
                return;
            }

            if (!m_staredShooters200m.Contains(shooterId))
            {
                return;
            }

            m_staredShooters200m.Remove(shooterId);
            StoreStaredShooters(m_staredShooters200m, rangeClass);
        }
Esempio n. 10
0
        public Categories SelectNewCategory(ObservableCollection <Categories> CatData)
        {
            double probability = new Random().NextDouble() * 100;
            Dictionary <Categories, RangeClass> Sorted = new Dictionary <Categories, RangeClass>();
            double lastVal = 0;

            foreach (Categories c in CatData)
            {
                RangeClass rangeClass = new RangeClass();
                rangeClass.start = lastVal;
                rangeClass.end   = lastVal + c.Percent;
                Sorted.Add(c, rangeClass);
                lastVal += c.Percent;
            }
            foreach (KeyValuePair <Categories, RangeClass> pair in Sorted)
            {
                RangeClass rangeClass = pair.Value;
                if (rangeClass.end >= probability && rangeClass.start <= probability)
                {
                    return(pair.Key);
                }
            }
            return(CatData[0]);
        }
Esempio n. 11
0
 public void LoadBuiltinClasses()
 {
     classes["Int"]               = new IntClass();
     classes["Float"]             = new FloatClass();
     classes["Boolean"]           = new BooleanClass();
     classes["String"]            = new StringClass();
     classes["Char"]              = new CharClass();
     classes["Byte"]              = new ByteClass();
     classes["Message"]           = new MessageClass();
     classes["Unassigned"]        = new UnassignedClass();
     classes["Tuple"]             = new TupleClass();
     classes["NameValue"]         = new NameValueClass();
     classes["Lambda"]            = new LambdaClass();
     classes["Void"]              = new VoidClass();
     classes["Some"]              = new SomeClass();
     classes["None"]              = new NoneClass();
     classes["Array"]             = new ArrayClass();
     classes["Iterator"]          = new IteratorClass();
     classes["LazyIterator"]      = new LazyIteratorClass();
     classes["StreamIterator"]    = new StreamIteratorClass();
     classes["Any"]               = new AnyClass();
     classes["Placeholder"]       = new PlaceholderClass();
     classes["Range"]             = new RangeClass();
     classes["Dictionary"]        = new DictionaryClass();
     classes["Container"]         = new ContainerClass();
     classes["Unmatched"]         = new UnmatchedClass();
     classes["Complex"]           = new ComplexClass();
     classes["Rational"]          = new RationalClass();
     classes["Long"]              = new LongClass();
     classes["Lazy"]              = new LazyClass();
     classes["YieldingInvokable"] = new YieldingInvokableClass();
     classes["Del"]               = new DelClass();
     classes["Slice"]             = new SliceClass();
     classes["End"]               = new EndClass();
     classes["List"]              = new ListClass();
     classes["Arguments"]         = new ArgumentsClass();
     classes["Symbol"]            = new SymbolClass();
     classes["Infinity"]          = new InfinityClass();
     classes["OpenRange"]         = new OpenRangeClass();
     classes["KeyValue"]          = new KeyValueClass();
     classes["Regex"]             = new RegexClass();
     classes["Pattern"]           = new PatternClass();
     classes["PackageFunction"]   = new PackageFunctionClass();
     classes["Sys"]               = new SysClass();
     classes["Math"]              = new MathClass();
     classes["RuntimeFunction"]   = new RuntimeFunctionClass();
     classes["Reference"]         = new ReferenceClass();
     classes["Group"]             = new RegexGroupClass();
     classes["Match"]             = new RegexMatchClass();
     classes["Date"]              = new DateClass();
     classes["Interval"]          = new IntervalClass();
     classes["TypeConstraint"]    = new TypeConstraintClass();
     classes["ByteArray"]         = new ByteArrayClass();
     classes["Selector"]          = new SelectorClass();
     classes["Number"]            = new NumberClass();
     classes["Collection"]        = new CollectionClass();
     classes["TextFinding"]       = new TextFindingClass();
     classes["SkipTake"]          = new SkipTakeClass();
     classes["Constructor"]       = new ConstructorClass();
     classes["MutString"]         = new MutStringClass();
     classes["Error"]             = new ErrorClass();
     classes["Success"]           = new SuccessClass();
     classes["Failure"]           = new FailureClass();
     classes["Optional"]          = new OptionalClass();
     classes["Result"]            = new ResultClass();
     classes["Monad"]             = new MonadClass();
     classes["Unit"]              = new UnitClass();
     classes["YieldReturn"]       = new YieldReturnClass();
     classes["Index"]             = new IndexClass();
     classes["Cycle"]             = new CycleClass();
     classes["Set"]               = new SetClass();
 }
Esempio n. 12
0
 public MyClass()
 {
     range = new RangeClass {
         min = 0, max = 100
     };
 }
Esempio n. 13
0
            public static void Main()
            {
                EventTest e = new EventTest(5);
                e.SetValue(7);
                e.SetValue(11);
                Console.ReadKey();

                RangeClass myRangeObject = new RangeClass();
                uint myTotal;

                // Question #15 - jhow to initialize a strng without needing backslash each \ character - use the @ modifier
                //Initialize with a regular string literal.
                string oldPath = "c:\\Program Files\\Microsoft Visual Studio 8.0";
                // Initialize with a verbatim string literal.
                string newPath = @"c:\Program Files\Microsoft Visual Studio 9.0";

                myTotal = myRangeObject.AddRange(1, 4);
                Console.WriteLine("Total from {0} to {1} is: {2}", 1, 4, myTotal);
                Console.ReadKey();
            }