Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     animatorController  = GetComponent <Animator>();
     player              = FindObjectOfType <PlayerController>();
     playerKeyController = player.GetComponent <KeyController>();
     treasure            = GetComponent <DropController>();
 }
        public MainPage()
        {
            InitializeComponent();

            dropController      = new DropController(this.dataGrid, this, this.DragSurface);
            dataGrid.DataSource = new List <DataItem>()
            {
                new DataItem()
                {
                    Value = "Item 0", SortOrder = 0
                },
                new DataItem()
                {
                    Value = "Item 1", SortOrder = 1
                },
                new DataItem()
                {
                    Value = "Item 2", SortOrder = 2
                },
                new DataItem()
                {
                    Value = "Item 3", SortOrder = 3
                },
                new DataItem()
                {
                    Value = "Item 4", SortOrder = 4
                },
            };
        }
        /// <summary>
        /// Saves the drops.
        /// </summary>
        /// <returns></returns>
        private SubscriberStatusEnum SaveDrops()
        {
            ShipmentDrop firstDropInTrip = null;

            foreach (ShipmentDrop drop in drops)
            {
                if ((firstDropInTrip == null || firstDropInTrip.TripNumber != drop.TripNumber) && drop.CallType == ShipmentDrop.CallTypeEnum.Depot)
                {
                    //we need to retain the first drop in the trip because we can then use the original
                    //deport data when relating the drops to a trip.
                    //the original deport data can change about after the first drop!
                    firstDropInTrip = drop;
                }


                if (firstDropInTrip != null)
                {
                    DropController.SaveDrop(drop, firstDropInTrip.OriginalDepot);

                    if (RequestProcessor != null && !RequestProcessor.RequestDictionary.ContainsKey("RoutingHistory"))
                    {
                        RoutingHistory routingHistory = RoutingController.GetRoutingHistoryByShipmentId(drop.ShipmentId);
                        if (routingHistory != null)
                        {
                            RequestProcessor.RequestDictionary.Add("RoutingHistory", routingHistory);
                        }
                    }
                    drop.TripId = Null.NullInteger;
                    drop.Id     = Null.NullInteger;
                }
            }

            return(SubscriberStatusEnum.Processed);
        }
Exemplo n.º 4
0
    /// <summary>
    /// Initialize class attributes.
    /// </summary>
    void Start()
    {
        this.PileObject = GameObject.Find("discard_pile").transform;
        this.PlayerHand = GameObject.Find("hand").transform;
        GameStart gs = GameObject.Find("GameStart").GetComponent <GameStart>();

        this.DropController = new DropController(this.transform, PileObject, gs.GameController);
    }
 public virtual void Interact(GameObject gameObject)
 {
     foreach (GameObject drop in drops)
     {
         GameObject     clone      = (GameObject)GameObject.Instantiate(drop, new Vector3(thisTransform.position.x, thisTransform.position.y + 5, thisTransform.position.z), drop.transform.rotation);
         DropController controller = clone.GetComponent <DropController>();
         controller.SetTarget(gameObject);
     }
 }
Exemplo n.º 6
0
        void IDropableObject.AcceptDrag(IDragableObject dragObject, Point position)
        {
            DragObject obj = dragObject as DragObject;

            if (obj == null)
            {
                return;
            }

            //
            // Recycle
            //
            if (this.leftGrid == obj.Source || this.rightGrid == obj.Source)
            {
                Point localPt = DropController.TransformSurface(position, this.recycler, this.DragSurface);
                if (DropController.IsIn(this.recycler, localPt))
                {
                    IList <DataItem> items = obj.Source.DataSource as IList <DataItem>;
                    items.Remove(obj.DataRow as DataItem);
                    obj.Source.Refresh();
                    return;
                }
            }

            IList <DataItem> sourceItems = null;
            IList <DataItem> destItems   = null;

            //
            // Right to Left
            //
            if (obj.Source == this.rightGrid)
            {
                sourceItems = this.rightGrid.DataSource as IList <DataItem>;
                destItems   = this.leftGrid.DataSource as IList <DataItem>;
            }

            //
            // Left to Right
            //
            else if (obj.Source == this.leftGrid)
            {
                sourceItems = this.leftGrid.DataSource as IList <DataItem>;
                destItems   = this.rightGrid.DataSource as IList <DataItem>;
            }

            DataItem dataItem = obj.DataRow as DataItem;

            if (sourceItems != null && destItems != null && dataItem != null && sourceItems.Contains(dataItem) && !destItems.Contains(dataItem))
            {
                sourceItems.Remove(dataItem);
                destItems.Add(dataItem);

                this.leftGrid.Refresh();
                this.rightGrid.Refresh();
            }
        }
Exemplo n.º 7
0
    public void SetPropertiesDrop()
    {
        //Not empty slot
        DropController dropController = listActionSlot.GetComponentInChildren <DropController>();

        if (dropController != null && prefabObject != null && spriteObject != null && countObject > 0)
        {
            dropController.SetMaxValueSlider(countObject);
            dropController.SetImageDrop(spriteObject, true);
            dropController.SetCurrentSlot(GetComponent <SlotController>());
        }
    }
Exemplo n.º 8
0
 void CreateSortedGrid()
 {
     sortedGrid = new List <DropController>();
     foreach (Transform item in gameObject.transform)
     {
         DropController dropper = item.GetComponent <DropController>();
         if (dropper.dropIndex != 0)
         {
             sortedGrid.Add(dropper);
         }
     }
     sortedGrid.Sort((p1, p2) => p1.dropIndex.CompareTo(p2.dropIndex));
 }
        public bool CanAccept(IDragableObject dragObject, Point position)
        {
            DragObject obj = dragObject as DragObject;

            if (this.dataGrid == obj.Source)
            {
                Point localPt = DropController.TransformSurface(position, this.dataGrid, this.DragSurface);
                if (DropController.IsIn(this.dataGrid, localPt))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 10
0
        bool IDropableObject.CanAccept(IDragableObject dragObject, Point position)
        {
            DragObject obj = dragObject as DragObject;

            if (obj == null)
            {
                return(false);
            }

            //
            // Recycle
            //
            if (this.leftGrid == obj.Source || this.rightGrid == obj.Source)
            {
                Point localPt = DropController.TransformSurface(position, this.recycler, this.DragSurface);
                if (DropController.IsIn(this.recycler, localPt))
                {
                    return(true);
                }
            }

            //
            // Left to Right
            //
            if (this.leftGrid == obj.Source)
            {
                Point localPt = DropController.TransformSurface(position, this.rightGrid, this.DragSurface);
                if (DropController.IsIn(this.rightGrid, localPt))
                {
                    return(true);
                }
            }

            //
            // Right to Left
            //
            else if (this.rightGrid == obj.Source)
            {
                Point localPt = DropController.TransformSurface(position, this.leftGrid, this.DragSurface);
                if (DropController.IsIn(this.leftGrid, localPt))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 11
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
        stageController = GetComponent <StageController>();
        dropController  = GetComponent <DropController>();

        if (!stageController || !dropController)
        {
            Debug.LogError("[StageActor] Missing components!");
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        spriteRenderer = GetComponent <SpriteRenderer>();

        Ballista         = GetComponent <Ballista>();
        Bat              = GetComponent <BatController>();
        BoundTrap        = GetComponent <BoundTrapController>();
        Bush             = GetComponent <BushController>();
        Button           = GetComponent <ButtonController>();
        Crocodile        = GetComponent <CrocodileController>();
        Drop             = GetComponent <DropController>();
        FallingPlataform = GetComponent <FallingPlataform>();
        //Pajaro = GameObject.FindGameObjectsWithTag("").GetComponent<ButtonController>();
        Mole       = GetComponent <MoloController>();
        Mushroom   = GetComponent <MushroomController>();
        Rat        = GetComponent <RatController>();
        Rock       = GetComponent <RockController>();
        RotateTrap = GetComponent <RotateTrapController>();
        Spawner    = GetComponent <Spawner>();
        Spikes     = GetComponent <SpikesController>();
        Thorms     = GetComponent <ThormsController>();
        Trap       = GetComponent <TrapController>();

        spriteRenderer.enabled = false;
        //Ballista.enabled = false;
        Bat.enabled              = false;
        BoundTrap.enabled        = false;
        Bush.enabled             = false;
        Button.enabled           = false;
        Crocodile.enabled        = false;
        Drop.enabled             = false;
        FallingPlataform.enabled = false;
        //Pajaro.enabled = false;
        Mole.enabled       = false;
        Mushroom.enabled   = false;
        Rat.enabled        = false;
        Rock.enabled       = false;
        RotateTrap.enabled = false;
        Spawner.enabled    = false;
        Spikes.enabled     = false;
        Thorms.enabled     = false;
        Trap.enabled       = false;
    }
Exemplo n.º 13
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        switch (other.tag)
        {
        case "Drop":
            DropController drop = other.GetComponent <DropController>();
            if (!drop)
            {
                return;
            }

            int excess = inventory.AddItem(drop.GetItem(), drop.GetAmout());
            if (excess <= 0)
            {
                Destroy(other.gameObject);
            }
            break;
        }
    }
        /// <summary>
        /// Saves the dropLines.
        /// </summary>
        /// <returns></returns>
        private SubscriberStatusEnum SaveDropLines()
        {
            foreach (ShipmentDropLine dropLine in dropLines)
            {
                if (DropController.SaveDropLine(dropLine) == -1)
                {
                    throw new Exception("A Drop line did not save successfully.");
                }

                if (RequestProcessor != null && !RequestProcessor.RequestDictionary.ContainsKey("RoutingHistory"))
                {
                    RoutingHistory routingHistory = RoutingController.GetRoutingHistoryByShipmentLineId(dropLine.ShipmentLineId);
                    if (routingHistory != null)
                    {
                        RequestProcessor.RequestDictionary.Add("RoutingHistory", routingHistory);
                    }
                }

                dropLine.ShipmentLineId = -1;
                dropLine.DropId         = -1;
            }

            return(SubscriberStatusEnum.Processed);
        }
Exemplo n.º 15
0
        public Page()
        {
            InitializeComponent();

            //
            // Create DragAndDrop Controllers Before Populating the grid
            //

            leftController  = new DropController(this.leftGrid, this, this.DragSurface);
            rightController = new DropController(this.rightGrid, this, this.DragSurface);


            //
            // Populate Grids with Data
            //

            this.leftGrid.DataSource = new List <DataItem>()
            {
                new DataItem()
                {
                    Value = "Item 0"
                },
                new DataItem()
                {
                    Value = "Item 1"
                },
                new DataItem()
                {
                    Value = "Item 2"
                },
                new DataItem()
                {
                    Value = "Item 3"
                },
                new DataItem()
                {
                    Value = "Item 4"
                },
            };
            this.rightGrid.DataSource = new List <DataItem>()
            {
                new DataItem()
                {
                    Value = "Item 5"
                },
                new DataItem()
                {
                    Value = "Item 6"
                },
                new DataItem()
                {
                    Value = "Item 7"
                },
                new DataItem()
                {
                    Value = "Item 8"
                },
                new DataItem()
                {
                    Value = "Item 9"
                },
            };
        }
Exemplo n.º 16
0
 public void Start()
 {
     rb2d = GetComponent <Rigidbody2D>();
     anim = GetComponent <Animator>();
     dc   = GetComponent <DropController>();
 }
Exemplo n.º 17
0
 // Use this for initialization
 void Start()
 {
     dc = GetComponent <DropController>();
 }
Exemplo n.º 18
0
 public void addDropItem(DropController dropItem)
 {
     drops.Add(dropItem);
 }
Exemplo n.º 19
0
    void Start()
    {
        spriteRenderer = GetComponent <SpriteRenderer>();

        dropController = GetComponent <DropController>();
    }
Exemplo n.º 20
0
 private void Awake()
 {
     Instance = this;
 }