コード例 #1
0
    private IEnumerator ConfirmPurchase(ItemStore item)
    {
        yield return(new WaitForSeconds(messageDelay));

        Canvas dialog = ClassDb.dialogBoxManager.OpenDialog();

        StoreManager storeManager = GameObject.Find(StaticDb.storeScreenName).GetComponent <StoreManager>();

        DialogBoxMessage message = MessageFromJson(Resources.Load <TextAsset>(StaticDb.purchase));

        dialog.GetComponent <DialogBoxManager>().SetDialog(
            message.head,
            string.Format(message.body, item.price),
            message.backBtn,
            message.nextBtn,
            dialog
            );

        //open dialog box
        //set listeners for the buttons on the dialog box
        dialog.GetComponent <DialogBoxManager>().dialogBoxBtnNext.onClick.RemoveAllListeners();
        dialog.GetComponent <DialogBoxManager>().dialogBoxBtnNext.gameObject.SetActive(true);
        dialog.GetComponent <DialogBoxManager>().dialogBoxBtnNext.onClick.AddListener(delegate
        {
            ClassDb.dialogBoxManager.CloseDialog(dialog);
            storeManager.PurchaseItem(item);
        });

        dialog.GetComponent <DialogBoxManager>().dialogBoxBtnBack.onClick.RemoveAllListeners();
        dialog.GetComponent <DialogBoxManager>().dialogBoxBtnBack.gameObject.SetActive(true);
        dialog.GetComponent <DialogBoxManager>().dialogBoxBtnBack.onClick.AddListener(delegate
        {
            ClassDb.dialogBoxManager.CloseDialog(dialog);
        });
    }
コード例 #2
0
ファイル: EagerManager.cs プロジェクト: vyakhir/pooling
 private void Preload(int preloadCount)
 {
     for (int i = 0; i < preloadCount; i++)
     {
         ItemStore.Store(factory());
     }
 }
コード例 #3
0
 protected override void setup()
 {
     base.setup();
     _ItemStore = new ItemStore(TestDbContext);
     SetupData();
     ThenItem = null;
 }
コード例 #4
0
 public Analyzer()
 {
     participantStore       = new ParticipantStore();
     championWithStatsStore = new ChampionWithStatsStore(context);
     champStore             = new ChampionStore(context);
     Items = new ItemStore(context);
 }
コード例 #5
0
ファイル: PropertyCollection.cs プロジェクト: gugacoder/paper
        protected override void OnCommitAdd(ItemStore store, IEnumerable <Property> items, int index = -1)
        {
            var names = items.Select(x => x.Name);

            store.RemoveWhen(item => names.Any(name => name.EqualsIgnoreCase(item.Name)));
            base.OnCommitAdd(store, items, index);
        }
コード例 #6
0
ファイル: PauseMenu.cs プロジェクト: OrlandoAguilar/Orly
 void Awake()
 {
     GUILayout.ExpandHeight(true);
     Time.timeScale = 1;
     itemStore= new ItemStore(textDisk, textInmune, textFreeze,coinsTexture,textArrow,textJewel,textMas,this);
     //PauseGame();
 }
コード例 #7
0
 public void SellItem()
 {
     foreach (ItemStore item in _core._itemStore.ToList())
     {
         if (_itemShopIsSelect.id == item.id)
         {
             item.amount += -1;
             _core._player.currentMoney += (item.data.price / 2);
             _core.getSubMenuCore().Cancel();
             foreach (ItemShop itemShop in _itemShopList)
             {
                 if (itemShop.id == _itemShopIsSelect.itemId)
                 {
                     if (itemShop.buyCount >= 0)
                     {
                         itemShop.buyCount--;
                     }
                     ViewShop();
                     break;
                 }
             }
             _itemShopIsSelect = null;
             if (item.amount == 0)
             {
                 Destroy(item.obj);
                 _core._itemStore.Remove(item);
                 return;
             }
             item.obj.transform.Find("Count").GetComponent <Text>().text = item.amount.ToString();
             break;
         }
     }
 }
コード例 #8
0
ファイル: PauseScreen.cs プロジェクト: midofit/gbc
    public void SlotClick()
    {
        EquipmentSlot slot = EventSystem.current.currentSelectedGameObject.GetComponent <EquipmentSlot>();

        if (slot.GetCount() > 0 && !mouseImage.enabled)
        {
            Texture2D tex = ItemStore.getItem(slot.GetId()).texture;
            mouseImage.sprite  = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero);
            mouseImage.enabled = true;
            mouseId            = slot.GetId();
            mouseCount         = slot.GetCount();
            mouseText.text     = mouseCount > 1 ? mouseCount.ToString() : "";
            mouseSelected      = selectedSlot == slot;
            slot.SetCount(0);
            slot.Deselect();
        }
        else if (mouseImage.enabled && slot.GetCount() == 0)
        {
            mouseImage.enabled = false;
            slot.SetId(mouseId);
            slot.SetCount(mouseCount);
            mouseText.text = "";

            if (mouseSelected)
            {
                slot.Select();
            }
        }
    }
コード例 #9
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }
            IsBusy = true;

            Database db = new Database();

            string[,] inventory = db.GetUserInventory();

            try
            {
                Items.Clear();
                var items = await ItemStore.GetItemsAsync(true);

                for (int i = 0; i < inventory.Length; i++)
                {
                    Items.Add(new Item {
                        UPC = inventory[i, 0], ProductName = inventory[i, 1], Description = inventory[i, 2], ImageUrl = inventory[i, 3], Quantity = inventory[i, 4]
                    });
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #10
0
ファイル: EquipmentSlot.cs プロジェクト: midofit/gbc
    public void SetId(int id)
    {
        this.id = id;
        Texture2D tex = ItemStore.getItem(id).texture;

        image.sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero);
    }
コード例 #11
0
        /// <summary>
        ///     Dispose all un-released items in the poll storage and the pool itself
        /// </summary>
        public void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }

            IsDisposed = true;
            // Do we have items in the store and does the item support the IDisposable interface?
            if (ItemStore.Count > 0 && typeof(IDisposable).IsAssignableFrom(typeof(T)))
            {
                // If so, try to dispose all unreleased items from the storage
                lock (ItemStore) {
                    do
                    {
                        var disposable = (IDisposable)ItemStore.Fetch();
                        // Avoid expensive exceptions
                        if (disposable == null)
                        {
                            continue;
                        }

                        try {
                            disposable.Dispose();
                        } catch {
                        }
                    } while (ItemStore.Count > 0);
                }
            }

            // Close the semaphore
            _sync.Close();
        }
コード例 #12
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Items.Clear();
                var items = await ItemStore.GetDatasAsync(true);

                foreach (var item in items)
                {
                    Items.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #13
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Items.Clear();
                var items = await ItemStore.GetAsync(true);

                Items.ReplaceRange(items);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                MessagingCenter.Send(new MessagingCenterAlert
                {
                    Title   = "Error",
                    Message = "Unable to load items.",
                    Cancel  = "OK"
                }, "message");
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #14
0
ファイル: QueryAddLink.cs プロジェクト: qifengwei/TFSPlus
 public void CreatLink(Dictionary <string, int> child)
 {
     foreach (WorkItem item in SearchResult)
     {
         String pattern = @"UC-\d+";
         Match  match   = Regex.Match(item.Description, pattern, RegexOptions.IgnoreCase);
         if (match.Value != "")
         {
             if (child.ContainsKey(match.Value))
             {
                 base.Link(item.Id, child[match.Value], "Shared Steps");
             }
             else
             {
                 String             tempQuery = String.Format("SELECT [System.ID] FROM WorkItems WHERE [System.TeamProject] = '{0}' AND [System.Title] CONTAINS '{1}'", RecentProject.Name, match.Value);
                 WorkItemCollection eItems    = ItemStore.Query(tempQuery);
                 foreach (WorkItem eItem in eItems)
                 {
                     if (UC(eItem.Title) == match.Value)
                     {
                         base.Link(item.Id, eItem.Id, "Shared Steps");
                     }
                 }
             }
         }
     }
 }
コード例 #15
0
    public void GVLoad(string id)
    {
        hdnKindid.SetValue(id.ToString());
        var item = from i in dc.Person
                   from d in dc.Department
                   join p in dc.Position on i.Personid equals p.Posid into gg
                   from tt in gg.DefaultIfEmpty()
                   where i.Deptid == d.Deptnumber &&
                   i.Visualfield == 3 && (i.Areadeptid == id || i.Maindeptid == id)
                   //orderby i.Sort
                   select new
        {
            i.Name,
            i.Personnumber,
            Posname = tt.Posname == null?"":tt.Posname,
            d.Deptname,
            i.Visualfield
        };

        ItemStore.DataSource = item;
        ItemStore.DataBind();

        btnJoemNew.Disabled = false;
        //ItemControlSet();

        //JeomSet(-1);
    }
コード例 #16
0
        protected override void OnCommitAdd(ItemStore store, IEnumerable <string> items, int index = -1)
        {
            var groups =
                from item in ParseNames(items)
                where !store.Contains(item)
                let isCamelCase = char.IsLower(item.FirstOrDefault())
                                  group item by isCamelCase into g
                                  select new { isCamelCase = g.Key, items = g };

            var divider =
                store.TakeWhile(item => !char.IsUpper(item.FirstOrDefault())).Select((item, i) => i + 1).LastOrDefault();

            foreach (var group in groups)
            {
                if (group.isCamelCase)
                {
                    var position = (index == -1 || index > divider) ? divider : index;
                    base.OnCommitAdd(store, group.items, position);
                }
                else
                {
                    var position = (index == -1) ? -1 : index + divider;
                    base.OnCommitAdd(store, group.items, position);
                }
            }
        }
コード例 #17
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                _SecureLevel = (SecureLevel)reader.ReadInt();
                goto case 0;
            }

            case 0:
            default:
            {
                if (reader.ReadBool())
                {
                    _Store = new ItemStore(reader);

                    //this makes sure the script listing synchronizes with the saved keys
                    _Store.SynchronizeStore(EntryStructure);

                    //synch up the display column number from the item definition with the store
                    _Store.DisplayColumns = DisplayColumns;

                    //reference this item so the store can connect back to this
                    _Store.Owner = this;
                }
                break;
            }
            }
        }
コード例 #18
0
        public void BuyItem()
        {
            int totalPrice = 0;

            foreach (ItemShop itemShop in _itemShopList)
            {
                if (itemShop.item.id == _itemShopIsSelect.itemId)
                {
                    if (_core._gameMode == GAMESTATE.LAND)
                    {
                        totalPrice = _itemShopIsSelect.data.price + (itemShop.buyCount / 10) * 5;
                    }
                    else
                    {
                        totalPrice = _itemShopIsSelect.data.price + (_itemShopIsSelect.data.price / 4) * itemShop.buyCount;
                    }

                    if (_core._player.currentMoney < totalPrice)
                    {
                        _core.Notify(iconCoin == null ? Resources.Load <Sprite>("Sprites/Icon16x16/coin16x16") : iconCoin, "not enough money!");
                        return;
                    }
                    _core._player.currentMoney += -totalPrice;
                    itemShop.buyCount++;
                    ViewShop();
                    break;
                }
            }

            bool haveItem = false;

            foreach (ItemStore item in _core._itemStore)
            {
                if (_itemShopIsSelect.itemId == item.itemId)
                {
                    if (item.amount == 99)
                    {
                        break;
                    }
                    item.amount++;
                    item.obj.transform.Find("Count").GetComponent <Text>().text = item.amount.ToString();
                    _core.getSubMenuCore().Cancel();
                    haveItem = true;
                    break;
                }
            }

            if (!haveItem)
            {
                _core._itemStore     = _core._itemStore.OrderBy(o => o.id).ToList();
                _itemShopIsSelect.id = _core._itemStore[_core._itemStore.Count - 1].id + 1;
                //Debug.Log("add newitem id : " + _itemShopIsSelect.id);
                _itemShopIsSelect.amount = 1;
                _core._itemStore.Add(_itemShopIsSelect);
                _core.getItemCon().ViewItem(_itemList.transform, "item");
                _core.getSubMenuCore().Cancel();
            }
            _itemShopIsSelect = null;
        }
コード例 #19
0
        private async void NewCustomer()
        {
            aggregator.GetEvent <UIElementFocusEvent>().Publish("");
            await Task.Delay(500);

            SelectedItem = SelectedItem.CreateNewItem();
            ItemStore    = ItemStore.CreateNewStore();
        }
コード例 #20
0
ファイル: EagerPool.cs プロジェクト: GodLesZ/ZeusEngine
        public override T Acquire()
        {
            _sync.WaitOne();

            lock (ItemStore) {
                return(ItemStore.Fetch());
            }
        }
コード例 #21
0
        public NewItemPage(ItemStore store)
        {
            this.store = store;
            NavigationPage.SetHasNavigationBar(this, false);
            InitializeComponent();

            BindingContext = this;
        }
コード例 #22
0
        protected override ItemStore GenerateItemStore()
        {
            ItemStore store = base.GenerateItemStore();

            store.Label      = "Pet Key";
            store.OfferDeeds = false;
            return(store);
        }
コード例 #23
0
ファイル: Stack.cs プロジェクト: midofit/gbc
    public void loadData(StreamReader reader)
    {
        _count = int.Parse(reader.ReadLine());
        int id = int.Parse(reader.ReadLine());

        _item = ItemStore.createItem(id);
        //item.loadData(reader);
    }
コード例 #24
0
 public void OnReset()
 {
     for (int i = 0; i < ItemStore.Count; i++)
     {
         GameCenter.Scene.MahjongCtrl.PushMahjongToPool(ItemStore[i]);
     }
     ItemStore.Clear();
 }
コード例 #25
0
 public override T GetItem()
 {
     if (ItemStore.Count > 0)
     {
         return(ItemStore.Fetch());
     }
     return(factory());
 }
コード例 #26
0
        /// <summary>
        ///     Release a pooled item back to the store
        /// </summary>
        /// <param name="item"></param>
        public void Release(T item)
        {
            lock (ItemStore) {
                ItemStore.Store(item);
            }

            _sync.Release();
        }
コード例 #27
0
        public MyQuery(ItemStore store)
        {
            Name = "Query";

            Field <ItemType>(
                "getItem",
                resolve: context => store.CurrentItem);
        }
コード例 #28
0
ファイル: EagerPool.cs プロジェクト: GodLesZ/ZeusEngine
 /// <summary>
 ///     Preloads all items
 /// </summary>
 protected void PreloadItems()
 {
     for (var i = 0; i < PoolSize; i++)
     {
         var item = ItemFactoryFunc(this);
         ItemStore.Store(item);
     }
 }
コード例 #29
0
    private void SetItemLevel(ItemStore itemStore)
    {
        itemStore.currentLevel++;

        if (itemStore.currentLevel < itemStore.finalLevel)
        {
            itemStore.price += itemStore.price / 2;
        }
    }
コード例 #30
0
ファイル: EntityItem.cs プロジェクト: midofit/gbc
    // Update the visual texture to comply with the texture of the item contained within this entity
    void updateVisuals()
    {
        ItemAsset asset   = ItemStore.getItem(_itemID);
        Texture2D texture = asset.texture;

        Debug.Log("Asset " + asset.id + asset.name);

        _renderer.material.mainTexture = texture;
    }
コード例 #31
0
        public void AddNewItem_AddsItemToQueueForProcessing()
        {
            var mocks = new LocatorMocks();
            var store = new ItemStore(mocks.MockLocator.Object);
            var rawItem = GetSampleItem();

            store.AddNewItem(rawItem);

            mocks.MockQueueStore.Verify(mqs => mqs.Enqueue(Match.Create<ItemBase>(ib => ib.ResourceId == rawItem.ResourceId)), Times.Once());
        }
コード例 #32
0
        public void AddNewItem_RecordsAdditionInTable()
        {
            var mocks = new LocatorMocks();
            var store = new ItemStore(mocks.MockLocator.Object);
            var rawItem = GetSampleItem();

            store.AddNewItem(rawItem);

            mocks.MockTableStore.Verify(mts => mts.Create(Match.Create<ItemBase>(ib => ib.ResourceId == rawItem.ResourceId)), Times.Once());
        }
コード例 #33
0
        public void FinishProcessingItem_AddsItemToFinishedBlobStore()
        {
            var mocks = new LocatorMocks();
            var store = new ItemStore(mocks.MockLocator.Object);
            var rawItem = GetSampleItem();

            store.StoreFinishedItem(rawItem);

            mocks.MockFinishedBlobStore.Verify(b => b.Create(rawItem.ResourceId, rawItem.File), Times.Once());
        }
コード例 #34
0
        public void FinishProcessingItem_RemovesRawItemFromBlobStore()
        {
            var mocks = new LocatorMocks();
            var store = new ItemStore(mocks.MockLocator.Object);
            var rawItem = GetSampleItem();

            store.StoreFinishedItem(rawItem);

            mocks.MockRawBlobStore.Verify(b => b.Delete(rawItem.ResourceId), Times.Once());
        }
コード例 #35
0
        public void FinishProcessingItem_UpdatesTableStoreInformation()
        {
            var mocks = new LocatorMocks();
            var store = new ItemStore(mocks.MockLocator.Object);
            var rawItem = GetSampleItem();

            store.StoreFinishedItem(rawItem);

            mocks.MockTableStore.Verify(ts => ts.Update(Match.Create<ItemBase>(ib => ib.ResourceId == rawItem.ResourceId)), Times.Once());
        }
コード例 #36
0
        public void AddNewItem_StoresRawFileInBlob()
        {
            var mocks = new LocatorMocks();
            var store = new ItemStore(mocks.MockLocator.Object);
            var rawItem = GetSampleItem();

            store.AddNewItem(rawItem);

            mocks.MockRawBlobStore.Verify(mrb => mrb.Create(rawItem.ResourceId, rawItem.File), Times.Once());
        }
コード例 #37
0
 public void setItem(ItemStore i)
 {
     ID          = i.ID;
     itemName    = i.itemName;
     type        = i.type;
     Description = i.Description;
     armour      = i.armour;
     weaponDmg   = i.weaponDmg;
     isEquipped  = i.isEquipped;
 }
コード例 #38
0
        public void RetrieveForProcessing_ItemInQueue_ReturnsItemWithRawData()
        {
            var mocks = new LocatorMocks();
            var store = new ItemStore(mocks.MockLocator.Object);
            Guid id = Guid.NewGuid();
            byte[] expected = new UTF8Encoding().GetBytes("test data");
            mocks.MockQueueStore.Setup(q => q.Dequeue()).Returns(new ItemBase() { ResourceId = id });
            mocks.MockRawBlobStore.Setup(b => b.Retrieve(id)).Returns(expected);

            var actual = store.RetrieveForProcessing();

            Assert.AreEqual(expected, actual.File);
        }
コード例 #39
0
        public void RetrieveForProcessing_ItemInQueue_DequeuesASingleItem()
        {
            var mocks = new LocatorMocks();
            var store = new ItemStore(mocks.MockLocator.Object);
            Guid id = Guid.NewGuid();
            byte[] expected = new UTF8Encoding().GetBytes("test data");
            mocks.MockQueueStore.Setup(q => q.Dequeue()).Returns(new ItemBase() { ResourceId = id });
            mocks.MockRawBlobStore.Setup(b => b.Retrieve(id)).Returns(expected);

            var actual = store.RetrieveForProcessing();

            mocks.MockRawBlobStore.Verify(b => b.Retrieve(id), Times.Once());
        }
コード例 #40
0
        public void RetrieveForProcessing_NoItemInQueue_DoesNotAttemptToRetrieveDataFroBlobStore()
        {
            var mocks = new LocatorMocks();
            var store = new ItemStore(mocks.MockLocator.Object);
            Guid id = Guid.NewGuid();
            byte[] expected = new UTF8Encoding().GetBytes("test data");
            mocks.MockQueueStore.Setup(q => q.Dequeue()).Returns<ItemBase>(null);

            var actual = store.RetrieveForProcessing();

            mocks.MockRawBlobStore.Verify(b => b.Retrieve(It.IsAny<Guid>()), Times.Never());
        }
コード例 #41
0
        public void RetrieveForProcessing_NoItemInQueue_ReturnsNull()
        {
            var mocks = new LocatorMocks();
            var store = new ItemStore(mocks.MockLocator.Object);
            Guid id = Guid.NewGuid();
            byte[] expected = new UTF8Encoding().GetBytes("test data");
            mocks.MockQueueStore.Setup(q => q.Dequeue()).Returns<ItemBase>(null);

            var actual = store.RetrieveForProcessing();

            Assert.IsNull(actual);
        }