Exemplo n.º 1
0
 public void PanelOn(Ingredient ingredient, GameObject exPanel)
 {
     this.ingredient = ingredient;
     this.exPanel    = exPanel;
     exPanel.gameObject.SetActive(false);
     ingredientInfo.IngredientChange(ingredient, gameObject);
     Eye();
 }
Exemplo n.º 2
0
    public void AddIngredientBookmarks()
    {
        List <int>    ingredientBookmarkList = StringToIntList(Panels.instance.memberInfo.member.ingredientBookmarks);
        int           amount       = ingredientBookmarkList.Count;
        Vector2       panelSize    = body.GetComponent <RectTransform>().rect.size;
        RectTransform content      = body.GetChild(1).GetChild(0).GetComponent <RectTransform>();
        float         ySize        = panelSize.y / ingredientOnePageAmount;
        float         contentYSize = panelSize.y;

        if (amount > ingredientOnePageAmount)
        {
            contentYSize = ySize * amount;
        }
        content.offsetMin     = new Vector2(0, 0);
        content.offsetMax     = new Vector2(0, contentYSize);
        content.localPosition = new Vector2(0, -contentYSize / 2);
        for (int i = 0; i < amount; i++)
        {
            Transform newBookmark = Instantiate(ingredientBookmark);
            newBookmark.SetParent(content);
            IngredientBookmark bookmarkInfo = newBookmark.GetComponent <IngredientBookmark>();

            ingredientBookmarks.Add(bookmarkInfo);
            RectTransform rectTransform = newBookmark.GetComponent <RectTransform>();

            rectTransform.offsetMin     = Vector2.zero;
            rectTransform.offsetMax     = new Vector2(0, ySize);
            rectTransform.localPosition = new Vector2(0, contentYSize / 2 + -ySize * i - ySize / 2);

            int    ingredientID = ingredientBookmarkList[i];
            string sql          = "SELECT * FROM ingredient WHERE id = " + ingredientID + ";";
            MySql.Data.MySqlClient.MySqlDataReader reader = DbConnecter.instance.Reader(sql);
            reader.Read();

            Ingredient ingredient = new Ingredient();
            ingredient.id            = reader.GetInt32(0);
            ingredient.casNo         = reader.GetString(1);
            ingredient.english       = reader.GetString(2);
            ingredient.korean        = reader.GetString(3);
            ingredient.ewgGrade      = reader.GetString(4);
            ingredient.eye           = reader.GetString(5);
            ingredient.respiratory   = reader.GetString(6);
            ingredient.digestive     = reader.GetString(7);
            ingredient.reproductive  = reader.GetString(8);
            ingredient.integumentary = reader.GetString(9);
            reader.Close();
            DbConnecter.instance.CloseConnection();
            IngredientInfo ingredientInfo = newBookmark.GetChild(0).GetComponent <IngredientInfo>();
            ingredientInfo.IngredientChange(ingredient, gameObject);

            bookmarkInfo.ingredientID = ingredient.id;
        }
    }
Exemplo n.º 3
0
    float ShowIngredient(List <Ingredient> ingredients, float startYMax, float yRate)
    {
        int   amount        = ingredients.Count;
        float yAnchorHeight = amount * yRate;
        float nextYMax      = SizeChange(ingredientListPanel, startYMax, startYMax - yAnchorHeight);

        for (int i = 0; i < amount; i++)
        {
            Transform newTextBox = Instantiate(ingredientInfoPanel);
            newTextBox.SetParent(ingredientListPanel.transform);
            RectTransform rectTransform = newTextBox.GetComponent <RectTransform>();
            float         yMax          = 1 - i / (float)amount;
            float         yMin          = 1 - (i + 1) / (float)amount;
            SizeChange(rectTransform, yMax, yMin);
            IngredientInfo ingredientInfo = newTextBox.GetComponent <IngredientInfo>();
            Ingredient     ingredient     = ingredients[i];
            ingredientInfo.IngredientChange(ingredient, gameObject);
        }
        return(nextYMax);
    }