public void LoadList(PlayerBoardObservable <TR> thisMod) { _thisMod = thisMod; _cardList = thisMod.CardList; _cardList.CollectionChanged += CardList_CollectionChanged; if (thisMod.Game == PlayerBoardObservable <TR> .EnumGameList.None) { throw new BasicBlankException("Must choose Skuck or Horseshoes"); } if (_cardList.Count == 0) { throw new BasicBlankException("Must have cardlist already"); } _thisGrid = new Grid(); GamePackageDIContainer thisC = Resolve <GamePackageDIContainer>(); IProportionImage thisImage = thisC.Resolve <IProportionImage>(ts.TagUsed); SKSize thisSize = _cardList.First().DefaultSize; SKSize usedSize = thisSize.GetSizeUsed(thisImage.Proportion); var pixels = usedSize.Height / 2; int x; var loopTo = _cardList.Count; for (x = 1; x <= loopTo; x++) { GridHelper.AddPixelRow(_thisGrid, (int)pixels); } GridHelper.AddPixelRow(_thisGrid, (int)pixels); pixels = usedSize.Width + 6; for (x = 1; x <= 4; x++) { GridHelper.AddPixelColumn(_thisGrid, (int)pixels); } PopulateControls(); Content = _thisGrid; }
Task IHandleAsync <LoadEventModel> .HandleAsync(LoadEventModel message) { GamePackageViewModelBinder.ManuelElements.Clear(); //often times i have to add manually. SixtySix2PlayerSaveInfo save = cons !.Resolve <SixtySix2PlayerSaveInfo>(); //usually needs this part for multiplayer games. _score !.LoadLists(save.PlayerList); _playerHandWPF !.LoadList(_model.PlayerHand1 !, ts.TagUsed); // i think _discardGPile !.Init(_model.Pile1 !, ts.TagUsed); // may have to be here (well see) _discardGPile.StartListeningDiscardPile(); // its the main one. _deckGPile !.Init(_model.Deck1 !, ts.TagUsed); // try here. may have to do something else as well (?) _deckGPile.StartListeningMainDeck(); _trick1 !.Init(_model.TrickArea1 !, ts.TagUsed); _guide1.LoadList(_model); _marriage1 !.LoadList(_model.Marriage1 !, ts.TagUsed); var thisCard = new SixtySix2PlayerCardInformation(); IProportionImage thisP = _resolver.Resolve <IProportionImage>(ts.TagUsed); SKSize thisSize = thisCard.DefaultSize.GetSizeUsed(thisP.Proportion); var heights = thisSize.Height / 1.5f; _deckGPile.Margin = new Thickness(6, heights * -1, 0, 0); _deckStack !.Children.Add(_deckGPile); return(this.RefreshBindingsAsync(_aggregator)); }
public void SendDiceInfo(IStandardDice thisDice) //it did send dice { IGamePackageResolver thisR = (IGamePackageResolver)cons !; IProportionImage thisP = thisR.Resolve <IProportionImage>(GetDiceTag); _mains = new StandardDiceGraphicsCP(this); _mains.OriginalHeightWidth = thisDice.HeightWidth; HorizontalOptions = LayoutOptions.Start; VerticalOptions = LayoutOptions.Start; SetBinding(DiceStyleProperty, new Binding(nameof(IStandardDice.Style))); SetBinding(DotColorProperty, new Binding(nameof(IStandardDice.DotColor))); SetBinding(DiceValueProperty, new Binding(nameof(IStandardDice.Value))); SetBinding(FillColorProperty, new Binding(nameof(IStandardDice.FillColor))); SetBinding(HoldProperty, new Binding(nameof(IStandardDice.Hold))); SetBinding(IsSelectedProperty, new Binding(nameof(IStandardDice.IsSelected))); //maybe i forgot this too. BindingContext = thisDice; SKSize tempSize = new SKSize(thisDice.HeightWidth, thisDice.HeightWidth); DiceSize = tempSize.GetSizeUsed(thisP.Proportion); HeightRequest = DiceSize.Height; WidthRequest = DiceSize.Width; _thisDraw.HeightRequest = DiceSize.Height; _thisDraw.WidthRequest = DiceSize.Width; Init(); }
public void LoadList(DominosRegularVMData model, IGamePackageResolver resolver) { _model = model; IProportionImage thisP = resolver.Resolve <IProportionImage>(ts.TagUsed); Text = "Display"; _thisGrid = new Grid(); Grid finalGrid = new Grid(); _dominoList = _model.GameBoard1 !.DominoList; _dominoList.CollectionChanged += DominoCollectionChange; if (_dominoList.Count != 3) { throw new BasicBlankException("Only 3 dominos are supported"); } if (_dominoList.First().DefaultSize.Width == 0) { throw new BasicBlankException("The width can never be 0 for dominos"); } SKSize thisSize = _dominoList.First().DefaultSize.GetSizeUsed(thisP.Proportion); int pixels = (int)thisSize.Width / 2; for (int x = 0; x < 4; x++) { AddPixelColumn(_thisGrid, pixels); } RepopulateList(); SetUpMarginsOnParentControl(_thisGrid); finalGrid.Children.Add(ThisDraw); finalGrid.Children.Add(_thisGrid); Content = finalGrid; }
public TriangleObservable(ITriangleVM thisMod, CommandContainer command, IGamePackageResolver resolver, int maxColumnsRows) { _thisMod = thisMod; _maxRowsColumns = maxColumnsRows; _thisP = resolver.Resolve <IProportionImage>(ts.TagUsed); MethodInfo method = this.GetPrivateMethod(nameof(PrivateCardClickAsync)); MethodInfo fun = this.GetPrivateMethod(nameof(CanClickCard)); CardCommand = new PlainCommand(this, method, fun, command); LoadBoard(); }
public ScatteringPiecesObservable(CommandContainer command, IGamePackageResolver resolver) : base(command) { //Visible = true; // the old did not have this. will always be true here. _thisI = resolver.Resolve <IProportionImage>(TagUsed); _rs = resolver.Resolve <RandomGenerator>(); _thisE = resolver.Resolve <EventAggregator>(); MethodInfo method = this.GetPrivateMethod(nameof(PrivateClickItemAsync)); ObjectCommand = new ControlCommand(this, method, command); method = this.GetPrivateMethod(nameof(PrivateBoardClickAsync)); BoardCommand = new ControlCommand(this, method, command); }
public MahJongSolitaireGameBoardCP(MahJongSolitaireSaveInfo saveRoot, BaseMahjongGlobals customGlobal , MahJongSolitaireModGlobal mainGlobal, IProportionImage thisP, BasicData data) { _saveRoot = saveRoot; //if this causes too many problems, has to resolve later. _customGlobal = customGlobal; _mainGlobal = mainGlobal; _data = data; _sizeUsed = MahjongSolitaireTileInfo.GetDefaultSize().GetSizeUsed(thisP.Proportion); if (saveRoot.BoardList.Count > 0) { throw new BasicBlankException("The saveroot should have cleared out every game. Rethink"); } FirstLoad(); }
public void Init(TriangleObservable thisMod) { SolitaireCard card = new SolitaireCard(); GamePackageDIContainer tt = Resolve <GamePackageDIContainer>(); IProportionImage pp = tt.Resolve <IProportionImage>(ts.TagUsed); _size = card.DefaultSize.GetSizeUsed(pp.Proportion); _thisMod = thisMod; _cardList = thisMod.CardList; _cardList.CollectionChanged += CollectionChange; _thisCanvas = new AbsoluteLayout(); _thisMod.PositionUI = this; PopulateCards(); Content = _thisCanvas; }
public void LoadControls(ClockObservable thisMod) { _thisMod = thisMod; _thisCanvas = new AbsoluteLayout(); thisMod.PositionUI = this; Content = _thisCanvas; SolitaireCard card = new SolitaireCard(); GamePackageDIContainer tt = Resolve <GamePackageDIContainer>(); IProportionImage pp = tt.Resolve <IProportionImage>(ts.TagUsed); _size = card.DefaultSize.GetSizeUsed(pp.Proportion); if (_thisMod.ClockList != null && _thisMod.ClockList.Count > 0) { PrivateReposition(); } }
public void LoadList(GameBoardObservable <CA> mod, string tagUsed) { _tagUsed = tagUsed; _thisMod = mod; BindingContext = _thisMod; _objectList = _thisMod.ObjectList; _objectList.CollectionChanged += ObjectList_CollectionChanged; Grid firstGrid = new Grid(); if (_thisMod.HasFrame == true) { firstGrid.Children.Add(ThisDraw); } _mainGrid = new Grid(); _mainGrid.ColumnSpacing = 0; _mainGrid.RowSpacing = 0; firstGrid.Children.Add(_mainGrid); var firstCard = new CA(); // for size if (firstCard.DefaultSize.Height == 0 || firstCard.DefaultSize.Width == 0) { throw new BasicBlankException("The width and height must be greater than 0 when initializging hand wpf"); } IGamePackageResolver thisR = (IGamePackageResolver)cons !; IProportionImage thisI = thisR.Resolve <IProportionImage>(tagUsed); _sizeUsed = firstCard.DefaultSize.GetSizeUsed(thisI.Proportion); SetBinding(TextProperty, new Binding(nameof(GameBoardObservable <CA> .Text))); SetBinding(IsEnabledProperty, new Binding(nameof(GameBoardObservable <CA> .IsEnabled))); SetBinding(IsVisibleProperty, new Binding(nameof(GameBoardObservable <CA> .Visible))); SetUpGrid(); var tempWidth = _sizeUsed.Width * _thisMod.Columns; var tempHeight = _sizeUsed.Height * _thisMod.Rows; if (_thisMod.HasFrame == true) { SetUpMarginsOnParentControl(_mainGrid); } float tops = (float)_mainGrid.Margin.Top + (float)_mainGrid.Margin.Bottom; float lefts = (float)_mainGrid.Margin.Left + (float)_mainGrid.Margin.Right; HeightRequest = tempHeight + tops; WidthRequest = tempWidth + lefts; PopulateList(); Content = firstGrid; }
public static string GetDiceTag => "StandardDice"; //same as other dice. public void SendDiceInfo(Multiplier thisDice) //it did send dice { IGamePackageResolver thisR = (IGamePackageResolver)cons !; IProportionImage thisP = thisR.Resolve <IProportionImage>(GetDiceTag); _mains = new ButtonDiceGraphicsCP(); _mains.PaintUI = this; _mains.MinimumWidthHeight = thisDice.HeightWidth; SetBinding(TextProperty, nameof(Multiplier.Value)); SKSize tempSize = new SKSize(thisDice.HeightWidth, thisDice.HeightWidth); DiceSize = tempSize.GetSizeUsed(thisP.Proportion); Height = DiceSize.Height; Width = DiceSize.Width; DataContext = thisDice; Init(); }
public void Init(XactikaVMData thisMod, IGamePackageResolver resolver) { SKSize firstSize = new SKSize(60, 138); IProportionImage thisP = resolver.Resolve <IProportionImage>(""); _sizeUsed = firstSize.GetSizeUsed(thisP.Proportion); _tempMod = thisMod.ShapeChoose1; _shapeList = _tempMod !.PieceList; Margin = new Thickness(10, 10, 10, 10); BindingContext = _tempMod; // i think var thisBind = new Binding(nameof(ChooseShapeObservable.Visible)); SetBinding(IsVisibleProperty, thisBind); // i think _thisStack = new StackLayout(); _thisStack.Orientation = StackOrientation.Horizontal; // for this time, must be horizontal. _shapeList.CollectionChanged += ShapeList_CollectionChanged; Content = _thisStack; PopulateList(); }
public void SendDiceInfo(CategoriesDice thisDice, ThinkTwiceGameContainer gameContainer) //it did send dice { _gameContainer = gameContainer; IGamePackageResolver thisR = (IGamePackageResolver)cons !; IProportionImage thisP = thisR.Resolve <IProportionImage>(GetDiceTag); _mains = new ButtonDiceGraphicsCP(); _mains.PaintUI = this; _mains.MinimumWidthHeight = thisDice.HeightWidth; SetBinding(TextProperty, new Binding(nameof(CategoriesDice.Value))); SetBinding(HoldProperty, new Binding(nameof(CategoriesDice.Hold))); SetBinding(IsVisibleProperty, new Binding(nameof(CategoriesDice.Visible))); SKSize tempSize = new SKSize(thisDice.HeightWidth, thisDice.HeightWidth); DiceSize = tempSize.GetSizeUsed(thisP.Proportion * 1.3f); HeightRequest = DiceSize.Height; WidthRequest = DiceSize.Width; BindingContext = thisDice; Init(); }
public static string GetDiceTag => "StandardDice"; //same as other dice. //private ICommand? Command; public void SendDiceInfo(CategoriesDice thisDice, ThinkTwiceGameContainer gameContainer) //it did send dice { IGamePackageResolver thisR = (IGamePackageResolver)cons !; IProportionImage thisP = thisR.Resolve <IProportionImage>(GetDiceTag); _gameContainer = gameContainer; _mains = new ButtonDiceGraphicsCP(); _mains.PaintUI = this; _mains.MinimumWidthHeight = thisDice.HeightWidth; SetBinding(TextProperty, nameof(CategoriesDice.Value)); SetBinding(HoldProperty, nameof(CategoriesDice.Hold)); SetBinding(VisibilityProperty, GetVisibleBinding(nameof(CategoriesDice.Visible))); SKSize TempSize = new SKSize(thisDice.HeightWidth, thisDice.HeightWidth); DiceSize = TempSize.GetSizeUsed(thisP.Proportion); //Command = thisDice.CategoryClickCommand!; Height = DiceSize.Height; Width = DiceSize.Width; DataContext = thisDice; Init(); }
public void LoadList(GameBoardObservable <CA> mod, string tagUsed) { _tagUsed = tagUsed; _thisMod = mod; DataContext = _thisMod; _objectList = _thisMod.ObjectList; _objectList.CollectionChanged += ObjectList_CollectionChanged; Grid firstGrid = new Grid(); if (_thisMod.HasFrame == true) { firstGrid.Children.Add(ThisDraw); } _mainGrid = new Grid(); firstGrid.Children.Add(_mainGrid); var firstCard = new CA(); // for size if (firstCard.DefaultSize.Height == 0 || firstCard.DefaultSize.Width == 0) { throw new BasicBlankException("The width and height must be greater than 0 when initializging hand wpf"); } IGamePackageResolver thisR = (IGamePackageResolver)cons !; IProportionImage thisI = thisR.Resolve <IProportionImage>(tagUsed); _sizeUsed = firstCard.DefaultSize.GetSizeUsed(thisI.Proportion); SetUpGrid(); PopulateList(); SetBinding(TextProperty, nameof(GameBoardObservable <CA> .Text)); SetBinding(IsEnabledProperty, nameof(GameBoardObservable <CA> .IsEnabled)); SetBinding(VisibilityProperty, GetVisibleBinding(nameof(GameBoardObservable <CA> .Visible))); if (_thisMod.HasFrame == true) { var thisRect = ThisFrame.GetControlArea(); _mainGrid.Margin = new Thickness(thisRect.Left + 3, thisRect.Top + 3, 3, 5); // try this way. } Content = firstGrid; }
public void SendSize(string tag, CA thisData) { if (cons == null) { throw new BasicBlankException("The resolver was never set"); } IGamePackageResolver thisR = (IGamePackageResolver)cons; IProportionImage thisP = thisR.Resolve <IProportionImage>(tag); if (thisData.DefaultSize.Height <= 0 || thisData.DefaultSize.Width <= 0) { throw new BasicBlankException("The height and width must be greater than 0"); //if this happens, has to really rethink } Mains = new BaseDeckGraphicsCP(); Mains.OriginalSize = thisData.DefaultSize; MainObject = new G(); MainObject.MainGraphics = Mains; Mains.ThisGraphics = MainObject; //i think Mains.PaintUI = this; //i do need it after all here. BindingContext = thisData; PopulateInitObject(); Init(); //maybe i forgot this part. ObjectSize = thisData.DefaultSize.GetSizeUsed(thisP.Proportion); }
public void LoadList(HandObservable <CA> thisMod, string tagUsed) { CA firstCard; _tagUsed = tagUsed; BindingContext = thisMod; SetBinding(TextProperty, new Binding(nameof(HandObservable <CA> .Text))); SetBinding(IsEnabledProperty, new Binding(nameof(HandObservable <CA> .IsEnabled))); _thisMod = thisMod; if (_alreadyLoaded == true) { throw new BasicBlankException("Needs some rethinking because i intended to load once"); } if (_thisMod.HandList.Count == 0) { firstCard = new CA(); } else { firstCard = _thisMod.HandList.First(); } if (firstCard.DefaultSize.Height == 0 || firstCard.DefaultSize.Width == 0) { throw new BasicBlankException("The width and height must be greater than 0 when initializging hand wpf"); } IGamePackageResolver thisR = (IGamePackageResolver)cons !; IProportionImage thisI = thisR.Resolve <IProportionImage>(tagUsed); _sizeUsed = firstCard.DefaultSize.GetSizeUsed(thisI.Proportion); ObjectList = _thisMod.HandList; ObjectList.CollectionChanged += ObjectList_CollectionChanged; ThisScroll = new ScrollView(); if (HasAngles == false) { _thisStack = new GameOverlapLayout <CA, GC>(_sizeUsed); _thisStack.Spacing = 0; } else { _otherStack = new StackLayout(); _otherStack.Spacing = 0; } SetBinding(MaximumCardsProperty, new Binding(nameof(HandObservable <CA> .Maximum))); PositionMainControls(); PopulateList(); SetVisibleConverter(); _thisGrid.Children.Add(ThisDraw); ThisScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Default; ThisScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Default; //try this too. if (HasAngles == false) { ThisScroll.Content = _thisStack; } else { ThisScroll.Content = _otherStack; } var thisRect = ThisFrame.GetControlArea(); if (HasAngles == false) { ThisScroll.Margin = new Thickness(thisRect.Left - 1, thisRect.Top - 1, 0, 3); // try this way. } else { ThisScroll.Margin = new Thickness(thisRect.Left - 1, thisRect.Top - 1, 3, 3); } _thisGrid.Children.Add(ThisScroll); RecalulateFrames(); _drawControl = new SKCanvasView(); _drawControl.EnableTouchEvents = true; _drawControl.Touch += DrawControlTouch; _thisGrid.Children.Add(_drawControl); Content = _thisGrid; _alreadyLoaded = true; }
public GlobalClass(IGamePackageResolver resolver) { _prop = resolver.Resolve <IProportionImage>(ts.TagUsed); }