Esempio n. 1
0
        //初始化初级精油的数量列表
        private void InitPOilMaterial()
        {
            for (int i = 0; i < MaterialList.childCount; i++)
            {
                GameObject go = MaterialList.GetChild(i).gameObject;
                GameObject.Destroy(go);
            }

            Dictionary <int, Oil> oils = Farm_Game_StoreInfoModel.storage.Oils;

            foreach (Oil o in oils.Values)
            {
                if (o.OilType == 3)
                {
                    GameObject go     = GameObject.Instantiate(fcItemPrefab) as GameObject;
                    FcItem     fcitem = go.AddComponent <FcItem>();
                    fcitem.SetData(o);

                    go.transform.SetParent(MaterialList);
                    go.transform.localScale = new Vector3(1, 1, 1);
                }
            }

            Dictionary <int, Formula> f = Farm_Game_StoreInfoModel.storage.Formulas;

            if (f.Count > 0)
            {
                GameObject _go     = GameObject.Instantiate(fcItemPrefab) as GameObject;
                FcItem     _fcitem = _go.AddComponent <FcItem>();
                _fcitem.SetData(f[0]);
                _go.transform.SetParent(MaterialList);
                _go.transform.localScale = new Vector3(1, 1, 1);
            }
        }
Esempio n. 2
0
        //初始化果实材料
        private void InitMaterials()
        {
            for (int i = 0; i < MaterialList.childCount; i++)
            {
                GameObject go = MaterialList.GetChild(i).gameObject;
                GameObject.Destroy(go);
            }


            Dictionary <int, Result> results = Farm_Game_StoreInfoModel.storage.Results;

            foreach (Result r in results.Values)
            {
                GameObject go     = GameObject.Instantiate(fcItemPrefab) as GameObject;
                FcItem     fcitem = go.AddComponent <FcItem>();
                fcitem.SetData(r);

                go.transform.SetParent(MaterialList);
                go.transform.localScale = new Vector3(1, 1, 1);
            }
        }