Beispiel #1
0
 // Update is called once per frame
 void Update()
 {
     if (GM.legsIDEnemy != -1)
     {
         SRLegs.enabled    = true;
         SRHead.enabled    = true;
         SRWeaponL.enabled = true;
         SRWeaponR.enabled = true;
         SRTorso.enabled   = true;
         LC                 = GM.LegList[GM.legsIDEnemy];
         HC                 = GM.HeadList[GM.headIDEnemy];
         TC                 = GM.TorsoList[GM.torsoIDEnemy];
         WrC                = GM.WeaponRList[GM.gunRIDEnemy];
         WlC                = GM.WeaponLList[GM.gunLIDEnemy];
         SRLegs.sprite      = LC.part;
         SRLegs.material    = LC.Emitter;
         SRHead.sprite      = HC.part;
         SRHead.material    = HC.Emitter;
         SRTorso.sprite     = TC.part;
         SRTorso.material   = TC.Emitter;
         SRWeaponR.sprite   = WrC.part;
         SRWeaponR.material = WrC.Emitter;
         SRWeaponL.sprite   = WlC.part;
         SRWeaponL.material = WlC.Emitter;
     }
     else
     {
         SRLegs.enabled    = false;
         SRHead.enabled    = false;
         SRWeaponL.enabled = false;
         SRWeaponR.enabled = false;
         SRTorso.enabled   = false;
     }
 }
Beispiel #2
0
    // Start is called before the first frame update
    void Start()
    {
        ID               = 7;
        Hit.enabled      = false;
        HitImage.enabled = false;
        seeker           = GetComponent <Seeker>();
        AM               = FindObjectOfType <AudioManager>();
        GM               = FindObjectOfType <GameManager>();
        //GM = GameObject.FindGameObjectWithTag("GameManager");
        LC  = GM.LegList[7];
        HC  = GM.HeadList[7];
        TC  = GM.TorsoList[7];
        WrC = GM.WeaponRList[7];
        WlC = GM.WeaponLList[7];

        SRLegs.sprite      = LC.part;
        SRLegs.material    = LC.Emitter;
        SRHead.sprite      = HC.part;
        SRHead.material    = HC.Emitter;
        SRTorso.sprite     = TC.part;
        SRTorso.material   = TC.Emitter;
        SRWeaponR.sprite   = WrC.part;
        SRWeaponR.material = WrC.Emitter;
        SRWeaponL.sprite   = WlC.part;
        SRWeaponL.material = WlC.Emitter;
        Anim = legsChildren.GetComponent <Animator>();
        Anim.SetInteger("ArmorID", 7);
        Anim.speed       = 0;
        SRLegs.sprite    = LC.part;
        currentHP        = HC.hp + TC.hp + LC.hp;
        maxHP            = HC.hp + TC.hp + LC.hp;
        maxEnergy        = TC.energy;
        currentEnergy    = maxEnergy;
        currentAmmoL     = WlC.ammo;
        currentAmmoR     = WrC.ammo;
        BarrelL.position = new Vector2(BarrelL.position.x, BarrelL.position.y + WlC.barrelLength);
        BarrelR.position = new Vector2(BarrelR.position.x, BarrelR.position.y + WrC.barrelLength);

        if (AM.Playing("MenuSong"))
        {
            AM.Stop("MenuSong");
        }


        //AM.Play("TempleSong");
        if (Boosters.isPlaying)
        {
            Boosters.Stop();
        }
        InvokeRepeating("UpdatePath", 0f, 0.5f);
    }
Beispiel #3
0
    // Start is called before the first frame update
    void Start()
    {
        GM  = FindObjectOfType <GameManager>();
        AM  = FindObjectOfType <AudioManager>();
        WrC = GM.WeaponRList[GM.gunRID];
        WlC = GM.WeaponLList[GM.gunLID];
        HC  = GM.HeadList[GM.headID];
        BarrelL.position = new Vector2(BarrelL.position.x, BarrelL.position.y + WlC.barrelLength);
        BarrelR.position = new Vector2(BarrelR.position.x, BarrelR.position.y + WrC.barrelLength);
        currentAmmoL     = WlC.ammo;
        currentAmmoR     = WrC.ammo;

        GunNameTextR.text = WrC.partName;
        GunNameTextL.text = WlC.partName;
    }
Beispiel #4
0
 // Update is called once per frame
 void Update()
 {
     LC                 = GM.LegList[GM.legsID];
     HC                 = GM.HeadList[GM.headID];
     TC                 = GM.TorsoList[GM.torsoID];
     WrC                = GM.WeaponRList[GM.gunRID];
     WlC                = GM.WeaponLList[GM.gunLID];
     SRLegs.sprite      = LC.part;
     SRLegs.material    = LC.Emitter;
     SRHead.sprite      = HC.part;
     SRHead.material    = HC.Emitter;
     SRTorso.sprite     = TC.part;
     SRTorso.material   = TC.Emitter;
     SRWeaponR.sprite   = WrC.part;
     SRWeaponR.material = WrC.Emitter;
     SRWeaponL.sprite   = WlC.part;
     SRWeaponL.material = WlC.Emitter;
 }
Beispiel #5
0
    // Start is called before the first frame update
    void Start()
    {
        C  = FindObjectOfType <Camera>();
        AM = FindObjectOfType <AudioManager>();
        GM = FindObjectOfType <GameManager>();
        //GM = GameObject.FindGameObjectWithTag("GameManager");
        LC  = GM.LegList[GM.legsID];
        HC  = GM.HeadList[GM.headID];
        TC  = GM.TorsoList[GM.torsoID];
        WrC = GM.WeaponRList[GM.gunRID];
        WlC = GM.WeaponLList[GM.gunLID];

        SRLegs.sprite      = LC.part;
        SRLegs.material    = LC.Emitter;
        SRHead.sprite      = HC.part;
        SRHead.material    = HC.Emitter;
        SRTorso.sprite     = TC.part;
        SRTorso.material   = TC.Emitter;
        SRWeaponR.sprite   = WrC.part;
        SRWeaponR.material = WrC.Emitter;
        SRWeaponL.sprite   = WlC.part;
        SRWeaponL.material = WlC.Emitter;
        Anim = legsChildren.GetComponent <Animator>();
        Anim.SetInteger("ArmorID", GM.legsID);
        SRLegs.sprite      = LC.part;
        currentHP          = HC.hp + TC.hp + LC.hp;
        maxHP              = HC.hp + TC.hp + LC.hp;
        maxEnergy          = TC.energy;
        currentEnergy      = maxEnergy;
        C.orthographicSize = 6;
        if (Boosters.isPlaying)
        {
            Boosters.Stop();
        }
        if (overBoosters.isPlaying)
        {
            overBoosters.Stop();
        }
        AM.Play("Start1");
        AM.Play("Start2");
        AM.Play("Start3");
        AM.Play("Start4");
        AM.Play("Start5");
    }
Beispiel #6
0
    protected void btn_Generate_Click(object sender, EventArgs e)
    {
        SalesDBManager SalesDB = new SalesDBManager();

        try
        {
            lblmsg.Text = "";
            string         milkopeningbal = string.Empty;
            string         milkclosingbal = string.Empty;
            SalesDBManager vdm            = new SalesDBManager();
            DateTime       fromdate       = DateTime.Now;
            DateTime       todate         = DateTime.Now;
            string         idcno          = string.Empty;
            string         inworddate     = string.Empty;
            double         totalissueqty  = 0;
            string[]       datestrig      = dtp_FromDate.Text.Split(' ');
            if (datestrig.Length > 1)
            {
                if (datestrig[0].Split('-').Length > 0)
                {
                    string[] dates = datestrig[0].Split('-');
                    string[] times = datestrig[1].Split(':');
                    fromdate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
                }
            }
            datestrig = dtp_Todate.Text.Split(' ');
            if (datestrig.Length > 1)
            {
                if (datestrig[0].Split('-').Length > 0)
                {
                    string[] dates = datestrig[0].Split('-');
                    string[] times = datestrig[1].Split(':');
                    todate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
                }
            }
            lblFromDate.Text = fromdate.ToString("dd/MM/yyyy");
            lbltodate.Text   = todate.ToString("dd/MM/yyyy");
            int Plant_Code = Convert.ToInt32(ddlplant.SelectedItem.Value);
            hidepanel.Visible = true;
            DataTable Report    = new DataTable();
            DataTable snfReport = new DataTable();
            Report.Columns.Add("Plant Name");
            Report.Columns.Add("Month");
            Report.Columns.Add("Year");
            Report.Columns.Add("Milkqty").DataType           = typeof(double);
            Report.Columns.Add("PerdayAvg_MilkQty").DataType = typeof(double);

            DateTime startDate = fromdate;
            DateTime endDate   = todate;
            int      months    = endDate.Subtract(startDate).Days / 30;

            string           presentmonth  = fromdate.ToString("MM");
            string           year          = fromdate.ToString("yyyy");
            int              pmonth        = Convert.ToInt32(presentmonth);
            int              pyear         = Convert.ToInt32(year);
            List <HeadClass> HeadClasslist = new List <HeadClass>();
            for (int i = 0; i <= months; i++)
            {
                if (i == 0)
                {
                    pmonth = pmonth + i;
                    pyear  = pyear + i;
                }
                else
                {
                    pmonth = pmonth + 1;
                    if (pmonth > 12)
                    {
                        pyear  = pyear + 1;
                        pmonth = 1;
                    }
                }
                HeadClass getVehicles = new HeadClass();
                getVehicles.month = pmonth.ToString();
                getVehicles.year  = pyear.ToString();
                HeadClasslist.Add(getVehicles);
            }

            foreach (var value in HeadClasslist)
            {
                string   mnth      = value.month;
                string   yr        = value.year;
                DateTime frmdt     = new DateTime(Convert.ToInt32(yr), Convert.ToInt32(mnth), 1);
                string   myfrmdate = frmdt.ToString();
                DateTime mf        = Convert.ToDateTime(myfrmdate);
                DateTime Date      = frmdt.AddMonths(1).AddDays(-1);
                string   mytodate  = Date.ToString();
                DateTime mt        = Convert.ToDateTime(mytodate);
                cmd = new SqlCommand("SELECT SUM(Milk_kg) AS milkqty,  Plant_Master.Plant_Name  FROM  Procurement INNER JOIN Plant_Master ON Procurement.Plant_Code = Plant_Master.Plant_Code  WHERE (Procurement.Plant_Code = @pcode) AND (Procurement.Prdate BETWEEN @d1 AND @d2) GROUP BY Plant_Master.Plant_Name");
                cmd.Parameters.Add("@d1", GetLowDate(mf));
                cmd.Parameters.Add("@d2", GetHighDate(mt));
                cmd.Parameters.Add("@pcode", Plant_Code);
                DataTable dtqty = vdm.SelectQuery(cmd).Tables[0];
                if (dtqty.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtqty.Rows)
                    {
                        DataRow newdr = Report.NewRow();
                        newdr["Plant Name"] = dr["Plant_Name"].ToString();
                        newdr["Month"]      = mf.ToString("MMM");
                        newdr["Year"]       = mf.ToString("yyyy");
                        string milkqty = dr["milkqty"].ToString();
                        if (milkqty != "")
                        {
                            double milkq     = Convert.ToDouble(milkqty);
                            double avgperday = milkq / 30;
                            newdr["Milkqty"]           = Math.Round(milkq, 0);
                            newdr["PerdayAvg_MilkQty"] = Math.Round(avgperday, 0);
                        }
                        Report.Rows.Add(newdr);
                    }
                }
            }
            if (Report.Rows.Count > 0)
            {
                DataRow newTotal = Report.NewRow();
                newTotal["Year"] = "Total";
                double val = 0.0;
                foreach (DataColumn dc in Report.Columns)
                {
                    if (dc.DataType == typeof(Double))
                    {
                        val = 0.0;
                        double.TryParse(Report.Compute("sum([" + dc.ToString() + "])", "[" + dc.ToString() + "]<>'0'").ToString(), out val);
                        if (val == 0.0)
                        {
                        }
                        else
                        {
                            newTotal[dc.ToString()] = val;
                        }
                    }
                }
                Report.Rows.Add(newTotal);
            }
            Session["xportdata"]  = Report;
            Session["filename"]   = "Per day Avg milk Details - " + ddlplant.SelectedItem.Text + "";
            grdReports.DataSource = Report;
            grdReports.DataBind();
            hidepanel.Visible = true;
        }
        catch (Exception ex)
        {
            lblmsg.Text = ex.Message;
        }
    }
Beispiel #7
0
        //游戏算法实现
        public void Algorithm(Graphics g, PictureBox pictureBox, Label label) //定义一个方法
        {
            //判断游戏是否开始
            if (start)  //判断游戏是否开始
            {
                //是否死亡
                if (die)                                   //如果die等于true
                {
                    g.DrawImage(dieImage, 0, 0, 600, 400); //绘制死亡图像
                    if (save == false)                     //判断save是否为false
                    {
                        Record(Convert.ToString(score));   //将score传入record
                        save  = true;                      //使save等于true
                        start = false;
                    }
                    return;
                }

                //空格暂停
                else                                            //否则
                {
                    if (pause)                                  //判断pause是否等于true
                    {
                        g.DrawImage(stopImage, 0, 0, 600, 400); //绘制暂停图片
                        return;                                 //返回值 阻止程序执行下面的操作
                    }
                    else                                        //否则
                    {
                        //绘制画布
                        pictureBox.Refresh();   //刷新背景
                                                //g.DrawImage(bg1, 0, 0, 600, 400);
                    }
                }

                //生成蛇头
                if (time >= 1)                                            //如果time大于等于1
                {
                    HeadList.RemoveAt(0);                                 //从HeadList中移出下标为0的数
                }
                time += 1;                                                //使time等于time+1
                HeadClass HeadClass = new HeadClass(HdX, HdY, HeadImage); //将HdX HdY HeadImage传入HeadClass中
                HeadList.Add(HeadClass);                                  //将HeadClass加入HeadList

                //画蛇头
                g.DrawImage(HeadImage, new Point(HdX, HdY)); //在HdX,HdY坐标绘制HeadImage

                //蛇头移动
                if (direction == 8 && HdY >= 10)  //判断direction等于8 并且HdY大于等于10
                {
                    HdY -= snakeR * 2;            //HdY等于HdY-snakeR * 2
                }
                if (direction == 5 && HdY <= 389) //判断direction等于5 并且HdY小于等于389
                {
                    HdY += snakeR * 2;            //HdY等于HdY+snakeR * 2
                }
                if (direction == 4 && HdX >= 10)  //判断direction等于4 并且HdX大于等于10
                {
                    HdX -= snakeR * 2;            //HdX等于HdX-snakeR * 2
                }
                if (direction == 6 && HdX <= 589) //判断direction等于6 并且HdX小于等于589
                {
                    HdX += snakeR * 2;            //HdX等于HdX+snakeR * 2
                }

                //生成食物
                if (foodNumber < foodScreen)                                   //判断foodNumber是否小于1
                {
                    int tX = new Random().Next(10, 580);                       //定义int变量tX 等于在10到580中取随机数
                    System.Threading.Thread.Sleep(100);                        //延迟100毫秒   //用来防止两次生成随机数相同
                    int tY = new Random().Next(10, 380);                       //定义int变量tY 等于在10到380中取随机数
                    foodNumber += 1;                                           //使foodNumber等于foodNumber+1
                    FoodsClass FoodsClass = new FoodsClass(tX, tY, FoodImage); //将tX tY FoodImage传入FoodsClass中
                    FoodList.Add(FoodsClass);                                  //将food加入FoodList
                }

                //绘制食物
                for (int i = 0; i < FoodList.Count; i++)                                         //循环判断 定义int i等于0,在i小于FoodList的长度中循环,i++   //遍历FoodList
                {
                    g.DrawImage(FoodList[i].image, new Point(FoodList[i].FdX, FoodList[i].FdY)); //绘制FoodList中下标为i的图片,在FoodList中下标为i的横坐标FdX,纵坐标为FdY的位置
                }

                //吃食物
                for (int i = 0; i < FoodList.Count; i++)     //循环判断 定义int i等于0,在i小于FoodList的长度中循环,i++   //遍历FoodList
                {
                    for (int j = 0; j < HeadList.Count; j++) //循环判断 定义int j等于0,在j小于HeadList的长度中循环,j++   //遍历HeadList
                    {
                        //碰撞检测
                        if (Math.Abs((FoodList[i].FdX) - (HeadList[j].HdX)) <= (2 * snakeR) && Math.Abs((FoodList[i].FdY) - (HeadList[j].HdY)) <= (2 * snakeR))
                        //判断 FoodList中下标为i的横坐标 减去HeadList中下标为j的横坐标 的绝对值 是否小于等于2r,并且FoodList中下标为i的纵坐标 减去HeadList中下标为j的纵坐标 的绝对值 是否小于等于2r
                        {
                            foodNumber  -= 1;                                              //foodNumber等于foodNumber-1
                            score       += Convert.ToInt32(100 * magnification);           //score等于score+100
                            snakelength += 1;                                              //snakelength等于snakelength+1
                                                                                           //增加蛇身长度
                            if (snakelength > 0)                                           //判断snakelength是否大于0
                            {
                                HeadClass HeadClass0 = new HeadClass(HdX, HdY, HeadImage); //将HdX HdY HeadImage 传入HeadClass中
                                HeadList.Add(HeadClass0);                                  //将HeadClass0添加到HeadList中
                                GC.Collect();                                              //强制进行垃圾回收
                            }
                            label.Text = "得分:" + Convert.ToString(score);                  //使label输出文字和分数
                            FoodList.Remove(FoodList[i]);                                  //从FoodList中移出FoodList中下标为i的成员
                            break;                                                         //跳出循环
                        }
                    }
                }

                //画蛇身
                for (int i = 1; i <= snakelength; i++)                                                               //循环判断 定义int i等于1,在i小于snakelength中循环,i++   //遍历snakelength
                {
                    g.DrawImage(HeadImage, new Point(HeadList[snakelength - i].HdX, HeadList[snakelength - i].HdY)); //在横坐标等于HeadList中下标snakelength-i,纵坐标等于HeadList中下标snakelength-i的位置绘制HeadImage
                }

                Collision(snakeR);   //调用碰撞检测
            }
        }