public static CustomBasicList <int> GetPossiblePlayers(IGameInfo game) { int x; x = 0; CustomBasicList <int> tempList = new CustomBasicList <int>(); if (game.MinPlayers == 3) { tempList.Add(1); //because you would already have at least 2 players. } do { x += 1; if (x > game.MaxPlayers) { break; } if (x + 1 >= game.MinPlayers && x + 1 != game.NoPlayers) { tempList.Add(x); } }while (true); tempList.RemoveLastItem(); //i think return(tempList); }
public static CustomBasicList <int> NumberList(GameBoardProcesses gameBoard1) { CustomBasicList <int> output = new CustomBasicList <int>(); var thisList = gameBoard1.GetNumberList(); var newList = ComboList(thisList, gameBoard1); if (newList.Count == 0) { return(new CustomBasicList <int>()); } var thisCombo = newList.GetRandomItem(); if (thisCombo.Number1 == 0) { throw new BasicBlankException("The first number at least has to be filled out"); } if (gameBoard1.GetDiceTotal != (thisCombo.Number1 + thisCombo.Number2)) { throw new BasicBlankException("This was not even correct"); } output.Add(thisCombo.Number1); if (thisCombo.Number2 > 0) { output.Add(thisCombo.Number2); } return(output); }
private CustomBasicList <TrickCoordinate> GetCoordinateList() { if (_gameContainer.PlayerList.Count() != 2) { throw new BasicBlankException("This is a 2 player game."); } CustomBasicList <TrickCoordinate> output = new CustomBasicList <TrickCoordinate>(); int y = _gameContainer.SelfPlayer; int x; TrickCoordinate thisPlayer; for (x = 1; x <= 2; x++) { thisPlayer = new TrickCoordinate(); if (x == 1) { thisPlayer.IsSelf = true; thisPlayer.Column = 2; thisPlayer.Text = "Your Hand:"; // had to summarize so it works better for mobile. } else { thisPlayer.PossibleDummy = true; thisPlayer.Column = 1; thisPlayer.Text = "Your Bar:"; } thisPlayer.Row = 2; // i think thisPlayer.Player = y; output.Add(thisPlayer); } if (y == 1) { y = 2; } else { y = 1; } for (x = 1; x <= 2; x++) { thisPlayer = new TrickCoordinate(); thisPlayer.Row = 1; thisPlayer.Player = y; if (x == 1) { thisPlayer.Column = 2; thisPlayer.Text = "Opponent Hand:"; } else { thisPlayer.PossibleDummy = true; // forgot this part. thisPlayer.Text = "Opponent Bar:"; thisPlayer.Column = 1; } output.Add(thisPlayer); } return(output); }
public CustomBasicList <YahtzeeResults> GetResults(CustomBasicList <ComboCardInfo> combinationList, CustomBasicList <ICard> cardList) // 0 means no results found { CustomBasicList <YahtzeeResults> resultList = new CustomBasicList <YahtzeeResults>(); combinationList.ForEach(thisCombo => { _firstNumber = 0; _secondNumber = 0; var tempList = cardList.ToCustomBasicList(); if (thisCombo.FirstSet > 0 && thisCombo.SecondSet > 0) { if (HasFullHouse(tempList) == true) { if (_firstNumber == 0 || _secondNumber == 0) { throw new BasicBlankException("Must have a first and second number used"); } resultList.Add(new YahtzeeResults() { NumberUsed = _firstNumber + _secondNumber, Points = thisCombo.Points }); } } else if (thisCombo.FirstSet > 0) { if (HasKinds(tempList, thisCombo.FirstSet) == true) { if (_firstNumber == 0) { throw new Exception("Must have a number used for the kinds"); } resultList.Add(new YahtzeeResults() { NumberUsed = _firstNumber, Points = thisCombo.Points }); } } else if (thisCombo.NumberInStraight > 0) { if (HasStraight(tempList, thisCombo.NumberInStraight) == true) { resultList.Add(new YahtzeeResults() { NumberUsed = _firstNumber, Points = thisCombo.Points }); } } else { throw new Exception("Invalid Combo"); } }); resultList = (from items in resultList orderby items.Points descending, items.NumberUsed descending select items).ToCustomBasicList(); return(resultList); }
public void DrawBacks(SKCanvas canvas, SKRect rect_Card) { if (BackText == "") { throw new BasicBlankException("Must have the back text"); } var thisList = BackText.Split(" ").ToList(); if (thisList.Count > 2) { throw new Exception("Only 2 lines are supported currently"); } var thisFill = GetFillColor(); var thisPaint = GetSolidPaint(thisFill); DrawDefaultRectangles(canvas, rect_Card, thisPaint); SKPaint textPaint; CustomBasicList <SKRect> rectList = new CustomBasicList <SKRect>(); if (thisList.Count == 1) { rectList.Add(rect_Card); } else { SKRect firstRect; firstRect = SKRect.Create(8, 8, rect_Card.Width - 6, rect_Card.Height / 2.1f); var secondRect = SKRect.Create(8, rect_Card.Height / 2, rect_Card.Width - 6, rect_Card.Height / 2.1f); rectList.Add(firstRect); rectList.Add(secondRect); } if (rectList.Count != thisList.Count) { throw new BasicBlankException("Numbers Don't Match For Drawing Backs"); } int x = 0; foreach (var thisRect in rectList) { float fontSize; var ThisText = thisList[x]; if (ThisText.Length == 5) { fontSize = rect_Card.Height / 4.2f; } else { fontSize = rect_Card.Height / 3.6f; } textPaint = MiscHelpers.GetTextPaint(BackFontColor, fontSize); canvas.DrawBorderText(ThisText, TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _textBorder !, thisRect); x++; } }
public void DrawBacks(SKCanvas canvas, SKRect rect_Card) { canvas.DrawRect(rect_Card, _backPaint); CustomBasicList <SKRect> thisList = new CustomBasicList <SKRect>(); float fontSize; fontSize = rect_Card.Height / 3.2f; var textPaint = MiscHelpers.GetTextPaint(SKColors.Yellow, fontSize); var thisRect = SKRect.Create(2, 2, rect_Card.Width, rect_Card.Height / 3); thisList.Add(thisRect); thisRect = SKRect.Create(2, rect_Card.Height / 3, rect_Card.Width, rect_Card.Height / 3); thisList.Add(thisRect); thisRect = SKRect.Create(2, (rect_Card.Height / 3) * 2, rect_Card.Width, rect_Card.Height / 3); thisList.Add(thisRect); int x = 0; string thisText; foreach (var ThisRect in thisList) { x += 1; switch (x) { case 1: { thisText = "Hit"; break; } case 2: { thisText = "The"; break; } case 3: { thisText = "Deck"; break; } default: { throw new BasicBlankException("Only 3 lines"); } } canvas.DrawBorderText(thisText, TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _textBorder !, ThisRect); } }
//public static CustomBasicList<Button> ButtonList = new CustomBasicList<Button>(); private static void GetLayoutChildren(Layout <View> layout) { foreach (var child in layout.Children) { if (child is Layout <View> view) { _controls.Add(child); //i think has to add this one too. otherwise, won't show any grids. we need that too. GetChildren(view); } else { _controls.Add(child); } } }
public static CustomBasicList <CustomBasicList <int> > CheckScores(int howManyExist, int howManyNeeded) { if (howManyNeeded > howManyExist) { return(new CustomBasicList <CustomBasicList <int> >()); } object[] mySet; CustomBasicList <CustomBasicList <int> > arr_Return = new CustomBasicList <CustomBasicList <int> >(); mySet = new object[howManyExist - 1 + 1]; var loopTo = howManyExist - 1; for (int i = 0; i <= loopTo; i++) { mySet[i] = i + 1; } // Get the unique combinations of numbers. CustomBasicList <CustomBasicList <object> > mySubsets = GetSubsets(mySet, howManyNeeded); Sort(mySubsets); foreach (CustomBasicList <object> i in mySubsets) { CustomBasicList <int> arr_Sample = new CustomBasicList <int>(); foreach (int j in i) { arr_Sample.Add(j); } arr_Return.Add(arr_Sample); } return(arr_Return); }
public CustomBasicList <CustomBasicList <D> > RollDice(int howManySections = 6) { if (DiceList.Count() != HowManyDice) { RedoList(); } CustomBasicList <CustomBasicList <D> > output = new CustomBasicList <CustomBasicList <D> >(); AsyncDelayer.SetDelayer(this, ref _delay !); //try both places. IGenerateDice <int> ThisG = MainContainer !.Resolve <IGenerateDice <int> >(); CustomBasicList <int> possList = ThisG.GetPossibleList; possList.MainContainer = MainContainer; D tempDice; int chosen; howManySections.Times(() => { CustomBasicList <D> firsts = new CustomBasicList <D>(); for (int i = 0; i < HowManyDice; i++) { tempDice = DiceList[i]; if (tempDice.Hold == false) //its uncommon enough that has to be different for different types of dice games. { chosen = possList.GetRandomItem(); tempDice = new D(); tempDice.Index = i + 1; //i think tempDice.Populate(chosen); //so they can do what they need to. } firsts.Add(tempDice); } output.Add(firsts); }); return(output); }
protected virtual void ReplaceGame() { //return; _ = MainContainer.ReplaceObject <IViewModelData>(); //this has to be replaced before the game obviously. Assembly assembly = Assembly.GetAssembly(GetType()) !; CustomBasicList <Type> thisList = assembly.GetTypes().Where(items => items.HasAttribute <AutoResetAttribute>()).ToCustomBasicList(); thisList.AddRange(GetAdditionalObjectsToReset()); ClearSubscriptions(); Type?type = MainContainer.LookUpType <IStandardRollProcesses>(); if (type != null) { thisList.Add(type); //hopefully this simple. this allows more parts to be able to be added without a new class //useful for dice games. } //attempt to also unsubscribe to all as well. //could do delegates. however, if not set, then won't do. if (MiscDelegates.GetMiscObjectsToReplace != null) { thisList.AddRange(MiscDelegates.GetMiscObjectsToReplace.Invoke()); } MainContainer.ResetSeveralObjects(thisList); _mainGame = MainContainer.ReplaceObject <IBasicGameProcesses <P> >(); //hopefully this works }
async Task IEverybodyOneProcesses.EverybodyGetsOneAsync(CustomBasicList <int> thisList, int selectedIndex) { if (_gameContainer.SingleInfo !.CanSendMessage(_gameContainer.BasicData !)) { CustomBasicList <int> sendList = new CustomBasicList <int>(); sendList.AddRange(thisList); sendList.Add(selectedIndex); await _gameContainer.Network !.SendAllAsync("everybodygetsone", sendList); } int player = _actionContainer.GetPlayerIndex(selectedIndex); var newList = thisList.Select(items => new PreviousCard { Deck = items, Player = player }).ToCustomBasicList(); _gameContainer !.EverybodyGetsOneList.AddRange(newList); int oldCount = _gameContainer.TempActionHandList.Count; _gameContainer.TempActionHandList.RemoveGivenList(thisList, System.Collections.Specialized.NotifyCollectionChangedAction.Remove); _actionContainer.SetUpGoals(); if (_gameContainer.TempActionHandList.Count == oldCount) { throw new BasicBlankException("Did not remove from temphand"); } if (_gameContainer.CanLoadEverybodyGetsOne() == false) { await LastCardsForEverybodyGetsOneAsync(); return; } await _processes.AnalyzeQueAsync(); }
private CustomBasicList <string> _arr_Pegs = new CustomBasicList <string>(); // needs to be gcolor because of autoresume public void AddPeg(string pegColor) { if (_arr_Pegs.Count < 6) { _arr_Pegs.Add(pegColor); } }
void ILoadActionProcesses.LoadEverybodyGetsOne() { _actionContainer.ActionCategory = EnumActionCategory.Everybody1; _basicActionLogic.LoadTempCards(); if (_gameContainer.EverybodyGetsOneList.Count == 0) { _basicActionLogic.LoadPlayers(true); return; } var tempLists = _gameContainer.PlayersLeftForEverybodyGetsOne(); if (tempLists.Count < 2) { throw new BasicBlankException("Cannot load everybody gets one because less than 2 players"); } _actionContainer.PlayerIndexList.Clear(); if (_gameContainer.IncreaseAmount() == 1) { _actionContainer.TempHand !.AutoSelect = HandObservable <FluxxCardInformation> .EnumAutoType.SelectAsMany; } _actionContainer.IndexPlayer = -1; CustomBasicList <string> firstList = new CustomBasicList <string>(); tempLists.ForEach(thisPlayer => { _actionContainer.PlayerIndexList.Add(thisPlayer.Id); firstList.Add($"{thisPlayer.NickName}, {thisPlayer.MainHandList.Count} cards in hand, {thisPlayer.Id}"); }); _actionContainer.Player1 !.LoadTextList(firstList); }
public static CustomBasicList <string> GetSalaryList(this CustomBasicList <LifeBoardGamePlayerItem> tempList) { CustomBasicList <string> output = new CustomBasicList <string>(); tempList.ForConditionalItems(items => items.Salary > 0, thisPlayer => output.Add(thisPlayer.NickName)); return(output); }
private void SetUpTeamPiles() { _mainGame !.SingleInfo = _mainGame.PlayerList !.GetSelf(); if (_mainGame.SingleInfo.MainHandList.Any(items => items.CompleteCategory == EnumCompleteCategories.None)) { throw new BasicBlankException("Cannot have category of none. Rethink"); } _pileGrid !.Children.Clear(); int x = 0; _gameContainer.TeamList.ForEach(thisTeam => { x++; Grid tempGrid = new Grid(); tempGrid.Margin = new Thickness(0, 0, 0, 5); Label ThisLabel = new Label(); if (ScreenUsed == EnumScreen.SmallPhone) { ThisLabel.FontSize = 8; AddPixelRow(tempGrid, 12); AddPixelRow(tempGrid, 68); } else { AddAutoRows(tempGrid, 1); AddLeftOverRow(tempGrid, 1); if (ScreenUsed == EnumScreen.SmallTablet) { ThisLabel.FontSize = 12; } else { ThisLabel.FontSize = 20; } } AddAutoColumns(tempGrid, 2); ThisLabel.Text = thisTeam.Text; ThisLabel.TextColor = Color.Aqua; ThisLabel.FontAttributes = FontAttributes.Bold; AddControlToGrid(tempGrid, ThisLabel, 0, 0); ThisLabel.HorizontalOptions = LayoutOptions.Center; // try this BasicMultiplePilesXF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsXF> thisDis = new BasicMultiplePilesXF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsXF>(); thisDis.Init(thisTeam.CardPiles, ""); thisDis.StartAnimationListener("team" + thisTeam.TeamNumber); AddControlToGrid(tempGrid, thisDis, 1, 0); SafetiesXF thisS = new SafetiesXF(); thisS.Init(thisTeam, _mainGame, _gameContainer.Command); _disList.Add(thisDis); if (x == 1) { AddControlToGrid(tempGrid, thisS, 0, 1); Grid.SetRowSpan(thisS, 2); } else { AddControlToGrid(tempGrid, thisS, 1, 1); } AddControlToGrid(_pileGrid, tempGrid, x - 1, 0); }); }
private void SetUpTeamPiles() { _mainGame !.SingleInfo = _gameContainer.PlayerList !.GetSelf(); if (_gameContainer.SingleInfo !.MainHandList.Any(items => items.CompleteCategory == EnumCompleteCategories.None)) { throw new BasicBlankException("Cannot have category of none. Rethink"); } _pileStack !.Children.Clear(); _gameContainer.TeamList.ForEach(thisTeam => { Grid tempGrid = new Grid(); tempGrid.Margin = new Thickness(0, 0, 0, 20); AddAutoRows(tempGrid, 2); AddAutoColumns(tempGrid, 2); TextBlock ThisLabel = new TextBlock(); ThisLabel.Text = thisTeam.Text; ThisLabel.Foreground = Brushes.Aqua; ThisLabel.FontWeight = FontWeights.Bold; AddControlToGrid(tempGrid, ThisLabel, 0, 0); Grid.SetColumnSpan(ThisLabel, 2); ThisLabel.HorizontalAlignment = HorizontalAlignment.Center; // try this BasicMultiplePilesWPF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsWPF> thisDis = new BasicMultiplePilesWPF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsWPF>(); thisDis.Init(thisTeam.CardPiles, ""); thisDis.StartAnimationListener("team" + thisTeam.TeamNumber); AddControlToGrid(tempGrid, thisDis, 1, 0); SafetiesWPF thisS = new SafetiesWPF(); thisS.Init(thisTeam, _mainGame, _gameContainer.Command); _disList.Add(thisDis); AddControlToGrid(tempGrid, thisS, 1, 1); _pileStack.Children.Add(tempGrid); }); }
public async Task PopulateBidAmountsAsync() { var nextPlayer = await _gameContainer.PlayerList !.CalculateWhoTurnAsync(true); int nonNumber = -1; if (nextPlayer == _gameContainer.WhoStarts) { var total = _gameContainer.PlayerList.Where(items => items.BidAmount > -1).Sum(items => items.BidAmount); if (total > 8) { nonNumber = -1; } else { nonNumber = 8 - total; } } int x; CustomBasicList <int> tempList = new CustomBasicList <int>(); for (x = 0; x <= 8; x++) { if (x != nonNumber) { tempList.Add(x); } } _model !.Bid1 !.UnselectAll(); _model.BidChosen = -1; _model.Bid1.LoadNumberList(tempList); await _gameContainer.ContinueTurnAsync !.Invoke(); }
private CustomBasicList <ComputerData> ValidMoveList() { CustomBasicList <ComputerData> thisList = new CustomBasicList <ComputerData>(); ComputerData thisComputer; int x; if (_gameContainer.IsValidMove == null) { throw new BasicBlankException("Nobody is handling the isvalidmove. Rethink"); } foreach (var tempCard in _gameContainer.SingleInfo !.MainHandList) { for (x = 1; x <= 4; x++) { if (_gameContainer.IsValidMove(x - 1, tempCard.Deck) == true) { thisComputer = new ComputerData(); thisComputer.ThisCard = tempCard; // i think needs to be this way. thisComputer.Pile = x - 1; thisComputer.Discard = -1; thisComputer.WhichType = EnumCardType.MyCards; thisList.Add(thisComputer); } } } SkipboCardInformation thisCard; int y; var thisDiscard = _model.DiscardPiles; DeckObservableDict <SkipboCardInformation> cardList; for (x = 1; x <= 4; x++) { cardList = thisDiscard !.PileList ![x - 1].ObjectList;
public void LoadCharacters(CustomBasicList <int> newCol) { var output = new CustomBasicList <EnumNameList>(); newCol.ForEach(thisItem => output.Add(thisItem.ToEnum <EnumNameList>())); LoadCharacters(output); }
async Task IPlaylistSongMainLogic.CreatePlaylistSongsAsync() { if (_ras == null) { throw new BasicBlankException("Never created random function for creating playlist songs. Rethink"); } if (_playlistId == null) { throw new BasicBlankException("Never created playlist id. Rethink"); } var list = await _ras.GetRandomListAsync(); var newList = new CustomBasicList <IPlayListSong>(); list.ForEach(song => { IPlayListSong fins = Resolve <IPlayListSong>(); if (fins.ID != 0) { throw new BasicBlankException("Did not use new object"); } fins.SongNumber = list.IndexOf(song) + 1; fins.PlayList = _playlistId.Value; fins.SongID = song.ID; newList.Add(fins); }); await _data.AddSeveralPlayListSongsAsync(newList); }
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 void LoadBoard() { var thisList = _gameContainer !.PlayerList !.GetAllPlayersStartingWithSelf(); StackPanel tempStack = new StackPanel(); tempStack.Orientation = Orientation.Horizontal; _boardStack !.Children.Clear(); _boardStack.Children.Add(tempStack); int x = 0; thisList.ForEach(thisPlayer => { x++; var thisControl = new BoardWPF(); thisControl.LoadList(thisPlayer, _gameContainer.Command); _boardList.Add(thisControl); if (x == 3) { tempStack = new StackPanel(); tempStack.Orientation = Orientation.Horizontal; _boardStack.Children.Add(tempStack); } tempStack.Children.Add(thisControl); }); }
private CustomBasicList <TextBlock> GetSeveralTextBoxes <P>(P thisPlayer) where P : class, IPlayerItem, new() { CustomBasicList <TextBlock> thisList = new CustomBasicList <TextBlock>(); foreach (var firstItem in _mainGrid !.Children) { TextBlock thisText = (TextBlock)firstItem !; if (Grid.GetRow(thisText) > 0) { P tempPLayer = (P)thisText.DataContext; if (tempPLayer.Id == thisPlayer.Id) { thisList.Add(thisText); } } } if (thisList.Count == 0) { throw new BasicBlankException($"Could not find any textboxes for player {thisPlayer.NickName}"); } if (thisList.Count != _rowList !.Count) { throw new BasicBlankException($"Textboxes don't reconcile. Found {thisList.Count} but needed {_rowList.Count}"); } return(thisList); }
public void FirstLoad() { 10.Times(() => { DiceList.Add(new SingleDiceInfo()); }); }
public static CustomBasicList <CustomBasicList <RegularSimpleCard> > PossibleCombinations(this IDeckDict <RegularSimpleCard> thisList, EnumColorList whatColor, int maxs) { if (maxs < 3 && whatColor == EnumColorList.Red) { throw new BasicBlankException("Attack must allow 3 cards for combinations"); } int mins; if (whatColor == EnumColorList.Red) { mins = 2; } else { mins = 1; } int x; CustomBasicList <int> firstList = new CustomBasicList <int>(); var loopTo = maxs; for (x = mins; x <= loopTo; x++) { firstList.Add(x); } var newList = thisList.Where(items => items.Color == whatColor).ToCustomBasicList(); CustomBasicList <CustomBasicList <RegularSimpleCard> > fullList = new CustomBasicList <CustomBasicList <RegularSimpleCard> >(); firstList.ForEach(y => { var thisCombo = newList.GetCombinations(y); fullList.AddRange(thisCombo); }); return(fullList); //looks like has to return a standard list for this one. }
public CustomBasicList <CustomBasicList <bool> > RollDice(int howManySections = 7) { if (DiceList.Count == 0) { throw new BasicBlankException("There are no dice to even roll. Try FirstLoad"); } int counts = DiceList.Count(Items => Items.Value == false); CustomBasicList <CustomBasicList <bool> > output = new CustomBasicList <CustomBasicList <bool> >(); AsyncDelayer.SetDelayer(this, ref _delay !); IDiceContainer <bool> thisG = MainContainer !.Resolve <IDiceContainer <bool> >(); thisG.MainContainer = MainContainer; CustomBasicList <bool> possList = thisG.GetPossibleList; howManySections.Times(() => { CustomBasicList <bool> firsts = new CustomBasicList <bool>(); counts.Times(() => { firsts.Add(possList.GetRandomItem()); }); output.Add(firsts); }); return(output); }
public void LoadTextList(CustomBasicList <string> thisList) { if (IndexMethod == EnumIndexMethod.Unknown) { throw new BasicBlankException("Must know the index method in order to continue"); } CustomBasicList <ListViewPieceCP> TempList = new CustomBasicList <ListViewPieceCP>(); int x; if (IndexMethod == EnumIndexMethod.OneBased) { x = 1; } else { x = 0; } foreach (var firstText in thisList) { ListViewPieceCP newText = new ListViewPieceCP(); newText.Index = x; newText.DisplayText = firstText; TempList.Add(newText); x += 1; } TextList.ReplaceRange(TempList); }
public void LoadList(SorryCardGamePlayerItem tempPlayer, CommandContainer command) { _thisPlayer = tempPlayer; StackPanel thisStack = new StackPanel(); thisStack.Orientation = Orientation.Horizontal; _clickCommand = tempPlayer.GetPlainCommand(command, nameof(SorryCardGamePlayerItem.SorryPlayerAsync)); //not just player anymore. _thisList = new CustomBasicList <CardGraphicsWPF>(); for (int x = 1; x <= 4; x++) { var thisCard = new CardGraphicsWPF(); _thisList.Add(thisCard); thisCard.SendSize("", new SorryCardGameCardInformation()); thisCard.DataContext = null; thisStack.Children.Add(thisCard); } Text = _thisPlayer.NickName; DataContext = _thisPlayer; var thisRect = ThisFrame.GetControlArea(); thisStack.Margin = new Thickness(thisRect.Left + 3, thisRect.Top + 10, 3, 3); var thisGrid = new Grid(); thisGrid.Children.Add(ThisDraw); thisGrid.Children.Add(thisStack); Content = thisGrid; _clickCommand !.CanExecuteChanged += ClickCommandChange; MouseUp += BoardWPF_MouseUp; _thisPlayer.PropertyChanged += ThisPlayerPropertyChange; RefreshList(); }
public CustomBasicList <CheckersChessVector> GetValidMoves() { CustomBasicList <CheckersChessVector> possibleList = new CustomBasicList <CheckersChessVector> { new CheckersChessVector(Row + 1, Column + 1), new CheckersChessVector(Row - 1, Column - 1), new CheckersChessVector(Row + 1, Column), new CheckersChessVector(Row - 1, Column), new CheckersChessVector(Row, Column + 1), new CheckersChessVector(Row, Column - 1), new CheckersChessVector(Row - 1, Column + 1), new CheckersChessVector(Row + 1, Column - 1) }; CustomBasicList <CheckersChessVector> finalList = new CustomBasicList <CheckersChessVector>(); SpaceCP?c; foreach (var thisPos in possibleList) { c = GameBoardGraphicsCP.GetSpace(thisPos.Row, thisPos.Column); if (c != null) { if (c.PlayerOwns != Player) { // can't be yourself period. finalList.Add(thisPos); } } } return(finalList); }
public CustomBasicList <CheckersChessVector> GetValidMoves() { CustomBasicList <CheckersChessVector> possibleList = new CustomBasicList <CheckersChessVector> { new CheckersChessVector(Row + 1, Column + 2), new CheckersChessVector(Row - 1, Column + 2), new CheckersChessVector(Row + 1, Column - 2), new CheckersChessVector(Row - 1, Column - 2), new CheckersChessVector(Row + 2, Column + 1), new CheckersChessVector(Row - 2, Column + 1), new CheckersChessVector(Row + 2, Column - 1), new CheckersChessVector(Row - 2, Column - 1) }; CustomBasicList <CheckersChessVector> output = new CustomBasicList <CheckersChessVector>(); SpaceCP?c; foreach (var possible in possibleList) { c = GameBoardGraphicsCP.GetSpace(possible.Row, possible.Column); if (c != null) { if (c.PlayerOwns == 0 || c.PlayerOwns != Player) { output.Add(possible); } } } return(output); }