public bool IsAntenna(out Dictionary <string, List <XDLPip> > pipsToRemove) { pipsToRemove = new Dictionary <string, List <XDLPip> >(); string outpinName = NetPins.Where(np => np is NetOutpin).First().SlicePort; XDLPip firstPipAfterOutpin = Pips.Where(p => p.From.EndsWith(outpinName) && IdentifierManager.Instance.IsMatch(p.Location, IdentifierManager.RegexTypes.CLB)).FirstOrDefault(); if (firstPipAfterOutpin == null) { //Console.WriteLine("Could not find the pip right after the outpin " + outpinName + " in net " + this.Name); return(false); } Queue <XDLPip> reachablePips = new Queue <XDLPip>(); reachablePips.Enqueue(firstPipAfterOutpin); foreach (XDLPip pip in Pips.Where(p => !p.Equals(firstPipAfterOutpin))) { if (!pipsToRemove.ContainsKey(pip.Location)) { pipsToRemove.Add(pip.Location, new List <XDLPip>()); } pipsToRemove[pip.Location].Add(pip); } while (reachablePips.Count > 0) { // from the current pip XDLPip current = reachablePips.Dequeue(); // go to all reachable locations foreach (Location loc in Navigator.GetDestinations(current.Location, current.To)) { if (!pipsToRemove.ContainsKey(loc.Tile.Location)) { continue; } // for readability we reference the list of pips List <XDLPip> pipsToRemoveOnTile = pipsToRemove[loc.Tile.Location]; while (true) { int index = pipsToRemoveOnTile.FindIndex(pip => pip.From.Equals(loc.Pip.Name)); if (index == -1) { break; } XDLPip reachable = pipsToRemoveOnTile[index]; pipsToRemoveOnTile.RemoveAt(index); reachablePips.Enqueue(reachable); // remove empty lists for readability if (pipsToRemoveOnTile.Count == 0) { pipsToRemove.Remove(loc.Tile.Location); } } } } return(pipsToRemove.Values.Any(l => l.Count > 0)); }
public Card(Suit suit, Pips pips) { mSuit = suit; mPips = pips; if (suit == PlayingCards.Suit.Clubs || suit == PlayingCards.Suit.Spades || suit == PlayingCards.Suit.None) //assume jokers are black { mCardColor = PlayingCards.CardColor.Black; } else { mCardColor = PlayingCards.CardColor.Red; } }
public override void Initialize() { base.Initialize(); // set up ship sprite spriteRenderer.Color = NGame.context.assets.paletteWhite; mind.attach(this); // attach mind body = Entity.AddComponent(new WingBody()); hitbox = Entity.AddComponent(new BoxCollider(-6, -10, 12, 18) { Tag = Constants.Colliders.SHIP }); Flags.SetFlagExclusive(ref hitbox.PhysicsLayer, Constants.Physics.LAYER_DEFAULT); Flags.SetFlag(ref hitbox.CollidesWithLayers, Constants.Physics.LAYER_DEFAULT); core = Entity.AddComponent(new EnergyCore(10_000)); // add pips pips = Entity.AddComponent <Pips>(); pips.spriteRenderer.LocalOffset = new Vector2(0, 14); // set body properties changeClass(WingClass.Wing); // change to default class // pips setup var pipNumber = 1 + Random.NextInt(5); pips.setPips(pipNumber, Pips.green); var ribbon = Entity.AddComponent(new TrailRibbon(40) { StartColor = new Color(175, 158, 180, 255), EndColor = new Color(175, 158, 180, 50), RibbonRadius = 8 }); ribbon.StopEmitting(); ribbon.Enabled = false; // var trail = Entity.AddComponent(new SpriteTrail(animator) { // InitialColor = new Color(200, 200, 200), // MinDistanceBetweenInstances = 40, // MaxSpriteInstances = 10, // FadeDelay = 0.5f, // }); if (name == null && Entity.Name != null) { name = Entity.Name; } }
protected internal override void OnRecieveRequest(TcpClient client) { Pips?.AddWork(async() => { if (client.Connected) { await ProcessRequest(client); } else { client.Close(); } }); }
public EDEvent Replay() { EDEvent edEvent = new EDEvent(); edEvent.Altitude = Altitude; edEvent.BodyName = BodyName; edEvent.Commander = Commander; edEvent.EventName = EventName; edEvent.Flags = Flags; edEvent.Heading = Heading; edEvent.Health = Health; edEvent.Latitude = Latitude; edEvent.Longitude = Longitude; edEvent.PlanetRadius = PlanetRadius; edEvent.PlayerControlled = PlayerControlled; edEvent.TargetedShipName = TargetedShipName; edEvent.Pips = (byte[])Pips.Clone(); edEvent.TimeStamp = DateTime.UtcNow; return(edEvent); }
/// <inheritdoc /> public override int GetHashCode() { unchecked { var hashCode = (int)Flags; hashCode = (hashCode * 397) ^ (Pips != null ? Pips.GetHashCode() : 0); hashCode = (hashCode * 397) ^ FireGroup.GetHashCode(); hashCode = (hashCode * 397) ^ (int)GuiFocus; hashCode = (hashCode * 397) ^ (Fuel != null ? Fuel.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)LegalState; hashCode = (hashCode * 397) ^ Cargo.GetHashCode(); hashCode = (hashCode * 397) ^ Latitude.GetHashCode(); hashCode = (hashCode * 397) ^ Altitude.GetHashCode(); hashCode = (hashCode * 397) ^ Longitude.GetHashCode(); hashCode = (hashCode * 397) ^ Heading.GetHashCode(); hashCode = (hashCode * 397) ^ (BodyName != null ? BodyName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ PlanetRadius.GetHashCode(); return(hashCode); } }
public void SetMelds(IRummyPlayer sender, List <Card> cardsInMeld) { if (sender.PlayerIndex != _currentPlayerIndex) { throw new Exception("The Player Indexes don't align"); } Pips number = Pips.Joker; //check to see if the cards are in the senders hand foreach (var item in cardsInMeld) { if (_playersHands[_currentPlayerIndex].Hand.Contains(item) == false) { throw new Exception("The card wasn't in the players hand"); } else { _playersHands[_currentPlayerIndex].Hand.Remove(item); } //Check to see if the SET MELDS are valid if (number == Pips.Joker) { number = item.Pips; } else if (item.Pips != number) { throw new Exception("Wasn't a valid SET MELD"); } } //Add it to the table _table.SetMelds.Add(_table.SetMelds.Count, cardsInMeld); _currentTurnMeldID.Add(_table.SetMelds.Count); }
public string ToListString() { return(Survivor + " vs. " + Killer + " - " + BloodPoints.ToString() + " (" + Pips.ToString() + ")"); }
public bool Equal(Pips other) { return(Systems == other.Systems && Engines == other.Engines && Weapons == other.Weapons); }
public UIPips(Pips value, DateTime time, bool refresh) : this(time, refresh) { Value = value; }
protected internal override void OnBroadcast(Action <object> action, object obj) { Pips?.AddWork(() => action?.Invoke(obj)); }
protected override void OnShutteddown() { Pips?.Kill(); base.OnShutteddown(); }
protected override void OnSuspended() { Pips?.Suspend(); base.OnSuspended(); }
protected override void OnResumed() { Pips?.Resume(); base.OnResumed(); }
public string ToListString() { return(Killer + " vs. " + String.Join(", ", Survivors.Keys) + " - " + BloodPoints.ToString() + " (" + Pips.ToString() + ")"); }
public UIPips(Pips value, DateTime time, bool refresh) : base(UITypeEnum.Pips, time, refresh) { Value = value; }
public UIPips(Pips value, DateTime time) : base(UITypeEnum.Pips, time) { Value = value; }