public void SetItemInSlot(Item value, ItemSlot slot) { if (!CanEquip(value, slot)) { return; } var old = Equip.FirstOrDefault(i => i.Slot == slot); if (old != null) { Equip.Remove(old); old.Slot = ItemSlot.Unequipable; old.PropertyChanged -= SlottedItemOnPropertyChanged; } if (value != null) { value.Slot = slot; Equip.Add(value); value.PropertyChanged += SlottedItemOnPropertyChanged; } OnPropertyChanged(slot.ToString()); RefreshItemAttributes(); }
private void AddItem(JObject val, ItemSlot islot) { var item = new Item(_persistentData, val, islot); Equip.Add(item); item.PropertyChanged += SlottedItemOnPropertyChanged; }
private void AddItem(JObject val, ItemClass iclass, ItemSlot islot) { Item item = null; item = new Item(iclass, val); item.Slot = islot; Equip.Add(item); OnPropertyChanged("Equip"); RefreshItemAttributes(); }
// 获取装备全部信息 protected Equip GetEquip(string equipName) { Equip equip = new Equip(); string equipInfo = ""; foreach (string e in GameConfig.equip) { equipInfo += iniTool.IniReadValue(devPath, equipIni, equipName, e) + ","; } equip.Name = equipName; equip.Add(equipInfo); return(equip); }
public void SetItemInSlot(Item?value, ItemSlot slot, ushort?socket) { if (!CanEquip(value, slot, socket)) { return; } var old = GetItemInSlot(slot, socket); if (value is null) { if (old != null) { Equip.Remove(old); } } else { value.Slot = slot; value.Socket = socket; if (old is null) { Equip.Add(value); } else { Equip.RemoveAndAdd(old, value); } } if (old != null) { old.Slot = ItemSlot.Unequipable; old.Socket = null; old.PropertyChanged -= SlottedItemOnPropertyChanged; } if (value != null) { value.PropertyChanged += SlottedItemOnPropertyChanged; } OnItemChanged(slot, socket); }
public void AddEquipmentIni(string path, FreelancerData data) { foreach (Section s in ParseFile(path, data.VFS)) { switch (s.Name.ToLowerInvariant()) { case "light": Equip.Add(new Light(s, data)); break; case "power": Equip.Add(FromSection <PowerCore>(s)); break; case "scanner": break; case "tractor": break; case "lootcrate": break; case "repairkit": break; case "countermeasure": break; case "countermeasuredropper": break; case "shieldbattery": break; case "armor": break; case "cargopod": break; case "commodity": break; case "tradelane": break; case "internalfx": Equip.Add(FromSection <InternalFx>(s)); break; case "attachedfx": Equip.Add(FromSection <AttachedFx>(s)); break; case "shieldgenerator": break; case "shield": break; case "engine": Equip.Add(FromSection <Engine>(s)); break; case "thruster": Equip.Add(FromSection <Thruster>(s)); break; case "cloakingdevice": break; case "motor": break; case "explosion": break; case "munition": Munitions.Add(FromSection <Munition>(s)); break; case "gun": Equip.Add(FromSection <Gun>(s)); break; case "mine": break; case "minedropper": break; case "lod": break; default: FLLog.Error("Equipment Ini", "Invalid Section in " + path + ": " + s.Name); break; } } }
private void AddItem(JObject val, ItemSlot islot) { Equip.Add(new Item(_persistentData, val, islot)); }