Inheritance: MonoBehaviour
        public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            if (parameter is long chatId)
            {
                var chat = CacheService.GetChat(chatId);
                if (chat == null)
                {
                    return(Task.CompletedTask);
                }

                var user = CacheService.GetUser(chat);
                if (user == null)
                {
                    return(Task.CompletedTask);
                }

                Items = new ItemsCollection(ProtoService, user.Id);
                RaisePropertyChanged(() => Items);
            }
            else if (parameter is int userId)
            {
                Items = new ItemsCollection(ProtoService, userId);
                RaisePropertyChanged(() => Items);
            }

            return(Task.CompletedTask);
        }
Beispiel #2
0
        public void Add()
        {
            var xmlDoc = new XmlDocument(TestUtility.CreateDefaultNSM().NameTable);

            xmlDoc.LoadXml(
                $@"<rowItems xmlns=""http://schemas.openxmlformats.org/spreadsheetml/2006/main"" count=""3"">
				<i>
					<x v=""1""/>
				</i>
				<i r=""1"">
					<x v=""2""/>
				</i>
				<i r=""1"">
					<x v=""3""/>
				</i>
			</rowItems>"            );
            var node            = xmlDoc.FirstChild;
            var itemsCollection = new ItemsCollection(TestUtility.CreateDefaultNSM(), node);

            itemsCollection.Add(5, 3);
            Assert.AreEqual(4, itemsCollection.Count);
            Assert.AreEqual(4, node.ChildNodes.Count);
            Assert.AreEqual(5, itemsCollection[3].RepeatedItemsCount);
            Assert.AreEqual(1, itemsCollection[3].Count);
        }
        public CallsViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            Items = new ItemsCollection(protoService, cacheService);

            CallDeleteCommand = new RelayCommand <TLCallGroup>(CallDeleteExecute);
        }
Beispiel #4
0
        protected override Task OnNavigatedToAsync(object parameter, NavigationMode mode, NavigationState state)
        {
            if (parameter is SettingsNotificationsExceptionsScope scope)
            {
                switch (scope)
                {
                case SettingsNotificationsExceptionsScope.PrivateChats:
                    Scope = new SettingsNotificationsScope(ProtoService, typeof(NotificationSettingsScopePrivateChats), Strings.Resources.NotificationsPrivateChats, Icons.Person);
                    Items = new ItemsCollection(ProtoService, new NotificationSettingsScopePrivateChats());
                    break;

                case SettingsNotificationsExceptionsScope.GroupChats:
                    Scope = new SettingsNotificationsScope(ProtoService, typeof(NotificationSettingsScopeGroupChats), Strings.Resources.NotificationsGroups, Icons.People);
                    Items = new ItemsCollection(ProtoService, new NotificationSettingsScopeGroupChats());
                    break;

                case SettingsNotificationsExceptionsScope.ChannelChats:
                    Scope = new SettingsNotificationsScope(ProtoService, typeof(NotificationSettingsScopeChannelChats), Strings.Resources.NotificationsChannels, Icons.Megaphone);
                    Items = new ItemsCollection(ProtoService, new NotificationSettingsScopeChannelChats());
                    break;
                }

                RaisePropertyChanged(nameof(Scope));
                RaisePropertyChanged(nameof(Items));

                Children.Add(Scope);
            }

            return(base.OnNavigatedToAsync(parameter, mode, state));
        }
Beispiel #5
0
 protected void RefreshItems()
 {
     if (ItemsCollection != null)
     {
         ItemsCollection.Refresh();
     }
 }
Beispiel #6
0
        bool IList.Contains(object value)
        {
            TEntity _item = (TEntity)value;
            int     _ret  = GetIndex(_item);

            return(ItemsCollection.ContainsKey(_ret));
        }
        public SettingsEmojiSetView(IProtoService protoService, IEmojiSetService emojiSetService, IEventAggregator aggregator)
        {
            this.InitializeComponent();

            _protoService = protoService;
            _aggregator   = aggregator;

            Title               = "Emoji Set";
            PrimaryButtonText   = Strings.Resources.OK;
            SecondaryButtonText = Strings.Resources.Cancel;

#if DEBUG
            CloseButtonText   = "Reset";
            CloseButtonClick += (s, args) =>
            {
                args.Cancel = true;

                foreach (var item in List.ItemsSource as ItemsCollection)
                {
                    if (item.IsOfficial)
                    {
                        continue;
                    }

                    _protoService.Send(new DeleteFileW(item.Document.Id));
                    _protoService.Send(new DeleteFileW(item.Thumbnail.Id));
                }
            };
#endif

            _aggregator.Subscribe(this);
            List.ItemsSource = _collection = new ItemsCollection(emojiSetService);
        }
        public ChatsViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, INotificationsService notificationsService, ChatList chatList, IChatFilter filter = null)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _notificationsService = notificationsService;

            _chatList = chatList;

            Items = new ItemsCollection(protoService, aggregator, this, chatList, filter);

            ChatPinCommand     = new RelayCommand <Chat>(ChatPinExecute);
            ChatArchiveCommand = new RelayCommand <Chat>(ChatArchiveExecute);
            ChatMarkCommand    = new RelayCommand <Chat>(ChatMarkExecute);
            ChatNotifyCommand  = new RelayCommand <Chat>(ChatNotifyExecute);
            ChatDeleteCommand  = new RelayCommand <Chat>(ChatDeleteExecute);
            ChatClearCommand   = new RelayCommand <Chat>(ChatClearExecute);
            ChatSelectCommand  = new RelayCommand <Chat>(ChatSelectExecute);

            ChatsMarkCommand    = new RelayCommand(ChatsMarkExecute);
            ChatsNotifyCommand  = new RelayCommand(ChatsNotifyExecute);
            ChatsArchiveCommand = new RelayCommand(ChatsArchiveExecute);
            ChatsDeleteCommand  = new RelayCommand(ChatsDeleteExecute);
            ChatsClearCommand   = new RelayCommand(ChatsClearExecute);

            ClearRecentChatsCommand = new RelayCommand(ClearRecentChatsExecute);

            TopChatDeleteCommand = new RelayCommand <Chat>(TopChatDeleteExecute);

#if MOCKUP
            Items.AddRange(protoService.GetChats(20));
#endif

            SelectedItems = new MvxObservableCollection <Chat>();
        }
Beispiel #9
0
        protected void ChangeItemState(object param, CommunicationItemState state, bool isEditing)
        {
            if (param is CommunicationItemViewModel)
            {
                // if old state is  Appended we have no to change it
                if ((param as CommunicationItemViewModel).State == CommunicationItemState.Appended)
                {
                    //if old state is  Appended and new state Deleted then delete item
                    if (state == CommunicationItemState.Deleted)
                    {
                        Items.Remove((param as CommunicationItemViewModel));
                    }
                }
                else
                {
                    (param as CommunicationItemViewModel).State = state;
                }

                (param as CommunicationItemViewModel).IsEditing = isEditing;
                (param as CommunicationItemViewModel).RaiseCanExecuteChanged();

                if (state == CommunicationItemState.Deleted)
                {
                    RefreshItems();
                }
                if (isEditing)
                {
                    ItemsCollection.MoveCurrentTo(param as CommunicationItemViewModel);
                }

                OnPropertyChanged("OneItemInCommunicationIsInEditState");
            }
        }
Beispiel #10
0
        internal List <UndoRedoManager.RemoveCommand> Remove(bool isRegUndoRedo, bool isGetUndoredo)
        {
            List <UndoRedoManager.RemoveCommand> commands = null;

            if (!IsRemove)
            {
                return(commands);
            }
            IsRomoving = true;
            ViewItem fi = null;

            if (FocusItem != null)
            {
                for (int i = FocusItem.Index - 1; i >= 0; i--)
                {
                    if (ItemsCollection.GetViewItem(i) is ViewItem item && !item.Selected)
                    {
                        fi = item;
                        break;
                    }
                }
            }
            commands = ItemsCollection.Remove(GetSelectList <object>(out int level), isRegUndoRedo || isGetUndoredo) as List <UndoRedoManager.RemoveCommand>;
            int sindex = fi == null ? 0 : fi.Index + 1;

            if (commands != null && isRegUndoRedo)
            {
                UndoRedoManager.RegistredNewCommand(commands);
            }
            SetFocus(sindex);
            IsRomoving = false;
            return(commands);
        }
        protected override Task OnNavigatedToAsync(object parameter, NavigationMode mode, NavigationState state)
        {
            if (parameter is long chatId)
            {
                var chat = CacheService.GetChat(chatId);
                if (chat == null)
                {
                    return(Task.CompletedTask);
                }

                var user = CacheService.GetUser(chat);
                if (user == null)
                {
                    return(Task.CompletedTask);
                }

                Items = new ItemsCollection(ProtoService, user.Id);
                RaisePropertyChanged(nameof(Items));
            }
            else if (parameter is long userId)
            {
                Items = new ItemsCollection(ProtoService, userId);
                RaisePropertyChanged(nameof(Items));
            }

            return(Task.CompletedTask);
        }
Beispiel #12
0
        public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            Item      = null;
            IsLoading = true;

            var channel = parameter as TLChannel;
            var peer    = parameter as TLPeerChannel;

            if (peer != null)
            {
                channel = CacheService.GetChat(peer.ChannelId) as TLChannel;
            }

            if (channel != null)
            {
                Item = channel;

                Items = new ItemsCollection(ProtoService, this, channel);
                Items.CollectionChanged += (s, args) => IsEmpty = Items.Count == 0;

                RaisePropertyChanged(() => Items);
            }

            return(Task.CompletedTask);
        }
        public DataGridSampleWpf()
        {
            InitializeComponent();
            DataContext = this;
            Items       = new ItemsCollection();

            var options = new OptionList();

            options.AddOption("Enabled", dataGrid, l => l.IsEnabled);
            options.AddOption("Multiple Rows",
                              dataGrid, c => c.SelectionMode,
                              DataGridSelectionMode.Extended,
                              DataGridSelectionMode.Single);
            options.AddOption("Full Row Select",
                              dataGrid, c => c.SelectionUnit,
                              DataGridSelectionUnit.FullRow,
                              DataGridSelectionUnit.CellOrRowHeader);
            options.AddEnumOption("Grid Lines",
                                  dataGrid, c => c.GridLinesVisibility);
            options.AddEnumOption("Headers",
                                  dataGrid, c => c.HeadersVisibility);
            options.AddOption("Wide Row Header",
                              dataGrid, c => c.RowHeaderWidth,
                              25,
                              double.NaN);
            options.AddOption("Frozen Columns", dataGrid, c => c.FrozenColumnCount);
            options.AddOption("Row Details", dataGrid,
                              c => c.RowDetailsVisibilityMode,
                              DataGridRowDetailsVisibilityMode.Visible,
                              DataGridRowDetailsVisibilityMode.Collapsed);
            Options = options;
        }
        private async void FiltersExecute()
        {
            var chat = _chat;

            if (chat == null)
            {
                return;
            }

            var supergroup = CacheService.GetSupergroup(chat);

            if (supergroup == null)
            {
                return;
            }

            var dialog = new SupergroupEventLogFiltersPopup();

            var confirm = await dialog.ShowAsync(ProtoService, supergroup.Id, _filters, _userIds);

            if (confirm == ContentDialogResult.Primary)
            {
                Filters = dialog.Filters;
                UserIds = dialog.UserIds;
                Items   = new ItemsCollection(ProtoService, _messageFactory, this, chat.Id, supergroup.IsChannel, dialog.Filters, dialog.AreAllAdministratorsSelected ? new int[0] : dialog.UserIds);

                RaisePropertyChanged(() => Items);
            }
        }
Beispiel #15
0
        protected override void DeserializeCore(XmlElement nodeElement, SaveContext context)
        {
            base.DeserializeCore(nodeElement, context);
            var wrapperName     = nodeElement.ChildNodes.Cast <XmlNode>().FirstOrDefault(x => x.Name == "listWrapper_name");
            var wrapperSelected = nodeElement.ChildNodes.Cast <XmlNode>().FirstOrDefault(x => x.Name == "listWrapper_selected");
            var wrapperIndex    = nodeElement.ChildNodes.Cast <XmlNode>().FirstOrDefault(x => x.Name == "listWrapper_index");

            if (wrapperName == null || wrapperSelected == null || wrapperIndex == null)
            {
                return;
            }
            if (wrapperName.Attributes == null || wrapperName.Attributes.Count <= 0)
            {
                return;
            }
            if (wrapperSelected.Attributes == null || wrapperSelected.Attributes.Count <= 0)
            {
                return;
            }
            if (wrapperIndex.Attributes == null || wrapperIndex.Attributes.Count <= 0)
            {
                return;
            }

            for (var i = 0; i <= wrapperName.Attributes.Count - 1; i++)
            {
                var name        = wrapperName.Attributes[i].Value;
                var selected    = wrapperSelected.Attributes[i].Value == "True";
                var index       = int.Parse(wrapperIndex.Attributes[i].Value);
                var itemWrapper = new ListItemWrapper {
                    Name = name, IsSelected = selected, Index = index
                };
                ItemsCollection.Add(itemWrapper);
            }
        }
        public void PopulateItems()
        {
            var e = GetInputElement();

            if (e != null)
            {
                var items = new List <ParameterWrapper>();

                // add instance parameters
                items.AddRange(GetParameters(e, "Instance"));

                // add type parameters
                if (e.CanHaveTypeAssigned())
                {
                    var et = DocumentManager.Instance.CurrentDBDocument.GetElement(e.GetTypeId());
                    if (et != null)
                    {
                        items.AddRange(GetParameters(et, "Type"));
                    }
                }
                ItemsCollection = new ObservableCollection <ParameterWrapper>(items.OrderBy(x => x.Name));
            }

            if (SelectedItem == null)
            {
                SelectedItem = ItemsCollection.FirstOrDefault();
            }
        }
Beispiel #17
0
        public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, NavigationState state)
        {
            if (parameter is int flags)
            {
                _type = (StickersType)flags;
            }

            if (_type is StickersType.Installed or StickersType.Masks)
            {
                Items = new ItemsCollection(ProtoService, _type == StickersType.Masks);

                ProtoService.Send(new GetArchivedStickerSets(_type == StickersType.Masks, 0, 1), result =>
                {
                    if (result is StickerSets stickerSets)
                    {
                        BeginOnUIThread(() => ArchivedStickersCount = stickerSets.TotalCount);
                    }
                });

                ProtoService.Send(new GetTrendingStickerSets(), result =>
                {
                    if (result is StickerSets stickerSets)
                    {
                        BeginOnUIThread(() => FeaturedStickersCount = stickerSets.TotalCount);
                    }
                });
            }
Beispiel #18
0
    public IA(ItemsCollection itemsCollection, LinesCollection linesCollection, Map map)
    {
        this.itemsCollection = itemsCollection;
        this.linesCollection = linesCollection;
        this.map = map;

        ItemController itemPlayer = null;
        ItemController itemEnemy = null;
        ItemController itemNeutral = null;

        foreach (ItemController item in itemsCollection.GetAllItemsController()) {
            if (item.owner == 0) {
                itemNeutral = item;
            }
            else if (item.owner == 1) {
                itemPlayer = item;
            }
            else {
                itemEnemy = item;
            }
        }

        if (itemPlayer != null && itemEnemy != null)
        {
            gameController.MakeAShootAtB(itemPlayer, itemEnemy);
        }

        if (itemNeutral != null && itemEnemy != null)
        {
            gameController.MakeAShootAtB(itemEnemy, itemNeutral);
        }
    }
Beispiel #19
0
        public SupplyCounter(UOObject container, List <UOItemTypeBase> types)
        {
            this.types = new List <UOItemTypeBase>();
            if (!container.Serial.IsValid)
            {
                throw new ArgumentException("container");
            }

            this.container = container;
            //this.type = type;
            //this.color = color;
            this.types.AddRange(types.ToArray());

            if (container is UOItem)
            {
                collection = ((UOItem)container).AllItems;
            }
            else if (container is UOCharacter)
            {
                collection = ((UOCharacter)container).Layers;

                if (Track)
                {
                    Notepad.WriteLine("Layers " + ((UOCharacter)container).Layers.Count());
                }
            }
            else
            {
                throw new ArgumentException("Invalid container type.");
            }

            container.Changed += new ObjectChangedEventHandler(container_Changed);
            // Init count
            Recalc();
        }
Beispiel #20
0
    public static IEnumerable <Item> filterSlot(ItemsCollection itemsCollection, string slot)
    {
        ItemsFilter filter = new ItemsFilter();

        filter.Slots.Add(slot);
        return(filter.filter(itemsCollection));
    }
Beispiel #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:SupplyCounter"/> class.
        /// </summary>
        public SupplyCounter(UOObject container, Graphic type, UOColor color)
        {
            if (!container.Serial.IsValid)
            {
                throw new ArgumentException("container");
            }
            if (type.IsInvariant || type == 0)
            {
                throw new ArgumentOutOfRangeException("type");
            }

            this.container = container;
            this.type      = type;
            this.color     = color;

            if (container is UOItem)
            {
                collection = ((UOItem)container).AllItems;
            }
            else if (container is UOCharacter)
            {
                collection = ((UOCharacter)container).Layers;
            }
            else
            {
                throw new ArgumentException("Invalid container type.");
            }

            container.Changed += new ObjectChangedEventHandler(container_Changed);

            // Init count
            Recalc();
        }
Beispiel #22
0
                /// <summary>
                /// Updates the <see cref="Control"/>. This is called for every <see cref="Control"/>, even if it is disabled or
                /// not visible.
                /// </summary>
                /// <param name="currentTime">The current time in milliseconds.</param>
                protected override void UpdateControl(TickCount currentTime)
                {
                    base.UpdateControl(currentTime);

                    if (!IsVisible)
                    {
                        return;
                    }

                    // Get the current item info
                    var currItemInfo = ItemsCollection.GetItemInfo(Slot);

                    // Check if the item info has changed and, if so, re-initialize the sprite
                    if (currItemInfo != _lastItemInfo)
                    {
                        ItemsCollection.PeerTradeForm.InitializeItemInfoSprite(_sprite, currItemInfo);
                        _lastItemInfo = currItemInfo;
                    }

                    // Update the sprite
                    if (_sprite.GrhData != null)
                    {
                        _sprite.Update(currentTime);
                    }
                }
        private void OnSearchTextTextChanged()
        {
            //Запоминаем какой Item выбран
            var tmpSelectedItem = SelectedItem;

            //Обнуляем счётчик отфильтрованных Item'ов
            FiltredItemsCounter = 0;

            CollectionViewSource.GetDefaultView(ItemsCollection).Filter = item =>
            {
                var tEntity = item as TEntity;

                if (tEntity?.GetEntityMainPropertyValue() != null)
                {
                    foreach (var filterWord in SearchText.ToLower().Split(_delimiterChars))
                    {
                        if (!tEntity.ToString().ToLower().Contains(filterWord.ToLower()))
                        {
                            return(false);
                        }
                    }
                }
                FiltredItemsCounter += 1;

                if (FiltredItemsCounter == 1)
                {
                    SelectedItem = tEntity;
                }

                return(true);
            };

            //RemoveSelectedButtonVisibility = SetVisibilityVisibleBasedOnSuggestListBox(FiltredItemsCounter);

            if (FiltredItemsCounter == 1)
            {
                Messenger.Default.Send(new NotificationMessage(SelectedItem, typeof(TEntity).ToString()));
            }


            else if (FiltredItemsCounter > 1)
            {
                SelectedItem = ItemsCollection.FirstOrDefault(item => item == tmpSelectedItem);
            }
            else
            {
                SelectedItem = null;
            }


            if (SearchText.Length > 0)
            {
                //SuggestListBoxAndControlButtonsVisibility = Visibility.Visible;
            }
            else
            {
                //SuggestListBoxAndControlButtonsVisibility = Visibility.Collapsed;
                SelectedItem = null;
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="combo"></param>
        /// <returns></returns>
        public object CreateGallery()
        {
            var g = PrimaryRibbonModel.CreateGallery();

            ItemsCollection.Add(g);
            return(g);
        }
Beispiel #25
0
        protected void AppendCommunicationItem(CommunicationItemViewModel item, bool isNew, bool isEditing)
        {
            if (item != null)
            {
                if (isNew)
                {
                    item.State        = CommunicationItemState.Appended;
                    item.IsEditing    = isEditing;
                    item.AuthorId     = _authorId;
                    item.AuthorName   = _authorName;
                    item.LastModified = DateTime.Now.ToUniversalTime();
                }

                DefItemCommands(item);
                item.RaiseCanExecuteChanged();

                Items.Add(item);


                if (isNew && ItemsCollection != null)
                {
                    RefreshItems();
                    ItemsCollection.MoveCurrentToFirst();
                }
                item.CommunicationItemPropertyChanged += CommunicationItem_OnPropertyChanged;

                OnPropertyChanged("OneItemInCommunicationIsInEditState");
                OnPropertyChanged("Items");
                OnPropertyChanged("IsShowEmpty");

                ModifiedRequest();
            }
        }
Beispiel #26
0
 private void Delete(object param)
 {
     commandBuffer.Add(new Helpers.CategoryCommand <InvoiceVatRate> {
         CommandType = Helpers.CommandEnum.Remove, Item = SelectedItem
     });
     ItemsCollection.Remove(SelectedItem);
 }
Beispiel #27
0
    public override void execute(Data data)
    {
        ItemsCollection selectedItems;

        if (!String.IsNullOrEmpty(ShopID))
        {
            GameData        gameData = (GameData)data;
            ItemsCollection items    = gameData.ShopData[ShopID].ItemsAll;

            selectedItems = items.getRandomItems(Count);
        }
        else
        {
            selectedItems = new ItemsCollection(new string[] { ItemID });
        }


        foreach (Item item in ((Dictionary <string, Item>)selectedItems).Values)
        {
            GameManager.Instance.PC.itemAdd(item);
            if (Equip)
            {
                GameManager.Instance.PC.currentOutfit.addItem(item);
            }
        }
    }
        public MainViewPresenter(ItemsCollection items, MainView view)
        {
            this._items = items;
            this._view  = view;

            this._view.Presenter = this;
        }
Beispiel #29
0
    public ItemsCollection getRandomItems(int count)
    {
        var result = new ItemsCollection();

        if (Count <= count)
        {
            if (Count < count)
            {
                ErrorMessage.Show($"Requesting {count} items from {Count} available items");
            }
            return(new ItemsCollection(getItemDict().Values));
        }


        List <Item> possibleItems = getItemDict().Values.ToList();

        for (int i = 0; i < count; i++)
        {
            int  index = BER2.Util.Randomness.Random.Range(0, possibleItems.Count);
            Item item  = possibleItems[index];

            result.addItem(item);
            possibleItems.RemoveAt(index);
        }

        return(result);
    }
 private void SetupNewCharacher()
 {
     this.Unit.Unit.View.UpdateAsks();
     this.Unit.BirthDay   = this.BirthDay;
     this.Unit.BirthMonth = this.BirthMonth;
     if (this.Doll != null)
     {
         this.Unit.Doll = this.Doll.CreateData();
         this.Unit.LeftHandedOverride = new bool?(this.Doll.LeftHanded);
     }
     if (this.State.Mode != LevelUpState.CharBuildMode.PreGen)
     {
         ItemsCollection.DoWithoutEvents(delegate
         {
             LevelUpHelper.AddStartingItems(this.Unit);
         });
     }
     else
     {
         this.Unit.Body.Initialize();
     }
     this.Unit.AddStartingInventory();
     foreach (Spellbook spellbook in this.Unit.Spellbooks)
     {
         spellbook.UpdateAllSlotsSize(true);
         int num = spellbook.GetTotalFreeSlotsCount();
         for (int i = 0; i < 100; i++)
         {
             if (num <= 0)
             {
                 break;
             }
             foreach (BlueprintAbility blueprint in BlueprintRoot.Instance.Progression.CharGenMemorizeSpells)
             {
                 AbilityData data = new AbilityData(blueprint, spellbook);
                 spellbook.Memorize(data, null);
             }
             int totalFreeSlotsCount = spellbook.GetTotalFreeSlotsCount();
             if (num <= totalFreeSlotsCount)
             {
                 break;
             }
             num = totalFreeSlotsCount;
         }
     }
     RestController.ApplyRest(this.Unit);
     if (this.Unit.IsCustomCompanion() && this.State.Mode != LevelUpState.CharBuildMode.Respec)
     {
         Game.Instance.EntityCreator.AddEntity(this.Unit.Unit, Game.Instance.Player.CrossSceneState);
         Game.Instance.Player.RemoteCompanions.Add(this.Unit.Unit);
         Game.Instance.Player.InvalidateCharacterLists();
         this.Unit.Unit.IsInGame = false;
         this.Unit.Unit.AttachToViewOnLoad(null);
         if (this.Unit.Unit.View != null)
         {
             this.Unit.Unit.View.transform.SetParent(Game.Instance.DynamicRoot, true);
         }
     }
 }
Beispiel #31
0
        public SettingsBlockedChatsViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            Items = new ItemsCollection(protoService);

            BlockCommand   = new RelayCommand(BlockExecute);
            UnblockCommand = new RelayCommand <MessageSender>(UnblockExecute);
        }
Beispiel #32
0
 protected internal void InitBin()
 {
     if (this.bin == null)
     {
         this.bin = new ItemsCollection<Observable>();
         this.bin.AfterItemAdd += this.AfterBinItemAdd;
         this.bin.AfterItemRemove += this.AfterItemRemove;
         this.bin.SingleItemMode = false;
     }
 }
Beispiel #33
0
    /**********************************************************/
    /********************** CONSTRUCTORS **********************/
    /**
     * Instantiates, setups and positions all the necessary lines
     */
    public LinesCollection(ItemsCollection itemsCollection)
    {
        GameObject lineObject, itemGameObjectI, itemGameObjectJ;
        LineRenderer lineRenderer;
        int collectionSize, position = 0;

        if (itemsCollection == null) {
            ErrorManager.DisplayErrorMessage("LineCollection: Cannot build LinesCollection from an empty ItemsCollection");
            return;
        }

        referenceMatrix = new ReferenceMatrix (itemsCollection.GetCollectionSize ());

        collectionSize = (itemsCollection.GetCollectionSize() * (itemsCollection.GetCollectionSize() - 1)) / 2;

        this.tabLines = new LineController[collectionSize];

        for (int i = 0; i < itemsCollection.GetCollectionSize(); i++) {
            for (int j = 0; j < itemsCollection.GetCollectionSize(); j++) {
                if (j > i) {
                    itemGameObjectI = itemsCollection.GetItemObject(i);
                    itemGameObjectJ = itemsCollection.GetItemObject(j);
                    lineObject = gameController.InstantiateLine();
                    lineRenderer = lineObject.GetComponent<LineRenderer>();

                    lineRenderer.SetPosition(0, new Vector3( itemGameObjectI.transform.position.x, 0, itemGameObjectI.transform.position.z));
                    lineRenderer.SetPosition(1, new Vector3(itemGameObjectJ.transform.position.x, 0, itemGameObjectJ.transform.position.z));
                    lineRenderer.SetWidth(0.1f, 0.1f);

                    tabLines[position] = lineObject.GetComponent<LineController>();

                    tabLines[position].Deactivate();
                    tabLines[position].SetOwnerOut(j);
                    tabLines[position].SetOwnerIn(i);
                    tabLines[position].SetStartPoint(new Vector3(itemGameObjectI.transform.position.x, 0, itemGameObjectI.transform.position.z));
                    tabLines[position].SetEndPoint(new Vector3(itemGameObjectJ.transform.position.x, 0, itemGameObjectJ.transform.position.z));
                    tabLines[position].ComputeConstants();

                    position++;
                }
            }
        }
    }
Beispiel #34
0
        static World()
        {
            itemList = new Dictionary<uint, RealItem>(128);
            charList = new Dictionary<uint, RealCharacter>(16);

            ground = new ItemsCollection(0x00000000, false);
            playerSerial = World.InvalidSerial;
            uoplayer = new UOPlayer(World.InvalidSerial);
            sunLight = 0xFF;
            sunLightChanged = new DefaultPublicEvent();

            cleanUpInterval = Config.InternalSettings.GetAttribute(5, "CleanUpInterval", "Config", "World");
            cleanUpDistance = Config.InternalSettings.GetAttribute(30, "CleanUpDistance", "Config", "World");

            cleanUpTimer = new Timer(new TimerCallback(CleanUpCallback), null, 10000, cleanUpInterval * 1000);
            worldCleaned = new DefaultPublicEvent();

            findDistance = Config.GroundFindDistance;
        }
Beispiel #35
0
		/// <summary>
		/// 	Если контейнер не инициализирован, то на основании характеристик открывшего существа генерируется наполнение
		/// </summary>
		/// <param name = "_creature"></param>
		/// <returns></returns>
		public ItemsCollection GetItems(Creature _creature)
		{
			if (m_items == null)
			{
				m_items = new ItemsCollection();
				foreach (var item in GenerateItems(_creature))
				{
					if (item is IFaked)
					{
						m_items.Add((Item) ((IFaked) item).Essence.Clone(_creature));
					}
					else
					{
						m_items.Add(item);
					}
				}
			}
			return m_items;
		}
Beispiel #36
0
        /// <summary>
        /// Saves history to file.
        /// </summary>
        /// <param name="list">List of items.</param>
        public static void Save(ItemsCollection list)
        {
            StringBuilder text = new StringBuilder();

            try
            {
                if (!System.IO.Directory.Exists(EnvironmentVariables.ConfigPath))
                    System.IO.Directory.CreateDirectory(EnvironmentVariables.ConfigPath);

                using (XmlTextWriter writer = new XmlTextWriter(EnvironmentVariables.ConfigPath + FileName, Encoding.UTF8))
                {
                    writer.Formatting = Formatting.Indented;
                    writer.WriteProcessingInstruction ("xml", "version='1.0'");
                    writer.WriteStartElement("items");

                    foreach (Item i in list)
                    {
                        if (i.IsText)
                        {
                            text.Remove(0, text.Length);
                            text.Append(i.Text);
                            text.Replace("<", "&lt;");
                            text.Replace(">", "&gt;");

                            writer.WriteStartElement("item");
                                writer.WriteStartElement("text");
                                    writer.WriteString(text.ToString());
                                writer.WriteEndElement();
                            writer.WriteEndElement();
                        }
                    }

                    writer.WriteEndElement();
                    writer.Close();
                }
            }
            catch (Exception ex)
            {
                Tools.PrintInfo(ex, typeof(History));
            }
        }
Beispiel #37
0
 public UOItem(uint serial)
     : base(serial)
 {
     items = new ItemsCollection(serial, false);
     allItems = new ItemsCollection(serial, true);
 }
 protected void InitItems()
 {
     if (this.items == null)
     {
         this.items = new ItemsCollection<AbstractComponent>();
         this.items.BeforeItemAdd += this.BeforeItemAdd;
         this.items.AfterItemAdd += this.AfterItemAdd;
         this.items.AfterItemRemove += this.AfterItemRemove;
         this.items.SingleItemMode = this.SingleItemMode;
     }
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="contentControls"></param>
        /// <param name="contentItems"></param>
        protected virtual void PopulateItems(ControlCollection contentControls, ItemsCollection<AbstractComponent> contentItems)
        {
            foreach (Control control in contentControls)
            {
                AbstractComponent cmp = control as AbstractComponent;

                if (cmp != null)
                {
                    contentItems.Add(cmp);
                    cmp.ID = cmp.ID;
                }
                else if (control is ContentPlaceHolder || control is UserControl)
                {
                    this.PopulateItems(control.Controls, contentItems);
                }
                else if(control is LiteralControl || control is Literal)
                {
                    continue;
                }
                else
                {
                    throw new Exception(string.Format(ServiceMessages.NON_LAYOUT_CONTROL, control.GetType().ToString()));
                }
            }
        }
Beispiel #40
0
 void Start()
 {
     itemsCollection = new ItemsCollection();
     linesCollection = new LinesCollection (itemsCollection);
     map = new Map (itemsCollection.GetCollectionSize ());
     this.dragDropManager.SendMessage ("SetLines", this.linesCollection);
     referenceMatrix = new ReferenceMatrix()
 }
        public MainPage()
        {
            InitializeComponent();

            Items = new ItemsCollection();
        }
        /// <summary>
        /// 
        /// </summary>
        protected internal void InitPlaceHolder()
        {
            if (this.placeHolder != null)
            {
                return;
            }

            this.placeHolder = new ItemsCollection<AbstractComponent>();
            this.placeHolder.BeforeItemAdd += this.BeforeItemAdd;
            this.placeHolder.AfterItemAdd += this.AfterItemAdd;
            this.placeHolder.AfterItemRemove += this.AfterItemRemove;
            this.placeHolder.SingleItemMode = true;
        }
        /// <summary>
        /// 
        /// </summary>
        protected internal void InitDockedItems()
        {
            if (this.dockedItems != null)
            {
                return;
            }

            this.dockedItems = new ItemsCollection<AbstractComponent>();
            this.dockedItems.BeforeItemAdd += this.BeforeItemAdd;
            this.dockedItems.AfterItemAdd += this.AfterItemAdd;
            this.dockedItems.AfterItemRemove += this.AfterItemRemove;
            this.dockedItems.SingleItemMode = false;
        }
Beispiel #44
0
 private void __BuildControl__control16(ItemsCollection<AbstractComponent> __ctrl)
 {
     TextField field = this.__BuildControltxtUsername();
     __ctrl.Add(field);
     TextField field2 = this.__BuildControltxtPassword();
     __ctrl.Add(field2);
     TextField field3 = this.__BuildControltxtVerifyCode();
     __ctrl.Add(field3);
     Ext.Net.Image image = this.__BuildControlimgVerify();
     __ctrl.Add(image);
     DisplayField field4 = this.__BuildControl__control17();
     __ctrl.Add(field4);
     Ext.Net.LinkButton button = this.__BuildControlbtnChangeImage();
     __ctrl.Add(button);
 }
Beispiel #45
0
 private void __BuildControl__control18(ItemsCollection<ButtonBase> __ctrl)
 {
     Ext.Net.Button button = this.__BuildControlbtnLogin();
     __ctrl.Add(button);
 }
Beispiel #46
0
 private void __BuildControl__control12(ItemsCollection<AbstractComponent> __ctrl)
 {
     FormPanel panel = this.__BuildControl__control13();
     __ctrl.Add(panel);
 }
Beispiel #47
0
 public Container(IDeclarationContext parent, string name)
     : base(parent, name)
 {
     _variables = new VariableCollection(this);
     _types = new ItemsCollection();
 }
Beispiel #48
0
 private void createSubMenu(ItemsCollection<Component> itemsCollection, DataTable dt, string p)
 {
     DataRow[] rows = dt.Select("parentid='" + p + "'");
     foreach (DataRow row in rows) {
         sysprog prog = ConvertHelper.RowToObject<sysprog>(row);
         Ext.Net.MenuItem menu = new Ext.Net.MenuItem(prog.ProgName);
         if (prog.IsGroup == "1") {
             menu.Icon = Icon.Folder;
             createSubMenu(menu.Menu, dt, prog.id);
         } else {
             menu.Icon = Icon.World;
             //menu.ID = prog.id;
             menu.Listeners.Click.Handler = "showmodule(#{MyDesktop},'" + prog.id + "');";
         }
         itemsCollection.Add(menu);
     }
 }