public void NewWeapon() { var weapon = new BaseWeapon() { UniqueId = new Random().Next(int.MinValue, int.MaxValue), // TODO: check other item unique IDs to prevent rare collisions AssetLibrarySetId = 0, }; var viewModel = new BaseWeaponViewModel(weapon); this.Slots.Add(viewModel); this.SelectedSlot = viewModel; }
public BaseWeaponViewModel(BaseWeapon weapon) { if (weapon == null) { throw new ArgumentNullException("weapon"); } this._Weapon = weapon; this.TypeAssets = CreateAssetList( InfoManager.WeaponBalance.Items.Where(kv => kv.Value.Type != null).Select( kv => kv.Value.Type.ResourcePath).Distinct().OrderBy(s => s)); this.BuildBalanceAssets(); }