private async Task HandleAlbum(SpotifyClient client, DisplayCard displayCard, string itemId) { var album = await GetAlbum(client, itemId); displayCard.ContextName = album.Name; displayCard.ContextImage = album.Images.FirstOrDefault().Url; }
private async Task HandleArtirst(SpotifyClient client, DisplayCard displayCard, string itemId) { var artist = await GetArtist(client, itemId); displayCard.ContextName = artist.Name; displayCard.ContextImage = artist.Images.FirstOrDefault().Url; }
public void LoadCard() { foreach (CollectionCardItem item in _cards) { Application.Current.Dispatcher.Invoke(() => DisplayCard?.Invoke(new BCA_CollectionCard(item))); } }
public void PopulateNewCards(IDeckDict <PokerCardInfo> thisList) { DisplayCard thisDisplay; if (PokerList.Count == 0) { CustomBasicList <DisplayCard> newList = new CustomBasicList <DisplayCard>(); if (thisList.Count != 5) { throw new BasicBlankException("Must have 5 cards for the poker hand"); } thisList.ForEach(thisCard => { thisDisplay = new DisplayCard(); thisDisplay.CurrentCard = thisCard; newList.Add(thisDisplay); }); PokerList.ReplaceRange(newList); return; } var tempList = PokerList.Where(items => items.WillHold == false).ToCustomBasicList(); if (tempList.Count != thisList.Count) { throw new BasicBlankException("Mismatch for populating new cards"); } int x = 0; tempList.ForEach(temps => { var thisCard = thisList[x]; temps.CurrentCard = thisCard; x++; }); }
private DeckOfCardsXF <PokerCardInfo> GetNewCard(DisplayCard thisPoker) { DeckOfCardsXF <PokerCardInfo> thisCard = new DeckOfCardsXF <PokerCardInfo>(); thisCard.SendSize(ts.TagUsed, thisPoker.CurrentCard); thisCard.Command = _command !; return(thisCard); }
public void HoldUnhold(DisplayCard display) { if (display == null) { throw new BasicBlankException("The holdunhold showed nothing. Rethink"); } display.WillHold = !display.WillHold; }
public FindPictureFromWord(Random Random) { Card[] tmp = Card.GetRandom(6, Random); cards=new DisplayCard[tmp.Length]; for (int i = 0; i < tmp.Length; i++) cards[i] = new DisplayCard(tmp[i]); AnswerCards = new int[] { Random.Next(cards.Length) }; }
private async Task HandlePlaylist(SpotifyClient client, DisplayCard displayCard, string itemId) { var playlistRequest = BuildPlaylistRequestWithFields(); var playlist = await GetPlaylist(client, playlistRequest, itemId); displayCard.ContextName = playlist.Name; displayCard.ContextImage = playlist.Images.FirstOrDefault().Url; }
public FindPictureFromPhrase(Random Random) { Card[] tmp = Card.GetRandom(6, Random); cards = new DisplayCard[tmp.Length]; for (int i = 0; i < tmp.Length; i++) cards[i] = new DisplayCard(tmp[i]); AnswerCards = new int[] { Random.Next(cards.Length) }; prompt = string.Format(phrases[Random.Next(phrases.Length)], cards[AnswerCards[0]].Card.Text); }
public void CardSelected(DisplayCard card) { Hide(); //TurnEvent turnEvent = boardManager.PlayCardFromDiscardPile(card); IPromise <IList <TurnEvent> > turnEvent = boardManager.PlayCardFromDiscardPile(card); turnEvent.Then(te => cardSelectPromise.Resolve(te) ); }
public IPromise <IList <TurnEvent> > PlayCardFromDiscardPile(DisplayCard displayCard) { InGameCard card = ourDiscardPile.PopCardById(displayCard.id); List <CombatType> eligibleCts = new List <CombatType> { CombatType.Melee, CombatType.Ranged, CombatType.Siege }; if (card.reviveRow == null) { throw new AddCardException( String.Format("{0} card is missing a revive row.", card.id) ); } else if (!eligibleCts.Contains(card.reviveRow.Value)) { throw new AddCardException( String.Format("{0} card has an ineligble revive row.", card.id) ); } CombatType reviveRow = card.reviveRow.Value; IPromise <IList <TurnEvent> > result; if (card.IsSpy()) { if (reviveRow == CombatType.Siege) { result = theirSiegeRow.AddCard(card); } else if (reviveRow == CombatType.Ranged) { result = theirRangedRow.AddCard(card); } else { result = theirMeleeRow.AddCard(card); } } else { if (reviveRow == CombatType.Melee) { result = ourMeleeRow.AddCard(card); } else if (reviveRow == CombatType.Ranged) { result = ourRangedRow.AddCard(card); } else { result = ourSiegeRow.AddCard(card); } } return(result); }
// Displays a list of all watchers this specific user has showcards with public IActionResult ByWatcher(int watcherID) { string message = TempData["message"]?.ToString(); int userID = GetUserID(); if (userID == 0) { return(RedirectToAction("Login", "User")); } List <DisplayCard> displayCards = new List <DisplayCard>(); List <Watcher> allUserWatchers = new List <Watcher>(); using (WeWatchContext context = new WeWatchContext()) { if (watcherID == 0) { message = "Unable to find that Watcher."; } else { // A list of all Show Cards with this Specific User and Watcher List <ShowCard> showCardsByWatcher = context.ShowCard.Include(x => x.Watcher).Where(x => x.WatcherID == watcherID && x.UserID == userID).ToList(); // A list of all Watchers that this Specific User has ShowCards with allUserWatchers = context.ShowCard.Include(x => x.Watcher).Where(x => x.UserID == userID).Select(x => x.Watcher).Distinct().ToList(); if (showCardsByWatcher == null) { message = "Looks like you are not watching a show with that Watcher"; } // If this User has ShowCards with this Watcher add them to the list of display cards if (showCardsByWatcher != null) { foreach (ShowCard showCard in showCardsByWatcher) { DisplayCard card = new DisplayCard(showCard.ShowID, showCard.WatcherID) { ShowCardID = showCard.ShowCardID, SeasonID = showCard.CurrentSeason, CurrentEpisode = showCard.CurrentEpisode }; card.ShowCardID = showCard.ShowCardID; displayCards.Add(card); } } } } ViewBag.Message = message; ViewBag.AllUserWatchers = allUserWatchers; ViewBag.DisplayCards = displayCards; return(View()); }
public FindFromGroup(Random Random) { subject = groups[Random.Next(groups.Length)]; Card[] tmp = Card.GetRandom(6, Random, null, "!"+subject.Group); cards = new DisplayCard[tmp.Length]; for (int i = 0; i < tmp.Length; i++) cards[i] = new DisplayCard(tmp[i]); AnswerCards = new int[] { Random.Next(cards.Length) }; cards[AnswerCards[0]] =new DisplayCard( Card.GetRandom(1, Random, null, subject.Group)[0]); prompt = subject.Prompt; }
// When an object is created for this layout group this method is invoked private void RegisterCardToEvent(DisplayCard displayCard) { InfiniteScrollLocationCheck infiniteScrollLocationCheck; displayCard.TryGetComponent <InfiniteScrollLocationCheck>(out infiniteScrollLocationCheck); // If this object has a InfiniteScrollLocationCheck then listen for its position updates if (infiniteScrollLocationCheck != null) { infiniteScrollLocationCheck.OnTooFarLeft += MoveIndexerRight; infiniteScrollLocationCheck.OnTooFarRight += MoveIndexerLeft; } }
private DeckOfCardsWPF <PokerCardInfo> GetNewCard(DisplayCard thisPoker) { DeckOfCardsWPF <PokerCardInfo> thisCard = new DeckOfCardsWPF <PokerCardInfo>(); thisCard.SendSize(ts.TagUsed, thisPoker.CurrentCard); //thisCard.Name = nameof(PokerMainViewModel.HoldUnhold); thisCard.Command = _command !; return(thisCard); }
public void Display(Player player) { title.text = player.Name; foreach (Transform t in scrollView.content) { Destroy(t.gameObject); } foreach (var card in player.cards) { DisplayCard displayCard = Instantiate(cardPrefab, scrollView.content).GetComponent <DisplayCard>(); displayCard.Display(card); } }
public void Display(IEnumerable <InGameCard> cards) { this.transform.localScale = originalScale; this.cardSelectBehaviour = false; // Need to copy the individual cards so they remain in their original // position (e.g. discard pile, hand) as well as being in the // CardDisplay. IEnumerable <DisplayCard> displayCards = cards.Select(card => { DisplayCard newCard = DisplayCard.CreateCard(card, this, false); newCard.SetSize(270, 360); return(newCard); }); cardDisplayRow.Populate(displayCards); }
public async Task <DisplayCard> BuildRecentlyPlayedCard(SpotifyClient client) { var displayCard = new DisplayCard(); var user = await GetUser(client); var recentlyPlayedItem = (await client.Player.GetRecentlyPlayed(new PlayerRecentlyPlayedRequest() { Limit = 1, }))?.Items?.FirstOrDefault(); var recentlyPlayerTrack = recentlyPlayedItem.Track; var itemContext = recentlyPlayedItem.Context; if (itemContext != null) { var contextType = GetContextType(itemContext); var itemId = GetIdFromHref(itemContext.Href); displayCard.UserName = user.DisplayName; displayCard.TrackName = recentlyPlayerTrack.Name; displayCard.ContextType = SpotifyContextType.playlist; displayCard.ArtistNames = BuildArtistNames(recentlyPlayerTrack.Artists); displayCard.ContextType = contextType; if (contextType == SpotifyContextType.playlist) { await HandlePlaylist(client, displayCard, itemId); return(displayCard); } if (contextType == SpotifyContextType.artist) { await HandleArtirst(client, displayCard, itemId); return(displayCard); } if (contextType == SpotifyContextType.album) { await HandleAlbum(client, displayCard, itemId); return(displayCard); } } return(displayCard); }
public IPromise <IList <TurnEvent> > DisplayForCardRevival(IEnumerable <InGameCard> cards) { cardSelectPromise = new Promise <IList <TurnEvent> >(); this.transform.localScale = originalScale; this.cardSelectBehaviour = true; IEnumerable <DisplayCard> displayCards = cards.Where(card => card.IsUnitType() && !card.IsHero() ).Select(card => { DisplayCard newCard = DisplayCard.CreateCard(card, this, true); newCard.SetSize(270, 360); return(newCard); }); cardDisplayRow.Populate(displayCards); return(cardSelectPromise); }
public PictureWantsPicture(Random Random) { Card[] working = Card.GetRandom(6, Random); AnswerCards = new int[2]; AnswerCards[1] = Random.Next(working.Length); AnswerCards[0] = Random.Next(working.Length); while (AnswerCards[0] == AnswerCards[1]) AnswerCards[0] = Random.Next(working.Length); List<Card> sentient = Card.GetCardsInGroup(new string[] { "Animal", "Person" }); working[AnswerCards[0]] = sentient[Random.Next(sentient.Count)]; prompt = string.Format(phrases[Random.Next(phrases.Length)], working[AnswerCards[0]].Text, working[AnswerCards[1]].Text); AnswerOrderImportant = true; cards = new DisplayCard[working.Length]; for (int i = 0; i < cards.Length; i++) cards[i] = new DisplayCard(working[i]); }
public static DisplayCard CreateCard( InGameCard inGameCard, CardDisplay display, Boolean cardSelectBehaviour) { GameObject cardObject = Instantiate((GameObject)Resources.Load("DisplayCard"), display.transform); DisplayCard card = cardObject.GetComponent <DisplayCard>(); card.cardObject = cardObject; card.id = inGameCard.id; card.combatTypes = new List <CombatType>(inGameCard.combatTypes); card.attributes = new List <CardAttribute>(inGameCard.attributes); card.basePower = inGameCard.basePower; card.currentPower = inGameCard.currentPower; card.faction = inGameCard.faction; card.image = Resources.Load <Sprite>("CardImages/" + inGameCard.id); card.cardDisplay = display; card.cardSelectBehaviour = cardSelectBehaviour; return(card); }
// Displays a list of ShowCards for this specific user and the provided show public IActionResult ByShow(int showID) { string message = TempData["message"]?.ToString(); int userID = GetUserID(); if (userID == 0) { return(RedirectToAction("Login", "User")); } List <DisplayCard> displayCards = new List <DisplayCard>(); List <Show> allUserShows = new List <Show>(); using (WeWatchContext context = new WeWatchContext()) { List <ShowCard> showCardsByShow = context.ShowCard.Include(x => x.Show).Where(x => x.ShowID == showID && x.UserID == userID).ToList(); allUserShows = context.ShowCard.Include(x => x.Show).Where(x => x.UserID == userID).Select(x => x.Show).Distinct().ToList(); if (showCardsByShow != null) { foreach (ShowCard showCard in showCardsByShow) { DisplayCard card = new DisplayCard(showCard.ShowID, showCard.WatcherID) { ShowCardID = showCard.ShowCardID, SeasonID = showCard.CurrentSeason, CurrentEpisode = showCard.CurrentEpisode }; card.ShowCardID = showCard.ShowCardID; displayCards.Add(card); } } } ViewBag.Message = message; ViewBag.AllUserShows = allUserShows; ViewBag.DisplayCards = displayCards; return(View()); }
void RefreshUI() { foreach (Transform child in player1ScrollArea.transform) { GameObject.Destroy(child.gameObject); } foreach (Transform child in player2ScrollArea.transform) { GameObject.Destroy(child.gameObject); } overworldPlayer1Name.text = player1.name; overworldPlayer2Name.text = player2.name; overworldPlayer1Health.text = player1.health + "/" + player1.maxHealth; float percentagePlayer1 = (player1.health / (float)player1.maxHealth) * overworldPlayer1HealthBarWitdh; overworldPlayer1HealthBar.rectTransform.sizeDelta = new Vector2(percentagePlayer1, overworldPlayer1HealthBar.rectTransform.sizeDelta.y); overworldPlayer2Health.text = player2.health + "/" + player2.maxHealth; float percentagePlayer2 = (player2.health / (float)player2.maxHealth) * overworldPlayer2HealthBarWitdh; overworldPlayer2HealthBar.rectTransform.sizeDelta = new Vector2(percentagePlayer2, overworldPlayer2HealthBar.rectTransform.sizeDelta.y); overworldPlayer1Mana.text = "Mana: " + player1.maxMana.ToString(); overworldPlayer2Mana.text = "Mana: " + player2.maxMana.ToString(); foreach (var card in player1.cards) { GameObject go = Instantiate(overworldCardPrefab, player1ScrollArea.transform) as GameObject; DisplayCard displayCard = go.GetComponentInChildren <DisplayCard>(); displayCard.Display(card); } ((RectTransform)player1ScrollArea.transform).sizeDelta = new Vector2(243, (Mathf.Clamp(player1.cards.Count - 1, 0, player1.cards.Count) / 5) * 65.454f + 65.454f); foreach (var card in player2.cards) { GameObject go = Instantiate(overworldCardPrefab, player2ScrollArea.transform) as GameObject; DisplayCard displayCard = go.GetComponentInChildren <DisplayCard>(); displayCard.Display(card); } ((RectTransform)player2ScrollArea.transform).sizeDelta = new Vector2(243, (Mathf.Clamp(player2.cards.Count - 1, 0, player2.cards.Count) / 5) * 65.454f + 65.454f); goldText.text = "Gold: " + gold.ToString(); }
// Ensure all the neccessary information to create a show card is received public IActionResult CreateCard(int showID, int watcherID, int seasonID, int episode) { string message = TempData["message"]?.ToString(); int userID = GetUserID(); if (userID == 0) { return(RedirectToAction("Login", "User")); } using WeWatchContext context = new WeWatchContext(); Show selectedShow = new Show(); ShowSeason selectedSeason = new ShowSeason(); Watcher selectedWatcher = new Watcher(); List <ShowSeason> seasons = new List <ShowSeason>(); DisplayCard card = new DisplayCard(); // A show and a watcher must be selected before seasons can be determined if (showID != 0 && watcherID != 0) { card = new DisplayCard(showID, watcherID); // Check to see if this user already has a card with this watcher and this show if (context.ShowCard.Where(x => x.ShowID == card.ShowID && x.WatcherID == card.WatcherID && x.UserID == userID).Count() != 0) { message = $"You are already watching {card.ShowTitle} with {card.WatcherName}"; } // Populate the seasons for this show else { seasons = context.ShowSeason.Where(x => x.ShowID == showID).OrderBy(x => x.IndividualSeason).ToList(); // Populate episodes if season has been selected if (seasonID != 0) { card.SeasonID = seasonID; selectedSeason = context.ShowSeason.Where(x => x.ShowSeasonID == seasonID).Single(); card.CurrentEpisode = episode; } } } // If we were passed a ShowCardID from another action, create a displayCard if (TempData["showCardID"] != null) { int showCardID = int.Parse(TempData["showCardID"].ToString()); ShowCard show = context.ShowCard.Where(x => x.ShowCardID == showCardID).Single(); card = new DisplayCard(show.ShowID, show.WatcherID) { SeasonID = show.CurrentSeason, CurrentEpisode = show.CurrentEpisode }; } ViewBag.Card = card; List <Show> allShows = context.Show.OrderBy(x => x.Title).ToList(); List <Watcher> allWatchers = context.Watcher.OrderBy(x => x.Name).ToList(); ViewBag.Message = message; ViewBag.AllShows = allShows; ViewBag.AllWatchers = allWatchers; ViewBag.Seasons = seasons; return(View()); }
public void Forwards() { //Clean Up foreach (var DisplayCard in CardSlots) { DisplayCard.gameObject.SetActive(false); } foreach (var item in Queue) { //Debug.Log(item.name); } if (Queue.Count == 0) { //Debug.Log("EMPTY"); } //Build new int NeededCards = 3; if (OneChoice) { NeededCards = 1; OneChoice = false; } else if (TwoChoice) { NeededCards = 2; TwoChoice = false; } else if (FourChoice) { NeededCards = 4; FourChoice = false; } //Queue Cards List <Card> SideStack = new List <Card>(); Card TheCard; int MaxRounds = 20; for (int i = 0; i < NeededCards; i++) { MaxRounds--; TheCard = dataBase.DrawCard(playerData.Thrill, StepOnThrillCount); bool check = true; if (TheCard.Animal && NoAnimals) { check = false; } if (check) { foreach (var card in SideStack) { if (card == TheCard) { check = false; break; } } for (int x = 0; x < Queue.Count; x++) { if (Queue[x] == TheCard) { check = false; break; } if (Queue[x].Animal && NoAnimals) { Queue.RemoveAt(x); } } }//Check Duplicates if (!check && MaxRounds > 0) { i--; } else { SideStack.Add(TheCard); } }//Pull Unique Cards List <Card> Stack = new List <Card>(); for (int i = 0; i < Queue.Count; i++) { Stack.Add(Queue[i]); } if (Queue.Count < NeededCards) { for (int i = 0; i < NeededCards - Queue.Count; i++) { Stack.Add(SideStack[i]); } } //Set Display Cards List <int> activeindex = new List <int>();//for Taint info bool BigBoiCominIn = false; foreach (var Card in Stack) { if (Card.BigCard) { CardSlots[4].gameObject.SetActive(true); CardSlots[4].SetCard(Card); //Debug.Log("CARD SET:"+Card.name); BigBoiCominIn = true; activeindex.Add(4); break; } } bool isTainted = false; if (!BigBoiCominIn) { for (int j = 0; j < NeededCards; j++) { CardSlots[j].gameObject.SetActive(true); } int i = 0; foreach (var DisplayCard in CardSlots) { if (DisplayCard.gameObject.activeSelf) { DisplayCard.SetCard(Stack[i]); //Debug.Log("CARD SET:" + Stack[i].name); if (Stack[i].Taint) { isTainted = true; } activeindex.Add(i); } i++; } } if (isTainted) { Tainted(activeindex); } Queue.Clear(); NoAnimals = false; }
// ----------------------------------------------------------------------------------------- public void CreateContentCard(IRecognizableComposite Source, DisplayCard DispCard) { var TableColDefs = new List <Capsule <string, string, double> >(); var TableRowVals = new List <string>(); if (DispCard.PropName) { TableColDefs.Add(Capsule.Create(FormalPresentationElement.__Name.TechName.ToHtmlEncoded(), FormalPresentationElement.__Name.Name.ToHtmlEncoded(), 30.0)); TableRowVals.Add(Source.Name.RemoveNewLines().ToHtmlEncoded()); } if (DispCard.PropTechName) { TableColDefs.Add(Capsule.Create(FormalPresentationElement.__TechName.TechName.ToHtmlEncoded(), FormalPresentationElement.__TechName.Name.ToHtmlEncoded(), 30.0)); TableRowVals.Add(Source.TechName.ToHtmlEncoded()); } if (DispCard.PropPictogram && Source is IRecognizableElement) { var LocalPicture = this.CurrentWorker.AtOriginalThreadInvoke <ImageSource>( () => { var Picture = ((IRecognizableElement)Source).Pictogram; if (Picture == null) { if (Source is IdeaDefinition) { Picture = ((IdeaDefinition)Source).Pictogram; } else if (Source is Idea && ((Idea)Source).IdeaDefinitor.DefaultSymbolFormat.UseDefinitorPictogramAsNullDefault) { Picture = ((Idea)Source).IdeaDefinitor.Pictogram; } } if (Picture != null && !Picture.IsFrozen) { Picture.Freeze(); } return(Picture); }); if (LocalPicture != null) { var PictureRef = this.CreateImage(LocalPicture, Source, FormalPresentationElement.__Pictogram.TechName); TableColDefs.Add(Capsule.Create(FormalPresentationElement.__Pictogram.TechName.ToHtmlEncoded(), FormalPresentationElement.__Pictogram.Name.ToHtmlEncoded(), 40.0)); TableRowVals.Add("<img Alt='" + Source.Name.RemoveNewLines().ToHtmlEncoded() + "' Src='" + PictureRef + "' style='max-width:" + ReportConfiguration.PICTOGRAM_MAX_WIDTH.ToString() + "px; max-height:" + ReportConfiguration.PICTOGRAM_MAX_HEIGHT.ToString() + "px;' />"); /* This works on IE, but only if allowed by user (it says that 'IE has blocked execution of ActiveX or Script code')... * "width: expression(this.width > " + ReportConfiguration.PICTOGRAM_MAX_WIDTH.ToString() + " ? " + ReportConfiguration.PICTOGRAM_MAX_WIDTH.ToString() + ": true);" + * "height: expression(this.height > " + ReportConfiguration.PICTOGRAM_MAX_HEIGHT.ToString() + " ? " + ReportConfiguration.PICTOGRAM_MAX_HEIGHT.ToString() + ": true);' />"); */ } } this.PageWriteTable("tbl_card_props", TableRowVals.IntoEnumerable(), TableColDefs.ToArray()); // .......................................................... if (DispCard.PropSummary) { this.PageWriteTable("tbl_card_props", Source.Summary.ToHtmlEncoded().IntoEnumerable().IntoEnumerable(), Capsule.Create(FormalPresentationElement.__Summary.TechName.ToHtmlEncoded(), FormalPresentationElement.__Summary.Name.ToHtmlEncoded(), 100.0)); } // .......................................................... TableColDefs.Clear(); TableRowVals.Clear(); if (DispCard.Definitor && Source is Idea) { TableColDefs.Add(Capsule.Create("KindName", ((Idea)Source).BaseKind.Name.ToHtmlEncoded(), 30.0)); TableRowVals.Add(((Idea)Source).IdeaDefinitor.Name.ToHtmlEncoded()); } if (DispCard.PropGlobalId && Source is IUniqueElement) { TableColDefs.Add(Capsule.Create(UniqueElement.__GlobalId.TechName.ToHtmlEncoded(), UniqueElement.__GlobalId.Name.ToHtmlEncoded(), 30.0)); TableRowVals.Add(((IUniqueElement)Source).GlobalId.ToString().ToHtmlEncoded()); } if (DispCard.Definitor && Source is View) { TableColDefs.Add(Capsule.Create(View.__ClassDefinitor.TechName.ToHtmlEncoded(), View.__ClassDefinitor.Name.ToHtmlEncoded(), 30.0)); TableRowVals.Add(((Idea)Source).IdeaDefinitor.Name.ToHtmlEncoded()); } this.PageWriteTable("tbl_card_props", TableRowVals.IntoEnumerable(), TableColDefs.ToArray()); // .......................................................... if (DispCard.Route & Source is Idea) { this.PageWriteTable("tbl_card_props", ((Idea)Source).GetContainmentRoute().ToHtmlEncoded().IntoEnumerable().IntoEnumerable(), Capsule.Create("Route", "Route", 100.0)); } // .......................................................... if (DispCard.PropDescription && Source is IFormalizedElement) { var Element = (IFormalizedElement)Source; // Description if (!Element.Description.IsAbsent()) { var TextDocument = Display.XamlRichTextTo(Element.Description, DataFormats.Html); this.PageWriteTable("tbl_card_props", TextDocument.IntoEnumerable().IntoEnumerable(), Capsule.Create(FormalElement.__Description.TechName.ToHtmlEncoded(), FormalElement.__Description.Name.ToHtmlEncoded(), 100.0)); } // Classification (Pending) // Versioning if (Element.Version != null) { TableColDefs.Clear(); TableRowVals.Clear(); var VerInfo = new Grid(); VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.13, GridUnitType.Star) }); // Version Number VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.13, GridUnitType.Star) }); // Version Sequence VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.13, GridUnitType.Star) }); // Creation VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.24, GridUnitType.Star) }); // Creator VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.13, GridUnitType.Star) }); // Last Modification VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.24, GridUnitType.Star) }); // Last Modifier TableColDefs.Add(Capsule.Create(VersionCard.__VersionNumber.TechName.ToHtmlEncoded(), VersionCard.__VersionNumber.Name.ToHtmlEncoded(), 13.0)); TableRowVals.Add(Element.Version.VersionNumber.ToHtmlEncoded()); TableColDefs.Add(Capsule.Create(VersionCard.__VersionSequence.TechName.ToHtmlEncoded(), VersionCard.__VersionSequence.Name.ToHtmlEncoded(), 13.0)); TableRowVals.Add(Element.Version.VersionSequence.ToString()); TableColDefs.Add(Capsule.Create(VersionCard.__Creation.TechName.ToHtmlEncoded(), VersionCard.__Creation.Name.ToHtmlEncoded(), 13.0)); TableRowVals.Add(Element.Version.Creation.ToString().ToHtmlEncoded()); TableColDefs.Add(Capsule.Create(VersionCard.__Creator.TechName.ToHtmlEncoded(), VersionCard.__Creator.Name.ToHtmlEncoded(), 24.0)); TableRowVals.Add(Element.Version.Creator.ToHtmlEncoded()); TableColDefs.Add(Capsule.Create(VersionCard.__LastModification.TechName.ToHtmlEncoded(), VersionCard.__LastModification.Name.ToHtmlEncoded(), 13.0)); TableRowVals.Add(Element.Version.LastModification.ToString().ToHtmlEncoded()); TableColDefs.Add(Capsule.Create(VersionCard.__LastModifier.TechName.ToHtmlEncoded(), VersionCard.__LastModifier.Name.ToHtmlEncoded(), 24.0)); TableRowVals.Add(Element.Version.LastModifier.ToHtmlEncoded()); this.PageWriteTable("tbl_card_props", TableRowVals.IntoEnumerable(), TableColDefs.ToArray()); if (!Element.Version.Annotation.IsAbsent()) { this.PageWriteTable("tbl_card_props", Element.Version.Annotation.ToHtmlEncoded().IntoEnumerable().IntoEnumerable(), Capsule.Create(VersionCard.__Annotation.TechName.ToHtmlEncoded(), VersionCard.__Annotation.Name.ToHtmlEncoded(), 100.0)); } } } if (DispCard.PropTechSpec && Source is ITechSpecifier) { var Element = (ITechSpecifier)Source; if (!Element.TechSpec.IsAbsent()) { this.PageWriteTable("tbl_card_props", Element.TechSpec.ToHtmlEncoded().IntoEnumerable().IntoEnumerable(), Capsule.Create(FormalPresentationElement.__TechSpec.TechName.ToHtmlEncoded(), FormalPresentationElement.__TechSpec.Name.ToHtmlEncoded(), 100.0)); } } }
public void Backwards() { //Clean Up foreach (var DisplayCard in CardSlots) { DisplayCard.gameObject.SetActive(false); } //Queue Cards if necessary if (firstBackwards) { Queue.Clear(); //if (Log.Count <= 0) //{ // LevelManager.LoadMuseum(); //} foreach (var card in Log) { Queue.Insert(0, card); } if (Queue.Count % 2 == 1) { Queue.Add(dataBase.FailState); } firstBackwards = false; TwoChoice = true; Log.Clear(); } if (Queue.Count <= 0) { LevelManager.LoadMuseum(); } else { //Set Display Cards List <int> activeindex = new List <int>();//for Taint info bool BlockedOne = false; CardSlots[0].gameObject.SetActive(true); CardSlots[1].gameObject.SetActive(true); int i = 0; bool isTainted = false; foreach (var DisplayCard in CardSlots) { if (DisplayCard.gameObject.activeSelf) { if (Queue[0].Blocked) { if (BlockedOne) { DisplayCard.SetCard(dataBase.BlockedWayAround); break; } BlockedOne = true; } DisplayCard.SetCard(Queue[0]); if (Queue[0].Taint) { isTainted = true; } activeindex.Add(i); Queue.RemoveAt(0); } i++; } TwoChoice = true; if (isTainted) { Tainted(activeindex); } } }
// ----------------------------------------------------------------------------------------- public IList <FrameworkElement> CreateContentCard(IIdentifiableElement Source, DisplayCard DispCard) { var Result = new List <FrameworkElement>(); var BasicInfo = new DockPanel(); if (DispCard.PropName) { var Expositor = CreateContentCardPropertyExpositor(FormalPresentationElement.__Name.Name, Source.Name.RemoveNewLines(), this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); BasicInfo.Children.Add(Expositor); DockPanel.SetDock(Expositor, Dock.Top); } if (DispCard.PropTechName) { var Expositor = CreateContentCardPropertyExpositor(FormalPresentationElement.__TechName.Name, Source.TechName, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); BasicInfo.Children.Add(Expositor); DockPanel.SetDock(Expositor, Dock.Top); } if (DispCard.PropSummary) { var Expositor = CreateContentCardPropertyExpositor(FormalPresentationElement.__Summary.Name, Source.Summary, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); BasicInfo.Children.Add(Expositor); DockPanel.SetDock(Expositor, Dock.Top); } var MainInfo = new Grid(); var ColDef = new ColumnDefinition(); MainInfo.ColumnDefinitions.Add(ColDef); // new ColumnDefinition { Width = new GridLength(0.8, GridUnitType.Star) }); // MainInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.2, GridUnitType.Star) }); MainInfo.Children.Add(BasicInfo); Grid.SetColumn(BasicInfo, 0); if (DispCard.PropPictogram && Source is IRecognizableElement) { ColDef.Width = new GridLength(0.8, GridUnitType.Star); MainInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.2, GridUnitType.Star) }); var LocalPicture = this.CurrentWorker.AtOriginalThreadInvoke <ImageSource>( () => { var Picture = ((IRecognizableElement)Source).Pictogram; if (Picture == null) { if (Source is IdeaDefinition) { Picture = ((IdeaDefinition)Source).Pictogram; } else if (Source is Idea && ((Idea)Source).IdeaDefinitor.DefaultSymbolFormat.UseDefinitorPictogramAsNullDefault) { Picture = ((Idea)Source).IdeaDefinitor.Pictogram; } } if (Picture != null && !Picture.IsFrozen) { Picture.Freeze(); } return(Picture); }); var PictureExpositor = CreateContentCardPropertyExpositor(FormalPresentationElement.__Pictogram.Name, LocalPicture, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground, ReportConfiguration.PICTOGRAM_MAX_WIDTH, ReportConfiguration.PICTOGRAM_MAX_HEIGHT); MainInfo.Children.Add(PictureExpositor); Grid.SetColumn(PictureExpositor, 1); } // .......................................................... var IdInfo = new List <FrameworkElement>(); var DefinitorAndGlobalIdPanel = new DockPanel(); if (DispCard.PropGlobalId && Source is IUniqueElement) { var Expositor = CreateContentCardPropertyExpositor(UniqueElement.__GlobalId.Name, ((IUniqueElement)Source).GlobalId, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); DefinitorAndGlobalIdPanel.Children.Add(Expositor); DockPanel.SetDock(Expositor, Dock.Right); } if (DispCard.Definitor && Source is Idea) { var Expositor = CreateContentCardPropertyExpositor(((Idea)Source).BaseKind.Name, ((Idea)Source).IdeaDefinitor.Name, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); DefinitorAndGlobalIdPanel.Children.Add(Expositor); } if (DispCard.Definitor && Source is View) { var Expositor = CreateContentCardPropertyExpositor(View.__ClassDefinitor.Name, ((Idea)Source).IdeaDefinitor.Name, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); DefinitorAndGlobalIdPanel.Children.Add(Expositor); } if (DefinitorAndGlobalIdPanel.Children.Count > 0) { IdInfo.Add(DefinitorAndGlobalIdPanel); } if (DispCard.Route & Source is Idea) { var Route = ((Idea)Source).GetContainmentRoute(); var Expositor = CreateContentCardPropertyExpositor("Route", Route, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); IdInfo.Add(Expositor); } // .......................................................... var Extras = new List <FrameworkElement>(); if (DispCard.PropDescription && Source is IFormalizedElement) { var Element = (IFormalizedElement)Source; // Description if (!Element.Description.IsAbsent()) { var TextDocument = Display.XamlRichTextToFlowDocument(Element.Description); /*T var Range = new TextRange(TextDocument.ContentStart, TextDocument.ContentEnd); * var PlainText = Range.Text; */ var Expositor = CreateContentCardPropertyExpositor(FormalElement.__Description.Name, TextDocument, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); Extras.Add(Expositor); } // Classification (Pending) // Versioning if (Element.Version != null) { var VerPanel = new List <FrameworkElement>(); var VerInfo = new Grid(); VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.13, GridUnitType.Star) }); // Version Number VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.13, GridUnitType.Star) }); // Version Sequence VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.13, GridUnitType.Star) }); // Creation VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.24, GridUnitType.Star) }); // Creator VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.13, GridUnitType.Star) }); // Last Modification VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.24, GridUnitType.Star) }); // Last Modifier var Expositor = CreateContentCardPropertyExpositor(VersionCard.__VersionNumber.Name, Element.Version.VersionNumber, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); VerInfo.Children.Add(Expositor); Grid.SetColumn(Expositor, 0); Expositor = CreateContentCardPropertyExpositor(VersionCard.__VersionSequence.Name, Element.Version.VersionSequence, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); VerInfo.Children.Add(Expositor); Grid.SetColumn(Expositor, 1); Expositor = CreateContentCardPropertyExpositor(VersionCard.__Creation.Name, Element.Version.Creation, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); VerInfo.Children.Add(Expositor); Grid.SetColumn(Expositor, 2); Expositor = CreateContentCardPropertyExpositor(VersionCard.__Creator.Name, Element.Version.Creator, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); VerInfo.Children.Add(Expositor); Grid.SetColumn(Expositor, 3); Expositor = CreateContentCardPropertyExpositor(VersionCard.__LastModification.Name, Element.Version.LastModification, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); VerInfo.Children.Add(Expositor); Grid.SetColumn(Expositor, 4); Expositor = CreateContentCardPropertyExpositor(VersionCard.__LastModifier.Name, Element.Version.LastModifier, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); VerInfo.Children.Add(Expositor); Grid.SetColumn(Expositor, 5); VerPanel.Add(VerInfo); if (!Element.Version.Annotation.IsAbsent()) { Expositor = CreateContentCardPropertyExpositor(VersionCard.__Annotation.Name, Element.Version.Annotation, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); VerPanel.Add(Expositor); } Extras.AddRange(VerPanel); } } if (DispCard.PropTechSpec && Source is ITechSpecifier) { var Element = (ITechSpecifier)Source; if (!Element.TechSpec.IsAbsent()) { var Expositor = CreateContentCardPropertyExpositor(FormalPresentationElement.__TechSpec.Name, Element.TechSpec, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); Extras.Add(Expositor); } } // .......................................................... Result.Add(MainInfo); Result.AddRange(IdInfo); Result.AddRange(Extras); return(Result); }