コード例 #1
0
        /*
         * ==============================================
         *                   RESOURCES
         * ==============================================
         */

        public static ResourcesInventory GetResourcesInventory()
        {
            TableQuery <ResourcesInventory> resourcesInventories = m_database.Table <ResourcesInventory>();

            if (!resourcesInventories.Any())
            {
                Console.WriteLine("Create the ResourcesInventory Table in DB");
                return(InitializeResourcesInventoryEntry());
            }

            ResourcesInventory inventory = m_database.Table <ResourcesInventory>().First();

            if (inventory == null)
            {
                inventory = new ResourcesInventory()
                {
                    WoodQuantity  = 0,
                    StoneQuantity = 0
                };

                m_database.Insert(inventory);
            }

            return(inventory);
        }