예제 #1
0
        //location chosen
        void OnLocChosen(object sender, EventArgs args)
        {
            Picker modePicker = (Picker)sender;

            mode = modePicker.SelectedItem.ToString();
            rolePicker.IsEnabled   = false;
            rolePicker.ItemsSource = null;
            rolePicker.Items.Clear();

            Character   temp = _viewModel.DatasetCharacter.FirstOrDefault(a => a.Id == player);
            List <Item> templist;

            CurrentItem.Text = temp.GetItemAtLocation((ItemLocationEnum)Enum.Parse(typeof(ItemLocationEnum), mode));

            LocationSet.Clear();
            PoolSet = PoolSet.Where(a => a != null).ToList();
            if (mode == ItemLocationEnum.LeftFinger.ToString() || mode == ItemLocationEnum.RightFinger.ToString())
            {
                templist = PoolSet.FindAll(a => a.Location.ToString() == mode || a.Location.ToString() == "Finger");
            }
            else
            {
                templist = PoolSet.FindAll(a => a.Location.ToString() == mode);
            }
            foreach (var data in  templist)
            {
                LocationSet.Add(data);
            }
            rolePicker.ItemsSource = LocationSet;
            rolePicker.IsEnabled   = true;
        }
예제 #2
0
        //items select
        void OnItemChosen(object sender, EventArgs args)
        {
            Picker picker = (Picker)sender;
            Item   temp   = (Item)picker.SelectedItem;

            if (temp == null)
            {
                return;
            }
            var movitem = _viewModel.DatasetCharacter.FirstOrDefault(a => a.Id == player).RemoveItem((ItemLocationEnum)Enum.Parse(typeof(ItemLocationEnum), mode));

            PoolSet.Add(movitem);
            _viewModel.Dataset.Add(movitem);
            _viewModel.DatasetCharacter.FirstOrDefault(a => a.Id == player).AddItem((ItemLocationEnum)Enum.Parse(typeof(ItemLocationEnum), mode), temp.Id);
            PoolSet.Remove(temp);
            _viewModel.Dataset.Remove(temp);
            _viewModel.clean();
            PoolSet              = PoolSet.Where(x => x != null).ToList();
            CurrentItem.Text     = _viewModel.DatasetCharacter.FirstOrDefault(a => a.Id == player).GetItemAtLocation((ItemLocationEnum)Enum.Parse(typeof(ItemLocationEnum), mode));
            RemoveItem.IsEnabled = true;
        }