private void Craft() { ItemCollection craftCollection = m_Collections[m_CraftingCollectionIndex]; ItemBlueprint blueprint = ItemDatabase.GetBlueprint(craftCollection.ToArray()); if (blueprint == null) { return; } ItemCollection defaultCollection = m_Collections[m_DefaultCollectionIndex]; if (defaultCollection.IsFull(blueprint.Output)) { return; } if (!defaultCollection.IsAllowed(blueprint.Output)) { return; } craftCollection.Clear(true); GameObject obj = NetworkController.Instance.Scene.CreateForClient(Identity.OwnerConnection, blueprint.Output.gameObject, Vector3.zero, Quaternion.identity); InventoryItem item = obj.GetComponent <InventoryItem>(); Add(item, defaultCollection); NetworkController.Instance.RemoteProcedures.Call(Identity, RPCType.Target, nameof(ClientRpcClearCollection), Identity.OwnerConnection, GetCollectionIndex(craftCollection)); }
public override void Repaint() { base.Repaint(); InventoryItem[] items = Collection.ToArray(); ItemBlueprint bp = Collection.Database.GetBlueprint(items); m_CraftButton.interactable = bp != null; m_CraftSlot.Repaint(bp?.Output); m_CurrentBlueprint = bp; }