Exemplo 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();
    }
Exemplo n.º 2
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);
    }
Exemplo n.º 3
0
 void Start()
 {
     //get foodManager
     foodManager = transform.parent.gameObject.GetComponent <FoodTargetManager>();
     //get models
     variantModels = foodManager.GetVarModels();
     //initialize prop block
     propBlock = new MaterialPropertyBlock();
     //scaleVector to scale the models
     scaleVector = new Vector3(itemScale, itemScale, itemScale);
     //initialize clones array
     clones = new GameObject[variantModels.Length];
     //create models for first time
     CreateSmallModels();
     //get 3D text object
     variantName = transform.GetChild(0).gameObject;
     //show variant name
     ChangeVariantName(foodManager.GetSelectedVarName());
 }
Exemplo 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);
    }