public void WhenBehaviorIsAttached_ThenItSynchronizesTheInitialSelection()
        {
            var behavior = new SynchronizeSelectedItems();
            BindingOperations.SetBinding(
                behavior,
                SynchronizeSelectedItems.SelectionsProperty,
                new Binding("ObservableSelections"));

            var listBox = new ListBox() { SelectionMode = SelectionMode.Multiple };
            BindingOperations.SetBinding(
                listBox, ListBox.ItemsSourceProperty,
                new Binding("Items"));

            var itemsHolder =
                new ItemsHolder
                {
                    Items = { "a", "b", "c", "d" },
                    ObservableSelections = { "a", "c" }
                };

            listBox.DataContext = itemsHolder;

            var behaviors = Interaction.GetBehaviors(listBox);
            behaviors.Add(behavior);

            CollectionAssert.AreEquivalent(new[] { "a", "c" }, listBox.SelectedItems);
        }
    //-----------------------------------------------------------------
    private void ActivatePlayerCharacter()
    {
        characters[characterCounter].gameObject.SetActive(true);
        currentCharacterAnimation = characters[characterCounter].gameObject.GetComponent <Animation>();
        currentCharacterItems     = characters[characterCounter];

        GenerateItemsUI();
        GenerateAnimationsUI();

        if (presets != null)
        {
            presets.DeactivatePreset();
        }

        var characterRotate = GetComponent <CharacterRotate>();

        if (characterRotate != null)
        {
            characterRotate.objectToRotate = characters[characterCounter].transform;
        }

        if (presetOptions != null)
        {
            presetOptions.assetList.value = 0;
        }
    }
Esempio n. 3
0
        public void WhenBehaviorIsAttached_ThenItSynchronizesTheInitialSelection()
        {
            var behavior = new SynchronizeSelectedItems();

            BindingOperations.SetBinding(
                behavior,
                SynchronizeSelectedItems.SelectionsProperty,
                new Binding("ObservableSelections"));

            var listBox = new ListBox()
            {
                SelectionMode = SelectionMode.Multiple
            };

            BindingOperations.SetBinding(
                listBox, ListBox.ItemsSourceProperty,
                new Binding("Items"));

            var itemsHolder =
                new ItemsHolder
            {
                Items = { "a", "b", "c", "d" },
                ObservableSelections = { "a", "c" }
            };

            listBox.DataContext = itemsHolder;

            var behaviors = Interaction.GetBehaviors(listBox);

            behaviors.Add(behavior);

            CollectionAssert.AreEquivalent(new[] { "a", "c" }, listBox.SelectedItems);
        }
Esempio n. 4
0
 private void Awake()
 {
     if (ItemsHolder == null)
     {
         ItemsHolder = Instantiate(itemsHolder).GetComponent <ItemsHolder>();
         ItemsHolder.Initialize();
     }
 }
 public override void SetCurrenValues()
 {
     CurrentValues = ItemsHolder
                     .GetResultWithoutFilter(this)
                     .Where(s => s.Participant != null)
                     .Select(s => s.Participant.GUID)
                     .Distinct(DescriptionComparer.Default)
                     .Concat(new[] { (Description) new DescriptionInt(0) })
                     .OrderBy(o => o.CurrentLang)
                     .ToList();
 }
Esempio n. 6
0
 public override void SetCurrenValues()
 {
     CurrentValues = ItemsHolder
                     .GetResultWithoutFilter(this)
                     .Where(s => s.AreaInfo != null)
                     .Select(s => s.AreaInfo.CityNameOrGuid)
                     .Distinct()
                     .Select(s => new Description(s))
                     .Concat(new[] { (Description) new DescriptionInt(0) })
                     .OrderBy(o => o.CurrentLang)
                     .ToList();
 }
Esempio n. 7
0
        public static Entity CreateSimplePlayerCharacter(int x, int y, NamelessGame game)
        {
            var    position        = new Position(x, y);
            Entity playerCharacter = new Entity();

            playerCharacter.AddComponent(new Character());
            playerCharacter.AddComponent(new Player());
            playerCharacter.AddComponent(new InputReceiver());
            playerCharacter.AddComponent(new FollowedByCamera());
            playerCharacter.AddComponent(new InputComponent());
            playerCharacter.AddComponent(position);
            playerCharacter.AddComponent(new Drawable('@', new Engine.Utility.Color(0.9, 0.9, 0.9)));
            playerCharacter.AddComponent(new Description("Player", ""));
            var holder = new ItemsHolder();

            playerCharacter.AddComponent(holder);
            playerCharacter.AddComponent(new EquipmentSlots(holder, game));
            playerCharacter.AddComponent(new OccupiesTile());


            var stats = new Stats();

            stats.Health.Value    = 100;
            stats.Health.MaxValue = 100;

            stats.Stamina.Value    = 100;
            stats.Stamina.MaxValue = 100;


            stats.Attack.Value      = 25;
            stats.Defence.Value     = 10;
            stats.AttackSpeed.Value = 100;
            stats.MoveSpeed.Value   = 100;

            stats.Strength.Value    = 10;
            stats.Reflexes.Value    = 10;
            stats.Perception.Value  = 10;
            stats.Willpower.Value   = 10;
            stats.Imagination.Value = 10;
            stats.Wit.Value         = 10;

            playerCharacter.AddComponent(stats);

            playerCharacter.AddComponent(new ActionPoints()
            {
                Points = 100
            });

            game.WorldProvider.MoveEntity(playerCharacter, position.Point);

            return(playerCharacter);
        }
Esempio n. 8
0
        public void WhenSelectionsAreUpdatedOnTheObservableModelAfterDetachingTheBehavior_ThenSelectedItemsAreNotUpdatedOnTheListBox()
        {
            var behavior = new SynchronizeSelectedItems();

            BindingOperations.SetBinding(
                behavior,
                SynchronizeSelectedItems.SelectionsProperty,
                new Binding("ObservableSelections"));

            var listBox = new ListBox()
            {
                SelectionMode = SelectionMode.Multiple
            };

            BindingOperations.SetBinding(
                listBox, ListBox.ItemsSourceProperty,
                new Binding("Items"));

            var itemsHolder =
                new ItemsHolder
            {
                Items = { "a", "b", "c", "d" },
                ObservableSelections = { "a", "c" }
            };

            listBox.DataContext = itemsHolder;

            var behaviors = Interaction.GetBehaviors(listBox);

            behaviors.Add(behavior);

            itemsHolder.ObservableSelections.Add("d");

            behaviors.Remove(behavior);

            itemsHolder.ObservableSelections.Remove("c");

            CollectionAssert.AreEquivalent(new[] { "a", "c", "d" }, listBox.SelectedItems);
        }
        /// <param name="position">The position of the item within the adapter's data set of the item whose view
        ///  we want.</param>
        /// <summary>
        /// Gets the view.
        /// </summary>
        /// <returns>The view.</returns>
        /// <param name="convertView">Convert view.</param>
        /// <param name="parent">Parent.</param>
        public override Android.Views.View GetView(int position, Android.Views.View convertView, Android.Views.ViewGroup parent)
        {
            ItemsHolder holder = null;
            var         view   = convertView;

            if (view == null)
            {
                view   = _context.LayoutInflater.Inflate(Resource.Layout.list_view_details, null);
                holder = new ItemsHolder
                {
                    Year      = view.FindViewById <TextView>(Resource.Id.txtyear),
                    Title     = view.FindViewById <TextView>(Resource.Id.txtmovietitle),
                    ImgPoster = view.FindViewById <ImageView>(Resource.Id.imagePoster)
                };
                view.Tag = holder;
            }
            else
            {
                holder = view.Tag as ItemsHolder;
            }

            var tempitem = movies[position];

            if (holder == null)
            {
                return(view);
            }

            holder.Year.Text = "Year : " + tempitem.Year;
            if (tempitem.Poster.ToUpper() != "N/A")
            {
                var imageBitmap = GetImageBitmapFromUrl(tempitem.Poster);
                holder.ImgPoster.SetImageBitmap(imageBitmap);
            }
            holder.Title.Text = tempitem.Title;

            return(view);
        }
Esempio n. 10
0
 public PickUpItemCommand(IEnumerable <IEntity> items, ItemsHolder holder, Point whereToPickUp)
 {
     Items         = items;
     Holder        = holder;
     WhereToPickUp = whereToPickUp;
 }
Esempio n. 11
0
 public PlayerFilter(ItemsHolder itemsHolder) : base(itemsHolder)
 {
     FilterType = FilterType.Selection;
 }
Esempio n. 12
0
 public AreasFilter(ItemsHolder itemsHolder) : base(itemsHolder)
 {
     FilterType = FilterType.Selection;
 }
Esempio n. 13
0
 public void Initialize()
 {
     Instance = this;
     DontDestroyOnLoad(gameObject);
 }
Esempio n. 14
0
 public SearchTextFilter(ItemsHolder itemsHolder) : base(itemsHolder)
 {
     FilterType = FilterType.Text;
 }
Esempio n. 15
0
 private void Start()
 {
     holder = new ItemsHolder(soHolder);
     ClearCells();
     SetupCells();
 }
 public SavegameItemsViewModel(ItemsHolder itemsholder)
 {
     ItemsHolder = itemsholder;
 }
Esempio n. 17
0
 private void LoadStationsPoints(ItemsHolder holder)
 {
     workstationsDictionary[Workstation.Specialty.Technology].LoadPoints(holder.TechnologyPoints);
     workstationsDictionary[Workstation.Specialty.Management].LoadPoints(holder.ManagementPoints);
     workstationsDictionary[Workstation.Specialty.Education].LoadPoints(holder.EducationPoints);
 }
Esempio n. 18
0
 private void LoadUnlockedItems(ItemsHolder holder)
 {
     workstationsDictionary[Workstation.Specialty.Technology].LoadUnlockedItemsList(holder.TechnologyUnlockedItems);
     workstationsDictionary[Workstation.Specialty.Management].LoadUnlockedItemsList(holder.ManagementUnlockedItems);
     workstationsDictionary[Workstation.Specialty.Education].LoadUnlockedItemsList(holder.EducationUnlockedItems);
 }
Esempio n. 19
0
 public DropItemCommand(IEnumerable <IEntity> items, ItemsHolder holder, Point whereToDrop)
 {
     Items       = items;
     Holder      = holder;
     WhereToDrop = whereToDrop;
 }
        public void WhenSelectedItemsAreUpdatedOnTheListBox_ThenSelectionsAreUpdatedOnTheModel()
        {
            var behavior = new SynchronizeSelectedItems();
            BindingOperations.SetBinding(
                behavior,
                SynchronizeSelectedItems.SelectionsProperty,
                new Binding("ObservableSelections"));

            var listBox = new ListBox() { SelectionMode = SelectionMode.Multiple };
            BindingOperations.SetBinding(
                listBox, ListBox.ItemsSourceProperty,
                new Binding("Items"));

            var itemsHolder =
                new ItemsHolder
                {
                    Items = { "a", "b", "c", "d" },
                    ObservableSelections = { "a", "c" }
                };

            listBox.DataContext = itemsHolder;

            var behaviors = Interaction.GetBehaviors(listBox);
            behaviors.Add(behavior);

            listBox.SelectedItems.Add("d");
            listBox.SelectedItems.Remove("c");

            CollectionAssert.AreEquivalent(new[] { "a", "d" }, itemsHolder.ObservableSelections);
        }
 public SessionsFilter(ItemsHolder itemsHolder) : base(itemsHolder)
 {
     FilterType = FilterType.Selection;
 }
Esempio n. 22
0
 protected BaseFilter(ItemsHolder itemsHolder)
 {
     ItemsHolder = itemsHolder;
     SetCurrenValues();
 }
Esempio n. 23
0
 public OrderFilter(ItemsHolder itemsHolder) : base(itemsHolder)
 {
     CurrentValues = values;
     SelectedValue = values.FirstOrDefault();
 }