コード例 #1
0
 void Start()
 {
     chargeSpeed = (maxLaunchForce - minLaunchForce) / maxChargeTime;
     layerMask   = 1 << 12;
     hud         = GameObject.Find("GameUI").GetComponent <HUD> ();
     inventory   = GameObject.FindGameObjectWithTag("UI").GetComponent <NewInventory> ();
 }
コード例 #2
0
 void Start()
 {
     inv             = GameObject.Find("GameUI").GetComponent <NewInventory> ();
     hud             = GameObject.Find("GameUI").GetComponent <HUD> ();
     tooltip         = inv.GetComponent <ToolTip> ();
     crossHairSprite = GameObject.FindGameObjectWithTag("CrossHair");
 }
コード例 #3
0
    void Update()
    {
        if (this.gameObject.name == "Images")
        {
            if (image.sprite == null)
            {
                text.text = "Images 1: null";
            }
            else
            {
                text.text = "Images 1: " + image.sprite.name;
            }
        }

        if (this.gameObject.name == "Inventory")
        {
            NewInventory inventory = GameObject.Find("Player").GetComponent <NewInventory>();
            if (inventory.playerDrinks[0] == null)
            {
                text.text = "Inventory 1: null";
            }
            else
            {
                text.text = "Inventory 1: " + inventory.playerDrinks[0].drinks_SOs.name;
            }
        }

        if (this.gameObject.name == "Count")
        {
            NewInventory inventory = GameObject.Find("Player").GetComponent <NewInventory>();
            text.text = "Items in Inventory: " + inventory.itemInInventory;
        }
    }
コード例 #4
0
        private void loadNewInventory()
        {
            NewInventory newInventory = new NewInventory();

            newInventory.Tag       = this;
            this.mainFrame.Content = newInventory;
        }
コード例 #5
0
ファイル: LocalNode.cs プロジェクト: ouyangshourui/AntShares
 public bool Relay(Inventory inventory)
 {
     if (connectedPeers.Count == 0)
     {
         return(false);
     }
     lock (KnownHashes)
     {
         if (!KnownHashes.Add(inventory.Hash))
         {
             return(false);
         }
     }
     if (inventory is Block)
     {
         if (Blockchain.Default == null)
         {
             return(false);
         }
         Block block = (Block)inventory;
         if (Blockchain.Default.ContainsBlock(block.Hash))
         {
             return(false);
         }
         if (!Blockchain.Default.AddBlock(block))
         {
             return(false);
         }
     }
     else if (inventory is Transaction)
     {
         if (!AddTransaction((Transaction)inventory))
         {
             return(false);
         }
     }
     else //if (inventory is Consensus)
     {
         if (!inventory.Verify())
         {
             return(false);
         }
     }
     lock (connectedPeers)
     {
         if (connectedPeers.Count == 0)
         {
             return(false);
         }
         RelayCache.Add(inventory);
         foreach (RemoteNode node in connectedPeers)
         {
             node.Relay(inventory);
         }
     }
     NewInventory?.Invoke(this, inventory);
     return(true);
 }
コード例 #6
0
        public bool Relay(IInventory inventory)
        {
            if (inventory is MinerTransaction)
            {
                return(false);
            }
            lock (KnownHashes)
            {
                if (!KnownHashes.Add(inventory.Hash))
                {
                    return(false);
                }
            }
            if (inventory is Block)
            {
                if (Blockchain.Default == null)
                {
                    return(false);
                }
                Block block = (Block)inventory;
                if (Blockchain.Default.ContainsBlock(block.Hash))
                {
                    return(false);
                }
                if (!Blockchain.Default.AddBlock(block))
                {
                    return(false);
                }
            }
            else if (inventory is Transaction)
            {
                if (!AddTransaction((Transaction)inventory))
                {
                    return(false);
                }
            }
            else //if (inventory is Consensus)
            {
                if (!inventory.Verify())
                {
                    return(false);
                }
            }
            bool relayed = RelayDirectly(inventory);

            NewInventory?.Invoke(this, inventory);
            return(relayed);
        }
コード例 #7
0
        public static async Task <Inventory> CreateInventoryDemo()
        {
            using var client = BricklinkClientFactory.Build();
            var newInventory = new NewInventory
            {
                ColorId   = 1,
                Condition = Condition.Used,
                Item      = new ItemBase
                {
                    Number = "3003",
                    Type   = ItemType.Part
                },
                Quantity    = 5,
                UnitPrice   = 0.01M,
                Description = "Good used condition"
            };

            var inventory = await client.CreateInventoryAsync(newInventory);

            PrintHelper.PrintAsJson(inventory);
            return(inventory);
        }
コード例 #8
0
        public static async Task CreateInventoriesDemo()
        {
            using var client = BricklinkClientFactory.Build();
            var newInventories = new NewInventory[]
            {
                new NewInventory
                {
                    ColorId   = 2,
                    Condition = Condition.Used,
                    Item      = new ItemBase
                    {
                        Number = "3003",
                        Type   = ItemType.Part
                    },
                    Quantity  = 5,
                    UnitPrice = 0.01M,
                    Remarks   = "Good used condition"
                },

                new NewInventory
                {
                    ColorId   = 3,
                    Condition = Condition.Used,
                    Item      = new ItemBase
                    {
                        Number = "3003",
                        Type   = ItemType.Part
                    },
                    Quantity  = 5,
                    UnitPrice = 0.01M,
                    Remarks   = "Good used condition"
                }
            };

            await client.CreateInventoriesAsync(newInventories);
        }
コード例 #9
0
        public async Task <IActionResult> AddNewStock([FromBody] NewInventory newInventory)
        {
            var orgId = getOrg();

            if (newInventory != null)
            {
                var stockRecord = _context.StockRecords.Where(x => x.ProductServiceId == newInventory.ProductServiceId).FirstOrDefault();

                newInventory.Id             = Guid.NewGuid();
                newInventory.OrganisationId = orgId;

                var product = _context.ProductServices.Where(x => x.Id == newInventory.ProductServiceId).FirstOrDefault();

                try
                {
                    _context.Add(newInventory);
                    await _context.SaveChangesAsync();

                    float remainQuantity = stockRecord.QuantityRemain;
                    float unitPrice      = stockRecord.CostPrice;
                    float totalprice     = remainQuantity * unitPrice;

                    stockRecord.QuantityRemain  = remainQuantity + newInventory.Quantity;
                    stockRecord.AllTimeQuantity = stockRecord.AllTimeQuantity + newInventory.Quantity;
                    stockRecord.CostPrice       = (totalprice + (newInventory.TotalPrice)) / stockRecord.QuantityRemain;

                    _context.Update(stockRecord);
                    await _context.SaveChangesAsync();

                    Transaction tCredit = new Transaction()
                    {
                        Id = Guid.NewGuid(),
                        TransactionType    = "IT",
                        TransactionId      = newInventory.Id,
                        DebitCredit        = "C",
                        TransactionDetails = "Inventory - " + newInventory.Quantity + " pcs " + product.ProductServiceName,
                        Amount             = newInventory.TotalPrice,
                        OrganisationId     = orgId
                    };

                    _context.Add(tCredit);
                    await _context.SaveChangesAsync();

                    Cashflow credit = new Cashflow()
                    {
                        Id             = Guid.NewGuid(),
                        FlowType       = "IT",
                        FlowTypeId     = newInventory.Id,
                        DebitCredit    = "C",
                        FlowDetails    = "Inventory - " + newInventory.Quantity + " pcs " + product.ProductServiceName,
                        Amount         = newInventory.TotalPrice,
                        OrganisationId = orgId
                    };

                    _context.Add(credit);
                    await _context.SaveChangesAsync();


                    return(Json(new
                    {
                        msg = "Success"
                    }));
                }
                catch
                {
                    return(Json(new
                    {
                        msg = "Failed"
                    }));
                }


                //StatusMessage = "New Vendor successfully created.";
            }

            //StatusMessage = "Error! Check fields...";
            //ViewData["StatusMessage"] = StatusMessage;
            return(Json(new
            {
                msg = "No Data"
            }));
        }
コード例 #10
0
 private void Awake()
 {
     inventory      = GetComponent <NewInventory>();
     giveToCustomer = GetComponent <GiveDrinksToCustomer>();
 }
コード例 #11
0
 private void Awake()
 {
     //reference the Raycast script
     detect    = GetComponent <DetectRaycastObject>();
     inventory = GetComponent <NewInventory>();
 }
コード例 #12
0
    private void Awake()
    {
        inventory = GetComponent<NewInventory>();
        interaction = GetComponent<Interaction>();
 
    }
コード例 #13
0
ファイル: StatsCheck.cs プロジェクト: etrainor11/MyBarGame
 private void Awake()
 {
     inventory = GetComponent <NewInventory>();
 }