private void CreateConstruction() { Item item = null; item = ItemsManager.Get().CreateItem(this.m_ResultItemID, true, base.transform.position, base.transform.rotation); if (this.m_PlacingCondition == ConstructionGhost.GhostPlacingCondition.NeedFirecamp) { IFirecampAttach[] components = item.gameObject.GetComponents <IFirecampAttach>(); foreach (IFirecampAttach firecampAttach in components) { firecampAttach.SetFirecamp(this.m_Firecamp); } } if (this.m_FirecampRacks.Count > 0 && ItemInfo.IsFirecamp(item.GetInfoID())) { foreach (FirecampRack firecampRack in this.m_FirecampRacks) { IFirecampAttach[] components2 = firecampRack.gameObject.GetComponents <IFirecampAttach>(); foreach (IFirecampAttach firecampAttach2 in components2) { firecampAttach2.SetFirecamp((Firecamp)item); } } } if (this.m_Smoker && ItemInfo.IsFirecamp(item.GetInfoID())) { IFirecampAttach[] components3 = this.m_Smoker.gameObject.GetComponents <IFirecampAttach>(); foreach (IFirecampAttach firecampAttach3 in components3) { firecampAttach3.SetFirecamp((Firecamp)item); } } if (this.m_ConstructionObjectName.Length > 0) { item.gameObject.name = this.m_ConstructionObjectName; } ScenarioAction.OnItemCreated(item.gameObject); ScenarioCndTF.OnItemCreated(item.gameObject); EventsManager.OnEvent(Enums.Event.Build, 1, (int)this.m_ResultItemID); HUDMessages hudmessages = (HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages)); hudmessages.AddMessage(GreenHellGame.Instance.GetLocalization().Get(this.m_ResultItemID.ToString()) + " " + GreenHellGame.Instance.GetLocalization().Get("HUDConstruction_Created"), null, HUDMessageIcon.None, string.Empty); PlayerAudioModule.Get().PlayBuildCompletedSound(); ItemsManager.Get().OnCreateItem(this.m_ResultItemID); item.SetLayer(item.transform, LayerMask.NameToLayer("Item")); foreach (IGhostObserver ghostObserver in this.m_Observers) { ghostObserver.OnCreateConstruction(this, item); } }
public void Load() { while (InventoryBackpack.Get().m_Items.Count > 0) { InventoryBackpack.Get().RemoveItem(InventoryBackpack.Get().m_Items[0], false); } int i = 0; while (i < Item.s_AllItems.Count) { if (Item.s_AllItems[i] == null) { Item.s_AllItems.RemoveAt(i); } else { if (Item.s_AllItems[i].GetInfoID() != ItemID.Liane_ToHoldHarvest) { UnityEngine.Object.Destroy(Item.s_AllItems[i].gameObject); } i++; } } Item.s_AllItems.Clear(); this.m_ItemsToSetupAfterLoad.Clear(); int num = SaveGame.LoadIVal("ItemsCount"); for (int j = 0; j < num; j++) { ItemID item_id = (ItemID)SaveGame.LoadIVal("ItemID" + j); bool flag = SaveGame.LoadBVal("ItemIMReg" + j); Item item = this.CreateItem(item_id, false, Vector3.zero, Quaternion.identity); item.Load(j); if (flag) { item.ItemsManagerRegister(false); } this.m_ItemsToSetupAfterLoad.Add(item); ScenarioAction.OnItemCreated(item.gameObject); ScenarioCndTF.OnItemCreated(item.gameObject); } InventoryBackpack.Get().OnInventoryChanged(); this.m_CreationsData.Clear(); int num2 = SaveGame.LoadIVal("ItemCreationData"); for (int k = 0; k < num2; k++) { ItemID key = (ItemID)SaveGame.LoadIVal("ItemCreationDataID" + k); int value = SaveGame.LoadIVal("ItemCreationDataCount" + k); this.m_CreationsData.Add((int)key, value); } this.m_CraftingLockedItems.Clear(); int num3 = SaveGame.LoadIVal("CraftingLockedItems"); for (int l = 0; l < num3; l++) { ItemID item2 = (ItemID)SaveGame.LoadIVal("CraftingLockedItem" + l); this.m_CraftingLockedItems.Add(item2); } this.m_WasConsumedData.Clear(); num2 = SaveGame.LoadIVal("ItemWasConsumed"); for (int m = 0; m < num2; m++) { this.m_WasConsumedData.Add((ItemID)SaveGame.LoadIVal("ItemWasConsumedID" + m)); } this.m_WasCollectedData.Clear(); num2 = SaveGame.LoadIVal("ItemWasCollected"); for (int n = 0; n < num2; n++) { this.m_WasCollectedData.Add((ItemID)SaveGame.LoadIVal("ItemWasCollectedID" + n)); } this.m_WasCraftedData.Clear(); num2 = SaveGame.LoadIVal("ItemWasCrafted"); for (int num4 = 0; num4 < num2; num4++) { this.m_WasCraftedData.Add((ItemID)SaveGame.LoadIVal("ItemWasCraftedID" + num4)); } this.m_WasLiquidBoiledData.Clear(); num2 = SaveGame.LoadIVal("WasLiquidBoiled"); for (int num5 = 0; num5 < num2; num5++) { this.m_WasLiquidBoiledData.Add((LiquidType)SaveGame.LoadIVal("WasLiquidBoiledID" + num5)); } ItemsManager.s_ItemUniqueID = SaveGame.LoadIVal("UniqueID"); this.m_UnlockedInNotepadItems.Clear(); int num6 = SaveGame.LoadIVal("UnlockedInNotepadItems"); for (int num7 = 0; num7 < num6; num7++) { ItemID id = (ItemID)SaveGame.LoadIVal("UnlockedInNotepadItemID" + num7); this.UnlockItemInNotepad(id); } }