protected override void OnPassengerRemove(Player player, VehicleSeatType seatType, byte seatPosition) { if (seatType != VehicleSeatType.Pilot) { return; } for (ItemSlot i = ItemSlot.MountFront; i <= ItemSlot.MountRight; i++) { var itemVisual = new ItemVisual { Slot = i }; // hoverboards have their flair visuals added to the player if (MountType == PetType.HoverBoard) { player.SetAppearance(itemVisual); } else { SetAppearance(itemVisual); } } if (PilotDisplayInfo != null) { player.SetAppearance(new ItemVisual { Slot = ItemSlot.Mount }); } UpdateVisuals(player); }
public void Initialize(ItemVisual itemVisual) { List <ItemEntity> items = itemVisual.GetContent(); m_itemVisual = itemVisual; for (int i = 0; i < Content.Count; i++) { if (items.Count > i) { Content[i].Item = items[i]; } else { Content[i].Item = null; } Content[i].UpdateSprite(); } if (Player.GetInstance().Hand.CurrentObject != null && !CheckEmptySlot()) { LockPanel.SetActive(true); } else { LockPanel.SetActive(false); } }
/// <summary> /// Update visual for supplied <see cref="ItemSlot"/> and optional <see cref="Costume"/>. /// </summary> private ItemVisual VisualUpdate(ItemSlot slot, Costume costume) { ItemVisual visual = GetItemVisual(slot, costume); player?.SetAppearance(visual); return(visual); }
public override void SerializeItemVisuals(ItemVisual itemVisual) { base.SerializeItemVisuals(itemVisual); var armorVis = itemVisual as ArmorVisuals; this.Position = itemVisual.transform.position; this.Rotation = itemVisual.transform.rotation.eulerAngles; HideFace = armorVis.HideFace; HideHair = armorVis.HideHair; }
public void OnBeginDrag(PointerEventData eventData) { if (itemAsset.counter > 0) { SelectedItem = Instantiate(GetComponent <ItemVisual>(), transform); SelectedItem.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(50, 50); SelectedItem.transform.parent = GameObject.FindWithTag("Canvas").transform; itemAsset.counter -= 1; GetComponentInChildren <Text>().text = itemAsset.counter.ToString(); SelectedItem.GetComponentInChildren <Text>().text = null; SelectedItem.GetComponent <Image>().raycastTarget = false; } }
protected override void OnPassengerAdd(Player player, VehicleSeatType seatType, byte seatPosition) { if (seatType != VehicleSeatType.Pilot) { return; } if (PilotDisplayInfo != null) { player.SetAppearance(new ItemVisual { Slot = ItemSlot.Mount, DisplayId = (ushort)PilotDisplayInfo.Id }); } PetCustomisation customisation = player.PetCustomisationManager.GetCustomisation(MountType, SpellEntry.Id); if (customisation != null) { ItemSlot slot = ItemSlot.MountFront; foreach (PetFlairEntry entry in customisation) { if (entry != null) { var itemVisual = new ItemVisual { Slot = slot, DisplayId = (ushort)(slot != ItemSlot.MountRight ? entry.ItemDisplayId[0] : entry.ItemDisplayId[1]) }; // hoverboards have their flair visuals added to the player if (MountType == PetType.HoverBoard) { player.SetAppearance(itemVisual); } else { SetAppearance(itemVisual); } } slot++; } } UpdateVisuals(player); }
internal override void ApplyItemVisualSettings(ItemVisual itemVisual, Transform actualVisuals) { base.ApplyItemVisualSettings(itemVisual, actualVisuals); var armorVisuals = itemVisual as ArmorVisuals; if (this.HideFace != null) { armorVisuals.HideFace = (bool)HideFace; } if (this.HideHair != null) { armorVisuals.HideHair = (bool)HideHair; } }
/// <summary> /// Returns <see cref="ItemVisual"/> for any visible items. /// </summary> public IEnumerable <ItemVisual> GetItemVisuals(Costume costume) { Bag bag = GetBag(InventoryLocation.Equipped); Debug.Assert(bag != null); foreach (Item item in bag) { Item2TypeEntry itemTypeEntry = GameTableManager.ItemType.GetEntry(item.Entry.Item2TypeId); ItemVisual visual = GetItemVisual((ItemSlot)itemTypeEntry.ItemSlotId, costume); if (visual != null) { yield return(visual); } } }
public static bool Prefix(ItemVisual __instance, ImbueStack newStack, Weapon _linkedWeapon) { var self = __instance; // if its not a bow, just do orig(self) and return if (_linkedWeapon.Type != Weapon.WeaponType.Bow) { return(true); } newStack.ImbueFX = ItemManager.Instance.GetImbuedFX(newStack.ImbuedEffectPrefab); if (!newStack.ImbueFX.gameObject.activeSelf) { newStack.ImbueFX.gameObject.SetActive(true); } newStack.ParticleSystems = newStack.ImbueFX.GetComponentsInChildren <ParticleSystem>(); if (self.GetComponentInChildren <SkinnedMeshRenderer>() is SkinnedMeshRenderer skinnedMesh) { for (int j = 0; j < newStack.ParticleSystems.Length; j++) { if (newStack.ParticleSystems[j].shape.shapeType == ParticleSystemShapeType.MeshRenderer) { var shape = newStack.ParticleSystems[j].shape; shape.shapeType = ParticleSystemShapeType.SkinnedMeshRenderer; shape.skinnedMeshRenderer = skinnedMesh; } newStack.ParticleSystems[j].Play(); } } newStack.ImbueFX.SetParent(self.transform); newStack.ImbueFX.ResetLocal(true); if (At.GetValue(typeof(ItemVisual), self, "m_linkedImbueFX") is List <ImbueStack> m_linkedImbues) { m_linkedImbues.Add(newStack); At.SetValue(m_linkedImbues, typeof(ItemVisual), self, "m_linkedImbueFX"); } return(false); }
internal virtual void ApplyItemVisualSettings(ItemVisual itemVisual, Transform visuals) { SL.Log($"Applying ItemVisuals settings to " + visuals.name); if (Position != null) { visuals.localPosition = (Vector3)Position; } if (Rotation != null) { visuals.eulerAngles = (Vector3)Rotation; } if (PositionOffset != null) { visuals.localPosition += (Vector3)PositionOffset; } if (RotationOffset != null) { visuals.eulerAngles += (Vector3)RotationOffset; } }
public virtual void SerializeItemVisuals(ItemVisual itemVisual) { if (!itemVisual.gameObject.GetComponentInChildren <SkinnedMeshRenderer>()) { var t = itemVisual.transform; foreach (Transform child in t) { if (child.GetComponent <MeshRenderer>() && child.GetComponent <BoxCollider>()) { Position = child.localPosition; Rotation = child.eulerAngles; break; } } } else { Position = itemVisual.transform.position; Rotation = itemVisual.transform.rotation.eulerAngles; } }
public static ItemProperty VisualEffect(ItemVisual itemVisual) => NWScript.ItemPropertyVisualEffect((int)itemVisual);
public static ItemProperty VisualEffect(ItemVisual itemVisual) { return(NWScript.ItemPropertyVisualEffect((int)itemVisual) !); }
public static ObservableCollection<ItemVisual> LoadItemVisuals() { ObservableCollection<ItemVisual> list = new ObservableCollection<ItemVisual>(); using (FileStream stream = File.Open(DATA_PATH + "DBC/ItemVisuals.dbc", FileMode.Open)) { BinaryReader r = new BinaryReader(stream); DBCHeader header = DBC.ReadDBCHeader(r); int dataSize = 20 + header.RowSize * header.Records; for (int i = 0; i != header.Records; ++i) { ItemVisual visual = new ItemVisual(); visual.ID = r.ReadInt32(); visual.Effect1 = r.ReadInt32(); visual.Effect2 = r.ReadInt32(); visual.Effect3 = r.ReadInt32(); visual.Effect4 = r.ReadInt32(); visual.Effect5 = r.ReadInt32(); list.Add(visual); } r.Close(); } return list; }
public static void CheckRentStatus() { try { AreaEnum areaN = (AreaEnum)AreaManager.Instance.GetAreaIndexFromSceneName(SceneManagerHelper.ActiveSceneName); if (DEBUG) { MyLogger.LogDebug($"CheckRentStatus={areaN}"); } if (!CheckStash()) { return; } Character character = CharacterManager.Instance.GetCharacter(CharacterManager.Instance.PlayerCharacters.Values[0]); CurrentStash = (TreasureChest)ItemManager.Instance.GetItem(StashAreaToStashUID[areaN]); if (!StashAreaToStashUID.Values.Contains(CurrentStash.UID)) { CurrentStash = null; if (DEBUG) { MyLogger.LogDebug($" > Unknown stash"); } return; } if (CurrentStash == null) { if (DEBUG) { MyLogger.LogDebug($" > NullStash"); } return; } //OLogger.Log($"Silver={m_currentStash.ContainedSilver}"); // If we are in Cierzo, check quest failure if (areaN == AreaEnum.CierzoVillage) { if (QuestEventManager.Instance.CurrentQuestEvents.Count(q => q.Name == $"General_NotLighthouseOwner") > 0) { CurrentStash = null; } return; } if (QuestEventManager.Instance.CurrentQuestEvents.Count(q => q.Name == $"PlayerHouse_{areaN}_HouseAvailable") > 0) { // House has been bought here, cancel rent event if present if (DEBUG) { MyLogger.LogDebug(" > House bought here"); } if (QuestEventManager.Instance.HasQuestEvent(StashAreaToQuestEvent[areaN].QuestEvent)) { QuestEventManager.Instance.RemoveEvent(StashAreaToQuestEvent[areaN].QuestEvent.EventUID); } return; } #region Move stash to inn Vector3 newPos = StashAreaToQuestEvent[areaN].StashPosition; Quaternion newRot = StashAreaToQuestEvent[areaN].StashRotation; CurrentStash.transform.SetPositionAndRotation(newPos, newRot); //ItemVisual iv2 = ItemManager.GetVisuals(m_currentStash.ItemID); //ItemVisual iv2 = ItemManager.GetVisuals(m_currentStash); Transform transform = UnityEngine.Object.Instantiate(CurrentStash.GetItemVisual()); ItemVisual iv2 = transform.GetComponent <ItemVisual>(); //ItemVisual iv2 = UnityEngine.Object.Instantiate(m_currentStash.LoadedVisual); iv2.ItemID = CurrentStash.ItemID; //ItemVisual iv2 = m_currentStash.LoadedVisual; iv2.transform.SetPositionAndRotation(newPos, newRot); #endregion CurrentStash.SetCanInteract(false); if (QuestEventManager.Instance.HasQuestEvent(StashAreaToQuestEvent[areaN].QuestEvent)) { if (QuestEventManager.Instance.CheckEventExpire(StashAreaToQuestEvent[areaN].QuestEvent.EventUID, Instance.ConfigRentDuration.Value * 24)) { //m_notification = $"Rent has expired!"; character.CharacterUI.SmallNotificationPanel.ShowNotification("Rent has expired!", 8f); QuestEventManager.Instance.RemoveEvent(StashAreaToQuestEvent[areaN].QuestEvent.EventUID); if (DEBUG) { MyLogger.LogDebug(" > Rent expired!"); } } else { //m_notification = "Rent ongoing"; character.CharacterUI.SmallNotificationPanel.ShowNotification("Rent ongoing", 8f); CurrentStash.SetCanInteract(true); if (DEBUG) { MyLogger.LogDebug(" > Rent still valid"); } } } else { if (DEBUG) { MyLogger.LogDebug($" > NoQuestEvent"); } } } catch (Exception ex) { MyLogger.LogError("CheckRentStatus: " + ex.Message); } }
private void HandleCollectionChanged (object sender, NotifyCollectionChangedEventArgs e) { if (ItemsPanel == null) return; switch (e.Action) { case NotifyCollectionChangedAction.Add: var index = e.NewStartingIndex; foreach (var o in e.NewItems) { var child = ItemTemplate.LoadContent (o); ItemsPanel.Children.Insert (index, child); items.Insert (index, new ItemVisual () { Item = o, Visual = child }); index++; } break; case NotifyCollectionChangedAction.Remove: foreach (var o in e.OldItems) { var item = items.First (i => i.Item == o); ItemsPanel.Children.Remove (item.Visual); items.Remove (item); } break; case NotifyCollectionChangedAction.Replace: var index2 = e.NewStartingIndex; foreach (var o in e.NewItems) { var child = ItemTemplate.LoadContent (o); ItemsPanel.Children[index2] = child; items[index2] = new ItemVisual () { Item = o, Visual = child }; index2++; } break; case NotifyCollectionChangedAction.Reset: ItemsPanel.Children.Clear (); break; default: break; } }
private void Awake() { itemVisual = GetComponent <ItemVisual>(); }
public void Initialize(ItemDescription desc) { Description = desc; Visual = new ItemVisual(Description, Vector3.zero, transform); }
public void InitializeTest() { Visual = new ItemVisual(Description, Vector3.zero, transform); }
public static SL_ItemVisual ParseVisualToTemplate(Item item, VisualPrefabType type, ItemVisual itemVisual) { var template = (SL_ItemVisual)Activator.CreateInstance(Serializer.GetBestSLType(itemVisual.GetType())); template.SerializeItemVisuals(itemVisual); switch (type) { case VisualPrefabType.VisualPrefab: template.ResourcesPrefabPath = item.VisualPrefabPath; break; case VisualPrefabType.SpecialVisualPrefabDefault: template.ResourcesPrefabPath = item.SpecialVisualPrefabDefaultPath; break; case VisualPrefabType.SpecialVisualPrefabFemale: template.ResourcesPrefabPath = item.SpecialVisualPrefabFemalePath; break; } ; return(template); }