// Token: 0x06002A0E RID: 10766 RVA: 0x0009BBA4 File Offset: 0x00099DA4 public void PlusMinusClick(int amount) { if (amount == 0) { return; } global::CraftingInventory component = global::RPOS.ObservedPlayer.GetComponent <global::CraftingInventory>(); if (component == null) { return; } if (component.isCrafting) { return; } this.SetRequestedAmount(this.desiredAmount + amount); this.UpdateIngredients(); }
// Token: 0x0600328E RID: 12942 RVA: 0x000BFA50 File Offset: 0x000BDC50 public virtual bool CanWork(int amount, global::Inventory workbenchInv) { if (this.lastCanWorkResult == null) { this.lastCanWorkResult = new List <int>(); } else { this.lastCanWorkResult.Clear(); } if (this.lastCanWorkIngredientCount == null) { this.lastCanWorkIngredientCount = new List <int>(this.ingredients.Length); } else { this.lastCanWorkIngredientCount.Clear(); } if (this.RequireWorkbench) { global::CraftingInventory component = workbenchInv.GetComponent <global::CraftingInventory>(); if (!component || !component.AtWorkBench()) { return(false); } } foreach (global::BlueprintDataBlock.IngredientEntry ingredientEntry in this.ingredients) { if (ingredientEntry.amount != 0) { int num = workbenchInv.CanConsume(ingredientEntry.Ingredient, ingredientEntry.amount * amount, this.lastCanWorkResult); if (num <= 0) { this.lastCanWorkResult.Clear(); this.lastCanWorkIngredientCount.Clear(); return(false); } this.lastCanWorkIngredientCount.Add(num); } } return(true); }
// Token: 0x06002A14 RID: 10772 RVA: 0x0009BECC File Offset: 0x0009A0CC public void CraftButtonClicked(GameObject go) { if (this.selectedItem == null) { return; } Debug.Log("Crafting clicked"); global::CraftingInventory component = global::RPOS.ObservedPlayer.GetComponent <global::CraftingInventory>(); if (component == null) { Debug.Log("No local player inventory.. weird"); return; } if (component.isCrafting) { component.CancelCrafting(); } else if (component.ValidateCraftRequirements(this.selectedItem)) { component.StartCrafting(this.selectedItem, this.RequestedAmount()); } }
// Token: 0x06002A15 RID: 10773 RVA: 0x0009BF54 File Offset: 0x0009A154 public bool AtWorkbench() { global::CraftingInventory component = global::RPOS.ObservedPlayer.GetComponent <global::CraftingInventory>(); return(component.AtWorkBench()); }
// Token: 0x06002A13 RID: 10771 RVA: 0x0009BCAC File Offset: 0x00099EAC public void Update() { if (global::RPOS.ObservedPlayer == null) { return; } global::CraftingInventory component = global::RPOS.ObservedPlayer.GetComponent <global::CraftingInventory>(); if (component == null) { return; } bool isCrafting = component.isCrafting; if (isCrafting) { component.CraftThink(); } if (!isCrafting && this.wasCrafting) { this.UpdateIngredients(); } else if (!this.wasCrafting && isCrafting) { this.craftSound.Play(); } if (this.craftButton.gameObject.activeSelf) { this.craftButton.GetComponentInChildren <global::UILabel>().text = ((!component.isCrafting) ? "Craft" : "Cancel"); } if (this.craftProgressBar && this.craftProgressBar.gameObject && this.craftProgressBar.gameObject.activeSelf) { global::UISlider uislider = this.craftProgressBar; float? craftingCompletePercent = component.craftingCompletePercent; uislider.sliderValue = ((craftingCompletePercent == null) ? 0f : craftingCompletePercent.Value); float?craftingSecondsRemaining = component.craftingSecondsRemaining; float num = (craftingSecondsRemaining == null) ? 0f : craftingSecondsRemaining.Value; if (num != this._lastTimeStringValue) { this._lastTimeStringString = num.ToString("0.0"); this._lastTimeStringValue = num; } this.progressLabel.text = this._lastTimeStringString; Color color = Color.white; float craftingSpeedPerSec = component.craftingSpeedPerSec; if (craftingSpeedPerSec > 1f) { color = Color.green; } else if (craftingSpeedPerSec < 1f) { color = Color.yellow; } else if (craftingSpeedPerSec < 0.5f) { color = Color.red; } this.progressLabel.color = color; } if (this.selectedItem != null) { this.UpdateWorkbenchRequirements(); } if (this.progressLabel) { this.progressLabel.enabled = isCrafting; } this.wasCrafting = component.isCrafting; }