Beispiel #1
0
        public static int GetMips(this List <Pe> peList, int id)
        {
            Pe pe = GetById(peList, id);

            if (pe != null)
            {
                return(pe.Mips);
            }
            return(-1);
        }
Beispiel #2
0
        public static bool SetPeStatus(this List <Pe> peList, int id, int status)
        {
            Pe pe = GetById(peList, id);

            if (pe != null)
            {
                pe.Status = status;
                return(true);
            }
            return(false);
        }
Beispiel #3
0
 void showWinPicture()
 {
     Text.text = "you win";
     Pnon.SetActive(false);
     Pa.SetActive(false);
     Pb.SetActive(false);
     Pc.SetActive(false);
     Pd.SetActive(false);
     Pe.SetActive(false);
     Pwin.SetActive(false);
     KK = ShowPic(WINNUM + 1, WIN);
 }
Beispiel #4
0
        private void PrintarPonto(Pe pe)
        {
            PictureBox pic    = pe.Lado == Lado.Esquerdo ? imgEsquerdo : imgDireito;
            Image      imagem = pic.Image;

            using (Graphics graphics = Graphics.FromImage(imagem))
            {
                Pen pen = new Pen(Color.Red, 3);
                graphics.DrawEllipse(pen, pe.X, pe.Y, 3, 3);
                pic.Image = imagem;
            }
        }
Beispiel #5
0
        private void PictureBoxMouseDown(object sender, MouseEventArgs e)
        {
            if ((!Edicao) || (e.Button != MouseButtons.Left))
            {
                return;
            }

            Pe pe = new Pe()
            {
                Id   = Guid.NewGuid(),
                Lado = sender == imgEsquerdo ? Lado.Esquerdo : Lado.Direito,
                X    = e.X,
                Y    = e.Y
            };

            Crianca.Pontos.Add(pe);
            PrintarPonto(pe);
        }
Beispiel #6
0
        /// <summary>
        /// VForecasting SSA method
        /// </summary>
        /// <param name="group"></param>
        /// <param name="stepsAhead"></param>
        /// <param name="wholeSeries"></param>
        /// <returns></returns>
        private double[] Vforecasting(int[] group, int stepsAhead, bool wholeSeries)
        {
            double[] forecast;
            //prepare for forecasting by calculation necessary values
            (double[,] X, double[,] Pe) = prepareVectorFormula(group);

            //define extended trajectory matrix
            double[,] Xext = new double[L, K + stepsAhead];

            //fill the first element of time series
            for (int i = 0; i < K + stepsAhead; i++)
            {
                if (i < K)
                {
                    for (int j = 0; j < L; j++)
                    {
                        Xext[j, i] = X[j, i];
                    }
                }
                else
                {
                    var Ydelta = Xext.GetColumn(i - 1).ToArray().ToMatrix(true);
                    var Zi     = Pe.Dot(Ydelta);

                    for (int j = 0; j < L; j++)
                    {
                        Xext[j, i] = Zi[j, 0];
                    }
                }
            }
            //perform diagonal averaginig
            forecast = diagonalAveraging(Xext);
            //
            if (wholeSeries)
            {
                return(forecast.ToArray());
            }
            else
            {
                return(forecast.TakeLast(stepsAhead).ToArray());
            }
        }
Beispiel #7
0
        //  Check Ping
        public static bool Ping(string ip)
        {
            try
            {
                if (!(String.IsNullOrEmpty(ip)))
                {
                    //int timeout = 2000;
                    //string data = "ttttttesttttttttt";
                    //Ping p = new Ping();
                    //PingOptions options = new PingOptions();
                    //options.DontFragment = true;
                    //byte[] buffer = Encoding.ASCII.GetBytes(data);
                    //PingReply reply = p.Send(ip, timeout, buffer, options);
                    //LogClass.wirteLine("IP : " + ip + ",Status:" + reply.Status);
                    //if (reply.Status == IPStatus.Success)
                    //{
                    //    LogClass.wirteLine("IP : " + ip + ",Status:" + reply.Status);
                    //    return true;
                    //}
                    var    ping   = new Ping();
                    byte[] buffer = new byte[60];

                    var pingReply = ping.Send(ip, 2000, buffer, new PingOptions(600, false));
                    if (pingReply.Status == IPStatus.Success)
                    {
                        LogClass.WirteLine("IP : " + ip + ",Status:" + pingReply.Status);
                        return(true);
                    }
                    LogClass.WirteLine("IP : " + ip + ",Status:" + pingReply.Status);
                    return(false);
                }
                LogClass.WirteLine("IP address is null");
                return(false);
            }
            catch (PingException Pe)
            {
                LogClass.WirteLine("Ping error from ip:" + ip + "," + Pe.ToString());
                return(false);
            }
        }
Beispiel #8
0
    void showPicture(char WH)
    {
        switch (WH)
        {
        case 'S':
            Text.text = "you're in next LEVEL";
            Pnon.SetActive(false);
            Pwrong.SetActive(false);
            Pa.SetActive(false);
            Pb.SetActive(false);
            Pc.SetActive(false);
            Pd.SetActive(false);
            Pe.SetActive(false);
            Pwin.SetActive(false);
            Pnext.SetActive(true);
            Pnext1.SetActive(true);
            NEXTL.SetActive(false);
            break;

        case 'A':
            Text.text = "A" + "X " + positionX + "Y " + positionY + "Z " + positionZ;
            Pnon.SetActive(false);
            Pwrong.SetActive(false);
            Pa.SetActive(true);
            Pb.SetActive(false);
            Pc.SetActive(false);
            Pd.SetActive(false);
            Pe.SetActive(false);
            Pwin.SetActive(false);
            Pnext.SetActive(false);
            Pnext1.SetActive(false);
            NEXTL.SetActive(false);
            break;

        case 'B':
            Text.text = "B" + "X " + positionX + "Y " + positionY + "Z " + positionZ;
            Pnon.SetActive(false);
            Pwrong.SetActive(false);
            Pa.SetActive(false);
            Pb.SetActive(true);
            Pc.SetActive(false);
            Pd.SetActive(false);
            Pe.SetActive(false);
            Pwin.SetActive(false);
            Pnext.SetActive(false);
            Pnext1.SetActive(false);
            NEXTL.SetActive(false);
            break;

        case 'C':
            Text.text = "C" + "X " + positionX + "Y " + positionY + "Z " + positionZ;
            Pnon.SetActive(false);
            Pwrong.SetActive(false);
            Pa.SetActive(false);
            Pb.SetActive(false);
            Pc.SetActive(true);
            Pd.SetActive(false);
            Pe.SetActive(false);
            Pwin.SetActive(false);
            Pnext.SetActive(false);
            Pnext1.SetActive(false);
            NEXTL.SetActive(false);
            break;

        case 'D':
            Text.text = "D" + "X " + positionX + "Y " + positionY + "Z " + positionZ;
            Pnon.SetActive(false);
            Pwrong.SetActive(false);
            Pa.SetActive(false);
            Pb.SetActive(false);
            Pc.SetActive(false);
            Pd.SetActive(true);
            Pe.SetActive(false);
            Pwin.SetActive(false);
            Pnext.SetActive(false);
            Pnext1.SetActive(false);
            NEXTL.SetActive(false);
            break;

        case 'E':
            Text.text = "E" + "X " + positionX + "Y " + positionY + "Z " + positionZ;
            Pnon.SetActive(false);
            Pwrong.SetActive(false);
            Pa.SetActive(false);
            Pb.SetActive(false);
            Pc.SetActive(false);
            Pd.SetActive(false);
            Pe.SetActive(true);
            Pwin.SetActive(false);
            Pnext.SetActive(false);
            Pnext1.SetActive(false);
            NEXTL.SetActive(false);
            break;

        case 'N':
            Text.text = "NON" + "X " + positionX + "Y " + positionY + "Z " + positionZ;
            Pnon.SetActive(true);
            Pwrong.SetActive(false);
            Pa.SetActive(false);
            Pb.SetActive(false);
            Pc.SetActive(false);
            Pd.SetActive(false);
            Pe.SetActive(false);
            Pwin.SetActive(false);
            Pnext.SetActive(false);
            Pnext1.SetActive(false);
            NEXTL.SetActive(false);
            break;

        case 'W':
            Pnon.SetActive(false);
            Pwrong.SetActive(true);
            Pa.SetActive(false);
            Pb.SetActive(false);
            Pc.SetActive(false);
            Pd.SetActive(false);
            Pe.SetActive(false);
            Pwin.SetActive(false);
            Pnext.SetActive(false);
            Pnext1.SetActive(false);
            NEXTL.SetActive(false);
            //KKKEEP = false;
            break;
        }
    }
Beispiel #9
0
    //int frameRate = 250;

    // Use this for initialization
    void Start()
    {
        //  Time.captureFramerate = frameRate;

        Time.fixedDeltaTime = 1.0f;
        Pa.SetActive(false);
        Pb.SetActive(false);
        Pc.SetActive(false);
        Pd.SetActive(false);
        Pe.SetActive(false);
        Pwin.SetActive(false);
        Pnon.SetActive(true);
        Pwrong.SetActive(false);
        Pnext.SetActive(false);
        Pnext1.SetActive(false);
        NEXTL.SetActive(false);

        animatorhand = Hand.GetComponent <Animator>();
        //print(animatorhand.GetInstanceID ());

        La.SetActive(false); Ld.SetActive(false);
        Da.SetActive(false); Db.SetActive(false); Dc.SetActive(false); Dd.SetActive(false); De.SetActive(false); Hand.SetActive(false);
        whichF       = 0;
        nowKeep      = 0;
        showcount    = 0;
        playercount  = 0;
        currentlevel = 0;

        Last       = 'F';
        nowplaying = false;

        int temptnum;

        #region random
        System.Random randNum = new System.Random();


        for (int i = 0; i < flowerlight_L0.Length;)
        {
            temptnum = randNum.Next(Min, Max);
            if (i == 0)
            {
                flowerlight_L0[i] = 0;
                i++;
            }

            else if (i == 1)
            {
                flowerlight_L0[i] = 1;
                i++;
            }

            else if (i == 2)
            {
                flowerlight_L0[i] = 4;
                i++;
            }
        }

        for (int i = 0; i < flowerlight_L1.Length;)
        {
            temptnum = randNum.Next(Min, Max);
            if (i == 0)
            {
                flowerlight_L1[i] = 0;
                i++;
            }

            else if (temptnum != flowerlight_L1[i - 1])
            {
                flowerlight_L1[i] = temptnum;
                i++;
            }
        }

        for (int i = 0; i < flowerlight_L2.Length;)
        {
            temptnum = randNum.Next(Min, Max);
            if (i == 0)
            {
                flowerlight_L2[i] = 0;
                i++;
            }

            else if (temptnum != flowerlight_L2[i - 1])
            {
                flowerlight_L2[i] = temptnum;
                i++;
            }
        }

        for (int i = 0; i < flowerlight_L3.Length;)
        {
            temptnum = randNum.Next(Min, Max);
            if (i == 0)
            {
                flowerlight_L3[i] = 0;
                i++;
            }

            else if (temptnum != flowerlight_L3[i - 1])
            {
                flowerlight_L3[i] = temptnum;
                i++;
            }
        }
        #endregion
        cantouch = false;
        tempkeep = false;

        #region show WIN
        for (int i = 0; i < WINNUM; i++)
        {
            WIN[i].SetActive(false);
        }
        KK = false;
        #endregion
    }
Beispiel #10
0
        /// 得到一组线从头到尾的顺序
        /// <summary>
        /// 得到一组线从头到尾的顺序
        /// </summary>
        /// <param name="Curves"></param>
        /// <returns></returns>
        public static int[] Sort_Curves(WEntity2D[] Curves)
        {
            int Quan = Curves.Length;

            WPoint2D Pt;                      /////上一条线的尾端点
            WPoint2D Ps, Pe;                  /////扫描线的起点及终点

            List <int> At = new List <int>(); /////预先存储的顺序数组

            for (int i = 1; i < Quan; i++)
            {
                At.Add(i);
            }

            int[] Ao = new int[Quan];     /////输出用的标示曲线顺序的数组
            Ao[0] = 0;
            bool[] Co = new bool[Quan];   /////输出用的标示曲线起点开始或是终点开始的数组,True为首尾颠倒
            Co[0] = true;

            WCurve2D C = (WCurve2D)Curves[0];
            int      Num;
            double   l;

            Pt = C.EndPoint;

            for (int i = 1; i < Quan; i++)
            {
                for (int j = 0; j < At.Count; j++)
                {
                    Num = At[j];
                    C   = (WCurve2D)Curves[Num];
                    Ps  = C.StartPoint;
                    Pe  = C.EndPoint;

                    l = Ps.DistanceTo(Pt);
                    if (l < WGeos2D_Paras.E_Merge)
                    {
                        Ao[i] = Num;
                        Co[i] = false;
                        Pt    = Pe;
                        At.RemoveAt(j);
                        break;
                    }
                    l = Pe.DistanceTo(Pt);
                    if (l < WGeos2D_Paras.E_Merge)
                    {
                        Ao[i] = Num;
                        Co[i] = true;
                        Pt    = Ps;
                        At.RemoveAt(j);
                        break;
                    }
                }
            }
            ////////////////
            for (int i = 0; i < Quan; i++)
            {
                Ao[i] *= 2;
                if (Co[i] == true)   /////如果首尾颠倒则输出一个奇数,否则输出一个偶数
                {
                    Ao[i]++;
                }
            }
            return(Ao);
        }