예제 #1
0
파일: Pit.cs 프로젝트: tempestrock/Kalaha
        /// <summary>Moves an existing seed into this pit.</summary>
        /// <param name="seed">The seed to be moved here.</param>
        public void MoveSeedHere(Seed seed, Point newTopLeftCorner)
        {
            Logging.I.LogMessage("Pit.MoveSeedHere (" + seed + ", (" + newTopLeftCorner + "))\n", Logging.LogLevel.DeepDebug);
            // Add the seed to the list of seeds in this pit:
            _seeds.Add(seed);

            // Set the coordinates of the seed to the new position:
            seed.SetTopLeftCorner(newTopLeftCorner);

            // Modify the number that is shown for this pit:
            _numberField.Text = _seeds.Count.ToString();
            PositionNumberFieldCorrectly();
        }
예제 #2
0
파일: Pit.cs 프로젝트: tempestrock/Kalaha
        /// <summary>Adds one seed to the pit.</summary>
        public void AddNewSeed()
        {
            // Create a new seed and add it to the list:
            Seed newSeed = new Seed();
            _seeds.Add(newSeed);
            _numberField.Text = _seeds.Count.ToString();
            PositionNumberFieldCorrectly();

            Point newTopLeftCorner = FindPlaceForNewSeed(newSeed.GetWidth(), newSeed.GetHeight());
            newSeed.SetTopLeftCorner(newTopLeftCorner);

            //DEBUG     Logging.Inst.LogMessage(this.ToString() + ": Added " + newSeed + " at (" + newTopLeftCorner + "). Image.coords: (" +
            //DEBUG                             Canvas.GetLeft(newSeed.GetImage()).ToString() + ";" + Canvas.GetTop(newSeed.GetImage()).ToString() + ")\n");
            _canvasToPaintOn.Children.Add(newSeed.GetImage());
        }