Exemple #1
0
    //public SpaceshipParameters Params { get; set; }
    private void LoadSlots()
    {
        if (sModel == null)
        {
            return;
        }

        //Загрузка слотов - сначала подкачиваются все слоты которые есть в модели корабля,
        //а затем на них накатываются модули, которые установлены в эти слоты согласно
        Slots = new List <RigSlot>();

        Dictionary <int, RigSlot> slotDict = new Dictionary <int, RigSlot>();

        sModel.ClearSlotDuplicates();

        foreach (ShipModelSlot modelSlot in sModel.slots)
        {
            RigSlot curSlot = new RigSlot(modelSlot);
            Slots.Add(curSlot);
            if (!slotDict.ContainsKey(curSlot.Slot.Id))
            {
                slotDict.Add(curSlot.Slot.Id, curSlot);
            }
        }
    }
Exemple #2
0
    private void LoadSlots()
    {
        if (sModel == null)
        {
            return;
        }

        //Загрузка слотов - сначала подкачиваются все слоты которые есть в модели корабля,
        //а затем на них накатываются модули, которые установлены в эти слоты согласно
        Slots = new List <RigSlot>();

        Dictionary <int, RigSlot> slotDict = new Dictionary <int, RigSlot>();

        sModel.ClearSlotDuplicates();

        foreach (ShipModelSlot modelSlot in sModel.slots)
        {
            RigSlot curSlot = new RigSlot(modelSlot);
            Slots.Add(curSlot);
            if (!slotDict.ContainsKey(curSlot.Slot.Id))
            {
                slotDict.Add(curSlot.Slot.Id, curSlot);
            }
        }


        if (Id > 0)
        {
            string q;
            q = $@"
            SELECT
                id,
                ss_rig_id,
                slot_id,
                module_type_id,
                officer_ids,
                crew_id,
                ISNULL(module_id, 0) AS module_id
            FROM
                ss_rigs_slots
            WHERE
                ss_rig_id = {this.Id}";

            SqlDataReader r = DataConnection.GetReader(q);
            if (r.HasRows)
            {
                while (r.Read())
                {
                    int SlotId = Convert.ToInt32(r["slot_id"]);
                    slotDict[SlotId].LoadRig(r, PlayerId);
                }
            }
        }
    }