예제 #1
0
 /// <summary>
 /// 关闭菜单
 /// </summary>
 public void CloseDetail()
 {
     TweenPositions[0].PlayReverse();
     if (ShowSimilar.activeSelf)
     {
         ShowSimilar.SetActive(false);
     }
 }
예제 #2
0
    /// <summary>
    /// 显示详细信息
    /// </summary>
    /// <param name="clickName"></param>
    /// <param name="clickTag"></param>
    public void ShowDetail(string clickName, string clickTag)
    {
        TweenPositions[0].PlayForward();
        TitleLabel.text = clickName;
        string[] strings    = clickName.Split('-');
        int      shelfIndex = Convert.ToInt32(strings[0]) - 1;
        int      floorIndex = Convert.ToInt32(strings[1]) - 1;
        Dictionary <string, Good> dictionary = new Dictionary <string, Good>();

        //Good good;
        try
        {
            switch (clickTag)
            {
            case "Floor":

                Cell[] cells = GameController.Shelves[shelfIndex].floors[floorIndex].cells;
                foreach (var _cell in cells)
                {
                    foreach (var good in _cell.goods)
                    {
                        if (dictionary.ContainsKey(good.name))
                        {
                            dictionary[good.name].num += good.num;
                        }
                        else
                        {
                            dictionary[good.name] = new Good
                            {
                                id         = 0,
                                name       = good.name,
                                model_name = good.model_name,
                                unit       = good.unit
                            };
                        }
                    }
                }

                break;

            case "Cell":
                if (_lastClickGood != null)
                {
                    ShowSimilar.SetActive(true);
                }
                int    cellIndex = Convert.ToInt32(strings[2]) - 1;
                Good[] goods     = GameController.Shelves[shelfIndex].floors[floorIndex].cells[cellIndex].goods;
                foreach (var good in goods)
                {
                    dictionary[good.name] = good;
                    //Detail.SetData(good);
                }
                break;
            }
        }
        catch (Exception exception)
        {
            Debug.Log(exception);
        }
        ShowData(2, dictionary);
    }