private void OnClothingEquipped(ClothingV2 clothing, bool isEquiped) { //Logger.Log($"Clothing {clothing} was equipped {isEquiped}!", Category.Inventory); // if new clothes equiped, add new hide flags if (isEquiped) { hideClothingFlags |= clothing.HideClothingFlags; } // if player get off old clothes, we need to remove old flags else { //repeat 11 times, once for each bit for (int i = 0; i < 11; i++) { //get a bit from the byte ulong bit = ((ulong)clothing.HideClothingFlags >> i) & 1U; if (bit == 1) { //disable the enabled bit ulong bytechange = (ulong)hideClothingFlags; bytechange &= ~(1UL << 1); hideClothingFlags = (ClothingHideFlags)bytechange; } } } // Update hide flags ValidateHideFlags(); }
public void RefreshFromClothing(ClothingV2 clothing) { spriteHandler.spriteData = clothing.SpriteInfo; List <Color> palette = clothing.GetComponent <ItemAttributesV2>()?.ItemSprites?.Palette; if (palette != null) { spriteHandler.SetPaletteOfCurrentSprite(palette); } spriteHandler.ChangeSprite(clothing.SpriteInfoState); PushTexture(); }
public void RefreshFromClothing(ClothingV2 clothing) { spriteHandler.SetCatalogue(clothing.SpriteDataSO); spriteHandler.ChangeSprite(clothing.CurrentClothIndex); List <Color> palette = clothing.GetComponent <ItemAttributesV2>()?.ItemSprites?.Palette; if (palette != null) { spriteHandler.SetPaletteOfCurrentSprite(palette, Network: false); } PushTexture(); }
private void OnClothingEquipped(ClothingV2 clothing, bool isEquiped) { //Logger.Log($"Clothing {clothing} was equipped {isEquiped}!", Category.Inventory); // if new clothes equiped, add new hide flags if (isEquiped) { hideClothingFlags |= clothing.HideClothingFlags; } // if player get off old clothes, we need to remove old flags else { hideClothingFlags ^= clothing.HideClothingFlags; } // Update hide flags ValidateHideFlags(); }
public void OnClothingEquipped(ClothingV2 clothing, bool isEquipped) { //Logger.Log($"Clothing {clothing} was equipped {isEquiped}!", Category.Inventory); // if new clothes equiped, add new hide flags if (isEquipped) { for (int n = 0; n < 11; n++) { //if both bits are enabled set the n'th bit in the overflow string if (IsBitSet((ulong)clothing.HideClothingFlags, n) && (IsBitSet((ulong)hideClothingFlags, n))) { overflow |= 1UL << n; } else if (IsBitSet((ulong)clothing.HideClothingFlags, n)) //check if n'th bit is set to 1 { ulong bytechange = (ulong)hideClothingFlags; bytechange |= 1UL << n; //set n'th bit to 1 hideClothingFlags = (ClothingHideFlags)bytechange; } } } // if player get off old clothes, we need to remove old flags else { for (int n = 0; n < 11; n++) //repeat 11 times, once for each hide flag { if (IsBitSet(overflow, n)) //check if n'th bit in overflow is set to 1 { overflow &= ~(1UL << n); //set n'th bit to 0 } else if (IsBitSet((ulong)clothing.HideClothingFlags, n)) //check if n'th bit is set to 1 { ulong bytechange = (ulong)hideClothingFlags; bytechange &= ~(1UL << n); //set n'th bit to 0 hideClothingFlags = (ClothingHideFlags)bytechange; } } } // Update hide flags ValidateHideFlags(); }
private void CheckAndApplyPalette() { isPaletted = false; //image.material.SetInt("_IsPaletted", 0); ClothingV2 prefabClothing = prefab.GetComponent <ClothingV2>(); if (prefabClothing != null) { palette = prefabClothing.GetPaletteOrNull(); if (palette != null) { isPaletted = true; image.material.SetInt("_IsPaletted", 1); image.material.SetColorArray("_ColorPalette", palette.ToArray()); palette = new List <Color>(image.material.GetColorArray("_ColorPalette")); } } if (!isPaletted) { image.material.SetInt("_IsPaletted", 0); } }
public void RefreshFromClothing(ClothingV2 clothing) { spriteHandler.spriteData = clothing.SpriteInfo; spriteHandler.ChangeSprite(clothing.SpriteInfoState); PushTexture(); }
private void Awake() { clothingV2 = GetComponent <ClothingV2>(); itemAttributesV2 = GetComponent <ItemAttributesV2>(); spriteHandler = GetComponentInChildren <SpriteHandler>(); }
private void Awake() { clothingV2 = GetComponent <ClothingV2>(); itemAttributesV2 = GetComponent <ItemAttributesV2>(); }