コード例 #1
0
        private AKunit.BP GetBodyPart(string bodyPartName)
        {
            if (spawner.Spawned as AKunit != null)
            {
                return(null);
            }

            AKunit ut = spawner.Spawned as AKunit;

            if (ut == null)
            {
                return(null);
            }

            AKunit.BP selectedBodyPart = null;

            foreach (AKunit.BP bp in ut.Bp)
            {
                if (bp.GUIDesplayName == bodyPartName)
                {
                    selectedBodyPart = bp;
                    break;
                }
            }

            if (selectedBodyPart == null)
            {
                Log.Error(string.Format("Body part \"{0}\" not found on {1}", bodyPartName, spawner.Spawned.Name));
            }

            return(selectedBodyPart);
        }
コード例 #2
0
        private int GetBodyPartIndex(string bodyPartName)
        {
            AKunit ut = spawner.Spawned as AKunit;

            //foreach (AKunitType.BodyPart bp in ut.BodyParts)
            for (int i = 0; i < ut.Bp.Count; i++)
            {
                AKunit.BP bp = ut.Bp[i];

                if (bp.GUIDesplayName == bodyPartName)
                {
                    return(i);
                }
            }

            return(-1);
        }
コード例 #3
0
        private void PopulateWeaponSlotsDropDown(string bodyPartName)
        {
            AKunit.BP selectedBodyPart = GetBodyPart(bodyPartName);

            if (selectedBodyPart == null)
            {
                return;
            }

            cbxWeaponSlots.Items.Clear();

            foreach (AKunitType.WeaponItem wi in selectedBodyPart.Weapons)
            {
                cbxWeaponSlots.Items.Add(wi);
            }

            if (cbxWeaponSlots.Items.Count > 0)
            {
                cbxWeaponSlots.SelectedIndex = 0;
            }
        }