Exemplo n.º 1
0
    public void SubSetBodyPart(BodyPart Body_Part, string path)
    {
        path = path + "/" + Body_Part.name;


        CustomisationStorage customisationStorage = null;

        foreach (var Custom in ThisCharacter.SerialisedBodyPartCustom)
        {
            if (path == Custom.path)
            {
                customisationStorage = Custom;
                break;
            }
        }

        if (customisationStorage != null)
        {
            bool pass = true;
            if (Body_Part.OptionalOrgans.Count > 0)
            {
                pass = false;
                BodyPartDropDownOrgans.OnPlayerBodyDeserialise(Body_Part, null,
                                                               customisationStorage.Data.Replace("@£", "\""),
                                                               livingHealthMasterBase);
            }

            if (Body_Part.OptionalReplacementOrgan.Count > 0 && pass)
            {
                pass = false;
                BodyPartDropDownReplaceOrgan.OnPlayerBodyDeserialise(Body_Part,
                                                                     customisationStorage.Data.Replace("@£", "\""),
                                                                     livingHealthMasterBase);
            }

            if (pass)
            {
                if (Body_Part.LobbyCustomisation != null)
                {
                    Body_Part.LobbyCustomisation.OnPlayerBodyDeserialise(Body_Part,
                                                                         customisationStorage.Data.Replace("@£", "\""),
                                                                         livingHealthMasterBase);
                }
                else
                {
                    Logger.Log($"[PlayerSprites] - Could not find {Body_Part.name}'s characterCustomization script. Returns -> {Body_Part.LobbyCustomisation.characterCustomization}", Category.Character);
                }
            }
        }


        foreach (var Limb in Body_Part.ContainBodyParts)
        {
            SubSetBodyPart(Limb, path);
        }
    }
Exemplo n.º 2
0
    public void SubSetBodyPart(BodyPart Body_Part, string path)
    {
        path = path + "/" + Body_Part.name;

        CustomisationStorage customisationStorage = null;

        foreach (var Custom in ThisCharacter.SerialisedBodyPartCustom)
        {
            if (path == Custom.path)
            {
                customisationStorage = Custom;
                break;
            }
        }

        if (customisationStorage != null)
        {
            var data = customisationStorage.Data.Replace("@£", "\"");
            if (Body_Part.OptionalOrgans.Count > 0)
            {
                BodyPartDropDownOrgans.OnPlayerBodyDeserialise(Body_Part, data, livingHealthMasterBase);
            }
            else if (Body_Part.OptionalReplacementOrgan.Count > 0)
            {
                BodyPartDropDownReplaceOrgan.OnPlayerBodyDeserialise(Body_Part, data);
            }
            else
            {
                if (Body_Part.LobbyCustomisation == null)
                {
                    Logger.Log($"[PlayerSprites] - Could not find {Body_Part.name}'s characterCustomization script. Returns -> {Body_Part.LobbyCustomisation.characterCustomization}", Category.Character);
                    return;
                }
                Body_Part.LobbyCustomisation.OnPlayerBodyDeserialise(Body_Part, data, livingHealthMasterBase);
            }
        }
    }
Exemplo n.º 3
0
        public void SetupSprites()
        {
            CustomisationStorage customisationStorage = null;

            if (ThisCharacter.SerialisedBodyPartCustom == null)
            {
                //TODO : (Max) - Fix SerialisedBodyPartCustom being null on Dummy players
                Logger.LogWarning($"{gameObject} has spawned with null bodyPart customizations. This error should only appear for Dummy players only.");
                return;
            }

            foreach (var Custom in ThisCharacter.SerialisedBodyPartCustom)
            {
                if (livingHealthMasterBase.name == Custom.path)
                {
                    customisationStorage = Custom;
                    break;
                }
            }

            if (customisationStorage != null)
            {
                BodyPartDropDownOrgans.PlayerBodyDeserialise(null, customisationStorage.Data, livingHealthMasterBase);
            }

            foreach (var bodyPart in livingHealthMasterBase.BodyPartList)
            {
                SubSetBodyPart(bodyPart, "");
            }

            PlayerHealthData SetRace = null;

            foreach (var Race in RaceSOSingleton.Instance.Races)
            {
                if (Race.name == ThisCharacter.Species)
                {
                    SetRace = Race;
                }
            }

            List <IntName> ToClient = new List <IntName>();

            foreach (var Customisation in SetRace.Base.CustomisationSettings)
            {
                ExternalCustomisation externalCustomisation = null;
                foreach (var EC in ThisCharacter.SerialisedExternalCustom)
                {
                    if (EC.Key == Customisation.CustomisationGroup.name)
                    {
                        externalCustomisation = EC;
                    }
                }

                if (externalCustomisation == null)
                {
                    continue;
                }


                var Net = SpriteHandlerManager.GetRecursivelyANetworkBehaviour(this.gameObject);
                var SpriteHandlerNorder = Instantiate(ToInstantiateSpriteCustomisation.gameObject, CustomisationSprites.transform)
                                          .GetComponent <SpriteHandlerNorder>();
                SpriteHandlerManager.UnRegisterHandler(Net, SpriteHandlerNorder.SpriteHandler);

                SpriteHandlerNorder.transform.localPosition = Vector3.zero;
                SpriteHandlerNorder.name = Customisation.CustomisationGroup.ThisType.ToString();
                SpriteHandlerManager.RegisterHandler(Net, SpriteHandlerNorder.SpriteHandler);

                var newone = new IntName();
                newone.Int =
                    CustomNetworkManager.Instance.IndexLookupSpawnablePrefabs[ToInstantiateSpriteCustomisation.gameObject];

                newone.Name = Customisation.CustomisationGroup.ThisType.ToString();
                ToClient.Add(newone);

                OpenSprites.Add(SpriteHandlerNorder);
                //SubSetBodyPart
                foreach (var Sprite_s in Customisation.CustomisationGroup.PlayerCustomisations)
                {
                    if (Sprite_s.Name == externalCustomisation.SerialisedValue.SelectedName)
                    {
                        SpriteHandlerNorder.SpriteHandler.SetSpriteSO(Sprite_s.SpriteEquipped);
                        SpriteHandlerNorder.SetSpriteOrder(new SpriteOrder(Customisation.CustomisationGroup.SpriteOrder));
                        newone.Data = JsonConvert.SerializeObject(new SpriteOrder(SpriteHandlerNorder.SpriteOrder));
                        Color setColor = Color.black;
                        ColorUtility.TryParseHtmlString(externalCustomisation.SerialisedValue.Colour, out setColor);
                        setColor.a = 1;
                        SpriteHandlerNorder.SpriteHandler.SetColor(setColor);
                    }
                }
            }
            GetComponent <RootBodyPartController>().PlayerSpritesData = JsonConvert.SerializeObject(ToClient);

            SetSurfaceColour();
            OnDirectionChange(directional.CurrentDirection);
        }
Exemplo n.º 4
0
    public void SetupsSprites()
    {
        foreach (var Root in livingHealthMasterBase.RootBodyPartContainers)
        {
            CustomisationStorage customisationStorage = null;
            foreach (var Custom in ThisCharacter.SerialisedBodyPartCustom)
            {
                if (Root.name == Custom.path)
                {
                    customisationStorage = Custom;
                    break;
                }
            }

            if (customisationStorage != null)
            {
                BodyPartDropDownOrgans.OnPlayerBodyDeserialise(null, Root, customisationStorage.Data,
                                                               livingHealthMasterBase);
            }

            foreach (var Limb in Root.ContainsLimbs)
            {
                SubSetBodyPart(Limb, "");
            }
        }

        PlayerHealthData SetRace = null;

        foreach (var Race in RaceSOSingleton.Instance.Races)
        {
            if (Race.name == ThisCharacter.Species)
            {
                SetRace = Race;
            }
        }

        List <uint> ToClient = new List <uint>();

        foreach (var Customisation in SetRace.Base.CustomisationSettings)
        {
            ExternalCustomisation externalCustomisation = null;
            foreach (var EC in ThisCharacter.SerialisedExternalCustom)
            {
                if (EC.Key == Customisation.CustomisationGroup.name)
                {
                    externalCustomisation = EC;
                }
            }

            if (externalCustomisation == null)
            {
                continue;
            }

            var SpriteHandlerNorder =
                Spawn.ServerPrefab(ToInstantiateSpriteCustomisation.gameObject, null, CustomisationSprites.transform)
                .GameObject.GetComponent <SpriteHandlerNorder>();
            SpriteHandlerNorder.transform.localPosition = Vector3.zero;
            ToClient.Add(SpriteHandlerNorder.GetComponent <NetworkIdentity>().netId);
            OpenSprites.Add(SpriteHandlerNorder);
            //SubSetBodyPart
            foreach (var Sprite_s in Customisation.CustomisationGroup.PlayerCustomisations)
            {
                if (Sprite_s.Name == externalCustomisation.SerialisedValue.SelectedName)
                {
                    SpriteHandlerNorder.SpriteHandler.SetSpriteSO(Sprite_s.SpriteEquipped);
                    SpriteHandlerNorder.SetSpriteOrder(new SpriteOrder(Customisation.CustomisationGroup.SpriteOrder));
                    Color setColor = Color.black;
                    ColorUtility.TryParseHtmlString(externalCustomisation.SerialisedValue.Colour, out setColor);
                    SpriteHandlerNorder.SpriteHandler.SetColor(setColor);
                }
            }
        }

        this.GetComponent <RootBodyPartController>().UpdateCustomisations("", JsonConvert.SerializeObject(ToClient));

        //TODOH

        //Fetch Race Health Pack
        // if(Character.Race == Race.Human)
        // {
        //
        // }

        //this is Target zone

        //Instantiates Sprites
        //TODOH
        //Race data contain sprites order
        //healing/Damage splits across body parts
        //needs a generate sprites dynamically


        //RaceBodyparts.Base.LegLeft.GetComponent<ItemStorage>()


        //RaceTexture = Spawn.RaceData["human"];

        //Loop through dimrphic body parts
        //SetupBodySpritesByGender();
        SetSurfaceColour();
        OnDirectionChange(directional.CurrentDirection);
    }
Exemplo n.º 5
0
    public void SetupsSprites()
    {
        foreach (var Root in livingHealthMasterBase.RootBodyPartContainers)
        {
            CustomisationStorage customisationStorage = null;
            foreach (var Custom in ThisCharacter.SerialisedBodyPartCustom)
            {
                if (Root.name == Custom.path)
                {
                    customisationStorage = Custom;
                    break;
                }
            }

            if (customisationStorage != null)
            {
                BodyPartDropDownOrgans.OnPlayerBodyDeserialise(null, Root, customisationStorage.Data,
                                                               livingHealthMasterBase);
            }

            foreach (var Limb in Root.ContainsLimbs)
            {
                SubSetBodyPart(Limb, "");
            }
        }

        PlayerHealthData SetRace = null;

        foreach (var Race in RaceSOSingleton.Instance.Races)
        {
            if (Race.name == ThisCharacter.Species)
            {
                SetRace = Race;
            }
        }

        List <uint> ToClient = new List <uint>();

        foreach (var Customisation in SetRace.Base.CustomisationSettings)
        {
            ExternalCustomisation externalCustomisation = null;
            foreach (var EC in ThisCharacter.SerialisedExternalCustom)
            {
                if (EC.Key == Customisation.CustomisationGroup.name)
                {
                    externalCustomisation = EC;
                }
            }

            if (externalCustomisation == null)
            {
                continue;
            }

            var SpriteHandlerNorder =
                Spawn.ServerPrefab(ToInstantiateSpriteCustomisation.gameObject, null, CustomisationSprites.transform)
                .GameObject.GetComponent <SpriteHandlerNorder>();
            SpriteHandlerNorder.transform.localPosition = Vector3.zero;
            ToClient.Add(SpriteHandlerNorder.GetComponent <NetworkIdentity>().netId);
            OpenSprites.Add(SpriteHandlerNorder);
            //SubSetBodyPart
            foreach (var Sprite_s in Customisation.CustomisationGroup.PlayerCustomisations)
            {
                if (Sprite_s.Name == externalCustomisation.SerialisedValue.SelectedName)
                {
                    SpriteHandlerNorder.SpriteHandler.SetSpriteSO(Sprite_s.SpriteEquipped);
                    SpriteHandlerNorder.SetSpriteOrder(new SpriteOrder(Customisation.CustomisationGroup.SpriteOrder));
                    Color setColor = Color.black;
                    ColorUtility.TryParseHtmlString(externalCustomisation.SerialisedValue.Colour, out setColor);
                    setColor.a = 1;
                    SpriteHandlerNorder.SpriteHandler.SetColor(setColor);
                }
            }
        }
        GetComponent <RootBodyPartController>().PlayerSpritesData = JsonConvert.SerializeObject(ToClient);

        SetSurfaceColour();
        OnDirectionChange(directional.CurrentDirection);
    }
Exemplo n.º 6
0
    public void SetupSprites()
    {
        CustomisationStorage customisationStorage = null;

        foreach (var Custom in ThisCharacter.SerialisedBodyPartCustom)
        {
            if (livingHealthMasterBase.name == Custom.path)
            {
                customisationStorage = Custom;
                break;
            }
        }

        if (customisationStorage != null)
        {
            BodyPartDropDownOrgans.OnPlayerBodyDeserialise(null, customisationStorage.Data, livingHealthMasterBase);
        }


        foreach (var bodyPart in livingHealthMasterBase.BodyPartList)
        {
            SubSetBodyPart(bodyPart, "");

            //TODO: horrible, remove -- organ prefabs have bodyparts
            foreach (var organ in bodyPart.OrganList)
            {
                var bodyPartOrgan = organ.GetComponent <BodyPart>();
                SubSetBodyPart(bodyPartOrgan, $"/{bodyPart.name}");
            }
        }

        PlayerHealthData SetRace = null;

        foreach (var Race in RaceSOSingleton.Instance.Races)
        {
            if (Race.name == ThisCharacter.Species)
            {
                SetRace = Race;
            }
        }

        List <IntName> ToClient = new List <IntName>();

        foreach (var Customisation in SetRace.Base.CustomisationSettings)
        {
            ExternalCustomisation externalCustomisation = null;
            foreach (var EC in ThisCharacter.SerialisedExternalCustom)
            {
                if (EC.Key == Customisation.CustomisationGroup.name)
                {
                    externalCustomisation = EC;
                }
            }

            if (externalCustomisation == null)
            {
                continue;
            }

            var SpriteHandlerNorder = Spawn.ServerPrefab(ToInstantiateSpriteCustomisation.gameObject, null, CustomisationSprites.transform)
                                      .GameObject.GetComponent <SpriteHandlerNorder>();
            SpriteHandlerNorder.transform.localPosition = Vector3.zero;
            SpriteHandlerNorder.name = Customisation.CustomisationGroup.ThisType.ToString();

            var newone = new IntName();
            newone.Int =
                CustomNetworkManager.Instance.IndexLookupSpawnablePrefabs[ToInstantiateSpriteCustomisation.gameObject];

            newone.Name = Customisation.CustomisationGroup.ThisType.ToString();
            ToClient.Add(newone);

            OpenSprites.Add(SpriteHandlerNorder);
            //SubSetBodyPart
            foreach (var Sprite_s in Customisation.CustomisationGroup.PlayerCustomisations)
            {
                if (Sprite_s.Name == externalCustomisation.SerialisedValue.SelectedName)
                {
                    SpriteHandlerNorder.SpriteHandler.SetSpriteSO(Sprite_s.SpriteEquipped);
                    SpriteHandlerNorder.SetSpriteOrder(new SpriteOrder(Customisation.CustomisationGroup.SpriteOrder));
                    newone.Data = JsonConvert.SerializeObject(new SpriteOrder(SpriteHandlerNorder.SpriteOrder));
                    Color setColor = Color.black;
                    ColorUtility.TryParseHtmlString(externalCustomisation.SerialisedValue.Colour, out setColor);
                    setColor.a = 1;
                    SpriteHandlerNorder.SpriteHandler.SetColor(setColor);
                }
            }
        }
        GetComponent <RootBodyPartController>().PlayerSpritesData = JsonConvert.SerializeObject(ToClient);

        SetSurfaceColour();
        OnDirectionChange(directional.CurrentDirection);
    }