示例#1
0
        public void Setup()
        {
            UnityEngine.Assertions.Assert.raiseExceptions = true;

            _col0 = new Collection <IItemInstance>(5)
            {
            };
            _col1 = new Collection <IItemInstance>(5)
            {
            };

            _group = new CollectionGroup <IItemInstance, Collection <IItemInstance> >(new []
            {
                new CollectionGroup <IItemInstance, Collection <IItemInstance> > .Slot(_col0),
                new CollectionGroup <IItemInstance, Collection <IItemInstance> > .Slot(_col1, new CollectionPriority <IItemInstance>(60, 60, 60)),
            });

            // Arrange
            _itemDef = new ItemDefinition(Guid.NewGuid())
            {
                maxStackSize = 10
            };
            _itemDef2 = new ItemDefinition(Guid.NewGuid())
            {
                maxStackSize = 10
            };
            _item  = new ItemInstance(Guid.NewGuid(), _itemDef);
            _item2 = new ItemInstance(Guid.NewGuid(), _itemDef);
            _item3 = new ItemInstance(Guid.NewGuid(), _itemDef2);
        }
 public AjoutGroupe(CollectionGroup cg)
 {
     InitializeComponent();
     ThisGroup            = cg;
     DataContext          = ThisGroup;
     labelnom.DataContext = ThisGroup;
 }
        /// <summary>
        /// Adds the edit modal.
        /// </summary>
        /// <returns></returns>
        public async Task <ActionResult> AddEditModal(int?collectionGroupId = null)
        {
            CollectionGroup model = new CollectionGroup();

            if (collectionGroupId != null)
            {
                model = (await CollectionGroupBusinessManager.Current.SelectAsync(SecurityManager.Current.ConnectionInfo,
                                                                                  new CollectionGroup()
                {
                    CollectionGroupId = collectionGroupId ?? -1
                })).FirstOrDefault();

                int collectionItems = (await CollectionItemBusinessManager.Current.SelectAsync(SecurityManager.Current.ConnectionInfo,
                                                                                               new CollectionItem()
                {
                    CollectionGroupId = collectionGroupId ?? -1
                })).Count;

                if (collectionItems < 1)
                {
                    ViewBag.AllowDelete = true;
                }
            }

            return(View(model));
        }
示例#4
0
 public Customer(Guid id, object character, CollectionGroup <T> inventories, CurrencyCollectionGroup <ICurrency> currencies)
 {
     ID               = id;
     this.character   = character;
     this.inventories = inventories;
     this.currencies  = currencies;
 }
示例#5
0
//        public CollectionGroup<IItemInstance> serverItemCollectionGroup { get; set; }
//        public CollectionGroup<IEquippableItemInstance, IEquipmentCollection<IEquippableItemInstance>> serverEquipmentCollectionGroup { get; set; }
//        public CurrencyCollectionGroup<ICurrency> serverCurrencyCollectionGroup { get; set; }

        public UNetInventoryPlayer()
        {
            logger = new UnityLogger("[UNet][player] ");

            itemCollectionGroup      = new CollectionGroup <IItemInstance>();
            equipmentCollectionGroup = new CollectionGroup <IEquippableItemInstance, IEquipmentCollection <IEquippableItemInstance> >();
            currencyCollectionGroup  = new CurrencyCollectionGroup <ICurrency>();
        }
        /// <summary>
        /// Collection.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        public async Task <ActionResult> Collection(int id)
        {
            CollectionGroup model = (await CollectionGroupBusinessManager.Current.SelectAsync(SecurityManager.Current.ConnectionInfo, new CollectionGroup()
            {
                CollectionGroupId = id
            })).FirstOrDefault();

            return(View(model));
        }
        /// <summary>
        /// Mies the collections grid data.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <returns></returns>
        public async Task <JsonResult> MyCollectionsGridData(CollectionGroup filter)
        {
            filter.ClearEmptyModifiedColumns();

            filter.JSUserId = SecurityManager.Current.UserId;

            PagedResult <CollectionGroup> pagedResult = await CollectionGroupBusinessManager.Current.PagingSelectAsync(SecurityManager.Current.ConnectionInfo, filter);

            return(Json(pagedResult));
        }
        private void CreateContentAndNext_Click(object sender, RoutedEventArgs e)
        {
            var currentApp = System.Windows.Application.Current as App;

            try
            {
                currentApp.MyData.Colstruct.ListCollectionGroup.Add(ThisGroup);
                ThisGroup = new CollectionGroup();
            }
            catch { var result = System.Windows.Forms.MessageBox.Show("Mauvaises données rentrées", "Fermer", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); }
        }
示例#9
0
 protected virtual void DrawEquipmentCollections(InventoryPlayer t, CollectionGroup <IEquippableItemInstance, IEquipmentCollection <IEquippableItemInstance> > g)
 {
     using (new VerticalLayoutBlock("box"))
     {
         GUILayout.Label(new GUIContent("Equipment"), UnityEditor.EditorStyles.boldLabel);
         foreach (var collection in g.collections)
         {
             DrawCollection(collection.collection, collection.priority.GetGeneralPriority());
         }
     }
 }
示例#10
0
        private void CreateContent_Click(object sender, RoutedEventArgs e)
        {
            var currentApp = System.Windows.Application.Current as App;

            try
            {
                currentApp.MyData.ListCollection.Add(ThisCollection);
                CollectionGroup group = ListGroupes.SelectedItem as CollectionGroup;
                group.ListeCollection.Add(ThisCollection);
                this.Hide();
            }
            catch { var result = System.Windows.Forms.MessageBox.Show("Mauvaises données rentrées", "Fermer", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); }
        }
        public async Task <ActionResult> AddEditModal(CollectionGroup model)
        {
            if (ModelState.IsValid)
            {
                if (model.CollectionGroupId != default(int))
                {
                    await CollectionGroupBusinessManager.Current.UpdateAsync(SecurityManager.Current.ConnectionInfo, model);
                }
                else
                {
                    await CollectionGroupBusinessManager.Current.InsertAsyncWithCollectionGroupJSUser(SecurityManager.Current.ConnectionInfo, model);
                }

                ViewBag.StatusMessage = Localization.SavedSuccessfully;

                ModelState.Clear();
            }

            return(View(model));
        }
示例#12
0
        public override void OnEnter()
        {
            var customerWrapper     = ScriptableObject.CreateInstance <ItemVendorCustomerWrapper>();
            var character           = (Character)characterObject.Value;
            var inventories         = character.GetComponent <IInventoryCollectionOwner>()?.itemCollectionGroup;
            var currencyCollections = character.GetComponent <ICurrencyCollectionOwner>()?.currencyCollectionGroup;

            if (inventories == null)
            {
                inventories = new CollectionGroup <IItemInstance>();
                LogWarning(nameof(IInventoryCollectionOwner) + " not found on character. Using empty group.");
            }

            if (currencyCollections == null)
            {
                currencyCollections = new CurrencyCollectionGroup <ICurrency>();
                LogWarning(nameof(ICurrencyCollectionOwner) + " not found on character. Using empty group.");
            }

            customerWrapper.customer = new Customer <IItemInstance>(System.Guid.Parse(customerGuid.Value), character, inventories, currencyCollections);
            customerResult           = customerWrapper;
            Finish();
        }
 public EquippableCharacter(IEquipmentCollection <TEquippableType> collection, CollectionGroup <TBaseType> restoreItemsToGroup, ILogger logger = null)
 {
     this.restoreItemsToGroup = restoreItemsToGroup ?? new CollectionGroup <TBaseType>();
     this.logger     = logger ?? new NullLogger();
     this.collection = collection;
 }
        ///// <summary>
        ///// Update
        ///// </summary>
        ///// <param name="connectionInfo">The connection information.</param>
        ///// <param name="entity">The entity.</param>
        ///// <returns></returns>
        //public IProcessResult Update(IConnectionInfo connectionInfo, CollectionGroup entity)
        //{
        //    return CollectionGroupManager.Current.Update(connectionInfo, entity);
        //}

        /// <summary>
        /// Update Async
        /// </summary>
        /// <param name="connectionInfo">The connection information.</param>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task <IProcessResult> UpdateAsync(IConnectionInfo connectionInfo, CollectionGroup entity)
        {
            return(await CollectionGroupManager.Current.UpdateAsync(connectionInfo, entity));
        }
        ///// <summary>
        ///// Select
        ///// </summary>
        ///// <param name="connectionInfo">The connection information.</param>
        ///// <param name="filter">The filter.</param>
        ///// <returns></returns>
        //public List<CollectionGroup> Select(IConnectionInfo connectionInfo, CollectionGroup filter)
        //{
        //    return CollectionGroupManager.Current.Select(connectionInfo, filter);
        //}

        /// <summary>
        /// Select Async
        /// </summary>
        /// <param name="connectionInfo">The connection information.</param>
        /// <param name="filter">The filter.</param>
        /// <returns></returns>
        public async Task <List <CollectionGroup> > SelectAsync(IConnectionInfo connectionInfo, CollectionGroup filter)
        {
            return(await CollectionGroupManager.Current.SelectAsync(connectionInfo, filter));
        }
        ///// <summary>
        ///// Select
        ///// </summary>
        ///// <param name="connectionInfo">The connection information.</param>
        ///// <param name="filter">The filter.</param>
        ///// <returns></returns>
        //public List<CollectionGroup> Select(IConnectionInfo connectionInfo, CollectionGroup filter)
        //{
        //    return SelectInternal(connectionInfo, filter).Result;
        //}

        /// <summary>
        /// Select Async
        /// </summary>
        /// <param name="connectionInfo">The connection information.</param>
        /// <param name="filter">The filter.</param>
        /// <returns></returns>
        public async Task <List <CollectionGroup> > SelectAsync(IConnectionInfo connectionInfo, CollectionGroup filter)
        {
            return(await SelectInternal(connectionInfo, filter));
        }
        ///// <summary>
        ///// Update
        ///// </summary>
        ///// <param name="connectionInfo">The connection information.</param>
        ///// <param name="entity">The entity.</param>
        ///// <returns></returns>
        //public IProcessResult Update(IConnectionInfo connectionInfo, CollectionGroup entity)
        //{
        //    return UpdateInternal(connectionInfo, entity).Result;
        //}

        /// <summary>
        /// Update Async.
        /// </summary>
        /// <param name="connectionInfo">The connection information.</param>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task <IProcessResult> UpdateAsync(IConnectionInfo connectionInfo, CollectionGroup entity)
        {
            return(await UpdateInternal(connectionInfo, entity));
        }
        /// <summary>
        /// List
        /// </summary>
        /// <returns></returns>
        public ActionResult List()
        {
            CollectionGroup model = new CollectionGroup();

            return(View(model));
        }
示例#19
0
        /// <summary>
        /// Inserts the asynchronous with collection group js user.
        /// </summary>
        /// <param name="connectionInfo">The connection information.</param>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public async Task <IProcessResult> InsertAsyncWithCollectionGroupJSUser(IConnectionInfo connectionInfo, CollectionGroup model)
        {
            IProcessResult result = await InsertAsync(connectionInfo, model);

            if (result.IsSuccess())
            {
                result = await CollectionGroupJSUserBusinessManager.Current.InsertAsync(connectionInfo, new CollectionGroupJSUser()
                {
                    CollectionGroupId = model.CollectionGroupId,
                    JSUserId          = connectionInfo.UserId
                });
            }

            return(result);
        }
示例#20
0
 /// <summary>
 /// Pagings the select asynchronous.
 /// </summary>
 /// <param name="connectionInfo">The connection information.</param>
 /// <param name="filter">The filter.</param>
 /// <returns></returns>
 public Task <PagedResult <CollectionGroup> > PagingSelectAsync(IConnectionInfo connectionInfo, CollectionGroup filter)
 {
     return(CollectionGroupManager.Current.PagingSelectAsync(connectionInfo, filter));
 }