Example #1
0
        public static List <Recipie> Myrecipies(String email)
        {
            List <Recipie> lst = new List <Recipie>();
            Recipie        obj = null;
            String         q   = "";

            q = String.Format("Select * from Recipie where Email = '" + email + "'");
            try
            {
                using (DBHelper db = new DBHelper())
                {
                    SqlDataReader dr = db.ExecuteReader(q);
                    while (dr.Read())
                    {
                        obj       = new Recipie();
                        obj.ID    = dr.GetInt32(0);
                        obj.Email = dr.GetString(1);
                        obj.Name  = dr.GetString(2);
                        obj.Recip = dr.GetString(3);
                        obj.img   = dr.GetString(4);
                        lst.Add(obj);
                    }
                }
            }
            catch (Exception e)
            {
            }
            return(lst);
        }
Example #2
0
    void InitiateGame()
    {
        condiments.Init();
        tropSale        = false;
        ilmanqueqqchose = false;
        activeRecipie   = lstRecipies[Random.Range(0, lstRecipies.Count)];
        panel.GetComponent <Image>().sprite = activeRecipie.sprite;

        if (state == State.pregame || state == State.endgame)
        {
            miamometerSlider.value = 0;
            miamometer.SetActive(false);
            foreach (GameObject objet in ingredients)
            {
                GameObject instance = Instantiate(objet);
                instance.transform.parent = ingredientsContainer.transform;
                Cookable ck = instance.GetComponent <Cookable>();
                if (ck != null)
                {
                    ck.casserole = casserole;
                    ck.gameState = gameObject;
                }
                instance.name = objet.name;
            }
            state = State.game;
            avancee.transform.localPosition = avanceeOriginPos;
            avanceeCount = 0;
        }
    }
Example #3
0
        public static String searchImg(int id)
        {
            Recipie obj = null;
            String  q   = "";

            String im = null;

            q = String.Format("Select * from Recipie where ID=" + id);

            try
            {
                using (DBHelper db = new DBHelper())
                {
                    SqlDataReader dr = db.ExecuteReader(q);
                    if (dr.Read())
                    {
                        obj       = new Recipie();
                        obj.ID    = dr.GetInt32(0);
                        obj.Email = dr.GetString(1);
                        obj.Name  = dr.GetString(2);
                        obj.Recip = dr.GetString(3);
                        obj.img   = dr.GetString(4);
                        im        = obj.img;
                    }
                }
            }
            catch (Exception e)
            {
            }
            return(im);
        }
Example #4
0
        public async Task <IActionResult> PutRecipie(long id, Recipie recipie)
        {
            if (id != recipie.Id)
            {
                return(BadRequest());
            }

            _context.Entry(recipie).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RecipieExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #5
0
    // Start is called before the first frame update
    void Start()
    {
        state            = State.pregame;
        avancee          = panel.transform.GetChild(0).gameObject;
        readyButton      = panel.transform.GetChild(2).gameObject;
        mijoteButton     = panel.transform.GetChild(3).gameObject;
        avanceeOriginPos = avancee.transform.localPosition;

        activeRecipie = lstRecipies[Random.Range(0, lstRecipies.Count)];

        panel.GetComponent <Image>().sprite = activeRecipie.sprite;

        Button btn = readyButton.GetComponent <Button>();

        btn.onClick.AddListener(Finish);

        Button btn2 = mijoteButton.GetComponent <Button>();

        btn2.onClick.AddListener(Mijote);

        foreach (Transform child in casserole.transform)
        {
            if (child.name == "Slots")
            {
                slots = child;
            }
        }

        InitiateGame();
    }
Example #6
0
    //public List<Recipie> GetRecipie()
    //{
    //    //string strQuery = "SELECT * FROM Recipie";
    //    string strQuery = "SELECT * FROM testProduct";

    //    DataTable dtRecipie = null;
    //    Recipie objRecipie;
    //    //  SqlConnection con = GetConnection("Data Source=(PERSONAL-9D79B9);Initial Catalog=employee;Integrated Security=true");
    //    SqlConnection con = GetConnection(System.Configuration.ConfigurationManager.AppSettings["connectionString"]);
    //    using (con)
    //    {
    //        con.Open();
    //        using (SqlDataAdapter sqlAdapter = new SqlDataAdapter(strQuery, con))
    //        {
    //            dtRecipie = new DataTable();
    //            sqlAdapter.Fill(dtRecipie);
    //        }
    //    }
    //    List<Recipie> drlist = new List<Recipie>();

    //    foreach (DataRow row in dtRecipie.Rows)
    //    {
    //        objRecipie = new Recipie();
    //        //objRecipie.by = row["by"].ToString();
    //        //objRecipie.Recipiename = row["Recipiename"].ToString();
    //        //objRecipie.preparationtime = row["preparationtime"].ToString();
    //        //objRecipie.cookingtime = row["cookingtime"].ToString();

    //        objRecipie.pid = row["pid"].ToString();
    //        objRecipie.pname = row["pname"].ToString();
    //        //objRecipie.preparationtime = row["preparationtime"].ToString();
    //        //objRecipie.cookingtime = row["cookingtime"].ToString();


    //        drlist.Add(objRecipie);
    //    }
    //    return drlist;
    //}

    //public static System.Collections.Hashtable GetRecipie()
    //{
    //    //Company c = new Company();
    //    System.Collections.Hashtable c = new System.Collections.Hashtable();
    //    c.Add("pid", "Please enter Name");
    //    return c;
    //}

    public List <Recipie> GetRecipie(string ControlId)
    {
        string strcId = "";

        if (HttpContext.Current.Request.Params["controlId"] != null)
        {
            strcId = Convert.ToString(HttpContext.Current.Request.Params["controlId"]);
        }
        DataTable dtRecipie = new DataTable();

        dtRecipie.Columns.Add("msg", typeof(string));
        dtRecipie.Columns.Add("controlId", typeof(string));
        Recipie        objRecipie;
        List <Recipie> drlist = new List <Recipie>();
        DataRow        dr     = dtRecipie.NewRow();

        dr[0] = "Please enter Name";
        dr[1] = strcId;
        dtRecipie.Rows.Add(dr);
        foreach (DataRow row in dtRecipie.Rows)
        {
            objRecipie = new Recipie();
            // objRecipie.msg = row["msg"].ToString();
            objRecipie.msg       = "<a href=\"javascript:funMakeFocus(" + strcId + ");\">" + row["msg"].ToString() + "</a>";
            objRecipie.controlId = row["controlId"].ToString();
            drlist.Add(objRecipie);
        }
        return(drlist);
    }
Example #7
0
        public async Task <ActionResult <Recipie> > PostRecipie(Recipie recipie)
        {
            _context.Recipies.Add(recipie);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetRecipie", new { id = recipie.Id }, recipie));
        }
Example #8
0
        public ActionResult Editt(String id)
        {
            int     i   = Convert.ToInt32(id);
            Recipie obj = DBHandler.DAL.search(i);

            return(RedirectToAction("Edit", "Home2", obj));
        }
Example #9
0
        public ActionResult Edit(String iid)
        {
            int     i   = Convert.ToInt32(iid);
            Recipie obj = DBHandler.DAL.search(i);

            return(View(obj));
        }
Example #10
0
        public ActionResult RecipeTable1(int id)
        {
            Recipie IdRec = new Recipie();

            IdRec = db.RecipieDB.Where(i => i.Id == id).Single();
            db.RecipieDB.Remove(IdRec);
            db.SaveChanges();

            return(RedirectToAction("RecipeTable", "Home", null));
        }
Example #11
0
        public List <Recipie> GetRecipies(int start, int end)
        {
            List <Recipie> recipies = new List <Recipie>();

            MySql.Data.MySqlClient.MySqlConnection conn;
            string myConnectionString;

            myConnectionString = "server=localhost;uid=root;pwd=;database=asp1;";

            try
            {
                conn = new MySql.Data.MySqlClient.MySqlConnection();
                conn.ConnectionString = myConnectionString;
                conn.Open();

                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = "select * from recipies ORDER BY id LIMIT 4 OFFSET " + start;
                MySqlDataReader myreader = cmd.ExecuteReader();

                while (myreader.Read())
                {
                    Recipie stud = new Recipie();
                    stud.id       = (int)myreader["id"];
                    stud.name     = (string)myreader["name"];
                    stud.category = (string)myreader["category"];
                    stud.author   = (string)myreader["username"];
                    recipies.Add(stud);
                }
                myreader.Close();

                cmd.CommandText = "select * from recipies ORDER BY id LIMIT 4 OFFSET " + end;
                MySqlDataReader newreader = cmd.ExecuteReader();

                while (newreader.Read())
                {
                    Recipie stud = new Recipie();
                    stud.id       = (int)newreader["id"];
                    stud.name     = (string)newreader["name"];
                    stud.category = (string)newreader["category"];
                    stud.author   = (string)newreader["username"];
                    recipies.Add(stud);
                }
                newreader.Close();
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                Console.Write(ex.Message);
            }


            return(recipies);
        }
Example #12
0
    public void UpdateUI()
    {
        if (index == (availableRecipies.Count - 1))
        {
            Next.interactable = false;
        }
        else
        {
            Next.interactable = true;
        }

        if (index == 0)
        {
            Back.interactable = false;
        }
        else
        {
            Back.interactable = true;
        }

        if (availableRecipies.Count == 0)
        {
            Debug.Log("No Recipies");
            currentRecipie = null;
            Slot01.gameObject.SetActive(false);
            Slot02.gameObject.SetActive(false);
            Result.gameObject.SetActive(false);
            resultName.text = "No Recipies Available";

            Next.interactable    = false;
            Back.interactable    = false;
            CraftIt.interactable = false;

            return;
        }
        else
        {
            Slot01.gameObject.SetActive(true);
            Slot02.gameObject.SetActive(true);
            Result.gameObject.SetActive(true);

            CraftIt.interactable = true;
        }

        currentRecipie  = availableRecipies[index];
        Slot01.sprite   = currentRecipie.Input01.icon;
        Slot02.sprite   = currentRecipie.Input02.icon;
        Result.sprite   = currentRecipie.Result.icon;
        resultName.text = currentRecipie.Result.name;
    }
Example #13
0
        public static List <Recipie> search(String str)
        {
            List <Recipie> lst = new List <Recipie>();
            Recipie        obj = null;
            String         q   = "";

            String[] sp   = str.Split(' ');
            int      size = sp.Length;

            String where = " where";
            int i = 0;

            while (i < size)
            {
                where += " lower(Name) like '%" + sp[i].ToLower() + "%'";
                i++;
                if (i < size)
                {
                    where += " OR";
                }
            }

            q  = String.Format("Select * from Recipie");
            q += where;
            try
            {
                using (DBHelper db = new DBHelper())
                {
                    SqlDataReader dr = db.ExecuteReader(q);
                    while (dr.Read())
                    {
                        obj       = new Recipie();
                        obj.ID    = dr.GetInt32(0);
                        obj.Email = dr.GetString(1);
                        obj.Name  = dr.GetString(2);
                        obj.Recip = dr.GetString(3);
                        obj.img   = dr.GetString(4);
                        lst.Add(obj);
                    }
                }
            }
            catch (Exception e)
            {
            }
            return(lst);
        }
Example #14
0
    public void StartRecipie(Recipie newRecipie)
    {
        currentRecipie = newRecipie;
        if (isfirstPlay)
        {
            messageText.DisplayMessage(currentRecipie.name, "Place ingredients in the cauldron");
        }
        else
        {
            messageText.DisplayMessage(currentRecipie.name, "");
        }
        isfirstPlay = false;

        currentStep = 0;
        SetNewColor();
        currentStepStartedTime = Time.time;
        addedIngredientsThisStep.Clear();
    }
Example #15
0
        public ActionResult ChangeLikes(int id = 0)
        {
            if (id > 0)
            {
                var     temp = User.Identity.GetUserId();
                Recipie tr   = db.RecipieDB.Where(m => m.Id == id).SingleOrDefault();
                Like    tl   = db.LikeDB.Where(m => m.RecipeId == id && m.UserId == temp).SingleOrDefault();
                if (tl == null)
                {
                    tl           = new Like();
                    tl.RecipeId  = id;
                    tl.UserId    = User.Identity.GetUserId();
                    tl.TimeLiked = DateTime.Today;
                    db.LikeDB.Add(tl);
                    tr.LikeCounter    += 1;
                    db.Entry(tr).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }
            }

            return(Redirect(Request.UrlReferrer.ToString()));
        }
Example #16
0
        //
        // GET: /Home3/

        public ActionResult Recipie(int ID)
        {
            Recipie obj = DBHandler.DAL.search(ID);

            return(View(obj));
        }
Example #17
0
    // Update is called once per frame
    void Update()
    {
        //Added by Jimmy 2016-04-24
        if (LevelSelectionModal.PauseActive && this.transform.childCount != 0 && PlayerPrefs.GetString("tutorial") != "yes")
        {
            if (this.transform.GetChild(0).GetComponent<BoxCollider2D>())
                this.transform.GetChild(0).GetComponent<BoxCollider2D>().enabled = false;
            else if (this.transform.GetChild(1).GetComponent<BoxCollider2D>())
                this.transform.GetChild(1).GetComponent<BoxCollider2D>().enabled = false;
        }
        else if (!LevelSelectionModal.PauseActive && this.transform.childCount != 0 && PlayerPrefs.GetString("tutorial") != "yes")
        {
            if (this.transform.GetChild(0).GetComponent<BoxCollider2D>())
                this.transform.GetChild(0).GetComponent<BoxCollider2D>().enabled = true;
            else if (this.transform.GetChild(1).GetComponent<BoxCollider2D>())
                this.transform.GetChild(1).GetComponent<BoxCollider2D>().enabled = true;
        }
        //Tutorial
        if (LevelSelectionModal.PauseActive && this.transform.childCount != 0 && PlayerPrefs.GetString("tutorial") == "yes")
        {
            if (this.transform.GetChild(0).GetComponent<BoxCollider2D>())
                this.transform.GetChild(0).GetComponent<BoxCollider2D>().enabled = false;
            else if (this.transform.GetChild(1).GetComponent<BoxCollider2D>())
                this.transform.GetChild(1).GetComponent<BoxCollider2D>().enabled = false;
        }
        else if (!LevelSelectionModal.PauseActive && this.transform.childCount != 0 && PlayerPrefs.GetString("tutorial") == "yes")
        {
            if (this.transform.GetChild(0).GetComponent<BoxCollider2D>() && !GameObject.Find("bg_trans").GetComponent<SpriteRenderer>().enabled)
                this.transform.GetChild(0).GetComponent<BoxCollider2D>().enabled = true;
            else if (this.transform.GetChild(1).GetComponent<BoxCollider2D>() && !GameObject.Find("bg_trans").GetComponent<SpriteRenderer>().enabled)
                this.transform.GetChild(1).GetComponent<BoxCollider2D>().enabled = true;
            else if (this.transform.GetChild(0).GetComponent<BoxCollider2D>() && GameObject.Find("bg_trans").GetComponent<SpriteRenderer>().enabled)
                this.transform.GetChild(0).GetComponent<BoxCollider2D>().enabled = false;
            else if (this.transform.GetChild(1).GetComponent<BoxCollider2D>() && GameObject.Find("bg_trans").GetComponent<SpriteRenderer>().enabled)
                this.transform.GetChild(1).GetComponent<BoxCollider2D>().enabled = false;
        }

        //Debug.Log (hasFood);
        //Debug.Log (waitingOnFood);
        if (needsToOrder)
        {
            //play anim of waving hand

            //temporary instantiation.
            if (!tempObjInstantiated)
            {

                speechBubble = Instantiate(speechBubble, new Vector2(this.transform.parent.position.x, this.transform.parent.position.y + 3.0f), Quaternion.identity) as GameObject;
                speechBubble.transform.parent = transform;

                tempObj = Instantiate(tempObj, new Vector2(this.transform.parent.position.x, this.transform.parent.position.y + 3.0f), Quaternion.identity) as GameObject;
                tempObj.transform.parent = speechBubble.transform;
                tempObjInstantiated = true;

                if (PlayerPrefs.GetString("tutorial") == "yes" && tutArrowCount != 1)
                {
                    Instantiate(tutArrow, new Vector2(speechBubble.transform.position.x - 2.3f, speechBubble.transform.parent.position.y + 0.5f), Quaternion.identity);
                }
            }
        }
        else if (!needsToOrder && tempObj)
        {
            if (PlayerPrefs.GetString("tutorial") == "yes")
            {
                tutArrowCount = 1;
                CircleHighLight.customerCame = true;
                GameObject.Find("Main Camera").GetComponent<Tutorial>().TutDialogue();
            }
            //OpenSignAnim.confirm_tutorial_start = true;
            else
                CircleHighLight.customerCame = false;
            //OpenSignAnim.confirm_tutorial_start = false;
            _Panimator.SetInteger(_PeasantState, 3);
            Destroy(GameObject.Find("Touch(Clone)"));
            Destroy(tempObj);
        }
        if (!hasFood && !needsToOrder && !eatingState) {
            if (!waitingOnFood && !moneyOn) {
                //StartCoroutine(ExecuteAfterDelay(Random.Range (0,5)));
                //Debug.Log(peasantFoodQueue.Peek());
                //current_food = findRecipe(peasantFoodQueue.Dequeue());
                Debug.Log("foodqueue in customer:" + foodQueue.Peek());
                current_food = findRecipe(foodQueue.Peek());
                foodWaitingOn = foodQueue.Dequeue();
                Debug.Log("waiting on: " + foodWaitingOn);
                foodSprite = Instantiate(current_food.go, new Vector2(this.transform.parent.position.x, this.transform.parent.position.y + 3.2f), Quaternion.identity) as GameObject;
                foodSprite.transform.parent = speechBubble.transform;
                StartCoroutine(ScaleOverTime(0.5f, foodSprite));
                waitingOnFood = true;
            }
            else if (food_given == foodWaitingOn)
            {
                if (GameObject.FindGameObjectWithTag("Waitress").GetComponent<Waitress>().hand_with_Food(foodWaitingOn) == "one_h")
                {
                    GameObject.FindGameObjectWithTag("Waitress").GetComponent<Waitress>().one_h = "";
                    Destroy (GameObject.FindGameObjectWithTag("Waitress").GetComponent<Waitress>().go_1h);
                }
                else if (GameObject.FindGameObjectWithTag("Waitress").GetComponent<Waitress>().two_h == foodWaitingOn)
                {
                    GameObject.FindGameObjectWithTag("Waitress").GetComponent<Waitress>().two_h = "";
                    Destroy (GameObject.FindGameObjectWithTag("Waitress").GetComponent<Waitress>().go_2h);
                }
                waitingOnFood = false;
                foodWaitingOn = "none";
                food_given = "";
                //given correct food!
                Debug.Log ("yum!");
                Destroy(foodSprite);
                /**
                    EATING ANIMATION & DELAY - Jimmy 06/23/2016
                **/
                this.gameObject.transform.GetChild(0).GetComponent<SpriteRenderer>().enabled = false; //Speech Bubble
                //this.gameObject.transform.parent.GetChild(0).GetChild(0).GetChild(0).GetComponent<Image>().enabled = false; //Patience Meter
                eatingState = true;
                _Panimator.SetInteger(_PeasantState, 5);
                Invoke("EatingDelay", 2.8f); // 2.8f fixed delay

                //Moved to EatingDelay function
            }
            else if (food_given != foodWaitingOn && !string.IsNullOrEmpty(food_given))
            {
                Debug.Log ("this isn't my order!");
                food_given = "";
            }

            if (moneyPickedUp)
            {
                GameObject.Find("levelHandler").GetComponent<levelHandler>().customersServed++;
                GameObject.Find("levelHandler").GetComponent<levelHandler>().updateBools = true;
                this.GetComponentInParent<CustomerAI>().confirmExit(moneyPickedUp);

                moneyParticle = Instantiate(Resources.Load("Coins"), moneySprite.transform.position, Quaternion.identity) as GameObject;
                moneyParticle.GetComponent<ParticleSystem>().collision.SetPlane(1, GameObject.Find("counter_invis_plane").transform);

                if (this.transform.parent.gameObject.name.Contains("Peasant"))
                {
                    moneyParticle.GetComponent<ParticleSystem>().maxParticles = 1;
                    PlayerPrefs.SetInt("temp_coin", PlayerPrefs.GetInt("temp_coin") + 1);
                    GameObject.FindGameObjectWithTag("MainCamera").GetComponent<coinHandler>().Coins++;
                }
                else if (this.transform.parent.gameObject.name.Contains("Artisan"))
                {
                    moneyParticle.GetComponent<ParticleSystem>().maxParticles = 2;
                    PlayerPrefs.SetInt("temp_coin", PlayerPrefs.GetInt("temp_coin") + 2);
                    GameObject.FindGameObjectWithTag("MainCamera").GetComponent<coinHandler>().Coins+= 2;
                }
                else if (this.transform.parent.gameObject.name.Contains("Middle Class"))
                {
                    moneyParticle.GetComponent<ParticleSystem>().maxParticles = 5;
                    PlayerPrefs.SetInt("temp_coin", PlayerPrefs.GetInt("temp_coin") + 5);
                    GameObject.FindGameObjectWithTag("MainCamera").GetComponent<coinHandler>().Coins += 5;
                }
                else if (this.transform.parent.gameObject.name.Contains("Noble"))
                {
                    moneyParticle.GetComponent<ParticleSystem>().maxParticles = 8;
                    PlayerPrefs.SetInt("temp_coin", PlayerPrefs.GetInt("temp_coin") + 8);
                    GameObject.FindGameObjectWithTag("MainCamera").GetComponent<coinHandler>().Coins += 8;
                }

                moneyParticle.GetComponent<ParticleSystem>().Play();
                levelHandler.customersLeft -= 1;
                Destroy(moneySprite);
                //Destroy(foodSprite);
                Destroy(this.gameObject);
            }
        }
    }
Example #18
0
        public ActionResult UserLike(int id = 1)
        {
            List <Recipie> recList  = new List <Recipie>();
            List <Recipie> newList  = new List <Recipie>();
            List <Like>    likeList = new List <Like>();
            string         y        = User.Identity.GetUserId();

            //Returns a list of likes that the user has chosen.
            likeList = db.LikeDB.Where <Like>(x => x.UserId == y).ToList();

            foreach (Like lk in likeList)
            {
                recList.Add(db.RecipieDB.Where(x => x.Id == lk.RecipeId).Single());
            }
            //this should find the total number of pages, using the decimal to keep decimals until after rounding.
            int totalPages = (int)Math.Ceiling(((decimal)recList.Count) / (decimal)(12));


            //Checks to see if the id is a valid number
            if (id < 1)
            {
                id = 1;
            }

            //Checks to see if the id is within number of archive pages.
            else if (id > totalPages)
            {
                //TODO should add an error page for out of range ids
                id = totalPages;
            }

            //this should return the beginning record of a page.
            int counter = ((id - 1) * 12);

            if (recList.Count > 12)
            {
                for (int i = 0; i < 12; i++)
                {
                    newList.Add(recList[counter]);
                    counter++;
                }
            }
            else
            {
                for (int i = 0; i < recList.Count; i++)
                {
                    newList.Add(recList[counter]);
                    counter++;
                }
            }
            List <Bits_and_Bites.Models.Image> imList = new List <Bits_and_Bites.Models.Image>();
            List <RecipeWhole> wholeRec = new List <RecipeWhole>();

            foreach (Recipie i in newList)
            {
                Bits_and_Bites.Models.Image result = db.ImageDB.SingleOrDefault(tempIm => tempIm.Id == i.ImageID);
                imList.Add(result);
            }

            for (int i = 0; i < newList.Count; i++)
            {
                RecipeWhole x = new RecipeWhole
                {
                    CombRecipe = newList[i],
                    CombImage  = imList[i]
                };
                var     temp = User.Identity.GetUserId();
                Recipie tr   = db.RecipieDB.Where(m => m.Id == id).SingleOrDefault();
                Like    tl   = db.LikeDB.Where(m => m.RecipeId == id && m.UserId == temp).SingleOrDefault();
                wholeRec.Add(x);
            }

            ViewBag.Total    = totalPages;
            ViewBag.ThisPage = id;
            return(View(wholeRec));
        }
Example #19
0
    void cooking(string i1)
    {
        //checks a list of recipies and sees what you can cook.
        //if there is something,  remove the ingredients from the cook,
        //and saves the name of the food thats cooking. save the
        //current time, and then wait how long it takes to make the food.
        if (canCook(i1))
        {
            current_recipie = findRecipe (i1);
            food_cooking_name = current_recipie.name;
            createGrillTimer();
            if(food_cooking_name == "fish stew" || food_cooking_name == "onion soup" || food_cooking_name == "cheese stew" || food_cooking_name == "meat stew"){
                source.Stop ();
                source.PlayOneShot(bubblingSFX, .6f);
                source.PlayOneShot (friedEggSFX);
            }
            if(food_cooking_name == "grilled fish" || food_cooking_name == "grilledMeat"){
                source.Stop ();
                source.PlayOneShot(grillSizzleSFX, .35f);
            }
            if(food_cooking_name == "grilled carrot" || food_cooking_name == "grilled onion"){
                source.Stop ();
                source.PlayOneShot(friedEggSFX, .35f);
            }
            if( food_cooking_name == "bread"){
                source.PlayOneShot(tickingSFX, .50f);
                createOvenTimer();
            }
            //Debug.Log (current_recipie.timeToMake);
            Destroy(_cookingSpriteIdle);
            _cookingSprite = Instantiate(cookingSprite, transform.position + new Vector3(0.025f, 0.025f), transform.rotation) as GameObject;
            chef_1h = "";
            isCooking = true;
            time_to_cook = current_recipie.timeToMake + Time.time;
            start_time = Time.time;
            timeSaved = true;
            //Invoke("cookFood", current_recipie.timeToMake); //wait for food to be done...
            //Debug.Log ("food done!");
            //food is done! animation here.
            //food_ready = true;

        }
        else
        {
            //can't cook anything!
        }
    }
Example #20
0
 public void DeselectBook()
 {
     bookStand.UnequipBook();
     currentRecipie = null;
     currentStep    = 0;
 }
Example #21
0
        public void HaveATitle()
        {
            Recipie recipie = new Recipie("Crema de calabaza");

            Assert.IsType <Recipie>(recipie);
        }
Example #22
0
    public MainWindow()
    {
        using (SqlConnection dataConnection = new SqlConnection(ConfigurationManager.AppSettings["SQL_URI"]))
        {
            dataConnection.Open();

            //load loot
            string selectLoot = @"SELECT *
								  FROM loot
								  ORDER BY id"                                ;
            using (SqlCommand comm = new SqlCommand(selectLoot, dataConnection))
            {
                using (SqlDataReader reader = comm.DataReader())
                {
                    while (reader.Read())
                    {
                        LootItem li = new LootItem();
                        li.id          = (int)reader["id"];
                        li.name        = (string)reader["name"];
                        li.description = (string)reader["description"];

                        LootItemQty liq = new LootItemQty();
                        liq.item = li;
                        liq.qty  = (int)reader["qty"];

                        loot.Add(liq);
                    }
                }
            }

            //load recipies
            string selectRecipies = @"SELECT *
									  FROM recipies
									  ORDER BY id"                                    ;
            using (SqlCommand comm = new SqlCommand(selectRecipies, dataConnection))
            {
                using (SqlDataReader reader = comm.DataReader())
                {
                    while (reader.Read())
                    {
                        Recipie r = new Recipie();
                        r.id = (int)reader["id"];

                        string selectIngredients = @"SELECT *
													 FROM recipieIngredients
													 WHERE recipieID = '"                                                     + r.id + "'";
                        using (SqlCommand commIngredients = new SqlCommand(selectIngredients, dataConnection))
                        {
                            using (SqlDataReader readerIngredients = commIngredients.DataReader())
                            {
                                while (readerIngredients.Read())
                                {
                                    LootItemQty liq = new LootItemQty();
                                    liq.item = findLootInInventory((int)reader["ingredient"]).item;
                                    liq.qty  = (int)reader["qty"];
                                    r.ingredients.add(liq);
                                }
                            }
                        }
                        LootItem result = findLootInInventory((int)reader["result"]).item;
                        r.resultQty    = (int)reader["resultQty"];
                        r.profession   = (string)reader["profession"];
                        r.crafterLevel = (string)reader["crafterLevel"];

                        recipies.Add(r);
                    }
                }
            }
        }
    }
Example #23
0
 void Start()
 {
     createBurnTimer = false;
     //Debug.Log(GetComponent<recipeRepository>().cookingObjectName);
     foreach (Recipie a in GetComponent<recipeRepository>().recipes)
     {
         Debug.Log(a.name);
     }
     if (recipie1)
     recipie1 = Instantiate (recipie1);
     if (recipie2)
     recipie2 = Instantiate (recipie2);
     //if (needsFurnace) {
 }
Example #24
0
    // Update is called once per frame
    void Update()
    {
        if (needsFurnace) {
            bool furnaceOn = GameObject.Find ("furnace").GetComponent<Furnace> ().isOn;
            this.GetComponent<Animator>().SetBool("furnaceOn", furnaceOn);
            if (!string.IsNullOrEmpty(chef_1h) && !_cookingSpriteIdle && !isCooking)
            {
                _cookingSpriteIdle = Instantiate(cookingSpriteIdle, transform.position, transform.rotation) as GameObject;
            }
            if (!isCooking && !food_ready && furnaceOn) {
                //isCooking = true;
                start_time = Time.time;
                cooking (chef_1h);

            }
            if (!furnaceOn && timeSaved)
            {
                timeSaved = false;
                time_to_cook -= Time.time; //time to cook - currnet time = new time to cook.
            }
            if (isCooking && furnaceOn && !timeSaved)
            {
                //furnace is off, save time to cook.
                timeSaved = true;
                time_to_cook += Time.time; //add Time.time, to get new end time when furnace starts up again.
                start_time = Time.time;
                Debug.Log ("TIME TO COOK: " + time_to_cook);
                Debug.Log ("TIME: " + Time.time);
            }
            else if (isCooking && furnaceOn) {
                //timeSaved = false;
                if (Time.time >= time_to_cook) {
                    cookFood (); //food is finished
                } else {
                    //do nothing, wait for food to cook.
                }
            }
            else if (food_ready && canBurn && isBurning)
            {
                /*
                if (burn_time_start)
                {
                    burn_start_time = Time.time;
                    burn_time_start = false;
                }
                */
                if (!furnaceOn && burn_timeSaved)
                {
                    burn_timeSaved = false;
                    burn_time_to_cook -= Time.time; //time to cook - currnet time = new time to cook.
                }
                if (furnaceOn)
                {
                    if (!burn_timeSaved)
                    {
                        //furnace is off, save time to cook.
                        burn_timeSaved = true;
                        burn_time_to_cook += Time.time; //add Time.time, to get new end time when furnace starts up again.
                        burn_start_time = Time.time;
                        Debug.Log("BURN TIME TO COOK: " + burn_time_to_cook);
                        Debug.Log("TIME: " + Time.time);
                    }
                    //burn timer
                    //Debug.Log("burn time:" + burn_time_to_cook);
                    //Debug.Log("time: " + Time.time);
                    if (Time.time >= burn_time_to_cook && !burned)
                    {
                        //burned!
                        if (name.Contains("grill"))
                        {
                            current_recipie = findRecipe("ash_grill");
                        }
                        else if (name.Contains("oven"))
                        {
                            Debug.Log(name);
                            current_recipie = findRecipe("ash_oven");
                        }
                        Debug.Log("burned!");
                        Destroy(foodSprite);
                        foodSprite = Instantiate(current_recipie.finishedDish, transform.position, transform.rotation) as GameObject;
                        //Debug.Log("burned!");
                        burned = true;
                        isBurning = false;
                        burn_time_start = true;
                        //current_recipie = Resources.Load()
                    }
                }
                else if (!furnaceOn)
                {
                    //burn_timeSaved = false;
                    //burn_time_to_cook -= Time.time;
                }
            }

        } else {
            if (!isCooking && !food_ready) {
                //isCooking = true;
                cooking (chef_1h);
            }
            //this.GetComponent<SpriteRenderer> ().color = c;

        }
        if (!food_ready && foodSprite) {
            Destroy (foodSprite);
            burned = false;
        }
        genBurnTimer = food_ready;
    }
Example #25
0
 //test
 IEnumerator ExecuteAfterDelay(float delay)
 {
     Debug.Log (delay);
     yield return new WaitForSeconds(delay);
     current_food = randomRecipe();
     foodWaitingOn = current_food.name;
     Debug.Log ("waiting on: " + foodWaitingOn);
     foodSprite = Instantiate (current_food.go, new Vector2(this.transform.parent.position.x, this.transform.parent.position.y + 2.8f), Quaternion.identity) as GameObject;
     foodSprite.transform.parent = transform;
     waitingOnFood = true;
     //food_ready = true;
     //update sprite;
 }