Example #1
0
    private void AddPartButtons(WorkshopItemType part, string prefix)
    {
        if (RagdollPresetPartMetadata.IsEmpty(CustomizationController.instance.activeCustomization.preset.GetPart(part)))
        {
            return;
        }
        RagdollModel model = CustomizationController.instance.activeCustomization.GetModel(part);

        if (!(model == null))
        {
            if (model.mask1)
            {
                AddChannelButton(part, 1, string.Format(prefix, 1));
            }
            if (model.mask2)
            {
                AddChannelButton(part, 2, string.Format(prefix, 2));
            }
            if (model.mask3)
            {
                AddChannelButton(part, 3, string.Format(prefix, 3));
            }
            if (channelButtons.Count > 9)
            {
                title.gameObject.SetActive(value: false);
                buttons.pivot = new Vector2(0f, 0.3f);
            }
            else
            {
                title.gameObject.SetActive(value: true);
                buttons.pivot = new Vector2(0f, 0.4f);
            }
        }
    }
 internal void Bind(WorkshopItemType part, int number, string label)
 {
     this.part   = part;
     this.number = number;
     this.label  = label;
     text.text   = label;
 }
Example #3
0
 private void Parse()
 {
     if (!_isParsed)
     {
         try
         {
             if (string.IsNullOrEmpty(type))
             {
                 _type = WorkshopItemType.Level;
             }
             else if (type.Equals("LevelSumo"))
             {
                 _type = WorkshopItemType.Levels;
             }
             else
             {
                 _type = (WorkshopItemType)Enum.Parse(typeof(WorkshopItemType), type);
             }
             _isParsed = true;
         }
         catch
         {
         }
     }
 }
Example #4
0
 private void DeserializePart(WorkshopItemType part, NetStream stream)
 {
     if (stream.ReadBool())
     {
         RagdollPresetPartMetadata part2 = GetPart(part);
         byte[] array = part2.bytes = stream.ReadArray(32);
     }
 }
Example #5
0
    private void AddChannelButton(WorkshopItemType part, int number, string label)
    {
        CustomizationColorsMenuChannel component = Object.Instantiate(channelTemplate.gameObject, channelsContainer).GetComponent <CustomizationColorsMenuChannel>();

        component.gameObject.SetActive(value: true);
        channelButtons.Add(component);
        component.Bind(part, number, label);
    }
Example #6
0
    public void SetMask(WorkshopItemType part, int number, bool on)
    {
        int num = 1 << number - 1;

        mask[part] = ((mask[part] & ~num) | (on ? num : 0));
        RagdollModel model = customization.GetModel(part);

        if (model != null)
        {
            model.SetMask(mask[part]);
        }
    }
Example #7
0
    private void ShowMask(WorkshopItemType part, bool show)
    {
        RagdollModel model = CustomizationController.instance.activeCustomization.GetModel(part);

        if (!(model == null))
        {
            model.ShowMask(show);
            if (show)
            {
                model.SetMask(paint.GetMask(part));
            }
        }
    }
    public void SetPart(WorkshopItemType part, RagdollPresetPartMetadata data)
    {
        if (data != null)
        {
            data.suppressCustomTexture = true;
        }
        activeCustomization.preset.SetPart(part, data);
        activeCustomization.ApplyPreset(activeCustomization.preset);
        RagdollModel model = activeCustomization.GetModel(part);

        if (model != null)
        {
            data.color1 = HexConverter.ColorToHex(model.color1);
            data.color2 = HexConverter.ColorToHex(model.color2);
            data.color3 = HexConverter.ColorToHex(model.color3);
        }
        activeCustomization.RebindColors(bake: false);
    }
Example #9
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));
            }
        }
Example #10
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;
            }
        }
    private static void CopyPartTexture(RagdollPresetMetadata preset, WorkshopItemType part, string targetFolder)
    {
        string sourcePath = FileTools.Combine(preset.folder, part.ToString() + ".png");
        string text       = FileTools.Combine(targetFolder, part.ToString() + ".png");
        RagdollPresetPartMetadata part2 = preset.GetPart(part);

        if (part2 == null || string.IsNullOrEmpty(part2.modelPath) || part2.suppressCustomTexture)
        {
            FileTools.DeleteFile(text);
        }
        else
        {
            FileTools.Copy(sourcePath, text, deleteIfMissing: true);
        }
        if (part2 != null && part2.suppressCustomTexture)
        {
            part2.suppressCustomTexture = false;
        }
    }
Example #12
0
        public RagdollPresetPartMetadata GetPart(WorkshopItemType part)
        {
            switch (part)
            {
            case WorkshopItemType.ModelFull:
                return(main);

            case WorkshopItemType.ModelHead:
                return(head);

            case WorkshopItemType.ModelUpperBody:
                return(upperBody);

            case WorkshopItemType.ModelLowerBody:
                return(lowerBody);

            default:
                throw new Exception("Invalid part");
            }
        }
        public RagdollModel GetModel(WorkshopItemType part)
        {
            switch (part)
            {
            case WorkshopItemType.ModelFull:
                return(main);

            case WorkshopItemType.ModelHead:
                return(head);

            case WorkshopItemType.ModelUpperBody:
                return(upper);

            case WorkshopItemType.ModelLowerBody:
                return(lower);

            default:
                throw new InvalidOperationException();
            }
        }
    public void FocusPart(WorkshopItemType part)
    {
        switch (part)
        {
        case WorkshopItemType.ModelFull:
            FocusCharacterModel();
            break;

        case WorkshopItemType.ModelHead:
            FocusHead();
            break;

        case WorkshopItemType.ModelUpperBody:
            FocusUpperBody();
            break;

        case WorkshopItemType.ModelLowerBody:
            FocusLowerBody();
            break;
        }
    }
Example #15
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);
            }
        }
Example #16
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");
            }
        }
Example #17
0
    private void AddPartButtons(WorkshopItemType part, string prefix)
    {
        if (RagdollPresetPartMetadata.IsEmpty(CustomizationController.instance.activeCustomization.preset.GetPart(part)))
        {
            return;
        }
        RagdollModel model = CustomizationController.instance.activeCustomization.GetModel(part);

        if (!(model == null))
        {
            if (model.mask1)
            {
                AddChannelButton(part, 1, string.Format(prefix, 1));
            }
            if (model.mask2)
            {
                AddChannelButton(part, 2, string.Format(prefix, 2));
            }
            if (model.mask3)
            {
                AddChannelButton(part, 3, string.Format(prefix, 3));
            }
        }
    }
Example #18
0
 public ModelPartRepository GetPartRepository(WorkshopItemType type)
 {
     return(modelRepos[type]);
 }
Example #19
0
 public void BindToModel(RagdollModel model)
 {
     part       = model.ragdollPart;
     this.model = model;
 }
 public void SetColor(WorkshopItemType part, int channel, Color color)
 {
     activeCustomization.preset.SetColor(part, channel, color);
     activeCustomization.ApplyPreset(activeCustomization.preset);
     activeCustomization.RebindColors(bake: false);
 }
 public Color GetColor(WorkshopItemType part, int channel)
 {
     return(activeCustomization.preset.GetColor(part, channel));
 }
 public RagdollPresetPartMetadata GetPart(WorkshopItemType part)
 {
     return(activeCustomization.preset.GetPart(part));
 }
Example #23
0
    public bool GetMask(WorkshopItemType part, int number)
    {
        int num = 1 << number - 1;

        return((mask[part] & num) != 0);
    }
Example #24
0
 public int GetMask(WorkshopItemType part)
 {
     return(mask[part]);
 }