예제 #1
0
 public void OnEndDrag(PointerEventData eventData)
 {
     if (OrdersMenuController.atOrderStation && represent != null)
     {
         GraphicRaycaster gr  = playerInventory.GetComponent <GraphicRaycaster>();
         PointerEventData ped = new PointerEventData(null);
         ped.position = Input.mousePosition;
         List <RaycastResult> results = new List <RaycastResult>();
         gr.Raycast(ped, results);
         if (results.Count > 0)
         {
             foreach (var item in results)
             {
                 if (item.gameObject.GetComponent <OrderedMeal>() != null)
                 {
                     PlayerSlot.mealOrder = item.gameObject.GetComponent <OrderedMeal>().MealOrder;
                 }
             }
         }
         if (represent == mealOrder.meal && Count >= mealOrder.Count && !mealOrder.completed)
         {
             mealOrder.completed = true;
             for (int i = 0; i < mealOrder.Count; i++)
             {
                 InventoryOfPlayer.BackTransaction(represent, 1);
             }
             transform.localPosition = normalLocalPos;
         }
         else
         {
             transform.localPosition = normalLocalPos;
         }
     }
 }
예제 #2
0
    public void Transfer()
    {
        bool execution = false;

        InventoryOfPlayer.BackTransaction(represent, sendQuantaty, out execution);
        adjuster.SetActive(false);
        PlayerController.kralinYarra = true;
        if (execution)
        {
            Station.Transaction(represent, sendQuantaty);
        }
    }
예제 #3
0
    public static void Transfer()
    {
        bool execution = false;

        InventoryOfPlayer.Transaction(PlayerController.current.GetComponent <Station>().inventory[adjusterIndex].typeOfItem, out execution, sendQuantaty);
        Debug.Log(InventoryOfPlayer.tkgCur);
        if (execution)
        {
            BackTransaction(PlayerController.current.GetComponent <Station>().inventory[adjusterIndex].typeOfItem, sendQuantaty);
            Debug.Log(execution);
        }
    }
예제 #4
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Left)
     {
         if (InventoryOfPlayer.Money >= price)
         {
             bool execution = false;
             InventoryOfPlayer.Transaction(represent, out execution, quantaty);
             if (execution)
             {
                 InventoryOfPlayer.Money -= price;
             }
         }
     }
     else if (eventData.button == PointerEventData.InputButton.Middle)
     {
     }
     else if (eventData.button == PointerEventData.InputButton.Right)
     {
     }
 }
예제 #5
0
    public void Create()
    {
        GetQuantaty();
        GameObject Output = RecipeController.GetRecipe();

        int[] takeFromInventory = new int[8];
        int[] takeFromStation   = new int[8];
        for (int i = 0; i < 8; i++)
        {
            if (slots[i].typeOfItem != null)
            {
                if (slots[i].unitCount <= supplyCalculator(slots[i].typeOfItem, out takeFromInventory[i], out takeFromStation[i]))
                {
                }
                else
                {
                    Debug.Log("eksik" + slots[i].typeOfItem);
                    return;
                }
            }
        }

        for (int i = 0; i < 8; i++)
        {
            if (slots[i].unitCount * Count > takeFromStation[i])
            {
                Station.BackTransaction(slots[i].typeOfItem, takeFromStation[i]);
                int surplus = (int)(slots[i].unitCount * Count - takeFromStation[i]);
                InventoryOfPlayer.BackTransaction(slots[i].typeOfItem, surplus);
            }
            else
            {
                Station.BackTransaction(slots[i].typeOfItem, (int)slots[i].unitCount * Count);
            }
        }
        PlayerController.current.GetComponent <Station>().Create(Output, Count);
        //GameObject[] outputAndCurrent = new GameObject[2] { Output, PlayerController.current };
        //StartCoroutine("animateAndCreate", outputAndCurrent);
    }