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; } } } }
private void OnUpdate() { AIProject.SaveData.Environment.PlantInfo info = this._icon.info; Slider progressBar = this._progressBar; float? progress = info?.progress; double num = !progress.HasValue ? 1.0 : (double)progress.Value; progressBar.set_value((float)num); bool?isEnd = info?.isEnd; bool flag = !isEnd.HasValue || isEnd.Value; this._timeText.set_text(!flag ? info.ToString() : this._completeStr); ((ReactiveProperty <bool>) this._finished).set_Value(flag); }
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; } }
private void OnUpdate() { List <AIProject.SaveData.Environment.PlantInfo> source; if (!Singleton <Game> .Instance.Environment.FarmlandTable.TryGetValue(this.HarvestID, out source)) { return; } AIProject.SaveData.Environment.PlantInfo element = source.GetElement <AIProject.SaveData.Environment.PlantInfo>(this.SectionID); if (element == null) { if (this._plantInfo == null) { return; } this._plantInfo = (AIProject.SaveData.Environment.PlantInfo)null; if (!Object.op_Inequality((Object)this._plantItem, (Object)null)) { return; } Object.Destroy((Object)((Component)this._plantItem).get_gameObject()); this._plantItem = (PlantItem)null; } else { if (this._plantInfo != element) { this._plantInfo = element; StuffItemInfo seedInfo = Singleton <Resources> .Instance.GameInfo.FindItemInfo(element.nameHash); AssetBundleInfo assetBundleInfo; if (Singleton <Resources> .Instance.Map.PlantItemList.TryGetValue(Singleton <Resources> .Instance.Map.PlantIvyFilterList.Find((Predicate <ItemInfo>)(x => x.CategoryID == seedInfo.CategoryID && x.ItemID == seedInfo.ID)).ObjID, out assetBundleInfo)) { GameObject gameObject = CommonLib.LoadAsset <GameObject>((string)assetBundleInfo.assetbundle, (string)assetBundleInfo.asset, false, (string)assetBundleInfo.manifest); MapScene.AddAssetBundlePath((string)assetBundleInfo.assetbundle, (string)assetBundleInfo.manifest); if (Object.op_Inequality((Object)gameObject, (Object)null)) { if (Object.op_Inequality((Object)this._plantItem, (Object)null)) { Object.Destroy((Object)((Component)this._plantItem).get_gameObject()); this._plantItem = (PlantItem)null; } this._plantItem = (PlantItem)((GameObject)Object.Instantiate <GameObject>((M0)gameObject, ((Component)this).get_transform(), false)).GetComponent <PlantItem>(); this._plantItem.ChangeState(0); } } } if (!Object.op_Inequality((Object)this._plantItem, (Object)null)) { return; } float num = element.timer / (float)element.timeLimit; if ((double)num < 0.5) { this._plantItem.ChangeState(0); } else if ((double)num < 1.0) { this._plantItem.ChangeState(1); } else { this._plantItem.ChangeState(2); } } }