protected void SetItem(ref int cnt)
        {
            CharaData chara = this.GetChara(ref cnt);

            if (chara == null)
            {
                return;
            }
            string[] args1 = this.args;
            int      num1;

            cnt = (num1 = cnt) + 1;
            int           index1   = num1;
            int           nameHash = int.Parse(args1[index1]);
            StuffItemInfo itemInfo = Singleton <Resources> .Instance.GameInfo.FindItemInfo(nameHash);

            if (itemInfo == null)
            {
                Debug.LogError((object)string.Format("Item none:{0}", (object)nameHash));
            }
            else
            {
                string[] args2 = this.args;
                int      num2;
                cnt = (num2 = cnt) + 1;
                int index2 = num2;
                int result;
                if (!int.TryParse(args2[index2], out result))
                {
                    Debug.LogError((object)string.Format("Num none:{0}[{1}]:{2}", (object)"args", (object)(cnt - 1), (object)this.args[cnt - 1]));
                    result = 1;
                }
                this.ItemListProc(itemInfo, chara.data.characterInfo.ItemList, new StuffItem(itemInfo.CategoryID, itemInfo.ID, result));
            }
        }
예제 #2
0
        public static bool AddItemVars(this TextScenario self, StuffItem Item)
        {
            Dictionary <string, ValData> vars = self.Vars;
            string        index1        = nameof(Item);
            StuffItemInfo stuffItemInfo = (StuffItemInfo)null;

            if (Item != null && Singleton <Resources> .IsInstance())
            {
                stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(Item.CategoryID, Item.ID);
            }
            vars[index1] = new ValData((object)(stuffItemInfo?.Name ?? string.Empty));
            Dictionary <string, ValData> dictionary = vars;
            string  index2   = string.Format("{0}.Hash", (object)index1);
            int?    nameHash = stuffItemInfo?.nameHash;
            ValData valData  = new ValData((object)(!nameHash.HasValue ? -1 : nameHash.Value));

            dictionary[index2] = valData;
            if (Item == null)
            {
                return(false);
            }
            vars[string.Format("{0}.{1}", (object)index1, (object)"CategoryID")] = new ValData((object)Item.CategoryID);
            vars[string.Format("{0}.{1}", (object)index1, (object)"ID")]         = new ValData((object)Item.ID);
            vars[string.Format("{0}.{1}", (object)index1, (object)"Count")]      = new ValData((object)Item.Count);
            return(true);
        }
        public void ResetFollowPercentage()
        {
            this.FollowPercentage = 0.0f;
            FishFoodInfo selectedFishFood = MapUIContainer.FishingUI.SelectedFishFood;

            if (selectedFishFood == null)
            {
                return;
            }
            FishInfo      fishInfo      = this.fish.fishInfo;
            StuffItemInfo stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(fishInfo.CategoryID, fishInfo.ItemID);

            if (stuffItemInfo == null)
            {
                return;
            }
            Dictionary <int, Dictionary <int, float> > hitBaseRangeTable = Singleton <Resources> .Instance.Fishing.FishHitBaseRangeTable;
            int grade = (int)stuffItemInfo.Grade;
            Dictionary <int, float> dictionary;
            float num;

            if (!hitBaseRangeTable.TryGetValue(fishInfo.SizeID, out dictionary) || !dictionary.TryGetValue(grade, out num))
            {
                return;
            }
            float element = (float)selectedFishFood.RarelityHitRange.GetElement <int>(grade);

            this.FollowPercentage = Mathf.Clamp(num + element, 0.0f, 100f);
        }
예제 #4
0
 public VendItemInfo(StuffItemInfo info, VendData.Param param)
     : this(info)
 {
     this.Rate    = param.Rate;
     this.Stocks  = param.Stocks;
     this.Percent = param.Percent;
 }
예제 #5
0
        public void SetPlantItemForAll(StuffItem item, int count)
        {
            StuffItemInfo stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(item.CategoryID, item.ID);

            if (stuffItemInfo == null)
            {
                Debug.LogError((object)string.Format("Item not Find\n[{0}:{1}][{2}:{3}]", (object)"CategoryID", (object)item.CategoryID, (object)"ID", (object)item.ID), (Object)this);
            }
            else
            {
                int num = 0;
                for (int index = 0; index < this._plantList.Count; ++index)
                {
                    if (this._plantList[index] == null)
                    {
                        if (num++ >= count)
                        {
                            break;
                        }
                        AIProject.SaveData.Environment.PlantInfo plantInfo = Singleton <Resources> .Instance.GameInfo.GetPlantInfo(stuffItemInfo.nameHash);

                        this._plantIcons[index].info = plantInfo;
                        this._plantList[index]       = plantInfo;
                    }
                }
            }
        }
예제 #6
0
 protected override void OnAwake(PlayerActor player)
 {
     player.SetActiveOnEquipedItem(false);
     player.ChaControl.setAllLayerWeight(0.0f);
     this.isEnd         = false;
     this.isWait        = (Func <PlayerActor, bool>)null;
     this.isNextEnabled = false;
     if (this.disposable != null)
     {
         this.disposable.Clear();
     }
     this.disposable = new CompositeDisposable();
     if (Object.op_Equality((Object)(this.hasAnimal = player.Animal), (Object)null))
     {
         this.isEnd = true;
         this.ToErrorEnd(player);
     }
     else
     {
         this.animalName    = this.hasAnimal.Name;
         this.isCameraBlend = true;
         this.getPercent    = 30f;
         if (this.hasAnimal is WildGround)
         {
             this.getPercent = (this.hasAnimal as WildGround).GetPercent;
         }
         this.getAnimalFlag = (double)Random.Range(0.0f, 100f) <= (double)this.getPercent;
         if (this.getAnimalFlag && Singleton <Resources> .IsInstance() && Singleton <Manager.Map> .IsInstance())
         {
             List <StuffItem> itemList = Singleton <Manager.Map> .Instance.Player?.PlayerData?.ItemList;
             if (itemList != null)
             {
                 this.getIteminfo = this.hasAnimal.ItemInfo;
                 if (this.getIteminfo != null)
                 {
                     this.addItem = new StuffItem(this.getIteminfo.CategoryID, this.getIteminfo.ID, 1);
                     itemList.AddItem(this.addItem);
                 }
             }
         }
         if (Singleton <Manager.Map> .IsInstance())
         {
             List <StuffItem> itemList = Singleton <Manager.Map> .Instance.Player?.PlayerData?.ItemList;
             if (itemList != null && this.hasAnimal is WildGround)
             {
                 ItemIDKeyPair getItemId = (this.hasAnimal as WildGround).GetItemID;
                 itemList.RemoveItem(new StuffItem(getItemId.categoryID, getItemId.itemID, 1));
             }
         }
         MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.None);
         if (this.hasAnimal.AnimalType == AnimalTypes.Cat || this.hasAnimal.AnimalType == AnimalTypes.Chicken)
         {
             this.Initialize(player);
         }
         else
         {
             this.ToErrorEnd(player);
         }
     }
 }
예제 #7
0
        public ItemNodeUI AddItemNode(int id, StuffItem item)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            ItemListUI.\u003CAddItemNode\u003Ec__AnonStorey2 nodeCAnonStorey2 = new ItemListUI.\u003CAddItemNode\u003Ec__AnonStorey2();
            // ISSUE: reference to a compiler-generated field
            nodeCAnonStorey2.id = id;
            // ISSUE: reference to a compiler-generated field
            nodeCAnonStorey2.\u0024this = this;
            StuffItemInfo itemInfo = ItemNodeUI.GetItemInfo(item);

            if (itemInfo == null)
            {
                return((ItemNodeUI)null);
            }
            GameObject gameObject = itemInfo.isNone ? ItemListUI.SystemNode : this.OptionNode;

            // ISSUE: reference to a compiler-generated field
            nodeCAnonStorey2.opt = (ItemNodeUI)((GameObject)Object.Instantiate <GameObject>((M0)gameObject, this.itemParent)).GetComponent <ItemNodeUI>();
            // ISSUE: reference to a compiler-generated field
            nodeCAnonStorey2.opt.Bind(item, itemInfo);
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated method
            DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <PointerEventData>((IObservable <M0>)nodeCAnonStorey2.opt.onEnter, (Action <M0>) new Action <PointerEventData>(nodeCAnonStorey2.\u003C\u003Em__0)), (Component)this);
            // ISSUE: reference to a compiler-generated field
            // ISSUE: method pointer
            ((UnityEvent)nodeCAnonStorey2.opt.OnClick).AddListener(new UnityAction((object)nodeCAnonStorey2, __methodptr(\u003C\u003Em__1)));
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            this._optionTable.Add(nodeCAnonStorey2.id, nodeCAnonStorey2.opt);
            // ISSUE: reference to a compiler-generated field
            return(nodeCAnonStorey2.opt);
        }
예제 #8
0
 protected override void ItemListProc(
     StuffItemInfo itemInfo,
     List <StuffItem> itemList,
     StuffItem stuffItem)
 {
     Debug.Log((object)string.Format("AddItem:{0}x{1}", (object)itemInfo.Name, (object)stuffItem.Count));
     itemList.AddItem(stuffItem);
 }
예제 #9
0
 public VendItemInfo(StuffItemInfo info, VendSpecialData.Param param)
     : this(info)
 {
     this.Rate   = param.Rate;
     this.Stocks = new int[1] {
         param.Stock
     };
 }
예제 #10
0
        public virtual void Refresh(StuffItem item)
        {
            StuffItemInfo itemInfo = this.GetItemInfo(item);

            this._itemName.set_text(itemInfo.Name);
            this._flavorText.set_text(itemInfo.Explanation);
            this.Refresh(item.Count);
        }
예제 #11
0
        public override void Refresh(StuffItem item)
        {
            this._item = item;
            StuffItemInfo stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(item.CategoryID, item.ID);

            this.itemName = stuffItemInfo.Name;
            ((ReactiveProperty <int>) this._createSum).SetValueAndForceNotify(0);
            this._flavorText.set_text(stuffItemInfo.Explanation);
            this.Refresh(item.Count);
        }
예제 #12
0
        public override void Refresh(StuffItem item)
        {
            StuffItemInfo stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(item.CategoryID, item.ID);

            this._itemName.set_text(stuffItemInfo.Name);
            this._flavorText.set_text(stuffItemInfo.Explanation);
            if (Object.op_Inequality((Object)this._infoLayout, (Object)null))
            {
                this._infoLayout.SetActive(stuffItemInfo.isTrash);
            }
            this.Refresh(item.Count);
        }
예제 #13
0
        public void Refresh(StuffItem item)
        {
            StuffItemInfo stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(item.CategoryID, item.ID);

            this._itemName.set_text(stuffItemInfo.Name);
            this._flavorText.set_text(stuffItemInfo.Explanation);
            if (Object.op_Inequality((Object)this._trashField, (Object)null))
            {
                this._trashField.SetActive(stuffItemInfo.isTrash);
            }
            this._countViewer.MaxCount   = Mathf.Max(item.Count, 1);
            this._countViewer.ForceCount = Mathf.Clamp(this._countViewer.Count, 1, this._countViewer.MaxCount);
        }
예제 #14
0
        public bool UpdateUI(Manager.Housing.LoadInfo _loadInfo)
        {
            bool flag = true;

            if (((IList <Manager.Housing.RequiredMaterial>)_loadInfo.requiredMaterials).IsNullOrEmpty <Manager.Housing.RequiredMaterial>())
            {
                foreach (MaterialUI.MaterialInfo materialInfo in this.materialInfos)
                {
                    materialInfo.Active = false;
                }
                return(true);
            }
            for (int index = 0; index < this.materialInfos.Length; ++index)
            {
                Manager.Housing.RequiredMaterial requiredMaterial = _loadInfo.requiredMaterials.SafeGet <Manager.Housing.RequiredMaterial>(index);
                if (requiredMaterial == null)
                {
                    this.materialInfos[index].Active = false;
                }
                else
                {
                    StuffItemInfo stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(requiredMaterial.category, requiredMaterial.no);

                    if (stuffItemInfo == null)
                    {
                        this.materialInfos[index].Active = false;
                    }
                    else
                    {
                        int       _num       = 0;
                        StuffItem stuffItem1 = new StuffItem(requiredMaterial.category, requiredMaterial.no, 0);
                        StuffItem stuffItem2 = Singleton <Manager.Map> .Instance.Player.PlayerData.ItemList.FindItem(stuffItem1);

                        if (stuffItem2 != null)
                        {
                            _num += stuffItem2.Count;
                        }
                        StuffItem stuffItem3 = Singleton <Game> .Instance.Environment.ItemListInStorage.FindItem(stuffItem1);

                        if (stuffItem3 != null)
                        {
                            _num += stuffItem3.Count;
                        }
                        flag &= this.materialInfos[index].Set(stuffItemInfo.Name, _num, requiredMaterial.num);
                        this.materialInfos[index].Active = true;
                    }
                }
            }
            return(flag);
        }
예제 #15
0
        public void Refresh(CraftUI craftUI)
        {
            this.itemListUI.ClearItems();
            this.ResetScroll();
            craftUI.SetID(this._id);
            // ISSUE: object of a compiler-generated type is created
            foreach (\u003C\u003E__AnonType18 <KeyValuePair <int, RecipeDataInfo[]>, int> anonType18 in ((IEnumerable <KeyValuePair <int, RecipeDataInfo[]> >) this._info).Select <KeyValuePair <int, RecipeDataInfo[]>, \u003C\u003E__AnonType18 <KeyValuePair <int, RecipeDataInfo[]>, int> >((Func <KeyValuePair <int, RecipeDataInfo[]>, int, \u003C\u003E__AnonType18 <KeyValuePair <int, RecipeDataInfo[]>, int> >)((p, i) => new \u003C\u003E__AnonType18 <KeyValuePair <int, RecipeDataInfo[]>, int>(p, i))))
            {
                int hash = anonType18.p.Key;
                RecipeDataInfo[] recipeInfo = anonType18.p.Value;
                StuffItemInfo    itemInfo   = Singleton <Resources> .Instance.GameInfo.FindItemInfo(hash);

                this.itemListUI.AddItemNode(anonType18.i, new CraftItemNodeUI.StuffItemInfoPack(itemInfo, (Func <CraftItemNodeUI.Possible>)(() => CraftViewer.Possible(craftUI.checkStorages, hash, recipeInfo))), recipeInfo);
            }
        }
예제 #16
0
        public void Refresh(StuffItem item)
        {
            StuffItemInfo stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(item.CategoryID, item.ID);

            bool flag = true;

            if (this.mode == ShopInfoPanelUI.Mode.Inventory && !stuffItemInfo.isTrash)
            {
                flag = false;
            }
            ((Selectable)this._decideButton).set_interactable(flag);
            this._itemName.set_text(stuffItemInfo.Name);
            this._flavorText.set_text(stuffItemInfo.Explanation);
            this._countViewer.MaxCount   = Mathf.Max(item.Count, 1);
            this._countViewer.ForceCount = Mathf.Clamp(this._countViewer.Count, 1, this._countViewer.MaxCount);
        }
예제 #17
0
        private void InvokePresent(int count)
        {
            StuffItemInfo stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(this._categoryID, this._itemID);

            PlayerActor player = Singleton <Manager.Map> .Instance.Player;
            int         num    = 0;

            while (num < count)
            {
                ++num;
            }
            StuffItem stuffItem = new StuffItem(stuffItemInfo.CategoryID, stuffItemInfo.ID, count);

            this.Target.AgentData.ItemList.AddItem(stuffItem);
            player.PlayerData.ItemList.RemoveItem(stuffItem);
        }
예제 #18
0
        public void SetPlantItem(StuffItem item)
        {
            StuffItemInfo stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(item.CategoryID, item.ID);

            if (stuffItemInfo == null)
            {
                Debug.LogError((object)string.Format("Item not Find\n[{0}:{1}][{2}:{3}]", (object)"CategoryID", (object)item.CategoryID, (object)"ID", (object)item.ID), (Object)this);
            }
            else
            {
                AIProject.SaveData.Environment.PlantInfo plantInfo = Singleton <Resources> .Instance.GameInfo.GetPlantInfo(stuffItemInfo.nameHash);

                this.currentIcon.info = plantInfo;
                this._plantList[this._currentIndex] = plantInfo;
            }
        }
예제 #19
0
        public void AttachItem(
            ItemListController sender,
            ItemListController receiver,
            int currentID,
            ItemNodeUI itemUI,
            ButtonType buttonType)
        {
            this.ClearItemInfo();
            if (sender == null || receiver == null)
            {
                this.IsActiveControl = false;
            }
            else if (!Singleton <Resources> .IsInstance() || Object.op_Equality((Object)itemUI, (Object)null) || (itemUI.Item == null || itemUI.Item.Count <= 0))
            {
                this.IsActiveControl = false;
            }
            else
            {
                StuffItem     stuffItem     = itemUI.Item;
                StuffItemInfo stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(stuffItem.CategoryID, stuffItem.ID);

                if (stuffItemInfo == null)
                {
                    this.IsActiveControl = false;
                }
                else
                {
                    this.SetItemInfo(sender, receiver, itemUI, currentID, buttonType);
                    this.InputNumber = 1;
                    this.RefreshUI();
                    this._itemNameText.set_text(stuffItemInfo.Name);
                    this._flavorText.set_text(stuffItemInfo.Explanation);
                    int num = (int)buttonType;
                    for (int index = 0; index < this._buttons.Length; ++index)
                    {
                        Button element = this._buttons.GetElement <Button>(index);
                        if (!Object.op_Equality((Object)element, (Object)null) && ((Component)element).get_gameObject().get_activeSelf() != (index == num))
                        {
                            ((Component)element).get_gameObject().SetActive(index == num);
                        }
                    }
                    this.IsActiveControl = true;
                }
            }
        }
예제 #20
0
        protected override void EnterDepop()
        {
            this.AutoChangeAnimation = false;
            StuffItemInfo _itemInfo = this.ItemInfo;
            StuffItem     _addItem  = (StuffItem)null;

            if (_itemInfo != null)
            {
                _addItem = new StuffItem(_itemInfo.CategoryID, _itemInfo.ID, 1);
            }
            PlayerActor playerActor = !Singleton <Manager.Map> .IsInstance() ? (PlayerActor)null : Singleton <Manager.Map> .Instance.Player;

            if ((!Object.op_Inequality((Object)playerActor, (Object)null) ? (List <StuffItem>)null : playerActor.PlayerData?.ItemList) != null && _addItem != null)
            {
                playerActor.PlayerData.ItemList.AddItem(_addItem);
            }
            if (Singleton <Resources> .IsInstance())
            {
                AnimalDefinePack animalDefinePack = Singleton <Resources> .Instance.AnimalDefinePack;
                if (Object.op_Inequality((Object)animalDefinePack, (Object)null))
                {
                    AudioSource audioSource = this.Play3DSound(animalDefinePack.SoundID.MechaStartup);
                    if (Object.op_Inequality((Object)audioSource, (Object)null))
                    {
                        audioSource.Stop();
                        ((Component)audioSource).get_transform().SetPositionAndRotation(this.Position, this.Rotation);
                        audioSource.Play();
                    }
                }
            }
            this.PlayInAnim(AnimationCategoryID.Etc, 1, (System.Action)(() =>
            {
                this.AutoChangeAnimation = true;
                if (_itemInfo != null && _addItem != null)
                {
                    MapUIContainer.AddSystemItemLog(_itemInfo, _addItem.Count, true);
                }
                else
                {
                    MapUIContainer.AddNotify(MapUIContainer.ItemGetEmptyText);
                }
                this.SetState(AnimalState.Destroyed, (System.Action)null);
            }));
        }
예제 #21
0
        public static CraftUI.CreateItem CreateCheck(
            IReadOnlyDictionary <int, RecipeDataInfo[]> targetTable,
            IReadOnlyCollection <IReadOnlyCollection <StuffItem> > storages)
        {
            // ISSUE: object of a compiler-generated type is created
            Dictionary <int, RecipeDataInfo[]> dictionary = ((IEnumerable <KeyValuePair <int, RecipeDataInfo[]> >)targetTable).Select <KeyValuePair <int, RecipeDataInfo[]>, \u003C\u003E__AnonType11 <int, RecipeDataInfo[]> >((Func <KeyValuePair <int, RecipeDataInfo[]>, \u003C\u003E__AnonType11 <int, RecipeDataInfo[]> >)(v => new \u003C\u003E__AnonType11 <int, RecipeDataInfo[]>(v.Key, CraftUI.Possible(storages, v.Value)))).Where <\u003C\u003E__AnonType11 <int, RecipeDataInfo[]> >((Func <\u003C\u003E__AnonType11 <int, RecipeDataInfo[]>, bool>)(v => ((IEnumerable <RecipeDataInfo>)v.Value).Any <RecipeDataInfo>())).ToDictionary <\u003C\u003E__AnonType11 <int, RecipeDataInfo[]>, int, RecipeDataInfo[]>((Func <\u003C\u003E__AnonType11 <int, RecipeDataInfo[]>, int>)(v => v.Key), (Func <\u003C\u003E__AnonType11 <int, RecipeDataInfo[]>, RecipeDataInfo[]>)(v => v.Value));

            if (!dictionary.Any <KeyValuePair <int, RecipeDataInfo[]> >())
            {
                return((CraftUI.CreateItem)null);
            }
            KeyValuePair <int, RecipeDataInfo[]> keyValuePair = dictionary.Shuffle <KeyValuePair <int, RecipeDataInfo[]> >().First <KeyValuePair <int, RecipeDataInfo[]> >();
            StuffItemInfo itemInfo = Singleton <Resources> .Instance.GameInfo.FindItemInfo(keyValuePair.Key);

            return(new CraftUI.CreateItem()
            {
                info = ((IEnumerable <RecipeDataInfo>)keyValuePair.Value).Shuffle <RecipeDataInfo>().First <RecipeDataInfo>(),
                item = new StuffItem(itemInfo.CategoryID, itemInfo.ID, 0)
            });
        }
예제 #22
0
        public override void Do()
        {
            base.Do();
            int num1 = 0;

            string[]      args1    = this.args;
            int           index1   = num1;
            int           num2     = index1 + 1;
            int           nameHash = int.Parse(args1[index1]);
            StuffItemInfo itemInfo = Singleton <Resources> .Instance.GameInfo.FindItemInfo(nameHash);

            if (itemInfo == null)
            {
                Debug.LogError((object)string.Format("Item none:{0}", (object)nameHash));
            }
            else
            {
                string[] args2  = this.args;
                int      index2 = num2;
                int      num3   = index2 + 1;
                int      result;
                if (!int.TryParse(args2[index2], out result))
                {
                    Debug.LogError((object)string.Format("Num none:{0}[{1}]:{2}", (object)"args", (object)(num3 - 1), (object)this.args[num3 - 1]));
                    result = 1;
                }
                StuffItem addItem = new StuffItem(itemInfo.CategoryID, itemInfo.ID, result);
                if (this.AddItem(Singleton <Manager.Map> .Instance.Player.PlayerData.ItemList, Singleton <Manager.Map> .Instance.Player.PlayerData.InventorySlotMax, addItem, result))
                {
                    Debug.Log((object)string.Format("AddItem(Inventory):{0}x{1}", (object)itemInfo.Name, (object)result));
                }
                else if (this.AddItem(Singleton <Game> .Instance.Environment.ItemListInStorage, Singleton <Resources> .Instance.DefinePack.ItemBoxCapacityDefines.StorageCapacity, addItem, result))
                {
                    Debug.Log((object)string.Format("AddItem(ItemBox):{0}x{1}", (object)itemInfo.Name, (object)result));
                }
                else
                {
                    Debug.LogError((object)string.Format("AddItem(Failed):{0}x{1}", (object)itemInfo.Name, (object)result));
                }
            }
        }
예제 #23
0
        public override void Do()
        {
            base.Do();
            int       cnt   = 0;
            CharaData chara = this.GetChara(ref cnt);

            if (chara == null)
            {
                return;
            }
            Tuple <StuffItemInfo, int> advScroungeInfo = Singleton <Resources> .Instance.GameInfo.GetAdvScroungeInfo(chara.chaCtrl);

            StuffItemInfo stuffItemInfo = advScroungeInfo.Item1;
            int           num           = advScroungeInfo.Item2;

            this.scenario.AddItemVars(stuffItemInfo, num);
            chara.data.agentActor.AgentData.ItemScrounge.Set((IReadOnlyCollection <StuffItem>) new StuffItem[1]
            {
                new StuffItem(stuffItemInfo.CategoryID, stuffItemInfo.ID, num)
            });
        }
예제 #24
0
        public static bool AddItemVars(this TextScenario self, StuffItemInfo Item, int Count)
        {
            Dictionary <string, ValData> vars = self.Vars;
            string index1 = nameof(Item);

            vars[index1] = new ValData((object)(Item?.Name ?? string.Empty));
            Dictionary <string, ValData> dictionary = vars;
            string  index2   = string.Format("{0}.Hash", (object)index1);
            int?    nameHash = Item?.nameHash;
            ValData valData  = new ValData((object)(!nameHash.HasValue ? -1 : nameHash.Value));

            dictionary[index2] = valData;
            if (Item == null)
            {
                return(false);
            }
            vars[string.Format("{0}.{1}", (object)index1, (object)"CategoryID")]  = new ValData((object)Item.CategoryID);
            vars[string.Format("{0}.{1}", (object)index1, (object)"ID")]          = new ValData((object)Item.ID);
            vars[string.Format("{0}.{1}", (object)index1, (object)nameof(Count))] = new ValData((object)Count);
            return(true);
        }
    private bool CheckHadItem(int id, int mode, ref List <HSceneSpriteHitem.HitemInfo> hitemInfos)
    {
        foreach (StuffItem stuffItem in mode != 0 ? Singleton <Game> .Instance.Environment.ItemListInStorage : Singleton <Manager.Map> .Instance.Player.PlayerData.ItemList)
        {
            if (stuffItem.CategoryID == this.ItemCategory && stuffItem.ID == id)
            {
                StuffItemInfo stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(stuffItem.CategoryID, id);

                if (stuffItemInfo != null)
                {
                    HSceneSpriteHitem.HitemInfo hitemInfo;
                    hitemInfo.id              = stuffItemInfo.ID;
                    hitemInfo.iconId          = stuffItemInfo.IconID;
                    hitemInfo.ItemName        = stuffItemInfo.Name;
                    hitemInfo.ExplanatoryText = stuffItemInfo.Explanation;
                    hitemInfos.Add(hitemInfo);
                    return(true);
                }
            }
        }
        return(false);
    }
예제 #26
0
        protected override void InitializeCommandLabels()
        {
            if (!((IReadOnlyList <CommandLabel.CommandInfo>) this.getLabels).IsNullOrEmpty <CommandLabel.CommandInfo>())
            {
                return;
            }
            CommonDefine commonDefine = !Singleton <Resources> .IsInstance() ? (CommonDefine)null : Singleton <Resources> .Instance.CommonDefine;

            CommonDefine.CommonIconGroup commonIconGroup = !Object.op_Inequality((Object)commonDefine, (Object)null) ? (CommonDefine.CommonIconGroup)null : commonDefine.Icon;
            this.getLabels = new CommandLabel.CommandInfo[1]
            {
                new CommandLabel.CommandInfo()
                {
                    Text             = "捕まえる",
                    Transform        = ((Component)this).get_transform(),
                    IsHold           = false,
                    Icon             = (Sprite)null,
                    TargetSpriteInfo = commonIconGroup?.CharaSpriteInfo,
                    Event            = (Action)(() =>
                    {
                        StuffItemInfo itemInfo = this.ItemInfo;
                        if (itemInfo != null)
                        {
                            StuffItem stuffItem = new StuffItem(itemInfo.CategoryID, itemInfo.ID, 1);
                            Singleton <Manager.Map> .Instance.Player.PlayerData.ItemList.AddItem(stuffItem);
                            MapUIContainer.AddSystemItemLog(itemInfo, stuffItem.Count, true);
                        }
                        else
                        {
                            MapUIContainer.AddNotify(MapUIContainer.ItemGetEmptyText);
                        }
                        this.Destroy();
                    })
                }
            };
        }
예제 #27
0
        private void UISetting()
        {
            this.IsImpossible = true;
            this.usedItems.Clear();
            ReadOnlyDictionary <int, RequestInfo> requestTable = Singleton <Resources> .Instance.PopupInfo.RequestTable;

            this.requestInfo = (RequestInfo)null;
            RequestInfo requestInfo;

            if (!requestTable.TryGetValue(this.RequestID, ref requestInfo))
            {
                this.HideElements();
            }
            else
            {
                this.requestInfo = requestInfo;
                int index1 = !Singleton <GameSystem> .IsInstance() ? 0 : Singleton <GameSystem> .Instance.languageInt;

                this.messageText.set_text(requestInfo.Title.GetElement <string>(index1) ?? string.Empty);
                switch (requestInfo.Type)
                {
                case 0:
                    this.requestCanvasGroup0.set_alpha(1f);
                    this.requestCanvasGroup1.set_alpha(0.0f);
                    this.requestCanvasGroup2.set_alpha(0.0f);
                    this.requestText.set_text(string.Empty);
                    Resources.GameInfoTables gameInfo = Singleton <Resources> .Instance.GameInfo;
                    List <StuffItem>         itemList = Singleton <Manager.Map> .Instance.Player.PlayerData.ItemList;
                    int  itemSlotMax = Singleton <Resources> .Instance.DefinePack.MapDefines.ItemSlotMax;
                    bool flag1       = !requestInfo.Items.IsNullOrEmpty <Tuple <int, int, int> >();
                    for (int index2 = 0; index2 < this.requestElements.Length; ++index2)
                    {
                        bool flag2 = requestInfo.Items.Length <= index2;
                        this.requestElements[index2].canvas.set_alpha(!flag2 ? 1f : 0.0f);
                        if (!flag2)
                        {
                            int category = requestInfo.Items[index2].Item1;
                            int id       = requestInfo.Items[index2].Item2;
                            int count    = requestInfo.Items[index2].Item3;
                            this.usedItems.Add(new StuffItem(category, id, count));
                            StuffItemInfo stuffItemInfo = gameInfo.GetItem(category, id);
                            this.requestElements[index2].name.set_text(stuffItemInfo.Name);
                            int num = 0;
                            foreach (StuffItem stuffItem in itemList)
                            {
                                if (stuffItem.CategoryID == category && stuffItem.ID == id)
                                {
                                    num += stuffItem.Count;
                                }
                            }
                            this.requestElements[index2].count.set_text(itemSlotMax >= num ? string.Format("{0}", (object)num) : string.Format("{0}+", (object)itemSlotMax));
                            this.requestElements[index2].need.set_text(count.ToString());
                            bool flag3 = num < count;
                            ((Graphic)this.requestElements[index2].count).set_color(!flag3 ? this.whiteColor : this.redColor);
                            if (flag3)
                            {
                                flag1 = false;
                            }
                        }
                    }
                    if (((Component)this.submitButton).get_gameObject().get_activeSelf() != flag1)
                    {
                        ((Component)this.submitButton).get_gameObject().SetActive(flag1);
                    }
                    this.IsImpossible = !flag1;
                    break;

                case 1:
                    this.requestCanvasGroup0.set_alpha(0.0f);
                    this.requestCanvasGroup1.set_alpha(1f);
                    this.requestCanvasGroup2.set_alpha(0.0f);
                    this.requestText.set_text(requestInfo.Message.GetElement <string>(index1) ?? string.Empty);
                    if (!((Component)this.submitButton).get_gameObject().get_activeSelf())
                    {
                        break;
                    }
                    ((Component)this.submitButton).get_gameObject().SetActive(false);
                    break;

                case 2:
                    this.requestCanvasGroup0.set_alpha(0.0f);
                    this.requestCanvasGroup1.set_alpha(0.0f);
                    this.requestCanvasGroup2.set_alpha(1f);
                    this.requestText.set_text(string.Empty);
                    int num1     = Manager.Map.GetTotalAgentFlavorAdditionAmount();
                    int?nullable = requestInfo.Items.GetElement <Tuple <int, int, int> >(0)?.Item1;
                    int num2     = !nullable.HasValue ? 9999 : nullable.Value;
                    if (Singleton <Resources> .IsInstance())
                    {
                        Dictionary <int, int> additionBorderTable = Singleton <Resources> .Instance.PopupInfo.RequestFlavorAdditionBorderTable;
                        if (!additionBorderTable.IsNullOrEmpty <int, int>())
                        {
                            foreach (KeyValuePair <int, int> keyValuePair in additionBorderTable)
                            {
                                if (keyValuePair.Key < this.RequestID)
                                {
                                    num1 -= keyValuePair.Value;
                                }
                                else
                                {
                                    break;
                                }
                            }
                            if (num1 < 0)
                            {
                                num1 = 0;
                            }
                        }
                    }
                    this.leftText_Type2.set_text(string.Format("{0}", (object)num1));
                    this.rightText_Type2.set_text(string.Format("{0}", (object)num2));
                    ((Graphic)this.leftText_Type2).set_color(num1 >= num2 ? this.whiteColor : this.redColor);
                    if (!((Component)this.submitButton).get_gameObject().get_activeSelf())
                    {
                        break;
                    }
                    ((Component)this.submitButton).get_gameObject().SetActive(false);
                    break;

                default:
                    this.HideElements();
                    break;
                }
            }
        }
예제 #28
0
 private VendItemInfo(StuffItemInfo info)
 {
     this.info = info;
 }
        static void Draw_List_Item(StuffItemInfo skill,
                                   Dictionary <int, int> list,
                                   List <StuffItem> items,
                                   int category)
        {
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label($"[{skill.ID}] {skill.Name.Translate()}");

                if (list.ContainsValue(skill.ID))
                {
                    if (GUILayout.Button("-", removeStyle, GUILayout.Width(24f)))
                    {
                        int key = list.FirstOrDefault(v => v.Value == skill.ID).Key;

                        if (key < 5)
                        {
                            list[key] = -1;
                        }
                        else
                        {
                            list.Remove(key);
                        }

                        if (ConsumeItem.Value)
                        {
                            StuffItem item = items.Find(v =>
                                                        v.CategoryID == category &&
                                                        v.ID == skill.ID
                                                        );

                            if (item == null)
                            {
                                item = new StuffItem(skill.CategoryID, skill.ID, 0);
                                items.Add(item);
                            }

                            item.Count++;
                        }
                    }
                }
                else
                {
                    StuffItem item = items.Find(v =>
                                                v.CategoryID == category &&
                                                v.ID == skill.ID
                                                );

                    if (item != null)
                    {
                        if (GUILayout.Button("+", addStyle, GUILayout.Width(24f)))
                        {
                            if (list.ContainsValue(-1))
                            {
                                int key = list.FirstOrDefault(v => v.Value == -1).Key;
                                list[key] = skill.ID;
                            }
                            else
                            {
                                list[list.Count] = skill.ID;
                            }

                            if (ConsumeItem.Value)
                            {
                                item.Count--;

                                if (item.Count <= 0)
                                {
                                    items.Remove(item);
                                }
                            }
                        }
                    }
                }
            }
            GUILayout.EndHorizontal();
        }
 protected abstract void ItemListProc(
     StuffItemInfo itemInfo,
     List <StuffItem> itemList,
     StuffItem stuffItem);