IEnumerator AccessGranted(long owner) { string sceneToLoad = ""; //get content provider to access app state GlobalContentProvider contentProvider = GlobalContentProvider.Instance; if (owner > 0) { contentProvider.InitCustomerSession(owner); sceneToLoad = "HomeScreen"; } else if (owner == 0) { sceneToLoad = "ChefScreen"; } else if (owner == -1) { sceneToLoad = "WaiterScreen"; } gameObject.transform.parent.GetComponent <LoginEffect>().startEffect(owner); yield return(new WaitForSeconds(4)); float fadeTime = GameObject.Find("Transition").GetComponent <Transition>().BeginFade(1); yield return(new WaitForSeconds(fadeTime)); SceneManager.LoadScene(sceneToLoad); }
// 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); }
void Awake() { GlobalContentProvider contentProvider = GlobalContentProvider.Instance; foodObject = contentProvider.foods[foodObjectIndex]; variants = foodObject.variants; }
void InvokeDatabase() { FirebaseDatabase.DefaultInstance .GetReference("Meal/" + GlobalContentProvider.GetMealKey(content.dishname) + "/Comments") .GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { //handle error } else if (task.IsCompleted) { DataSnapshot commentsSnap = task.Result; foreach (DataSnapshot comment in commentsSnap.Children) { if ((string)comment.Child("username").Value != "" && (string)comment.Child("content").Value != "") { content.comments.Add(new Tuple <string, string>( (string)comment.Child("username").Value, (string)comment.Child("content").Value)); } } setComments(); } }); }
void Awake() { DontDestroyOnLoad(transform.gameObject); Instance = this; //disable camera by default XRSettings.enabled = false; //InitCustomerSession(12); }
// Use this for initialization void Start() { viewinfo = false; menuinfo = null; MenuItems = new List <GameObject>(); Content = GameObject.Find("/Menulist/Background/ScrollView_1/ScrollRect/Content"); dishDetail = GameObject.Find("/Menulist/MenuDetail/ScrollView_5/ScrollRect/Content"); reviewCanvas = GameObject.Find("ReviewCanvas"); orderHistoryCanvas = GameObject.Find("OrderList"); offset = ((RectTransform)menuPrefab.transform).rect.height * 0.03f; menuHeight = ((RectTransform)menuPrefab.transform).rect.height * 0.65f + offset; //wl(MenuItems[0].transform.localScale.x.ToString()); // Set up the Editor before calling into the realtime database. FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://armenu-2220c.firebaseio.com/"); //add dishes from GlobalContentProvider to the MenuItem list provider = GlobalContentProvider.Instance; Content.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, menuHeight * provider.foods.Length + 10); for (int i = 0; i < provider.foods.Length; ++i) { //init options (variants) for each dish List <string> options = new List <string>(); for (int j = 0; j < provider.foods[i].variants.Length; ++j) { options.Add(provider.foods[i].variants[j].variantName); } //init comments for each dish, init defaul value for demo List <Tuple <string, string> > comments = new List <Tuple <string, string> >(); //invoke database to get the rating score and add menuitem once the async task is finished DishContent temp = new DishContent( provider.foods[i].foodName, provider.foods[i].foodImage, 0, provider.foods[i].description, options, provider.foods[i].price, 1, "", comments); InvokeDatabase(temp); // addMenuItem(new DishContent( // provider.foods[i].foodName, // provider.foods[i].foodImage, // 0, // provider.foods[i].description, // options, // (float)provider.foods[i].price, // 1, // "", // comments)); } }
public void init(DishContent _content) { content = _content; foodKey = GlobalContentProvider.GetMealKey(content.dishname); commentsRef = FirebaseDatabase.DefaultInstance .GetReference("Meal/" + foodKey + "/Comments"); // Get the reference for rating ratingRef = FirebaseDatabase.DefaultInstance .GetReference("Meal/" + foodKey + "/Rating"); }
protected virtual void Start() { mTrackableBehaviour = GetComponent <TrackableBehaviour>(); if (mTrackableBehaviour) { mTrackableBehaviour.RegisterTrackableEventHandler(this); } provider = GlobalContentProvider.Instance; foodManager = GetComponent <FoodTargetManager>(); baseFoodObject = transform.Find("BaseFoodObject").gameObject; selectCircle = transform.Find("SelectCircle").gameObject; }
// Use this for initialization void Start() { orderList = new List <OrderEntry>(); Orders = new List <GameObject>(); moveDisplacement = new List <float>(); Content = transform.Find("Background/ScrollView_1/ScrollRect/Content").gameObject; totalPrice = transform.Find("OrderTotal/MainTotalPrice").GetComponent <Text>(); nothingToShow = transform.Find("Background/NothingText").gameObject; backBtn = transform.Find("Title/BackBtn").gameObject.GetComponent <Button>(); backBtn.onClick.AddListener(OnBackClick); provider = GlobalContentProvider.Instance; gameObject.SetActive(false); }
// Use this for initialization void Start() { provider = GlobalContentProvider.Instance; foodManager = provider.GetCurrentFoodManager(); foodKey = foodManager.GetFoodKey(); canvas = GameObject.Find("ReviewCanvas"); detail = canvas.transform.Find("ScrollView_5/ScrollRect/Content"); //get ref to comment and username input commentInput = detail.Find("CommentField").GetComponent <InputField>(); usernameInput = detail.Find("Username").GetComponent <InputField>(); //add listener for button detail.Find("Submit").GetComponent <Button>().onClick.AddListener(OnSubmitClick); detail.Find("Share").GetComponent <Button>().onClick.AddListener(OnShareClick); //get ref to rating rating = detail.Find("Rating").Find("Score").GetComponent <Slider>(); //get toast toast = detail.Find("Toast").GetComponent <Toast>(); //get back btn 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/"); // Get the reference for comment commentsRef = FirebaseDatabase.DefaultInstance .GetReference("Meal/" + foodKey + "/Comments"); // Get the reference for rating ratingRef = FirebaseDatabase.DefaultInstance .GetReference("Meal/" + foodKey + "/Rating"); // // Try to get the rating key // GlobalContentProvider.Instance.ratings.TryGetValue(foodKey, out ratingKey); // // if there is no rating key associated with this meal in this session -> push new one // if (ratingKey == "" || ratingKey == null) { // currentRatingRef = ratingRef.Push(); // ratingKey = currentRatingRef.Key; // GlobalContentProvider.Instance.ratings.Add(foodKey, ratingKey); // } else { // currentRatingRef = ratingRef.Child(ratingKey); // } setContent(); }
// void InvokeDatabase(Rating _rating, string key, DishContent content) { // double temp = 0; // Debug.Log(key + "!!!!!!!"); // FirebaseDatabase.DefaultInstance // .GetReference("Meal/" + key + "/AveRating/Rate") // .GetValueAsync().ContinueWith(task => { // if (task.IsFaulted) { // //handle error // } // else if (task.IsCompleted) { // DataSnapshot rating = task.Result; // temp = (double) rating.Value; // // _rating.scorevalue = (float) temp; // // _rating.setValue(_rating.scorevalue); // // content.score = _rating.scorevalue; // } // }); // } void InvokeDatabase(DishContent content) { FirebaseDatabase.DefaultInstance .GetReference("Meal/" + GlobalContentProvider.GetMealKey(content.dishname) + "/AveRating/Rate") .GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { //handle error } else if (task.IsCompleted) { DataSnapshot rating = task.Result; double temp = (double)rating.Value; content.score = (float)temp; addMenuItem(content); } }); }
// Use this for initialization void Start() { detailsBtn = transform.Find("DetailsBtn").GetComponent <Button>(); customBtn = transform.Find("CustomizeBtn").GetComponent <Button>(); orderBtn = transform.Find("OrderBtn").GetComponent <Button>(); reviewBtn = transform.Find("ReviewBtn").GetComponent <Button>(); panelAnim = GetComponent <Animator>(); provider = GlobalContentProvider.Instance; provider.AddManagerListener(this); //set onClick detailsBtn.onClick.AddListener(OnDetailsClick); customBtn.onClick.AddListener(OnCustomClick); orderBtn.onClick.AddListener(OnOrderClick); reviewBtn.onClick.AddListener(OnReviewClick); isCircleActive = false; }
// 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); }
// Use this for initialization void Start() { reviewCanvas = GameObject.Find("ReviewCanvas"); confirmationCanvas = GameObject.Find("ConfirmationCanvas"); confirmationCanvas.SetActive(false); // 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; //referencing variables for order process menuinfo = GameObject.Find("MenuDetail"); menuinfoTransform = menuinfo.transform.Find("ScrollView_5/ScrollRect/Content"); quantityInput = menuinfoTransform.Find("Amount").GetComponent <InputField>(); requirementsInput = menuinfoTransform.Find("AdditionalInfo").GetComponent <InputField>(); //add listener for quantity input field on end edit quantityInput.onEndEdit.AddListener(delegate { onQuantityChanged(content); }); //init GlobalContentProvider object global = GlobalContentProvider.Instance; }
void Awake() { DontDestroyOnLoad(transform.gameObject); Instance = this; }
public string GetFoodKey() { return(GlobalContentProvider.GetMealKey(foodObject.foodName)); }