예제 #1
0
        public void CheckAli()
        {
            Ali a     = new Ali();
            int money = a.GetMoney();

            Assert.AreEqual(money, 50);
        }
예제 #2
0
        //THIS FUNCTION IS TEMPORARY. The function generates a box or a sweep. This determined by the linearity of the curve.
        public Brep MakeBrep()
        {
            Brep Geometri = new Brep();

            double[] parameter = { 0.0, 2.2 };


            Plane tempPlane = new Plane(elemLine.PointAtStart, elemLine.TangentAtStart);

            Ali.rotationVectorToPoint(elemLine.PointAtStart);
            Vector3d alignvector = Ali.Rotation;
            //Getting rotation angle
            double angle = Rhino.Geometry.Vector3d.VectorAngle(tempPlane.XAxis, alignvector, tempPlane);

            tempPlane.Rotate(angle, tempPlane.Normal, tempPlane.Origin);
            tempPlane.Translate(tempPlane.XAxis * Ali.OffsetY);
            tempPlane.Translate(tempPlane.YAxis * Ali.OffsetZ);



            Interval iz = new Interval();
            Interval iy = new Interval();
            Interval ix = new Interval();

            double HalfWidth  = rectSec.Width / 2;
            double HalfHeight = rectSec.Height / 2;

            iz = new Interval(-HalfHeight, HalfHeight);
            iy = new Interval(-HalfWidth, HalfWidth);
            ix = new Interval(0, elemLine.GetLength());



            if (elemLine.IsLinear())
            {
                Box boxen = new Box(tempPlane, iy, iz, ix);
                Geometri = boxen.ToBrep();
            }
            else
            {
                SweepOneRail tempsweep = new SweepOneRail();
                Rectangle3d  rect      = new Rectangle3d(tempPlane, iy, iz);
                rect.ToPolyline();

                var sweep = tempsweep.PerformSweep(elemLine, rect.ToNurbsCurve());


                Geometri = sweep[0];
            }



            return(Geometri);
        }
예제 #3
0
    public void recRelive(KBEngine.Role e, Vector3 relivePos)
    {
        if (e.renderObj == null)
        {
            return;
        }
        GameObject player = e.renderObj as GameObject;

        Transform dieTrans = player.transform;

        switch (e.career)
        {
        case 1:
            Ashe ashe = player.GetComponent <Ashe>();
            dieTrans = ashe.hipTrans;
            break;

        case 2:
            Ali ali = player.GetComponent <Ali>();
            dieTrans = ali.hipTrans;
            break;
        }
        Instantiate(dieEffect, dieTrans.position, player.transform.rotation, player.transform);
    }
예제 #4
0
        public IHttpActionResult PostSendRegisterCaptcha(GetCaptcha model)
        {
            //验证数据
            if (model == null)
            {
                return(BadRequest("请输入手机号码"));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.Values.First(s => s.Errors.Count > 0).Errors[0].ErrorMessage));
            }

            Volunteer volunteer = db.Volunteers.FirstOrDefault(s => s.MobileNumber == model.MobileNumber && s.Status != EnumUserStatus.注销);

            //生成验证码
            string code = new Random().Next(100000, 999999).ToString();

#if DEBUG
            code = "666666";
            Thread.Sleep(2000);
#endif
            //存储手机号码、验证码等信息到数据库
            //1.新手机号码
            if (volunteer == null)
            {
                DateTime now = DateTime.Now;
                volunteer = new Volunteer
                {
                    Id                    = Guid.NewGuid(),
                    MobileNumber          = model.MobileNumber,
                    SmsCaptcha            = code,
                    SmsCaptchaUsedFor     = EnumCaptchaUsedFor.志愿者注册,
                    SmsCaptchaExpiredTime = now.AddMinutes(30),
                    RegisterTime          = now
                };
                try
                {
                    db.Volunteers.Add(volunteer);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    return(BadRequest("操作发生错误"));
                }
            }
            //2.已存在的手机号码
            else
            {
                //排除已经提交手机号码但未进行验证的情况
                if (volunteer.Status == EnumUserStatus.注册未验证手机)
                {
                    return(BadRequest("该手机号码已注册"));
                }
                volunteer.SmsCaptcha        = code;
                volunteer.SmsCaptchaUsedFor = EnumCaptchaUsedFor.志愿者注册;
                DateTime now = DateTime.Now;
                volunteer.SmsCaptchaExpiredTime = now.AddMinutes(30);
                db.Entry(volunteer).State       = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    db.Entry(volunteer).State = EntityState.Unchanged;
                    return(BadRequest("操作发生错误"));
                }
            }

#if !DEBUG
            if (!Ali.SendWorkerRegisterSms(code, model.MobileNumber))
            {
                //发送错误不处理
            }
#endif

            return(Ok());
        }