Beispiel #1
0
        private void comboShipSlotType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (NoEvents)
            {
                return;
            }
            ShipModelSlot slot = GetCurrentShipSlot();

            if (slot == null)
            {
                return;
            }
            ShipModelSlot.SlotTypes t = UnityShipModelSlot.SlotTypes.None;
            if (comboShipSlotType.SelectedItem == null)
            {
                t = UnityShipModelSlot.SlotTypes.None;
            }
            else
            {
                List <ShipModelSlot.SlotTypes> tList = Enum.GetValues(typeof(ShipModelSlot.SlotTypes)).Cast <ShipModelSlot.SlotTypes>().ToList();
                foreach (var element in tList)
                {
                    if (element.ToString() == (string)comboShipSlotType.SelectedItem)
                    {
                        t = element;
                        break;
                    }
                }
            }
            slot.SlotType = t;
            listShipSlots.Items[listShipSlots.SelectedIndex] = listShipSlots.SelectedItem;
        }
Beispiel #2
0
        private void FillShipSlot()
        {
            ClearShipSlot();

            ShipModelSlot slot = GetCurrentShipSlot();

            if (slot == null)
            {
                return;
            }

            NoEvents                = true;
            textShipSlotId.Text     = slot.Id.ToString();
            textShipSlotNumber.Text = slot.SlotNumber.ToString();
            if ((int)slot.SlotType > 0)
            {
                comboShipSlotType.SelectedItem = slot.SlotType.ToString();
            }
            textShipSlotDefaultModule.Text            = slot.DefaultModuleId.ToString();
            textShipSlotControl.Text                  = slot.SlotControl;
            SlotSizeIntToRadioDict[slot.Size].Checked = true;
            checkShipMainCabin.Checked                = slot.MainCabin == 1;
            checkShipDoubleWeapon.Checked             = slot.DoubleWeapon == 1;
            ShowDefaultSlotName();
            NoEvents = false;
        }
Beispiel #3
0
    public ShipModelSlot AddSlot()
    {
        ShipModelSlot slot = new ShipModelSlot(this.Id);

        slots.Add(slot);
        return(slot);
    }
Beispiel #4
0
        private void buttonAddShipPart_Click(object sender, EventArgs e)
        {
            ShipModel tag = GetCurrentShipTag();

            if (tag == null)
            {
                return;
            }
            ShipModelSlot slot = tag.AddSlot();

            listShipSlots.Items.Add(slot);
            listShipSlots.SelectedItem = slot;
        }
Beispiel #5
0
        private void textShipSlotControl_TextChanged(object sender, EventArgs e)
        {
            if (NoEvents)
            {
                return;
            }
            ShipModelSlot slot = GetCurrentShipSlot();

            if (slot == null)
            {
                return;
            }
            slot.SlotControl = textShipSlotControl.Text;
        }
Beispiel #6
0
 public void LoadModules(List <ShipModule> moduleList)
 {
     ShipModule.ModuleList mList = new ShipModule.ModuleList(moduleList);
     foreach (var slot in Slots)
     {
         ShipModelSlot slot2 = slot.Slot;
         if (slot2.SlotType == ShipModelSlot.SlotTypes.Weapon)
         {
             var lst = mList.GetModules(ShipModuleType.ModuleTypes.Weapon);
             if (lst.Count > 0)
             {
                 slot.LoadModule(lst[0]);
             }
         }
         else if (slot2.SlotType == ShipModelSlot.SlotTypes.Reactor)
         {
             var lst = mList.GetModules(ShipModuleType.ModuleTypes.Reactor);
             if (lst.Count > 0)
             {
                 slot.LoadModule(lst[0]);
             }
         }
         else if (slot2.SlotType == ShipModelSlot.SlotTypes.Armor)
         {
             var lst = mList.GetModules(ShipModuleType.ModuleTypes.Armor);
             if (lst.Count > 0)
             {
                 slot.LoadModule(lst[0]);
             }
         }
         else if (slot2.SlotType == ShipModelSlot.SlotTypes.Thrusters)
         {
             var lst = mList.GetModules(ShipModuleType.ModuleTypes.Thrusters);
             if (lst.Count > 0)
             {
                 slot.LoadModule(lst[0]);
             }
         }
         else if (slot2.SlotType == ShipModelSlot.SlotTypes.Reactor)
         {
             var lst = mList.GetModules(ShipModuleType.ModuleTypes.Reactor);
             if (lst.Count > 0)
             {
                 slot.LoadModule(lst[0]);
             }
         }
     }
 }
Beispiel #7
0
        private void buttonRemoveShipPart_Click(object sender, EventArgs e)
        {
            ShipModel tag = GetCurrentShipTag();

            if (tag == null)
            {
                return;
            }
            ShipModelSlot slot = GetCurrentShipSlot();

            if (slot == null)
            {
                return;
            }
            tag.DeleteSlot(ref slot);
            listShipSlots.Items.Remove(slot);
            ClearShipSlot();
        }
Beispiel #8
0
        private void textShipSlotDefaultModule_TextChanged(object sender, EventArgs e)
        {
            if (NoEvents)
            {
                return;
            }
            ShipModelSlot slot = GetCurrentShipSlot();

            if (slot == null)
            {
                return;
            }
            int moduleId;

            Int32.TryParse(textShipSlotDefaultModule.Text, out moduleId);
            slot.DefaultModuleId = moduleId;
            ShowDefaultSlotName();
        }
Beispiel #9
0
        private void textShipSlotNumber_TextChanged(object sender, EventArgs e)
        {
            if (NoEvents)
            {
                return;
            }
            ShipModelSlot slot = GetCurrentShipSlot();

            if (slot == null)
            {
                return;
            }
            int amount = 0;

            Int32.TryParse(textShipSlotNumber.Text, out amount);
            slot.SlotNumber = amount;
            listShipSlots.Items[listShipSlots.SelectedIndex] = listShipSlots.SelectedItem;
        }
Beispiel #10
0
        private void checkShipDoubleWeapon_CheckedChanged(object sender, EventArgs e)
        {
            if (NoEvents)
            {
                return;
            }
            ShipModelSlot slot = GetCurrentShipSlot();

            if (slot == null)
            {
                return;
            }
            if (checkShipDoubleWeapon.Checked)
            {
                slot.DoubleWeapon = 1;
            }
            else
            {
                slot.DoubleWeapon = 0;
            }
        }
Beispiel #11
0
        private void SetSlotSize()
        {
            if (NoEvents)
            {
                return;
            }
            ShipModelSlot slot = GetCurrentShipSlot();

            if (slot == null)
            {
                return;
            }
            foreach (RadioButton key in SlotSizeRadioToIntDict.Keys)
            {
                if (key.Checked)
                {
                    slot.Size = SlotSizeRadioToIntDict[key];
                    return;
                }
            }
        }
Beispiel #12
0
 public UnityRigSlot(ShipModelSlot modelSlot)
 {
     team          = new RigSlotOfficerTeam();
     team.SlotType = modelSlot.SlotType;
     this.Slot     = modelSlot;
 }
Beispiel #13
0
 public void DeleteSlot(ref ShipModelSlot slot)
 {
     slots.Remove(slot);
     slotsToDelete.Add(slot.Id);
 }