コード例 #1
0
    //When the submit button is commeted should do the following
    protected void buttonSubmit_Click(object sender, EventArgs e)
    {
        //Ensure the page is valid before you submit to the database
        if (Page.IsValid)
        {
            //Create instance of compost db and load values to go into the db
            Compost fw = new Compost
            {
                date = Convert.ToDateTime(datepicker_hc.Text),
                weight = Convert.ToDouble(Weight_hc.Text),
                wasteType = "HotCompost"
            };
            db.Composts.InsertOnSubmit(fw);
            //Submit the changes and go home page
            //NOTE: Will not go to home page runnign in VS due to the way master pages work.
            try
            {
                db.SubmitChanges();
                //Response.Redirect("../Widgets.aspx");
            }
            //If not throw error
            catch
            {
                Console.WriteLine(e);
                db.SubmitChanges();
            }

        }
    }
コード例 #2
0
 //When the submit button is commeted should do the following
 protected void buttonSubmit_Click(object sender, EventArgs e)
 {
     //Ensure the page is valid before you submit to the database
     if (Page.IsValid)
     {
         //Create instance of compost db and load values to go into the db
         Compost fw = new Compost
         {
             date           = Convert.ToDateTime(datepicker_vo.Text),
             weight         = Convert.ToDouble(Weight_vo.Text),
             wasteType      = "VegetableOil",
             percentOilFull = Convert.ToDouble(Percent_Full.Text)
         };
         db.Composts.InsertOnSubmit(fw);
         //Submit the changes and go home page
         //NOTE: Will not go to home page runnign in VS due to the way master pages work.
         try
         {
             db.SubmitChanges();
         }
         //If not throw error
         catch
         {
             Console.WriteLine(e);
             db.SubmitChanges();
         }
     }
 }
コード例 #3
0
 //When the submit button is commeted should do the following
 protected void buttonSubmit_Click(object sender, EventArgs e)
 {
     //Ensure the page is valid before you submit to the database
     if (Page.IsValid)
     {
         //See if the trash is a yes/no if no switch present to false
         Boolean present = true;
         if((Trash.SelectedItem.Text).Equals("No"))
         {
             present = false;
         }
         //Create instance of compost db and load values to go into the db
         Compost fw = new Compost
         {
             date = Convert.ToDateTime(datepicker.Text),
             weight = Convert.ToDouble(Weight.Text),
             percentGrains = Convert.ToDouble(Percent_Grains.Text),
             percentFruit = Convert.ToDouble(Percent_Fruit.Text),
             percentVeg = Convert.ToDouble(Percent_Veg.Text),
             percentDairy = Convert.ToDouble(Percent_Dairy.Text),
             percentPaper = Convert.ToDouble(Percent_Paper.Text),
             percentCoffeeGrounds = Convert.ToDouble(Percent_CG.Text),
             trashPresent = present,
             Notes = Convert.ToString(Notes1.Text),
             wasteType = "Foodwaste",
             Vendor = Convert.ToString(Location.SelectedItem.Text)
         };
         //Insert fw into db
         db.Composts.InsertOnSubmit(fw);
         //Submit the changes and go home page
         //NOTE: Will not go to home page runnign in VS due to the way master pages work.
         try
         {
             db.SubmitChanges();
             clearControls();
             //Response.Redirect("");
         }
         //If not throw error
         catch
         {
             Console.WriteLine(e);
             db.SubmitChanges();
         }
         
     }
 }
コード例 #4
0
 //When the submit button is commeted should do the following
 protected void buttonSubmit_Click(object sender, EventArgs e)
 {
     //Ensure the page is valid before you submit to the database
     if (Page.IsValid)
     {
         //See if the trash is a yes/no if no switch present to false
         Boolean present = true;
         if ((Trash.SelectedItem.Text).Equals("No"))
         {
             present = false;
         }
         //Create instance of compost db and load values to go into the db
         Compost fw = new Compost
         {
             date                 = Convert.ToDateTime(datepicker.Text),
             weight               = Convert.ToDouble(Weight.Text),
             percentGrains        = Convert.ToDouble(Percent_Grains.Text),
             percentFruit         = Convert.ToDouble(Percent_Fruit.Text),
             percentVeg           = Convert.ToDouble(Percent_Veg.Text),
             percentDairy         = Convert.ToDouble(Percent_Dairy.Text),
             percentPaper         = Convert.ToDouble(Percent_Paper.Text),
             percentCoffeeGrounds = Convert.ToDouble(Percent_CG.Text),
             trashPresent         = present,
             Notes                = Convert.ToString(Notes1.Text),
             wasteType            = "Foodwaste",
             Vendor               = Convert.ToString(Location.SelectedItem.Text)
         };
         //Insert fw into db
         db.Composts.InsertOnSubmit(fw);
         //Submit the changes and go home page
         //NOTE: Will not go to home page runnign in VS due to the way master pages work.
         try
         {
             db.SubmitChanges();
             clearControls();
             //Response.Redirect("");
         }
         //If not throw error
         catch
         {
             Console.WriteLine(e);
             db.SubmitChanges();
         }
     }
 }
コード例 #5
0
    public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
    {
        Storage storage = go.AddOrGet <Storage>();

        storage.capacityKg = 2000f;
        Compost compost = go.AddOrGet <Compost>();

        compost.simulatedInternalTemperature = 348.15f;
        CompostWorkable compostWorkable = go.AddOrGet <CompostWorkable>();

        compostWorkable.workTime      = 20f;
        compostWorkable.overrideAnims = new KAnimFile[1]
        {
            Assets.GetAnim("anim_interacts_compost_kanim")
        };
        ElementConverter elementConverter = go.AddOrGet <ElementConverter>();

        elementConverter.consumedElements = new ElementConverter.ConsumedElement[1]
        {
            new ElementConverter.ConsumedElement(COMPOST_TAG, 0.1f)
        };
        elementConverter.outputElements = new ElementConverter.OutputElement[1]
        {
            new ElementConverter.OutputElement(0.1f, SimHashes.Dirt, 348.15f, false, true, 0f, 0.5f, 1f, byte.MaxValue, 0)
        };
        ElementDropper elementDropper = go.AddComponent <ElementDropper>();

        elementDropper.emitMass   = 10f;
        elementDropper.emitTag    = SimHashes.Dirt.CreateTag();
        elementDropper.emitOffset = new Vector3(0.5f, 1f, 0f);
        ManualDeliveryKG manualDeliveryKG = go.AddOrGet <ManualDeliveryKG>();

        manualDeliveryKG.SetStorage(storage);
        manualDeliveryKG.requestedItemTag = COMPOST_TAG;
        manualDeliveryKG.capacity         = 300f;
        manualDeliveryKG.refillMass       = 60f;
        manualDeliveryKG.minimumMass      = 1f;
        manualDeliveryKG.choreTypeIDHash  = Db.Get().ChoreTypes.FarmFetch.IdHash;
        Prioritizable.AddRef(go);
        go.AddOrGet <BuildingComplete>().isManuallyOperated = true;
    }
コード例 #6
0
 partial void DeleteCompost(Compost instance);
コード例 #7
0
 partial void UpdateCompost(Compost instance);
コード例 #8
0
 partial void InsertCompost(Compost instance);
コード例 #9
0
    protected void OnTriggerEnter(Collider c)
    {
        if (c.gameObject.layer == k_TrashLayerIndex)
        {
            Trash trash = c.GetComponent <Trash>();
            trash.Dispose();

            Compost compost = c.gameObject.GetComponent <Compost>();
            Metal   metal   = c.gameObject.GetComponent <Metal>();
            Nuclear nuclear = c.gameObject.GetComponent <Nuclear>();

            if (compost != null)
            {
                inventory.AddCompost();
            }
            else if (metal != null)
            {
                inventory.AddMetal();
            }
            else if (nuclear != null)
            {
                inventory.AddNuclear();
            }

            Destroy(c.gameObject);
        }
        else if (c.gameObject.layer == k_CoinsLayerIndex)
        {
            if (magnetCoins.Contains(c.gameObject))
            {
                magnetCoins.Remove(c.gameObject);
            }

            if (c.GetComponent <Coin>().isPremium)
            {
                Destroy(c.gameObject);
                controller.premium += 1;
                m_Audio.PlayOneShot(premiumSound);
            }
            else
            {
                /// TODO: Need to use the right pool
                Coin.coinPools[0].Free(c.gameObject);
                controller.coins += 1;
                m_Audio.PlayOneShot(coinSound);
            }
        }
        else if (c.gameObject.layer == k_ObstacleLayerIndex)
        {
            if (m_Invincible || controller.IsCheatInvincible())
            {
                return;
            }

            controller.StopMoving();

            c.enabled = false;

            Obstacle ob = c.gameObject.GetComponent <Obstacle>();

            if (ob != null)
            {
                ob.Impacted();
            }
            else
            {
                Destroy(c.gameObject);
            }

            controller.currentLife -= 1;
            controller.character.animator.SetTrigger(s_HitHash);

            if (controller.currentLife > 0)
            {
                m_Audio.PlayOneShot(controller.character.hitSound);
                SetInvincible();
            }
            // The collision killed the player, record all data to analytics.
            else
            {
                m_Audio.PlayOneShot(controller.character.deathSound);

                m_DeathData.character     = controller.character.characterName;
                m_DeathData.themeUsed     = controller.trackManager.currentTheme.themeName;
                m_DeathData.obstacleType  = ob.GetType().ToString();
                m_DeathData.coins         = controller.coins;
                m_DeathData.premium       = controller.premium;
                m_DeathData.score         = controller.trackManager.score;
                m_DeathData.worldDistance = controller.trackManager.worldDistance;
            }
        }
        else if (c.gameObject.layer == k_PowerupLayerIndex)
        {
            Consumable consumable = c.GetComponent <Consumable>();
            if (consumable != null)
            {
                controller.UseConsumable(consumable);
            }
        }
    }
コード例 #10
0
    IEnumerator Generate()
    {
        while (_count > 0 && !Game.status)
        {
            Sprite     newSprite;
            Waste      waste;
            GameObject wasteObj;

            Vector3 position = coords [Random.Range(0, numCoords)];
            int     n        = Random.Range(0, 4);

            if (n == 0)
            {
                // compost only
                int s = Random.Range(0, 5);
                newSprite = compostSprites [s];
                if (s < 3)
                {
                    waste = new compostAndRecycle();
                }
                else
                {
                    waste = new Compost();
                }
            }
            else if (n == 1)
            {
                // recyclable only
                int s = Random.Range(0, 6);
                newSprite = recycleSprites [s];
                if (s >= 4)
                {
                    waste = new compostAndRecycle();
                }
                else
                {
                    waste = new Recyclable();
                }
            }
            else if (n == 2)
            {
                // trash only
                int s = Random.Range(0, 5);
                waste     = new Trash();
                newSprite = trashSprites [s];
            }
            else
            {
                // n == 3
                // compost and recyclables
                int rand = Random.Range(0, 2);
                waste = new compostAndRecycle();
                if (rand == 0)
                {
                    // pick sprite from end of recyclable sprite array
                    int s = Random.Range(4, 6);
                    newSprite = recycleSprites [s];
                }
                else
                {
                    // pick sprite from start of compost sprite array
                    int s = Random.Range(0, 3);
                    newSprite = compostSprites [s];
                }
            }
            wasteObj = wastePrefab;
            wasteComponent wc = wasteObj.GetComponent <wasteComponent> ();
            wc.waste = waste;
            wc.UpdateValues();
            SpriteRenderer oldSprite = wasteObj.GetComponent <SpriteRenderer> ();
            oldSprite.sprite = newSprite;
            yield return(new WaitForSeconds(waitTime));

            Instantiate(wasteObj, position, Quaternion.identity);
            _count--;
        }
    }