Beispiel #1
0
 private void DeserializePart(WorkshopItemType part, NetStream stream)
 {
     if (stream.ReadBool())
     {
         RagdollPresetPartMetadata part2 = GetPart(part);
         byte[] array = part2.bytes = stream.ReadArray(32);
     }
 }
Beispiel #2
0
        public static RagdollPresetPartMetadata Clone(RagdollPresetPartMetadata source)
        {
            if (source == null)
            {
                return(null);
            }
            RagdollPresetPartMetadata ragdollPresetPartMetadata = new RagdollPresetPartMetadata();

            ragdollPresetPartMetadata.modelPath = source.modelPath;
            ragdollPresetPartMetadata.color1    = source.color1;
            ragdollPresetPartMetadata.color2    = source.color2;
            ragdollPresetPartMetadata.color3    = source.color3;
            return(ragdollPresetPartMetadata);
        }
Beispiel #3
0
        public Color GetColor(WorkshopItemType part, int channel)
        {
            RagdollPresetPartMetadata part2 = GetPart(part);

            switch (channel)
            {
            case 1:
                return(HexConverter.HexToColor(part2.color1, default(Color)));

            case 2:
                return(HexConverter.HexToColor(part2.color2, default(Color)));

            case 3:
                return(HexConverter.HexToColor(part2.color3, default(Color)));

            default:
                return(default(Color));
            }
        }
Beispiel #4
0
        public void SetColor(WorkshopItemType part, int channel, Color color)
        {
            RagdollPresetPartMetadata part2 = GetPart(part);

            switch (channel)
            {
            case 1:
                part2.color1 = HexConverter.ColorToHex(color);
                break;

            case 2:
                part2.color2 = HexConverter.ColorToHex(color);
                break;

            case 3:
                part2.color3 = HexConverter.ColorToHex(color);
                break;
            }
        }
Beispiel #5
0
        public void SetPart(WorkshopItemType part, RagdollPresetPartMetadata meta)
        {
            switch (part)
            {
            case WorkshopItemType.ModelFull:
                main = meta;
                break;

            case WorkshopItemType.ModelHead:
                head = meta;
                break;

            case WorkshopItemType.ModelUpperBody:
                upperBody = meta;
                break;

            case WorkshopItemType.ModelLowerBody:
                lowerBody = meta;
                break;

            default:
                throw new Exception("Invalid part");
            }
        }
Beispiel #6
0
        private void SerializePart(WorkshopItemType part, NetStream stream)
        {
            byte[] array = null;
            RagdollPresetPartMetadata part2 = GetPart(part);

            if (part2 != null)
            {
                array = part2.bytes;
                if (array == null && !string.IsNullOrEmpty(folder))
                {
                    string path = FileTools.Combine(folder, part.ToString() + ".png");
                    array = FileTools.ReadAllBytes(path);
                }
            }
            if (array != null)
            {
                stream.Write(v: true);
                stream.WriteArray(array, 32);
            }
            else
            {
                stream.Write(v: false);
            }
        }
Beispiel #7
0
 public static bool IsEmpty(RagdollPresetPartMetadata part)
 {
     return(part == null || IsEmpty(part.modelPath));
 }