Exemplo n.º 1
0
        /// <summary>
        /// 餐饮系统注册
        /// </summary>
        /// <param name="Param"></param>
        /// <returns></returns>
        public string RegistRepastAccount(RequestMerchant Param)
        {
            Param.AuditType = AuditEnum.WaitAduit;
            RepastRoleAuthor Author = Kily.Set <RepastRoleAuthor>().Where(t => t.IsDelete == false).Where(t => t.AuthorName.Contains("基本")).OrderBy(t => t.CreateTime).FirstOrDefault();

            Param.DingRoleId = Author.Id;
            RepastInfo Info     = Param.MapToEntity <RepastInfo>();
            var        IsReplay = Kily.Set <RepastInfo>().Where(t => t.Account == Param.Account).FirstOrDefault();

            if (IsReplay != null)
            {
                return("账号已经被注册");
            }
            var IsReplays = Kily.Set <RepastInfo>().Where(t => t.MerchantName == Param.MerchantName).FirstOrDefault();

            if (IsReplays != null)
            {
                return("企业已经注册,请勿重复注册");
            }
            if (!NormalUtil.CheckStringChineseUn(Info.Account))
            {
                if (Insert <RepastInfo>(Info))
                {
                    return(ServiceMessage.INSERTSUCCESS);
                }
                else
                {
                    return(ServiceMessage.INSERTFAIL);
                }
            }
            else
            {
                return("账号不能包含中文和特殊字符");
            }
        }
        /// <summary>
        /// Add extruded point(s) based on two neighbouring line segments.
        /// </summary>
        /// <param name="linePointAndForwardSegment">A line point and its corresponding segment.</param>
        /// <param name="previousLinePointAndForwardSegment">The previous line point and its corresponding segment.</param>
        /// <param name="nextLinePoint">The next line point (since its parameter, uv etc will be needed).</param>
        /// <param name="lineSegmentIndexToAssign">Line segment index to assign the extruded point coming from.</param>
        /// <param name="extrusionAmount">The extrusion amount.</param>
        /// <param name="extrudedLinePoints">The list of all extruded line points.</param>
        /// <param name="findParameter">Delegate for determining altered point parameter.</param>
        private static void AddPointExtrusionFromPreviousNextSegments(LinePointUVAndSegment linePointAndForwardSegment, LinePointUVAndSegment previousLinePointAndForwardSegment, LinePointUV nextLinePoint, int lineSegmentIndexToAssign, float extrusionAmount, List <ExtrudedPointUV> extrudedLinePoints, GetShiftedScaledParameter findParameter)
        {
            double extrusionMagnitudeFractionFirstTangent;
            bool   segmentIntersection = LineSegmentUtil.DoNeighbouringSegmentTangentsFromCommonPointIntersect(previousLinePointAndForwardSegment.SegmentTangent, linePointAndForwardSegment.SegmentTangent, Mathf.Sign(extrusionAmount), out extrusionMagnitudeFractionFirstTangent);

            if (segmentIntersection)
            {
                //Concave section; expect intersection of neighbouring line segments around this point
                var  extrusionDistanceAlongTangents = Mathf.Abs((float)extrusionMagnitudeFractionFirstTangent * extrusionAmount);
                bool intersectionOccursOutOfSegment = extrusionDistanceAlongTangents >= Mathf.Min(previousLinePointAndForwardSegment.SegmentLength, linePointAndForwardSegment.SegmentLength);
                if (intersectionOccursOutOfSegment)
                {
                    AttemptAddNaiveExtrudedPointsWhenTheirExtrudedSegmentsDoNotIntersect(linePointAndForwardSegment, previousLinePointAndForwardSegment, lineSegmentIndexToAssign, extrusionAmount, extrudedLinePoints, findParameter, extrusionDistanceAlongTangents);
                }
                else
                {
                    var intersection = LineSegmentUtil.GetExtrudedSegmentNeighbouringIntersectionPoint(linePointAndForwardSegment.Point, previousLinePointAndForwardSegment.SegmentTangent, extrusionMagnitudeFractionFirstTangent, extrusionAmount);
                    var linePointOfThisIntersection = new LinePointUV(findParameter(linePointAndForwardSegment.Parameter), intersection, linePointAndForwardSegment.UV);
                    extrudedLinePoints.Add(new ExtrudedPointUV(linePointOfThisIntersection, lineSegmentIndexToAssign, lineSegmentIndexToAssign - 1));
                }
            }
            else
            {
                //Convex section, expect a circular fan of points around this point.
                RangeF rangeFromPreviousPoints = new RangeF(findParameter(previousLinePointAndForwardSegment.Parameter), findParameter(linePointAndForwardSegment.Parameter));
                RangeF rangeFromNextPoints     = new RangeF(findParameter(linePointAndForwardSegment.Parameter), findParameter(nextLinePoint.Parameter));
                RangeF parameterRangeToUse     = new RangeF(rangeFromPreviousPoints.FromFractionUnclamped(0.6f), rangeFromNextPoints.FromFractionUnclamped(0.4f));

                var   extrudedFromPreviousNormal     = linePointAndForwardSegment.Point + extrusionAmount * previousLinePointAndForwardSegment.SegmentNormal;
                var   extrudedFromNextNormal         = linePointAndForwardSegment.Point + extrusionAmount * linePointAndForwardSegment.SegmentNormal;
                var   diffBetweenExtrusion           = (extrudedFromNextNormal - extrudedFromPreviousNormal).magnitude;
                var   minNeighbouringSegmentDistance = Mathf.Min(previousLinePointAndForwardSegment.SegmentLength, linePointAndForwardSegment.SegmentLength);
                float absExtrusionAmount             = Mathf.Abs(extrusionAmount);
                var   comparisonDistance             = Mathf.Min(minNeighbouringSegmentDistance, absExtrusionAmount);

                var angleBetweenSegmentNormals = Mathf.Acos(Mathf.Clamp(Vector3.Dot(previousLinePointAndForwardSegment.SegmentNormal, linePointAndForwardSegment.SegmentNormal), -1f, 1f));

                int numPointsFromDistance = Mathf.CeilToInt(diffBetweenExtrusion / comparisonDistance);
                if (numPointsFromDistance <= 2)
                {
                    numPointsFromDistance++;
                }                                                           //NB Want at least the end-points, and if distance is large enough to need 2 naturally, 3 seems to looks better.
                int numPointsFromAngle = Mathf.CeilToInt(angleBetweenSegmentNormals / _convexExtrusionMinimumAngleRadians);
                int numPoints          = Mathf.Max(numPointsFromDistance, numPointsFromAngle);

                for (int i = 0; i < numPoints; i++)
                {
                    float fraction       = numPoints == 1 ? 0.5f : i / (numPoints - 1.0f);
                    var   averageTangent = previousLinePointAndForwardSegment.SegmentTangent.AverageDirectionVector(linePointAndForwardSegment.SegmentTangent, fraction);
                    var   averageNormal  = NormalUtil.NormalFromTangent(averageTangent);
                    var   extrudedVector = linePointAndForwardSegment.Point + averageNormal * extrusionAmount;
                    var   parameter      = parameterRangeToUse.FromFractionUnclamped(fraction);

                    Vector2 newUV = GetUVParameterOfFanPoint(linePointAndForwardSegment, previousLinePointAndForwardSegment, nextLinePoint, absExtrusionAmount, angleBetweenSegmentNormals, fraction);

                    var newLinePointInFan = new LinePointUV(parameter, extrudedVector, newUV);
                    extrudedLinePoints.Add(new ExtrudedPointUV(newLinePointInFan, lineSegmentIndexToAssign, lineSegmentIndexToAssign - 1));
                }
            }
        }
Exemplo n.º 3
0
        private BlockFacing(string code, byte flag, int index, int oppositeIndex, int horizontalAngleIndex, Vec3i facingVector, Vec3f planeCenter, EnumAxis axis, Cuboidf plane)
        {
            this.index                = index;
            this.meshDataIndex        = (byte)(index + 1);
            this.horizontalAngleIndex = horizontalAngleIndex;
            this.flag          = flag;
            this.code          = code;
            this.oppositeIndex = oppositeIndex;
            this.normali       = facingVector;
            this.normalf       = new Vec3f(facingVector.X, facingVector.Y, facingVector.Z);
            this.normald       = new Vec3d((double)facingVector.X, (double)facingVector.Y, (double)facingVector.Z);
            this.plane         = plane;

            normalPacked = NormalUtil.PackNormal(normalf.X, normalf.Y, normalf.Z);
            normalb      = (byte)(
                (axis == EnumAxis.Z ? 1 : 0) << 0
                    | (facingVector.Z < 0 ? 1 : 0) << 1

                    | (axis == EnumAxis.Y ? 1 : 0) << 2
                    | (facingVector.Y < 0 ? 1 : 0) << 3

                    | (axis == EnumAxis.X ? 1 : 0) << 4
                    | (facingVector.X < 0 ? 1 : 0) << 5
                );

            normalPackedFlags = VertexFlags.PackNormal(normalf);

            this.planeCenter = planeCenter;
            this.axis        = axis;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 厨师注册
        /// </summary>
        /// <param name="Param"></param>
        /// <returns></returns>
        public string RegistCookAccount(RequestCookInfo Param)
        {
            Param.IsVip = false;
            CookVip        vip    = Param.MapToEntity <CookVip>();
            CookRoleAuthor author = Kily.Set <CookRoleAuthor>().Where(t => t.IsDelete == false).Where(t => t.AuthorName.Contains("基本")).FirstOrDefault();

            vip.RoleId = author.Id;
            if (NormalUtil.CheckStringChineseUn(vip.Account))
            {
                return("账号不能包含中文和特殊字符");
            }
            return(Insert <CookVip>(vip) ? ServiceMessage.INSERTSUCCESS : ServiceMessage.INSERTFAIL);
        }
Exemplo n.º 5
0
    /// <summary>
    /// 生成输出的json数据
    /// </summary>
    /// <param name="username"></param>
    /// <param name="password"></param>
    /// <returns></returns>
    public static string getLoginUserCommon(string username, string password)
    {
        UserManager user = new UserManager();
        string      json = "";
        string      data = NormalUtil.Obj2Json <List <UserModel> >(user.getLoginUser(username, password));

        if (data != null && !data.Equals(""))
        {
            json = "{" + "\"code\"" + ":" + 200 + "," + "\"message\"" + ":" + "\"success\"" + "," + "\"user\"" + ":" + data + "}";
            return(json);
        }
        else
        {
            json = "{" + "\"code\"" + ":" + 0 + "," + "\"message\"" + ":" + "\"error\"" + "}";
            return(json);
        }
    }