Esempio n. 1
0
    void MakeOrder()
    {
        //get inputs from the input fields
        string quantity     = quantityInput.text;
        string requirements = requirementsInput.text;

        //create an Order object based on the information given by the users and the FoodManager
        Order order = new Order(
            "",
            requirements,
            false,
            foodManager.GetFoodName() + " (" + foodManager.GetSelectedVarName() + ")",
            false,
            foodManager.GetFoodPrice() * long.Parse(quantity),
            long.Parse(quantity),
            provider.tableNumber);
        string jsonOrder = JsonUtility.ToJson(order);

        //write the new order as a new child node under Order entry
        DatabaseReference _ref = rootRef.Child("Order").Push();

        _ref.SetRawJsonValueAsync(jsonOrder);

        //add order to order history
        provider.AddOrderEntry(order, foodManager.GetFoodPrice());

        //show toast
        toast.ShowText("Your order has been placed!");

        //after finishing the ordering, the order box will disappear
        ResetInput();
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        provider    = GlobalContentProvider.Instance;
        foodManager = provider.GetCurrentFoodManager();
        canvas      = this.gameObject;
        detail      = canvas.transform.Find("ScrollView_5/ScrollRect/Content");
        backBtn     = canvas.transform.Find("Title/BackBtn").GetComponent <Button>();
        backBtn.onClick.AddListener(OnBackClick);

        // Set up the Editor before calling into the realtime database.
        FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://armenu-2220c.firebaseio.com/");

        //set the layout content
        DishContent _content = new DishContent(
            foodManager.GetFoodName(),
            foodManager.GetFoodImage(),
            0f,
            foodManager.GetFoodDescription(),
            null,
            foodManager.GetFoodPrice(),
            1,
            "",
            comments
            );

        setContent(_content);
    }
Esempio n. 3
0
    public void onOrderButtonClicked()
    {
        //get inputs from the input fields
        string quantity     = quantityInput.text;
        string requirements = requirementsInput.text;

        //create an Order object based on the information given by the users and the FoodManager
        Order order = new Order(
            "",
            requirements,
            false,
            foodManager.GetFoodName() + "(" + foodManager.GetSelectedVarName() + ")",
            false,
            foodManager.GetFoodPrice(),
            long.Parse(quantity),
            0);
        string jsonOrder = JsonUtility.ToJson(order);

        //write the new order as a new child node under Order entry
        DatabaseReference _ref = rootRef.Child("Order").Push();

        _ref.SetRawJsonValueAsync(jsonOrder);

        //after finishing the ordering, the order box will disappear
        quantityInput.text     = "";
        requirementsInput.text = "";
        canvas.SetActive(false);
    }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        provider    = GlobalContentProvider.Instance;
        foodManager = provider.GetCurrentFoodManager();

        canvas = this.gameObject;
        detail = canvas.transform.Find("ScrollView_5/ScrollRect/Content");
        //quantityInput = GameObject.Find ("Amount").GetComponent<InputField> ();
        quantityInput = detail.Find("Amount").GetComponent <InputField>();
        quantityInput.onEndEdit.AddListener(delegate { onQuantityChanged(); });
        //requirementsInput = GameObject.Find ("RequirementsInput").GetComponent<InputField> ();
        requirementsInput = detail.Find("AdditionalInfo").GetComponent <InputField>();
        //get toast
        toast = detail.Find("Toast").GetComponent <Toast>();
        //get back btn
        backBtn = canvas.transform.Find("Title/BackBtn").GetComponent <Button>();
        backBtn.onClick.AddListener(OnBackClick);
        //get confirm dialog
        confirmDialog = transform.Find("ConfirmDialog").GetComponent <ConfirmDialog>();

        // Set up the Editor before calling into the realtime database.
        FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://armenu-2220c.firebaseio.com/");

        // Get the root reference location of the database.
        rootRef = FirebaseDatabase.DefaultInstance.RootReference;

        //set the layout content
        DishContent _content = new DishContent(
            foodManager.GetFoodName() + " (" + foodManager.GetSelectedVarName() + ")",
            null,
            0f,
            null,
            null,
            foodManager.GetFoodPrice(),
            1,
            "",
            null
            );

        setContent(_content);
    }