public void SetUp(BodyPartUISlots.StorageCharacteristics StorageCharacteristics, ItemSlot ItemSlot, PlayerExaminationWindowUI toset) { UI_ItemSlot.LinkSlot(ItemSlot); UI_ItemSlot.SetUp(StorageCharacteristics); parent = toset; }
public void RemoveSpecifyedUISlot(IDynamicItemSlotS bodyPartUISlots, BodyPartUISlots.StorageCharacteristics StorageCharacteristics) { if (BodyPartToSlot.ContainsKey(bodyPartUISlots) == false) { BodyPartToSlot[bodyPartUISlots] = new List <GameObject>(); } var Slot = bodyPartUISlots.RelatedStorage.GetNamedItemSlot(StorageCharacteristics.namedSlot); for (int i = 0; i < BodyPartToSlot[bodyPartUISlots].Count; i++) { var slot = BodyPartToSlot[bodyPartUISlots][i].GetComponentInChildren <UI_DynamicItemSlot>(); if (slot.ItemSlot == Slot) { OpenSlots.Remove(BodyPartToSlot[bodyPartUISlots][i].GetComponentInChildren <UI_DynamicItemSlot>()); BodyPartToSlot[bodyPartUISlots][i].GetComponentInChildren <UI_DynamicItemSlot>().ReSetSlot(); Destroy(BodyPartToSlot[bodyPartUISlots][i]); BodyPartToSlot[bodyPartUISlots].RemoveAt(i); } } if (BodyPartToSlot[bodyPartUISlots].Count == 0) { BodyPartToSlot.Remove(bodyPartUISlots); } if (StorageCharacteristics.SlotArea == SlotArea.Hands) { HandsController.RemoveHand(StorageCharacteristics); } }
public void SetUp(BodyPartUISlots.StorageCharacteristics storageCharacteristics) { if (placeholderImage != null) { placeholderImage.sprite = storageCharacteristics.placeholderSprite; } namedSlot = storageCharacteristics.namedSlot; hoverName = storageCharacteristics.hoverName; }
public void AddHand(IDynamicItemSlotS bodyPartUISlots, BodyPartUISlots.StorageCharacteristics StorageCharacteristics) { if (this == null) { return; } DoubleHandController HandController; switch (StorageCharacteristics.namedSlot) { case NamedSlot.leftHand: if (AvailableLeftHand.Count > 0) { HandController = AvailableLeftHand[0]; AvailableLeftHand.RemoveAt(0); } else { HandController = Instantiate(DoubleHandController, transform); HandController.HideAll(); HandController.RelatedHandsController = this; AvailableRightHand.Add(HandController); DoubleHandControllers.Add(HandController); } break; case NamedSlot.rightHand: if (AvailableRightHand.Count > 0) { HandController = AvailableRightHand[0]; AvailableRightHand.RemoveAt(0); } else { HandController = Instantiate(DoubleHandController, transform); HandController.HideAll(); HandController.RelatedHandsController = this; AvailableLeftHand.Add(HandController); DoubleHandControllers.Add(HandController); } break; default: Logger.LogError("humm Tried to put non-hand into Hand Slot"); return; } StorageToHands[StorageCharacteristics] = HandController; HandController.AddHand(bodyPartUISlots, StorageCharacteristics); if (PlayerManager.LocalPlayerScript.playerNetworkActions.activeHand == null) { HandController.PickActiveHand(); } }
/// <summary> /// /// </summary> /// <param name="bodyPartUISlots"></param> /// <param name="StorageCharacteristics"></param> /// <returns>To mark whether or not to destroy hand controller from no hands being Present in it</returns> public bool RemoveHand( BodyPartUISlots.StorageCharacteristics StorageCharacteristics) { if (this == null) { return(false); } switch (StorageCharacteristics.namedSlot) { case NamedSlot.leftHand: if (RelatedHandsController.activeDoubleHandController == this && RelatedHandsController.ActiveHand == NamedSlot.leftHand && RightHandActive) { ActivateRightHand(); } LeftHand.SetActive(false); LeftHandActive = false; UI_LeftHand.ReSetSlot(); break; case NamedSlot.rightHand: if (RelatedHandsController.activeDoubleHandController == this && RelatedHandsController.ActiveHand == NamedSlot.rightHand && LeftHandActive) { ActivateLeftHand(); } RightHand.SetActive(false); RightHandActive = false; UI_RightHand.ReSetSlot(); break; } if (LeftHandActive == false && RightHandActive == false) { return(true); } if ((LeftHandActive && RightHandActive) == false) { Overly.SetActive(false); } return(false); }
public void AddIndividual(IDynamicItemSlotS bodyPartUISlots, BodyPartUISlots.StorageCharacteristics storageCharacteristicse) { if (this == null) { return; } if (storageCharacteristicse.SlotArea == SlotArea.Hands) { HandsController.AddHand(bodyPartUISlots, storageCharacteristicse); } else { var gameobjt = Instantiate(SlotPrefab); var NewSlot = gameobjt.GetComponentInChildren <UI_DynamicItemSlot>(); NewSlot.SetupSlot(bodyPartUISlots, storageCharacteristicse); switch (storageCharacteristicse.SlotArea) { case SlotArea.Pockets: gameobjt.transform.SetParent(Pockets.transform); break; case SlotArea.SuitStorage: gameobjt.transform.SetParent(SuitStorage.transform); break; case SlotArea.BeltPDABackpack: gameobjt.transform.SetParent(BeltPDABackpack.transform); break; case SlotArea.Clothing: gameobjt.transform.SetParent(Clothing.transform); break; } // if (ClientContents.ContainsKey(storageCharacteristicse.SlotArea) == false) ClientContents[storageCharacteristicse.SlotArea] = new List<UI_DynamicItemSlot>(); // ClientContents[storageCharacteristicse.SlotArea].Add(NewSlot); gameobjt.transform.localScale = Vector3.one; if (BodyPartToSlot.ContainsKey(bodyPartUISlots) == false) { BodyPartToSlot[bodyPartUISlots] = new List <GameObject>(); } BodyPartToSlot[bodyPartUISlots].Add(gameobjt); OpenSlots.Add(NewSlot); } }
//Used to set up sprites and properties of the Item slot public void SetupSlot(IDynamicItemSlotS bodyPartUISlots, BodyPartUISlots.StorageCharacteristics storageCharacteristics) { if (placeholderImage != null) { placeholderImage.sprite = storageCharacteristics.placeholderSprite; } namedSlot = storageCharacteristics.namedSlot; hoverName = storageCharacteristics.hoverName; RelatedBodyPartUISlots = bodyPartUISlots; var linkedSlot = ItemSlot.GetNamed(bodyPartUISlots.RelatedStorage, namedSlot); if (linkedSlot != null) { LinkSlot(linkedSlot); } }
public void AddHand(IDynamicItemSlotS bodyPartUISlots, BodyPartUISlots.StorageCharacteristics StorageCharacteristics) { switch (StorageCharacteristics.namedSlot) { case NamedSlot.leftHand: LeftHand.SetActive(true); LeftHandActive = true; UI_LeftHand.SetUpHand(bodyPartUISlots, StorageCharacteristics); break; case NamedSlot.rightHand: RightHand.SetActive(true); RightHandActive = true; UI_RightHand.SetUpHand(bodyPartUISlots, StorageCharacteristics); break; } if (LeftHandActive && RightHandActive) { Overly.SetActive(true); } }
public void RemoveHand( BodyPartUISlots.StorageCharacteristics StorageCharacteristics) { if (StorageToHands.ContainsKey(StorageCharacteristics) == false) { return; } if (StorageToHands[StorageCharacteristics].RemoveHand(StorageCharacteristics)) { var DoubleHand = StorageToHands[StorageCharacteristics]; DoubleHandControllers.Remove(DoubleHand); if (AvailableLeftHand.Contains(DoubleHand)) { AvailableLeftHand.Remove(DoubleHand); } if (AvailableRightHand.Contains(DoubleHand)) { AvailableRightHand.Remove(DoubleHand); } List <BodyPartUISlots.StorageCharacteristics> Toremove = new List <BodyPartUISlots.StorageCharacteristics>(); foreach (var KHandController in StorageToHands) { if (KHandController.Value == DoubleHand) { Toremove.Add(KHandController.Key); } } foreach (var storageCharacteristicse in Toremove) { StorageToHands.Remove(storageCharacteristicse); } if (activeDoubleHandController == DoubleHand) { if (DoubleHandControllers.Count > 0) { foreach (var DHC in DoubleHandControllers) { DHC.PickActiveHand(); break; } } else { PlayerManager.LocalPlayerScript.playerNetworkActions.CmdSetActiveHand(0, NamedSlot.none); PlayerManager.LocalPlayerScript.playerNetworkActions.activeHand = null; PlayerManager.LocalPlayerScript.playerNetworkActions.CurrentActiveHand = NamedSlot.none; } } DoubleHandControllers.Remove(DoubleHand); Destroy(DoubleHand.gameObject); } else { switch (StorageCharacteristics.namedSlot) { case NamedSlot.leftHand: AvailableLeftHand.Add(StorageToHands[StorageCharacteristics]); break; case NamedSlot.rightHand: AvailableRightHand.Add(StorageToHands[StorageCharacteristics]); break; } } StorageToHands.Remove(StorageCharacteristics); }
public void SetUpHand(IDynamicItemSlotS bodyPartUISlots, BodyPartUISlots.StorageCharacteristics StorageCharacteristics) { SetupSlot(bodyPartUISlots, StorageCharacteristics); }