Пример #1
0
    public void BuildAttachments()
    {
        if (Attachments == null)
        {
            Attachments = new CustomizerAttachments();
        }
        Attachments.Suppressers.Clear();
        Attachments.Sights.Clear();
        Attachments.Foregrips.Clear();
        Attachments.Magazines.Clear();
        CustomizerInfo info = bl_CustomizerData.Instance.GetWeapon(WeaponName);

        for (int i = 0; i < info.Attachments.Suppressers.Count; i++)
        {
            Attachments.Suppressers.Add(new CustomizerModelInfo());
            Attachments.Suppressers[i].SetInfo(info.Attachments.Suppressers[i]);
        }
        for (int i = 0; i < info.Attachments.Sights.Count; i++)
        {
            Attachments.Sights.Add(new CustomizerModelInfo());
            Attachments.Sights[i].SetInfo(info.Attachments.Sights[i]);
        }
        for (int i = 0; i < info.Attachments.Foregrips.Count; i++)
        {
            Attachments.Foregrips.Add(new CustomizerModelInfo());
            Attachments.Foregrips[i].SetInfo(info.Attachments.Foregrips[i]);
        }
        for (int i = 0; i < info.Attachments.Magazines.Count; i++)
        {
            Attachments.Magazines.Add(new CustomizerModelInfo());
            Attachments.Magazines[i].SetInfo(info.Attachments.Magazines[i]);
        }
    }
Пример #2
0
    public void RefreshAttachments()
    {
        CustomizerInfo info = bl_CustomizerData.Instance.GetWeapon(WeaponName);

        if (Attachments.Suppressers.Count != info.Attachments.Suppressers.Count)
        {
            for (int i = 0; i < info.Attachments.Suppressers.Count; i++)
            {
                if (Attachments.Suppressers.Count - 1 < i)
                {
                    Attachments.Suppressers.Add(new CustomizerModelInfo());
                }
                Attachments.Suppressers[i].SetInfo(info.Attachments.Suppressers[i]);
            }
        }
        if (Attachments.Sights.Count != info.Attachments.Sights.Count)
        {
            for (int i = 0; i < info.Attachments.Sights.Count; i++)
            {
                if (Attachments.Sights.Count - 1 < i)
                {
                    Attachments.Sights.Add(new CustomizerModelInfo());
                }
                Attachments.Sights[i].SetInfo(info.Attachments.Sights[i]);
            }
        }
        if (Attachments.Foregrips.Count != info.Attachments.Foregrips.Count)
        {
            for (int i = 0; i < info.Attachments.Foregrips.Count; i++)
            {
                if (Attachments.Foregrips.Count - 1 < i)
                {
                    Attachments.Foregrips.Add(new CustomizerModelInfo());
                }
                Attachments.Foregrips[i].SetInfo(info.Attachments.Foregrips[i]);
            }
        }
        if (Attachments.Magazines.Count != info.Attachments.Magazines.Count)
        {
            for (int i = 0; i < info.Attachments.Magazines.Count; i++)
            {
                if (Attachments.Magazines.Count - 1 < i)
                {
                    Attachments.Magazines.Add(new CustomizerModelInfo());
                }
                Attachments.Magazines[i].SetInfo(info.Attachments.Magazines[i]);
            }
        }
    }