Esempio n. 1
0
 private void CreateSpaces()
 {
     for (int spaceIndex = 1; spaceIndex <= 9; spaceIndex++)
     {
         Spaces.Add(new BoardCardSpace(spaceIndex));
     }
 }
Esempio n. 2
0
 private void CreateSpaces(MainWindow mainWindow)
 {
     for (int spaceIndex = 1; spaceIndex <= 9; spaceIndex++)
     {
         Spaces.Add(new BoardCardSpace(spaceIndex, mainWindow));
     }
 }
Esempio n. 3
0
 public void AddCar(CarOwner car, int spaceId, int levelId)
 {
     SpaceId        = spaceId;
     LevelId        = levelId;
     car.SpaceId    = spaceId;
     car.SpaceLevel = levelId;
     Spaces.Add(this);
     CarOwners.Add(car);
 }
Esempio n. 4
0
    /// <summary>
    /// Private Methods
    /// </summary>

    void Init()
    {
        for (int i = 0; i < Size; i++)
        {
            Spaces.Add(new List <Space>());
            for (int j = 0; j < Size; j++)
            {
                Spaces[i].Add(new Space(new Vector3(i, j), i * Size + j));
            }
        }
    }
Esempio n. 5
0
 /// <summary>
 /// Adds a space to the collection of spaces.
 /// </summary>
 /// <param name="obj"></param>
 public override void Add(object obj)
 {
     Ensure.ArgumentNotNull(obj, "obj");
     Spaces.Add(obj as Space);
 }
Esempio n. 6
0
 public void AddSpace(ObservationSpace observationSpace)
 {
     observationSpace.Dock = DockStyle.Left;
     this.Controls.Add(observationSpace);
     Spaces.Add(observationSpace);
 }
Esempio n. 7
0
 public void SetMasterSpace()
 {
     Spaces.Add(new Rect {
         Width = Master.Width, Height = Master.Height, X = 0, Y = 0
     });
 }
Esempio n. 8
0
 public void AddSpace(Space space)
 {
     Spaces.Add(space);
 }
Esempio n. 9
0
        public void __init__(int c)
        {
            Spaces.Add(new CardGameTableSpace(new CardGameTableSpaceOptions()
            {
                Name = "clubs"
            }));
            Spaces.Add(new CardGameTableSpace(new CardGameTableSpaceOptions()
            {
                Name = "spades"
            }));
            Spaces.Add(new CardGameTableSpace(new CardGameTableSpaceOptions()
            {
                Name = "hearts"
            }));
            Spaces.Add(new CardGameTableSpace(new CardGameTableSpaceOptions()
            {
                Name = "diamonds"
            }));



            TextAreas.Add(new GameCardGameTextArea(new GameCardGameTextAreaOptions()
            {
                Name = "clubs"
            }));
            TextAreas.Add(new GameCardGameTextArea(new GameCardGameTextAreaOptions()
            {
                Name = "spades"
            }));
            TextAreas.Add(new GameCardGameTextArea(new GameCardGameTextAreaOptions()
            {
                Name = "hearts"
            }));
            TextAreas.Add(new GameCardGameTextArea(new GameCardGameTextAreaOptions()
            {
                Name = "diamonds"
            }));



            Users.Add(new CardGameUser("Joe"));
            Users.Add(new CardGameUser("Mike"));
            Users.Add(new CardGameUser("Chris"));
            Users.Add(new CardGameUser("Steve"));

            for (int index = 0; index < 6; index++)
            {
                Spaces.Add(new CardGameTableSpace(new CardGameTableSpaceOptions()
                {
                    Name = "User" + index
                }));
                TextAreas.Add(new GameCardGameTextArea(new GameCardGameTextAreaOptions()
                {
                    Name = "User" + index
                }));
            }

            Size = new Size(15, 15);

            NumberOfCards  = 52;
            NumberOfJokers = 0;

            ConfigurationCompleted();
        }
Esempio n. 10
0
 public void AddSpace(Space space)
 {
     Spaces.Add(space);
     space.BoardReference = this;
 }
Esempio n. 11
0
        public bool Insert(RectWH imagerect, out RectFlipXYWH outresult, Action <SpaceRect> reportCandidateEmptySpace = null)
        {
            for (int i = Spaces.Count - 1; i >= 0; i--)
            {
                var candidateSpace = Spaces[i];
                reportCandidateEmptySpace?.Invoke(candidateSpace);

                RectFlipXYWH AcceptResult(CreatedSplits splits, bool flippingNecessary)
                {
                    Spaces.Remove(i);

                    for (int s = 0; s < splits.Count; s++)
                    {
                        Spaces.Add(splits.Spaces[s]);
                    }

                    var result = new RectFlipXYWH(
                        candidateSpace.X,
                        candidateSpace.Y,
                        imagerect.Width,
                        imagerect.Height,
                        AllowFlip && flippingNecessary,
                        imagerect.Attachment
                        );

                    CurrentAABB = CurrentAABB.ExpandWith <RectWH, RectFlipXYWH>(result);
                    return(result);
                }

                CreatedSplits TryToInsert(RectWH img) => CreatedSplits.InsertAndSplit(img, candidateSpace);

                if (AllowFlip)
                {
                    var normal  = TryToInsert(imagerect);
                    var flipped = TryToInsert(imagerect.Flip());
                    if (normal && flipped)
                    {
                        outresult = flipped.BetterThan(normal) ?
                                    AcceptResult(flipped, true) :
                                    AcceptResult(normal, false);
                        return(true);
                    }

                    if (normal)
                    {
                        outresult = AcceptResult(normal, false);
                        return(true);
                    }
                    if (flipped)
                    {
                        outresult = AcceptResult(flipped, true);
                        return(true);
                    }
                }
                else
                {
                    var normal = TryToInsert(imagerect);
                    if (normal)
                    {
                        outresult = AcceptResult(normal, false);
                        return(true);
                    }
                }
            }
            outresult = new RectFlipXYWH();
            return(false);
        }
Esempio n. 12
0
 public void Reset(RectWH r)
 {
     CurrentAABB = new RectWH();
     Spaces.Reset();
     Spaces.Add(new SpaceRect(r));
 }
Esempio n. 13
0
 public void Add(Vector2 position)
 {
     Spaces.Add(position);
     Objects.Add(null);
 }