protected override void Interact() { if (player.state != CharacterController2D.State.Interact) { CraftingManager.RequestCraftingMenu(recipeList); } }
public static Recipe GetReducedRecipes(string recipeName, int Reduction) { List <ItemStack> ingredients = new List <ItemStack>(); // If there's a recipe, grab it, and change it into a repair recipe. Recipe recipe = CraftingManager.GetRecipe(recipeName); if (recipe != null) { foreach (ItemStack ingredient in recipe.ingredients) { if (ingredient.count >= Reduction) { int repairCount = ingredient.count / Reduction; ingredient.count = repairCount; ingredients.Add(ingredient); } } recipe.craftingTime = Math.Max(1f, recipe.craftingTime / Reduction); recipe.craftExpGain = Math.Max(1, recipe.craftExpGain / Reduction); recipe.ingredients = ingredients; } return(recipe); }
public void UpdatePage(Recipe recipe) { selectedRecipe = recipe; resultItemSlot.ItemStack = recipe.Result; foreach (ItemStackSlot slot in ingredientsItemSlots) { Destroy(slot.gameObject); } ingredientsItemSlots.Clear(); Dictionary <ItemStack, bool> ingredients = CraftingManager.GetMissingIngredients(playerInventory.ItemInventory, recipe); foreach (KeyValuePair <ItemStack, bool> kvPair in ingredients) { GameObject obj = Instantiate(ingredientItemSlotPreFab, ingredientsContent.transform); obj.SetActive(true); if (!obj.TryGetComponent(out IngredientItemStack slot)) { continue; } slot.ItemStack = kvPair.Key; slot.HasItemStack = kvPair.Value; ingredientsItemSlots.Add(slot); } craftButton.interactable = CraftingManager.CanCraft(playerInventory.ItemInventory, recipe); }
private void initCraftingManager() { List <Recepie> recepies = new List <Recepie>(); Dictionary <InventoryItem, int> input1 = new Dictionary <InventoryItem, int>(); input1.Add(BlockPrototype.stone, 8); KeyValuePair <InventoryItem, int> output1; output1 = new KeyValuePair <InventoryItem, int>(BlockPrototype.dirt, 1); Recepie recepie1 = new Recepie(input1, output1); recepies.Add(recepie1); Dictionary <InventoryItem, int> input5 = new Dictionary <InventoryItem, int>(); input5.Add(BlockPrototype.ironOre, 1); recepies.Add(new Recepie(input5, new KeyValuePair <InventoryItem, int>(ItemTemplate.ironBar.createNew(), 1))); Dictionary <InventoryItem, int> input2 = new Dictionary <InventoryItem, int>(); input2.Add(BlockPrototype.sand, 1); recepies.Add(new Recepie(input2, new KeyValuePair <InventoryItem, int>(BlockPrototype.glass, 1))); craftingManager = new CraftingManager(recepies); }
public void OnInspection(GameObject obj) { if (!Player.Get().CanStartBodyInspection()) { return; } if (NotepadController.Get().IsActive()) { NotepadController.Get().Hide(); this.m_DelayedType = HUDQuickAccessBar.TYPE.Inspect; this.m_DelayedObj = obj; return; } if (CraftingManager.Get().gameObject.activeSelf) { CraftingManager.Get().Deactivate(); } if (!BodyInspectionController.Get().IsActive()) { Player.Get().StartController(PlayerControllerType.BodyInspection); } else { Player.Get().StopController(PlayerControllerType.BodyInspection); } }
private bool IsTransactionPendingOnThisCard() { CraftingManager manager = CraftingManager.Get(); if (manager == null) { return(false); } PendingTransaction pendingTransaction = manager.GetPendingTransaction(); if (pendingTransaction == null) { return(false); } EntityDef entityDef = this.m_actor.GetEntityDef(); if (entityDef == null) { return(false); } if (pendingTransaction.CardID != entityDef.GetCardId()) { return(false); } if (pendingTransaction.cardFlair != this.m_actor.GetCardFlair()) { return(false); } return(true); }
public override void UpdatePhx() { bool flag = base.m_PhxStaticRequests > 0 || base.m_StaticPhx; if (!flag) { PlayerHolder x = null; this.m_TempList.Clear(); if (base.gameObject.transform.parent != null) { base.gameObject.transform.parent.GetComponents <PlayerHolder>(this.m_TempList); } if (this.m_TempList.Count > 0) { x = this.m_TempList[0]; } flag = (CraftingManager.Get().ContainsItem(this) || (base.gameObject.transform.parent != null && (x != null || base.gameObject.transform.parent.CompareTag(this.m_AttachTag)))); } if (this.m_BoxCollider) { this.m_BoxCollider.isTrigger = flag; this.m_BoxCollider.enabled = (base.m_InInventory || base.m_OnCraftingTable || !flag); } if (this.m_Rigidbody) { this.m_Rigidbody.isKinematic = flag; } }
void OnEnable() { ResetGame(); _gameSession = GameObject.Find("GameSession").GetComponent <GameSession>(); _craftingManager = FindObjectOfType <CraftingManager>(); _robotTemplate.gameObject.SetActive(false); _enemyTemplate.gameObject.SetActive(false); GenerateTerrain(_gameSession.SelectedLevel); _move_button.onClick.AddListener(() => { var robot = _robots[_selected_robot_index]; if (_selected_robot_index >= 0 && robot.current_hp > 0 && robot.friend && !_battle_won) { _uiMode = UiMode.Move; } }); _action_button.onClick.AddListener(() => { var robot = _robots[_selected_robot_index]; if (_selected_robot_index >= 0 && robot.current_hp > 0 && robot.friend && !_battle_won) { _uiMode = UiMode.Attack; } }); _end_turn_button.onClick.AddListener(() => { NextTurn(); }); }
public void DeleteItem(string item_name) { ItemID item_id = (ItemID)Enum.Parse(typeof(ItemID), item_name); Item item = this.FindItem(item_id); if (!item) { return; } if (CraftingManager.Get().gameObject.activeSelf&& CraftingManager.Get().ContainsItem(item)) { CraftingManager.Get().RemoveItem(item, false); } if (!item.m_CurrentSlot && item.m_InventorySlot && item.m_InventorySlot.m_Items.Count > 0) { item.m_InventorySlot.RemoveItem(item, false); } else if (item.m_CurrentSlot && item.m_CurrentSlot.m_InventoryStackSlot) { item.m_CurrentSlot.RemoveItem(item, false); } if (this.m_EquippedItem == item) { this.m_EquippedItem = null; } this.RemoveItem(item, false); UnityEngine.Object.Destroy(item.gameObject); }
private bool AllignCarriedItemToCraftingTable() { Collider tableCollider = CraftingManager.Get().m_TableCollider; for (int i = 0; i < this.m_BackpackHits.Length; i++) { RaycastHit raycastHit = this.m_BackpackHits[i]; if (!(raycastHit.collider != tableCollider)) { this.m_CarriedItem.gameObject.transform.position = raycastHit.point + this.m_CarriedItem.gameObject.transform.up * this.m_CarriedItem.m_BoxCollider.size.y * this.m_CarriedItem.transform.localScale.y * 0.5f; Matrix4x4 identity = Matrix4x4.identity; Vector3 vector = -tableCollider.transform.forward; identity.SetColumn(1, vector); Vector3 v = Vector3.Cross(tableCollider.transform.up, vector); identity.SetColumn(0, v); identity.SetColumn(2, Vector3.Cross(identity.GetColumn(1), identity.GetColumn(0))); identity.SetColumn(0, Vector3.Cross(identity.GetColumn(1), identity.GetColumn(2))); Quaternion rotation = CJTools.Math.QuaternionFromMatrix(identity); this.m_CarriedItem.gameObject.transform.rotation = rotation; if (this.m_CarriedItem.m_Info.m_InventoryRotated) { this.m_CarriedItem.transform.RotateAround(this.m_CarriedItem.m_BoxCollider.bounds.center, this.m_CarriedItem.transform.up, 90f); } return(true); } } return(false); }
public void Deactivate() { if (this.m_CarriedItem && !this.m_CarriedItem.m_CurrentSlot) { this.OnLMouseUp(); } this.BlockPlayerRotation(false); if (!Player.Get().m_BodyInspectionController.IsActive()) { Player.Get().StopController(PlayerControllerType.Inventory); } this.m_Camera.enabled = false; this.m_Canvas.gameObject.SetActive(false); CursorManager.Get().ShowCursor(false); CursorManager.Get().SetCursor(CursorManager.TYPE.Normal); HUDManager.Get().SetActiveGroup(HUDManager.HUDGroup.Game); if (CraftingManager.Get().gameObject.activeSelf) { CraftingManager.Get().Deactivate(); } if (HUDItem.Get().m_Active) { HUDItem.Get().Deactivate(); } this.ResetNewCraftedItem(); this.m_SelectedSlot = null; this.m_SelectedGroup = null; this.m_MouseOverCraftTable = false; this.m_MouseOverBackpack = false; InventoryBackpack.Get().OnCloseBackpack(); base.gameObject.SetActive(false); this.m_DeactivationTime = Time.time; this.m_ActivityChanged = true; }
private IEnumerator ShowCustomerResponse(int level, float distraction) { this.conversationTracker.AdvanceDialogueWithQuality(level); CraftingManager.IncreaseDistraction(distraction); int quality = this.conversationTracker.Quality; yield return(new WaitForSeconds(0.15f)); playerResponseDraggedSuccess = false; focusedViewDialogueHub.SetMostRecentPlayerResponse(null); yield return(new WaitForSeconds(0.25f)); string[] getLines = this.conversationTracker.GetDisplayLinesAtDialogueIndex(quality); yield return(StartCoroutine(ReadMultiLineConversationSnippet(getLines))); yield return(new WaitWhile(() => conversationUiBusy)); yield return(new WaitForSeconds(0.15f)); conversationResponseManager.SetActiveInConversation(this.conversationTracker.GetPlayerDialogueChoices()); if (this.conversationTracker.ResponseDialogueComplete) { ConversationSnippet.DestroyAllSnippets(this); } }
// Start is called before the first frame update void Start() { if (!settings) { settings = GetComponent <GameSettings>(); } if (!subEventManager) { subEventManager = GetComponent <TwitchSubscribeEventManager>(); } if (!subEventManager) { subEventManager = gameObject.AddComponent <TwitchSubscribeEventManager>(); } commandServer = GetComponent <CommandServer>(); itemManager = GetComponent <ItemManager>(); playerManager = GetComponent <PlayerManager>(); chunkManager = GetComponent <ChunkManager>(); craftingManager = GetComponent <CraftingManager>(); raidManager = GetComponent <RaidManager>(); arenaController = FindObjectOfType <ArenaController>(); commandServer.StartServer(this); }
private void SetupSelections() { Color color = this.m_Buttons[0].m_Icon.color; color.a = ((!Player.Get().CanStartCrafting()) ? this.m_InactiveAlpha : (CraftingManager.Get().gameObject.activeSelf ? this.m_SelectedAlpha : this.m_NormalAlpha)); this.m_Buttons[0].m_Icon.color = color; color = this.m_Buttons[3].m_Icon.color; color.a = ((!Player.Get().CanShowNotepad()) ? this.m_InactiveAlpha : (NotepadController.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha)); this.m_Buttons[3].m_Icon.color = color; color = this.m_Buttons[4].m_Icon.color; color.a = (Inventory3DManager.Get().gameObject.activeSelf ? this.m_SelectedAlpha : this.m_NormalAlpha); this.m_Buttons[4].m_Icon.color = color; color = this.m_Buttons[5].m_Icon.color; color.a = ((!Player.Get().CanStartBodyInspection()) ? this.m_InactiveAlpha : (BodyInspectionController.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha)); this.m_Buttons[5].m_Icon.color = color; color = this.m_Buttons[1].m_Icon.color; color.a = ((!Player.Get().CanStartCrafting()) ? this.m_InactiveAlpha : (CraftingManager.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha)); this.m_Buttons[1].m_Icon.color = color; color = this.m_Buttons[0].m_Icon.color; color.a = ((!Player.Get().CanShowMap()) ? this.m_InactiveAlpha : (MapController.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha)); this.m_Buttons[0].m_Icon.color = color; color = this.m_Buttons[2].m_Icon.color; color.a = ((!Player.Get().CanSleep()) ? this.m_InactiveAlpha : (SleepController.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha)); this.m_Buttons[2].m_Icon.color = color; }
public void UpdateText() { EntityDef def; CardFlair flair; if (CraftingManager.Get().GetShownCardInfo(out def, out flair)) { TAG_RARITY rarity = def.GetRarity(); TAG_CARD_SET cardSet = def.GetCardSet(); if (cardSet == TAG_CARD_SET.CORE) { this.m_rarityLabel.Text = string.Empty; } else { this.m_rarityLabel.Text = GameStrings.GetRarityText(rarity); } this.AssignRarityColors(rarity, cardSet); this.m_rarityGem.SetRarityGem(rarity, cardSet); this.m_setName.Text = GameStrings.GetCardSetName(cardSet); object[] args = new object[] { def.GetArtistName() }; this.m_artistName.Text = GameStrings.Format("GLUE_COLLECTION_ARTIST", args); string str = "<color=#000000ff>" + def.GetFlavorText() + "</color>"; NetCache.CardValue cardValue = CraftingManager.Get().GetCardValue(def.GetCardId(), flair.Premium); if ((cardValue != null) && cardValue.Nerfed) { if (!string.IsNullOrEmpty(str)) { str = str + "\n\n"; } str = str + GameStrings.Get("GLUE_COLLECTION_RECENTLY_NERFED"); } this.m_flavorText.Text = str; } }
private void RemoveItemFromBackpack() { Item item = InventoryBackpack.Get().FindItem(this.m_StoredItemId); if (item == null) { return; } if (CraftingManager.Get().gameObject.activeSelf&& CraftingManager.Get().ContainsItem(item)) { CraftingManager.Get().RemoveItem(item, false); } if (!item.m_CurrentSlot && item.m_InventorySlot && item.m_InventorySlot.m_Items.Count > 0) { item.m_InventorySlot.RemoveItem(item, false); } else if (item.m_CurrentSlot && item.m_CurrentSlot.m_InventoryStackSlot) { item.m_CurrentSlot.RemoveItem(item, false); } if (InventoryBackpack.Get().m_EquippedItem == item) { InventoryBackpack.Get().m_EquippedItem = null; } InventoryBackpack.Get().RemoveItem(item, false); UnityEngine.Object.Destroy(item.gameObject); }
private void SetupInfo() { if (CraftingManager.Get().m_Results.Count == 0) { this.m_CraftButton.gameObject.SetActive(false); this.m_Icon.gameObject.SetActive(false); this.m_Text.gameObject.SetActive(false); return; } ItemInfo itemInfo = CraftingManager.Get().m_Results[0]; string text = itemInfo.m_IconName; if (text.Empty()) { text = "Default_Pickup"; } Sprite sprite = null; ItemsManager.Get().m_ItemIconsSprites.TryGetValue(text, out sprite); this.m_Icon.sprite = sprite; this.m_Text.text = GreenHellGame.Instance.GetLocalization().Get(itemInfo.m_ID.ToString(), true); this.m_CraftButton.gameObject.SetActive(true); this.m_CraftCJButton.OnPointerExit(null); this.m_Icon.gameObject.SetActive(true); this.m_Text.gameObject.SetActive(true); }
private void UpdateAmount(CurrencyType currencyType) { long amount = 0L; switch (currencyType) { case CurrencyType.NONE: return; case CurrencyType.GOLD: amount = NetCache.Get().GetNetObject <NetCache.NetCacheGoldBalance>().GetTotal(); this.SetAmount(amount); return; case CurrencyType.ARCANE_DUST: if (CraftingManager.Get() == null) { amount = NetCache.Get().GetNetObject <NetCache.NetCacheArcaneDustBalance>().Balance; break; } amount = CraftingManager.Get().GetLocalArcaneDustBalance(); break; default: return; } this.SetAmount(amount); }
private void OnRMouseDown() { if (HUDBackpack.Get().m_IsHovered) { return; } if (this.m_CarriedItem) { this.RotateItem(this.m_CarriedItem); } else if (this.m_FocusedItem) { if (!this.m_FocusedItem.m_OnCraftingTable) { HUDItem.Get().Activate(this.m_FocusedItem); } else { CraftingManager.Get().RemoveItem(this.m_FocusedItem); if (this.m_FocusedItem.m_Info.IsHeavyObject() || !this.m_FocusedItem.Take()) { this.DropItem(this.m_FocusedItem); } this.m_FocusedItem = null; } } else if (this.m_PlayerRotationBlocked) { this.BlockPlayerRotation(false); } }
protected override void ShowReward(bool updateCacheValues) { ArcaneDustRewardData data = base.Data as ArcaneDustRewardData; if (data == null) { Debug.LogWarning(string.Format("ArcaneDustReward.ShowReward() - Data {0} is not ArcaneDustRewardData", base.Data)); } else { if (!data.IsDummyReward && updateCacheValues) { NetCache.Get().OnArcaneDustBalanceChanged((long)data.Amount); if (CraftingManager.Get() != null) { CraftingManager.Get().AdjustLocalArcaneDustBalance(data.Amount); CraftingManager.Get().UpdateBankText(); } } base.m_root.SetActive(true); this.m_dustCount.Text = data.Amount.ToString(); Vector3 localScale = this.m_dustJar.transform.localScale; this.m_dustJar.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); object[] args = new object[] { "scale", localScale, "time", 0.5f, "easetype", iTween.EaseType.easeOutElastic }; iTween.ScaleTo(this.m_dustJar.gameObject, iTween.Hash(args)); } }
// Start is called before the first frame update void Start() { playerStatus = GameObject.Find("Player").GetComponent <PlayerStatus>(); isInteraction = gameObject.GetComponent <InteractionWithPlayer>(); //inventory = gameObject.GetComponent<FuranceInventory>(); craftingManager = gameObject.GetComponent <CraftingManager>(); }
private void Start() { craftingManager = GameObject.FindWithTag("CraftingWindow").GetComponent <CraftingManager>(); InvokeRepeating("drop", 0f, repeatTime); Time.timeScale = 0; }
public void OnCraft(GameObject obj) { if (!Player.Get().CanStartCrafting()) { return; } if (NotepadController.Get().IsActive()) { NotepadController.Get().Hide(); this.m_DelayedType = HUDQuickAccessBar.TYPE.Craft; this.m_DelayedObj = obj; return; } if (BodyInspectionController.Get().IsActive()) { Player.Get().StopController(PlayerControllerType.BodyInspection); } if (!Inventory3DManager.Get().gameObject.activeSelf) { Inventory3DManager.Get().Activate(); } if (!CraftingManager.Get().gameObject.activeSelf) { CraftingManager.Get().Activate(); return; } CraftingManager.Get().Deactivate(); }
// Token: 0x0600474C RID: 18252 public static void AddToFavourites(Recipe _recipe) { if (!CraftingManager.FavoriteRecipeList.Contains(_recipe.GetName())) { CraftingManager.ToggleFavoriteRecipe(_recipe); } }
private void Awake() { _craftingManager = CraftingManager.Instance; _uiManager = UiManager.Instance; _uiManager.RegisterWindow(WindowReference.CraftingMenu, gameObject); gameObject.SetActive(false); }
public CraftingMenu(CraftingManager craftingManager) : this(craftingManager.gameObject) { craftingSequenceDisplay = craftingManager.progressDisplay.GetOrAddComponent <TextMeshProUGUI>(); occupiablePositionContainer = new OccupiablePositionContainer(craftingManager.itemObjectPositions); CraftingButtonContainer = craftingManager.craftingActionButtonParent.GetOrAddComponent <UiElementContainer>(); }
public void SetCraftingActionButton(CraftingAction craftAction, CraftingManager crafter) { craftingAction = craftAction; craftingMenuBehaviour = crafter; this.SetWidgetText(craftingAction.ToString()); }
public bool HandleKeyboardInput() { if ((Input.GetKeyUp(KeyCode.Escape) && (CraftingManager.Get() != null)) && CraftingManager.Get().IsCardShowing()) { Navigation.GoBack(); return(true); } return(false); }
private void OnLMouseUp() { if (!this.m_CarriedItem) { return; } if (this.CanInsertCarriedItemToBackpack()) { InventoryBackpack.InsertResult insertResult = InventoryBackpack.Get().InsertItem(this.m_CarriedItem, this.m_SelectedSlot, this.m_SelectedGroup, false, false, false, false, true); if (insertResult != InventoryBackpack.InsertResult.Ok) { insertResult = InventoryBackpack.Get().InsertItem(this.m_CarriedItem, this.m_CarriedItem.m_PrevSlot, this.m_CarriedItem.m_Info.m_PrevInventoryCellsGroup, false, true, true, false, true); } if (insertResult == InventoryBackpack.InsertResult.Ok) { this.m_CarriedItem.m_ShownInInventory = true; this.PlayDropSound(); } } else if (CraftingManager.Get().gameObject.activeSelf&& this.m_MouseOverCraftTable) { CraftingManager.Get().AddItem(this.m_CarriedItem, false); this.PlayDropSound(); } else if (this.m_CarriedItem.m_Info.m_CanBeRemovedFromInventory) { if (BodyInspectionController.Get().IsActive()) { if (this.m_SelectedSlot && this.m_SelectedSlot.IsBIWoundSlot()) { this.m_SelectedSlot.InsertItem(this.m_CarriedItem); } else { this.DropItem(this.m_CarriedItem); } this.PlayDropSound(); } else if (this.m_SelectedSlot) { this.m_SelectedSlot.InsertItem(this.m_CarriedItem); this.PlayDropSound(); } else if (this.m_MouseOverBackpack) { InventoryBackpack.Get().InsertItem(this.m_CarriedItem, null, null, true, true, true, true, true); this.PlayDropSound(); } else { this.DropItem(this.m_CarriedItem); this.PlayDropSound(); } } this.SetCarriedItem(null); }
private void OnCraft() { if (CraftingManager.Get().IsActive()) { CraftingManager.Get().Deactivate(); return; } Inventory3DManager.Get().Activate(); CraftingManager.Get().Activate(); }
// Use this for initialization void Start () { Instance = this; }