public override void UpdateSpritesForImplant(BodyPart implant, ClothingHideFlags INClothingHide, SpriteDataSO Sprite, SpriteOrder _SpriteOrder = null)
 {
     ClothingHide = INClothingHide;
     SpriteOrder  = _SpriteOrder;
     baseSpriteHandler.PushTexture();
     OverlySpriteHandler.PushTexture();
 }
Exemple #2
0
        /// <summary>
        /// Sets up the sprite of a specified body part and adds its Net ID to InternalNetIDs
        /// </summary>
        /// <param name="implant">Body Part to display</param>
        public void SetupSpritesNID(BodyPart implant)
        {
            int  i = 0;
            bool isSurfaceSprite = implant.IsSurface;
            var  sprites         = implant.GetBodyTypeSprites(PlayerSprites.ThisCharacter.BodyType);

            foreach (var Sprite in sprites.Item2)
            {
                var newSprite = Spawn.ServerPrefab(implant.SpritePrefab.gameObject, Vector3.zero, this.transform)
                                .GameObject.GetComponent <BodyPartSprites>();
                newSprite.transform.localPosition = Vector3.zero;
                //newSprite.name = implant.name;
                PlayerSprites.Addedbodypart.Add(newSprite);
                if (ImplantBaseSpritesDictionary.ContainsKey(implant) == false)
                {
                    ImplantBaseSpritesDictionary[implant] = new List <BodyPartSprites>();
                }

                if (isSurfaceSprite)
                {
                    PlayerSprites.SurfaceSprite.Add(newSprite);
                }

                implant.RelatedPresentSprites.Add(newSprite);
                ImplantBaseSpritesDictionary[implant].Add(newSprite);
                var newOrder = new SpriteOrder(sprites.Item1);
                newOrder.Add(i);
                newSprite.UpdateSpritesForImplant(implant, implant.ClothingHide, Sprite, this, newOrder);
                InternalNetIDs.Add(newSprite.GetComponent <NetworkIdentity>().netId);

                i++;
                i++;
            }
            RootBodyPartController.RequestUpdate(this);
        }
 public void SetSpriteOrder(SpriteOrder InSpriteOrder, bool Lobby = false)
 {
     spriteOrder = InSpriteOrder;
     if (Lobby == false)
     {
         UpdateData(JsonConvert.SerializeObject(spriteOrder));
     }
 }
Exemple #4
0
	public void UpdateData(string InNew)
	{
		if (InNew == null) return;
		Data = InNew;
		if (CustomNetworkManager.Instance._isServer) return;
		spriteOrder = JsonConvert.DeserializeObject<SpriteOrder>(Data);
		SpriteOrder.Orders.RemoveRange(0, 4);
	}
	public void UpdateData(string InNew)
	{
		if (string.IsNullOrEmpty(InNew)) return;
		Data = InNew;
		SpriteOrder = JsonConvert.DeserializeObject<SpriteOrder>(Data);
		SpriteOrder.Orders.RemoveRange(0, 4);
		if (SpriteOrder != null)
		{
			if (SpriteOrder.Orders.Count > referenceOffset)
			{
				spriteRenderer.sortingOrder = SpriteOrder.Orders[referenceOffset];
			}
		}
		if (baseSpriteHandler == null) return;
		baseSpriteHandler.ChangeSpriteVariant(referenceOffset, false);
	}
	public virtual void UpdateSpritesForImplant(BodyPart implant,ClothingHideFlags INClothingHide, SpriteDataSO Sprite, SpriteOrder _SpriteOrder = null)
	{
		if (baseSpriteHandler == null) return;
		ClothingHide = INClothingHide;
		UpdateData( JsonConvert.SerializeObject(_SpriteOrder));
		//baseSpriteHandler.name = baseSpriteHandler.name + implant.name;
		baseSpriteHandler.SetSpriteSO(Sprite, Color.white);
		SpriteOrder = _SpriteOrder;
		if (SpriteOrder != null)
		{
			if (SpriteOrder.Orders.Count > 0)
			{
				spriteRenderer.sortingOrder = SpriteOrder.Orders[0];
			}
		}
		baseSpriteHandler.ChangeSpriteVariant(referenceOffset, false);
	}
 public virtual void UpdateSpritesForImplant(BodyPart implant, ClothingHideFlags INClothingHide, SpriteDataSO Sprite, RootBodyPartContainer rootBodyPartContainer, SpriteOrder _SpriteOrder = null)
 {
     if (baseSpriteHandler == null)
     {
         return;
     }
     ClothingHide = INClothingHide;
     UpdateData("", JsonConvert.SerializeObject(_SpriteOrder));
     //baseSpriteHandler.name = baseSpriteHandler.name + implant.name;
     baseSpriteHandler.SetSpriteSO(Sprite, Color.white);
     SpriteOrder = _SpriteOrder;
     if (SpriteOrder != null)
     {
         if (SpriteOrder.Orders.Count > 0)
         {
             spriteRenderer.sortingOrder = SpriteOrder.Orders[0];
         }
     }
 }
Exemple #8
0
        public void Setup(CustomisationGroup Customisations, CharacterCustomization incharacterCustomization, SpriteOrder _SpriteOrder)
        {
            thisCustomisations     = Customisations;
            characterCustomization = incharacterCustomization;
            HeadName.text          = Customisations.ThisType.ToString();
            spriteOrder            = _SpriteOrder;
            spriteHandlerNorder.SetSpriteOrder(spriteOrder);
            ThisType = Customisations.ThisType;

            // Make a list of all available options which can then be passed to the dropdown box
            var itemOptions = Customisations.PlayerCustomisations.Select(pcd => pcd.Name).ToList();

            itemOptions.Sort();

            // Ensure "None" is at the top of the option lists
            itemOptions.Insert(0, "None");
            Dropdown.AddOptions(itemOptions);

            RelatedSpriteRenderer.gameObject.transform.SetParent(incharacterCustomization.SpriteContainer.transform);
            RelatedSpriteRenderer.gameObject.transform.localPosition = Vector3.zero;
            Dropdown.onValueChanged.AddListener(ItemChange);
        }
Exemple #9
0
 public SpriteOrder(SpriteOrder Order)
 {
     Orders = new List <int>(Order.Orders);
 }