コード例 #1
0
        private void Station_CanCollect(object sender, BaggageEventArgs e)
        {
            int z;

            if (algo.FlightAtShelf.Keys.Contains(e.Baggage.Flight))
            {
                z = algo.FlightAtShelf[e.Baggage.Flight];
            }
            else
            {
                if (mistery)
                {
                    z = 0;
                }
                else
                {
                    z = 1;
                }
                mistery = !mistery;
            }
            if (inputStackerLeft.ReadyForCollecting && z == 0)
            {
                int x, y;
                x = shelf1.Location.X;
                y = shelf1.Location.Y;
                LogicLocation logic = algo.Push(e.Baggage.Flight, z);
                if (logic == null)
                {
                    return;
                }
                inputStackerLeft.GrabBag(station.ReleaseBag());
                inputStackerLeft.ReadyForCollecting = false;
                inputStackerLeft.TargetPoint        = new Point(x + (logic.Column) * 43 + 20, y + (logic.Row) * 43 + 20);
                inputStackerLeft.TargetLocation     = logic;
                shelf1.SetFrameHighlight(logic.Column, logic.Row, Color.Black);
            }
            else if (inputStackerRight.ReadyForCollecting && z == 1)
            {
                int x, y;
                x = shelf2.Location.X;
                y = shelf2.Location.Y;
                LogicLocation logic = algo.Push(e.Baggage.Flight, z);
                if (logic == null)
                {
                    return;
                }
                inputStackerRight.GrabBag(station.ReleaseBag());
                inputStackerRight.ReadyForCollecting = false;
                inputStackerRight.TargetPoint        = new Point(x + (logic.Column) * 43 + 20, y + (logic.Row) * 43 + 20);
                inputStackerRight.TargetLocation     = logic;
                shelf2.SetFrameHighlight(logic.Column, logic.Row, Color.Black);
            }
        }
コード例 #2
0
 private void Shelf2_BaggageDequeued(object sender, BaggageEventArgs e)
 {
     outputStackerRight.GrabBag(e.Baggage);
     outputStackerRight.TargetPoint = Point.Empty;
 }