public DnsResourceDataHostIdentityProtocol(DataSegment hostIdentityTag, DnsPublicKeyAlgorithm publicKeyAlgorithm, DataSegment publicKey, IEnumerable <DnsDomainName> rendezvousServers)
 {
     if (hostIdentityTag == null)
     {
         throw new ArgumentNullException("hostIdentityTag");
     }
     if (publicKey == null)
     {
         throw new ArgumentNullException("publicKey");
     }
     if (hostIdentityTag.Length > (int)byte.MaxValue)
     {
         throw new ArgumentOutOfRangeException("hostIdentityTag", (object)hostIdentityTag.Length, string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Cannot be bigger than {0}.", new object[1]
         {
             (object)byte.MaxValue
         }));
     }
     if (publicKey.Length > (int)ushort.MaxValue)
     {
         throw new ArgumentOutOfRangeException("publicKey", (object)publicKey.Length, string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Cannot be bigger than {0}.", new object[1]
         {
             (object)ushort.MaxValue
         }));
     }
     this.HostIdentityTag    = hostIdentityTag;
     this.PublicKeyAlgorithm = publicKeyAlgorithm;
     this.PublicKey          = publicKey;
     this.RendezvousServers  = IListExtensions.AsReadOnly <DnsDomainName>((IList <DnsDomainName>)Enumerable.ToArray <DnsDomainName>(rendezvousServers));
 }
        public void SetScroll(List <SuperHeroParts> superHeroPart, Action action)
        {
            onScroll = action;
            //buttonsParent.SetActive(true);
            selected_Sprite.gameObject.SetActive(false);

            spriteIndex = 0;
            this.superHeroParts.AddRange(superHeroPart);
            IListExtensions.Shuffle(this.superHeroParts);

            for (int i = 0; i < 2; i++)
            {
                SpriteRenderer objPart = Utils.GetSpriteRenderer(this.transform);
                objPart.maskInteraction         = SpriteMaskInteraction.VisibleInsideMask;
                objPart.transform.localScale    = Vector3.one * 0.8f;
                objPart.transform.localPosition = new Vector3(i * gapValue, 0, 0);

                objPart.gameObject.AddComponent <AnimationScript>();

                if (part == SuperHeroPart.Head)
                {
                    objPart.GetComponent <AnimationScript>().Init(0.5f, superHeroParts[i].gameSprites);
                }
                else
                {
                    objPart.sprite = superHeroParts[i].creatorSprite;
                }

                parts.Add(objPart.transform);
            }
        }
        /// <summary>
        /// Returns true if changes were made
        /// </summary>
        /// <param name="desired"></param>
        /// <returns></returns>
        private bool makeAvailableItemsLike(params NavigationManager.MainMenuSelections[] desired)
        {
            var desiredList = new List <MainMenuSelections>(desired);

            if (PowerPlannerApp.UseUnifiedCalendarDayTabItem)
            {
                desiredList.Remove(MainMenuSelections.Day);
            }

            if (PowerPlannerApp.DoNotShowYearsInTabItems)
            {
                desiredList.Remove(MainMenuSelections.Years);
            }

            if (PowerPlannerApp.DoNotShowSettingsInTabItems)
            {
                desiredList.Remove(MainMenuSelections.Settings);
            }

            bool answer = IListExtensions.MakeListLike(_availableItems, desiredList);

            if (PowerPlannerApp.DoNotShowYearsInTabItems && !AvailableItems.Any() && Popups.Count == 0)
            {
                OpenYears();
            }

            return(answer);
        }
Example #4
0
    // Update is called once per frame
    void Update()
    {
        if (this.spawnEnemies && this.timeToSpawn <= Time.time)
        {
            EnemyType spawnType = IListExtensions.Pop(this.spawnOrder);
            if (this.spawnOrder.Count == 0)
            {
                this.spawnEnemies = false;
            }

            int spawner = 0;

            switch (spawnType)
            {
            case EnemyType.Helicopter:
                spawner = Random.Range(0, helicopterSpawners.Count);
                helicopterSpawners[spawner].Spawn(this.helicopter);
                break;

            case EnemyType.Person:
                spawner = Random.Range(0, personSpawners.Count);
                personSpawners[spawner].Spawn(this.person);
                break;

            case EnemyType.Tank:
                spawner = Random.Range(0, tankSpawners.Count);
                tankSpawners[spawner].Spawn(this.tank);
                break;
            }

            this.timeToSpawn = Time.time + Random.Range(this.timeBetweenSpawns - this.varationBetweenSpawns,
                                                        this.timeBetweenSpawns + this.varationBetweenSpawns);
        }
    }
        //
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Shuffle
        ///</summary>
        public void ShuffleTestHelper <T>()
        {
            IList <T> list = null; // TODO: Initialize to an appropriate value

            IListExtensions.Shuffle <T>(list);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
Example #6
0
    public void SetRound(int personCount, int helicopterCount, int tankCount)
    {
        this.spawnOrder.AddRange(Enumerable.Repeat(EnemyType.Person, personCount));
        this.spawnOrder.AddRange(Enumerable.Repeat(EnemyType.Helicopter, helicopterCount));
        this.spawnOrder.AddRange(Enumerable.Repeat(EnemyType.Tank, tankCount));

        IListExtensions.Shuffle(this.spawnOrder);
    }
Example #7
0
 public IpV4OptionTimestampAndAddress(IpV4OptionTimestampType timestampType, byte overflow, byte pointedIndex, IList <IpV4OptionTimedAddress> timedRoute)
     : base(timestampType, overflow, pointedIndex)
 {
     if (timestampType != IpV4OptionTimestampType.AddressAndTimestamp && timestampType != IpV4OptionTimestampType.AddressPrespecified)
     {
         throw new ArgumentException("Illegal timestamp type " + (object)timestampType, "timestampType");
     }
     this._addressesAndTimestamps = IListExtensions.AsReadOnly <IpV4OptionTimedAddress>(timedRoute);
 }
Example #8
0
 protected IpV4OptionRoute(IpV4OptionType optionType, IList <IpV4Address> route, byte pointedAddressIndex)
     : base(optionType)
 {
     if ((int)pointedAddressIndex > 62)
     {
         throw new ArgumentOutOfRangeException("pointedAddressIndex", (object)pointedAddressIndex, "Maximum value is " + (object)62);
     }
     this._route = IListExtensions.AsReadOnly <IpV4Address>(route);
     this._pointedAddressIndex = pointedAddressIndex;
 }
Example #9
0
    public List <TileType> getColorArray(int range)
    {
        List <TileType> colors    = Enum.GetValues(typeof(TileType)).Cast <TileType>().ToList();
        List <TileType> subColors = colors.GetRange(2, colors.Count - 2);

        IListExtensions.Shuffle(subColors);
        subColors = subColors.GetRange(0, range);

        return(subColors);
    }
 private void RemoveClass(ViewItemClass c)
 {
     if (TrackChanges)
     {
         _addedClasses.RemoveWhere(i => i == c);
         base.StopObservingCollection(c.Schedules);
         c.PropertyChanged -= _classPropertyChangedEventHandler;
     }
     IListExtensions.RemoveWhere(this, i => i.Class == c);
 }
 private void SetTransferCodings(IList <string> transferCodings)
 {
     if (Enumerable.Any <string>((IEnumerable <string>)transferCodings, (Func <string, bool>)(coding => Enumerable.Any <char>((IEnumerable <char>)coding, (Func <char, bool>)(c => CharExtensions.IsUppercaseAlpha(c))))))
     {
         this._transferCodings = IListExtensions.AsReadOnly <string>((IList <string>)Enumerable.ToArray <string>(Enumerable.Select <string, string>((IEnumerable <string>)transferCodings, (Func <string, string>)(coding => coding.ToLowerInvariant()))));
     }
     else
     {
         this._transferCodings = IListExtensions.AsReadOnly <string>(transferCodings);
     }
 }
Example #12
0
        public static SkillsSerializable GetEquippedSkillByIndex(BattlerSerializable battler, int index)
        {
            var eqSkills = battler.skills;

            if (IListExtensions.IsDefinedAt(eqSkills, index))
            {
                return(GetSkillById(eqSkills[index]));
            }

            return(null);
        }
Example #13
0
        private Options(IList <T> options, bool isValid)
        {
            this._options    = IListExtensions.AsReadOnly <T>(options);
            this.IsValid     = isValid;
            this.BytesLength = Options <T> .SumBytesLength((IEnumerable <T>) this.OptionsCollection);

            if (this.BytesLength % 4 == 0)
            {
                return;
            }
            this.BytesLength = (this.BytesLength / 4 + 1) * 4;
        }
Example #14
0
 private void StartGame()
 {
     // shuffle players list
     IListExtensions.Shuffle <GameObject>(players);
     //FIXME in the future, make this start all ui components necessary when game starts
     foreach (GameObject player in Players)
     {
         player.GetComponent <InputController>().RpcSetNotificationPanel(true);
     }
     // initialise turn manager
     TurnManager.instance.Init();
 }
Example #15
0
 public void BuildCycle()
 {
     if (pickedAttackStates.Count > 0)
     {
         currentIdleDuration = 0;
     }
     else
     {
         currentIdleDuration = bossStats.idleDuration;
         pickedAttackStates  = Enum.GetValues(typeof(AttackStates)).Cast <AttackStates>().ToList();
         IListExtensions.Shuffle(pickedAttackStates);
     }
 }
Example #16
0
 //creates a deck of shuffeled cards
 public void CreateDeck()
 {
     //if (cards == null) cards = new List<int>(DataController.Instance.GetCardDataBase().Cards.Keys);
     //TODO:FIX THIS
     //this has to be done to avoid getting a reference of the list of cards and so changing it
     //foreach(int currentCard in DataController.Instance.GetCardService().DeckCards)
     //{
     //    Debug.Log("adding card with id :" + currentCard);
     //    cards.Add(currentCard);
     //}
     cards = DataController.Instance.GetCardService().DeckCards;
     IListExtensions.Shuffle(cards);
 }
Example #17
0
    //stolen from Heart.cs, modified slightly to work as an attachment to a bodypart rather than a bodypart in and of itself
    //forcing efficiency at 1.0f, ignoring whether or not the bodypart is functioning
    void PumpBloodMaster(float deltaTime)
    {
        //starting from a random bodypart that is connected to this charm:
        List <BodyPart> allBodyParts  = bodyPartManager.bodyParts;
        List <int>      bodypartOrder = Enumerable.Range(0, allBodyParts.Count()).ToList <int>();

        IListExtensions.Shuffle <int>(bodypartOrder);

        foreach (int bodypartIndex in bodypartOrder)
        {
            if (allBodyParts[bodypartIndex].IsConnectedToBodyPartStarter(this.gameObject.GetComponent <BodyPart>()))
            {
                allBodyParts[bodypartIndex].PumpBlood(1.0f, deltaTime);
            }
        }
    }
Example #18
0
 public void OnClickQuitDeckBuilder(string sceneName)
 {
     if (deckController.numberOfCards != 5)
     {
         deckController.NotifyErrorAllowedNumber();
     }
     else
     {
         if (IListExtensions.AreEqual(deckController.deckCards, deckController.GetCurrentDeckCards()))
         {
             SceneManager.LoadScene(sceneName, LoadSceneMode.Single);
         }
         else
         {
             notificationController.GetComponent <Animator>().SetTrigger(parameterConfirmationHash);
         }
     }
 }
Example #19
0
        void Start()
        {
            this.transform.localScale = new Vector3(1 / FindObjectOfType <Stage>().transform.localScale.x, 1, 1);

            //cloudStartPosition = 1;// AbstractImmersiveCamera.CurrentImmersiveCamera.cameras[2].transform.localPosition.x + AbstractImmersiveCamera.CurrentImmersiveCamera.cameras[2].aspect;
            //cloudLastPosition = -1;// AbstractImmersiveCamera.CurrentImmersiveCamera.cameras[0].transform.localPosition.x - AbstractImmersiveCamera.CurrentImmersiveCamera.cameras[0].aspect;

            IListExtensions.Shuffle(cloudSprites);

            for (int i = 0; i < clouds.Count; i++)
            {
                clouds[i].sprite = cloudSprites[i];
                clouds[i].transform.localPosition = new Vector3(clouds[i].transform.localPosition.x, Random.Range(0.7f, 1.2f), 0);
                xRange.Add(clouds[i].transform.localPosition.x);
                AnimateCloud(clouds[i], i);
            }

            IListExtensions.Shuffle(cloudSprites);
        }
Example #20
0
    // Start is called before the first frame update
    void Start()
    {
        imageList.Add(dog.GetComponent <SpriteRenderer>().sprite);
        imageList.Add(dog.GetComponent <SpriteRenderer>().sprite);
        imageList.Add(cat.GetComponent <SpriteRenderer>().sprite);
        imageList.Add(cat.GetComponent <SpriteRenderer>().sprite);
        imageList.Add(fern.GetComponent <SpriteRenderer>().sprite);
        imageList.Add(fern.GetComponent <SpriteRenderer>().sprite);
        imageList.Add(bottle.GetComponent <SpriteRenderer>().sprite);
        imageList.Add(bottle.GetComponent <SpriteRenderer>().sprite);
        IListExtensions.Shuffle(imageList);

        int index = 0;

        foreach (Transform card in coveredCards.transform)
        {
            card.GetComponent <SpriteRenderer>().sprite = imageList[index];
            index++;
        }
    }
Example #21
0
        void AnimateCloud(SpriteRenderer cloud, int index)
        {
            cloud.transform.localScale = Vector3.one * Random.Range(0.6f, 1.0f);

            float transitionTime = Vector2.Distance(cloud.transform.localPosition, new Vector2(-1, 0)) * 2;

            iTween.MoveTo(cloud.gameObject, iTween.Hash("x", cloud.transform.localPosition.x, "y", -1, "z", 0, "islocal", true,
                                                        "time", transitionTime * 5, "easetype", iTween.EaseType.linear, "oncomplete", (System.Action <object>)(newValue =>
            {
                cloud.sprite = cloudSprites[cloudIndex];
                cloud.transform.localPosition = new Vector3(Random.Range(xRange[index] - 0.4f, xRange[index] + 0.4f), Random.Range(0.7f, 1.2f), 0);
                AnimateCloud(cloud, index);

                cloudIndex++;

                if (cloudIndex >= clouds.Count)
                {
                    cloudIndex = 0;
                    IListExtensions.Shuffle(cloudSprites);
                }
            })));
        }
Example #22
0
    //responsible for controlling blood pumping in all bodyparts
    //TODO: the amount of blood moving around should be capped by the amount of blood actually *in* the heart
    void PumpBloodMaster(float deltaTime)
    {
        if (isFunctioning == false)
        {
            return;
        }

        //randomising pump order, to prevent odd effects from fixed loops
        List <BodyPart> allBodyParts  = bodyPartManager.bodyParts;
        List <int>      bodypartOrder = Enumerable.Range(0, allBodyParts.Count()).ToList <int>();

        IListExtensions.Shuffle <int>(bodypartOrder);

        //for all bodyparts,
        //if this heart is connected to that bodypart,
        //pump blood
        foreach (int bodypartIndex in bodypartOrder)
        {
            if (allBodyParts[bodypartIndex].connectedHearts.Contains(this))
            {
                allBodyParts[bodypartIndex].PumpBlood(efficiency, deltaTime);
            }
        }
    }
 public DnsResourceDataUri(ushort priority, ushort weight, IList <DataSegment> target)
 {
     this.Priority = priority;
     this.Weight   = weight;
     this.Target   = IListExtensions.AsReadOnly <DataSegment>(target);
 }
 internal GreSourceRouteEntryIp(IpV4Address[] addresses, int nextAddressIndex)
     : this(IListExtensions.AsReadOnly <IpV4Address>((IList <IpV4Address>)addresses), nextAddressIndex)
 {
 }
Example #25
0
 private void Start()
 {
     IListExtensions.Shuffle(colors);
     Camera.main.backgroundColor = backgroundColor;
 }
Example #26
0
    //Pumps blood, if there is blood left to pump.
    public void PumpBlood(float heartEfficiency, float deltaTime)
    {
        deltaTime *= timeScale;

        //pumping blood to contained organs in a random order, to prevent loops forming between pairs of bodyparts, trapping blood between them
        List <BodyPart> allBodyParts = connectedBodyParts.Concat(containedOrgans).ToList();

        IListExtensions.Shuffle(allBodyParts);

        foreach (BodyPart bodyPart in allBodyParts)
        {
            //cap blood and oxygen transfer rate at between 0.2 and 5 times the blood pump rate, plus slowdown factor for more localised substances
            float tempBloodPumpRate           = Mathf.Max(Mathf.Min((blood / bodyPart.blood), 5), 0.2f) * bloodPumpRate * heartEfficiency;
            float tempOxygenPumpRate          = Mathf.Max(Mathf.Min((oxygen / bodyPart.oxygen), 5), 0.2f) * bloodPumpRate * heartEfficiency;
            float tempHealthPotionPumpRate    = Mathf.Max(Mathf.Min((healthPotion / bodyPart.healthPotion), 5), 0.2f) * bloodPumpRate * heartEfficiency * 0.001f;
            float tempAntidotePumpRate        = Mathf.Max(Mathf.Min((antidote / bodyPart.antidote), 5), 0.2f) * bloodPumpRate * heartEfficiency * 0.001f;
            float tempSlowPoisonPumpRate      = Mathf.Max(Mathf.Min((slowPoison / bodyPart.slowPoison), 5), 0.2f) * bloodPumpRate * heartEfficiency * 0.0001f;
            float tempStasisPotionPumpRate    = Mathf.Max(Mathf.Min((stasisPotion / bodyPart.stasisPotion), 5), 0.2f) * bloodPumpRate * heartEfficiency * 0.001f;
            float tempCoagulantPotionPumpRate = Mathf.Max(Mathf.Min((coagulantPotion / bodyPart.coagulantPotion), 5), 0.2f) * bloodPumpRate * heartEfficiency * 0.001f;
            float tempHastePotionPumpRate     = Mathf.Max(Mathf.Min((hastePotion / bodyPart.hastePotion), 5), 0.2f) * bloodPumpRate * heartEfficiency * 0.001f;

            //transport blood
            float proposedBloodOut = tempBloodPumpRate * deltaTime;
            float bloodOut         = Mathf.Min(Mathf.Min(blood, proposedBloodOut), (bodyPart.bloodMax - bodyPart.blood));
            bodyPart.blood += bloodOut;
            blood          -= bloodOut;

            //transport oxygen
            float proposedOxygenOut = tempOxygenPumpRate * deltaTime;
            float oxygenOut         = Mathf.Max(Mathf.Min(oxygen, proposedOxygenOut), 0);
            bodyPart.oxygen += oxygenOut;
            oxygen          -= oxygenOut;

            if (healthPotion > 0.0f)
            {
                //transport health potion
                float proposedHealthPotionOut = tempHealthPotionPumpRate * deltaTime;
                float healthPotionOut         = Mathf.Min(healthPotion, proposedHealthPotionOut);
                bodyPart.healthPotion += healthPotionOut;
                healthPotion          -= healthPotionOut;
            }

            if (antidote > 0.0f)
            {
                //transport antidote
                float proposedAntidoteOut = tempAntidotePumpRate * deltaTime;
                float antidoteOut         = Mathf.Min(antidote, proposedAntidoteOut);
                bodyPart.antidote += antidoteOut;
                antidote          -= antidoteOut;
            }

            if (slowPoison > 0.0f)
            {
                //transport slow poison
                float proposedSlowPoisonOut = tempSlowPoisonPumpRate * deltaTime;
                float slowPoisonOut         = Mathf.Min(slowPoison, proposedSlowPoisonOut);
                bodyPart.slowPoison += slowPoisonOut;
                slowPoison          -= slowPoisonOut;
            }

            if (stasisPotion > 0.0f)
            {
                //transport stasis potion
                float proposedStasisPotionOut = tempStasisPotionPumpRate * deltaTime;
                float stasisPotionOut         = Mathf.Min(stasisPotion, proposedStasisPotionOut);
                bodyPart.stasisPotion += stasisPotionOut;
                stasisPotion          -= stasisPotionOut;
            }

            if (coagulantPotion > 0.0f)
            {
                //transport stasis potion
                float proposedCoagulantPotionOut = tempCoagulantPotionPumpRate * deltaTime;
                float coagulantPotionOut         = Mathf.Min(coagulantPotion, proposedCoagulantPotionOut);
                bodyPart.coagulantPotion += coagulantPotionOut;
                coagulantPotion          -= coagulantPotionOut;
            }

            if (hastePotion > 0.0f)
            {
                //transport stasis potion
                float proposedHastePotionOut = tempHastePotionPumpRate * deltaTime;
                float hastePotionOut         = Mathf.Min(hastePotion, proposedHastePotionOut);
                bodyPart.hastePotion += hastePotionOut;
                hastePotion          -= hastePotionOut;
            }
        }
    }
 public IgmpReportVersion3Layer()
 {
     this.GroupRecords = IListExtensions.AsReadOnly <IgmpGroupRecord>((IList <IgmpGroupRecord>) new IgmpGroupRecord[0]);
 }
Example #28
0
 public string ToHexadecimalString()
 {
     return(IEnumerableExtensions.BytesSequenceToHexadecimalString(IListExtensions.Range <byte>((IList <byte>) this.Buffer, this.StartOffset, this.Length)));
 }
Example #29
0
 public override sealed string ToString()
 {
     return(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0} bytes: {1}{2}", (object)this.Length, (object)IEnumerableExtensions.BytesSequenceToHexadecimalString(IListExtensions.Range <byte>((IList <byte>) this.Buffer, this.StartOffset, Math.Min(this.Length, 10))), this.Length > 10 ? (object)"..." : (object)""));
 }
 public IpV4OptionTimestampOnly(byte overflow, byte pointedIndex, IList <IpV4TimeOfDay> timestamps)
     : base(IpV4OptionTimestampType.TimestampOnly, overflow, pointedIndex)
 {
     this._timestamps = IListExtensions.AsReadOnly <IpV4TimeOfDay>(timestamps);
 }