Example #1
0
        private bool InitDogInfo(int eventId, object arg)
        {
            LoginModel       player = LoginModel.Instance;
            StorageDeltaList deltas = Farm_Game_StoreInfoModel.storage;
            int dogFoodCount        = 0;

            if (deltas.DogFoods.Count > 0)
            {
                dogFoodCount = deltas.DogFoods[601].ObjectNum;
            }
            Level.text           = "等级:LV" + player.DogLv;
            Grow_Slider.maxValue = player.DogUpgradeMaxExp;
            Grow_Slider.minValue = 0;
            Grow_Slider.value    = player.DogCurrentExp;
            Chance.text          = "防盗概率:" + player.Chance + "%";

            if (player.DogLv >= 3)
            {
                Grow_Text.text       = "已到最高等级";
                Grow_Slider.maxValue = 1;
                Grow_Slider.minValue = 0;
                Grow_Slider.value    = 1;

                Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", "test", "test1"));
            }
            else
            {
                Grow_Text.text = player.DogCurrentExp + "/" + player.DogUpgradeMaxExp;
            }


            if (dogFoodCount <= 0)
            {
                DogFoodCount.text = "没有狗粮了\n请前往商店购买!";
                FeedBtn_Text.text = "前往商店";
            }
            else
            {
                DogFoodCount.text = "x" + dogFoodCount.ToString();
                FeedBtn_Text.text = "喂养";
            }

            return(false);
        }
Example #2
0
        //加载仓库物品
        private bool LoadItems(int eventId, object arg)
        {
            if (ItemPrefab == null)
            {
                isFrist = false;
                return(false);
            }
            LoadingImageManager.Instance.StartLoading(TargetGo.transform, TargetGo.transform.position);

            StorageDeltaList store = Farm_Game_StoreInfoModel.storage;

            SetGrid <Seed>(SeedGrid, store.Seeds);
            SetGrid <Result>(FruitGrid, store.Results);
            SetOilGrid(OilGrid_Primary, OilGrid_Semi, OilGrid_Senior, store.Oils, store.Formulas);
            SetGrid <Fertilizer>(PlantFoodGrid, store.Fertilizers);
            SetGrid <Elixir>(PlantFoodGrid, store.Elixirs);
            LoadingImageManager.Instance.StopLoading();

            return(false);
        }
Example #3
0
        //仓库信息输入
        public static void SetStoreAnwData(IList <PMsg_StagePropUnit> list)
        {
            StorageDeltaList storageDeltaList = Farm_Game_StoreInfoModel.storage;

            if (list != null)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    //移除该id的信息,后面重新输入
                    storageDeltaList.Seeds.Remove(list[i].Id);
                    storageDeltaList.Results.Remove(list[i].Id);
                    storageDeltaList.Oils.Remove(list[i].Id);
                    storageDeltaList.DogFoods.Remove(list[i].Id);
                    storageDeltaList.Fertilizers.Remove(list[i].Id);
                    storageDeltaList.Elixirs.Remove(list[i].Id);
                    storageDeltaList.Formulas.Remove(list[i].Id);
                    //若数量为0,则表示该物品已从仓库移除

                    BaseAtrribute item = LoadObjctDateConfig.Instance.GetAtrribute(list[i].Id);

                    if (list[i].Count == 0)
                    {
                        switch (item.Type)
                        {
                        case ObjectType.Seed:
                            Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", list[i].Id, "test1"));

                            storageDeltaList.Seeds.Remove(list[i].Id);
                            Seed seed;
                            if (storageDeltaList.Seeds.TryGetValue(list[i].Id, out seed))
                            {
                                Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", seed.Name, "test1"));
                            }

                            Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", "test", "test1"));

                            break;

                        case ObjectType.Result:
                            storageDeltaList.Results.Remove(list[i].Id);
                            break;

                        case ObjectType.SeniorOil:
                        case ObjectType.PrimaryOil:
                        case ObjectType.SemiOil:
                            storageDeltaList.Oils.Remove(list[i].Id);
                            break;

                        case ObjectType.DogFood:
                            storageDeltaList.DogFoods.Remove(list[i].Id);
                            break;

                        case ObjectType.Fertilizer:
                            storageDeltaList.Fertilizers.Remove(list[i].Id);
                            break;

                        case ObjectType.elixir:
                            storageDeltaList.Elixirs.Remove(list[i].Id);
                            break;

                        case ObjectType.formula:
                            storageDeltaList.Formulas.Remove(list[i].Id);
                            break;

                        default:
                            Debug.LogError("后台返回了不该在仓库的东西:" + item.Name);
                            break;
                        }
                    }
                    else
                    {
                        if (item != null)
                        {
                            switch (item.Type)
                            {
                            case ObjectType.Seed:

                                storageDeltaList.Seeds.Add(list[i].Id, SetSeedAnwData(list[i]));
                                //                                Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", storageDeltaList.Seeds[list[i].Id].Name, storageDeltaList.Seeds[list[i].Id].ObjectNum));

                                break;

                            case ObjectType.Result:
                                storageDeltaList.Results.Add(list[i].Id, SetResultAnwData(list[i]));
                                break;

                            case ObjectType.SeniorOil:
                            case ObjectType.PrimaryOil:
                            case ObjectType.SemiOil:
                                storageDeltaList.Oils.Add(list[i].Id, SetOilAnwData(list[i]));
                                break;

                            case ObjectType.DogFood:
                                storageDeltaList.DogFoods.Add(list[i].Id, SetDogFoodAnwData(list[i]));
                                break;

                            case ObjectType.Fertilizer:
                                storageDeltaList.Fertilizers.Add(list[i].Id, SetFertilizerAnwData(list[i]));
                                break;

                            case ObjectType.elixir:
                                storageDeltaList.Elixirs.Add(list[i].Id, SetElixirAnwData(list[i]));
                                break;

                            case ObjectType.formula:
                                storageDeltaList.Formulas.Add(list[i].Id, SetFormulaAnwData(list[i]));
                                break;

                            default:
                                Debug.LogError("后台返回了不该在仓库的东西:" + item.Name);
                                break;
                            }
                        }
                    }
                }

                if (storageDeltaList.Seeds.Count == 0)
                {
                    if (ViewMgr.Instance.isOpen(ViewNames.SeedBarView))
                    {
                        SystemMsgView.SystemFunction(Function.OpenDialog, Info.SeedNumNotEngouth, ViewNames.ShopView, (
                                                         () =>
                        {
                            SeedBarView.PlayBack();
                        }));
                    }
                }
            }
            Farm_Game_StoreInfoModel.storage = storageDeltaList;
        }