示例#1
0
 public ActionResult Add()
 {
     try
     {
         UserProfile _UserProfile = new UserProfile
         {
             Id = ToolMethod.GetGuid(),
             //Role = UserProfile.EnumAccountType.User,
             LoginName = "*****@*****.**",
             NickName  = "Dipa666",
             Phone     = "13520387252",
             Password  = FormsAuthentication.HashPasswordForStoringInConfigFile("123456", "MD5"),
             FirstName = "Sun",
             LastName  = "Dapeng",
             Sex       = UserProfile.EnumSexType.Male,
             SysStatus = UserProfile.EnumSysType.正常,
             CDate     = DateTime.Now,
             LastDate  = DateTime.Now
         };
         if (_Bll.Add(_UserProfile))
         {
             return(Json(new { Success = true, Message = "添加成功!", SuccessModel = _UserProfile }));
         }
         else
         {
             return(Json(new { Success = true, Message = "添加失败!", SuccessModel = "" }));
         }
     }
     catch (Exception ee)
     {
         return(Json(new { Success = false, Message = "添加异常!", SuccessModel = ee }));
     }
 }
示例#2
0
        /// <summary>
        /// 从缓存中权限列表 未命中 则读取数据库存放至缓存
        /// </summary>
        /// <param name="IsCache">是否从缓存中读取数据</param>
        /// <returns></returns>
        public List <PermissionInfo> GetAll(bool IsCache)
        {
            string PermissionKey        = "PermissionList";
            string PermissionListString = string.Empty;

            //IsCache
            //false  重新读取数据
            //true   从缓存中读取数据
            if (!IsCache)
            {
                RedisHelper.CommonRemove("PermissionList");
            }

            PermissionListString = RedisHelper.ItemGet <string>(PermissionKey);
            if (PermissionListString != null)
            {
                return(JsonHelper.DeserializeJsonToList <PermissionInfo>(PermissionListString));
            }
            else
            {
                List <PermissionInfo> _permissionInfoList = _PermissionInfoDal.GetAll();
                if (_permissionInfoList.Count > 0)
                {
                    PermissionListString = JsonHelper.SerializeObject(_permissionInfoList);
                    RedisHelper.ItemSet <string>(PermissionKey, PermissionListString);
                    RedisHelper.CommonSetExpire(PermissionKey, ToolMethod.GetNow().AddDays(1));
                }
                return(_permissionInfoList);
            }
        }
示例#3
0
    public override void InitData()
    {
        type = ShapeType.rect;

        halfWidth  = ToolMethod.Config2Logic(halfWidthCon);
        halfHeight = ToolMethod.Config2Logic(halfHeightCon);
    }
示例#4
0
        public ActionResult UpdateBlogs(FormCollection fc)
        {
            #region 验证用户信息
            string _SessionId       = HttpContext.Request.Cookies["SessionId"].Value;
            string _UserProfileJson = RedisHelper.ItemGet <string>(_SessionId);
            #endregion

            var _Content = fc["editor"];
            var _BlogsId = fc["BlogsId"];

            if (!string.IsNullOrEmpty(_UserProfileJson))
            {
                UserProfile _UserProfile = ToolMethod.GetUerProfile(_UserProfileJson);
                BlogsInfo   _BlogsInfo   = _IBlogsInfoBLL.GetModels(x => x.Id == _BlogsId && x.Delflag == EnumType.DelflagType.正常, true, null, "BlogsInfo").FirstOrDefault();
                _BlogsInfo.BlogContent = _Content;
                _BlogsInfo.UDate       = ToolMethod.GetNow();

                RedisHelper.HashSet <BlogsInfo>("BlogsInfo", _BlogsId, _BlogsInfo);

                BackgroundJobClient _Job = new BackgroundJobClient();
                _Job.Enqueue(() => _IBlogsInfoBLL.Update(_BlogsInfo));

                return(Json(new { Success = true, SuccessModel = "修改博客成功!" }));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
示例#5
0
    public override void InitData()
    {
        type      = ShapeType.arc;
        arcRadius = ToolMethod.Config2Logic(arcRadiusCon);

        arcCenter = ToolGameVector.ChangeGameVectorConToGameVector2(arcCenterCon) + basePosition;
    }
示例#6
0
        /// <summary>
        /// 从缓存中角色列表 未命中 则读取数据库存放至缓存
        /// </summary>
        /// <param name="IsCache">是否从缓存中读取数据</param>
        /// <returns></returns>
        public List <RoleInfo> GetAll(bool IsCache)
        {
            string RoleKey        = "RoleList";
            string RoleListString = string.Empty;

            //IsCache
            //false  重新读取数据
            //true   从缓存中读取数据
            if (!IsCache)
            {
                RedisHelper.CommonRemove("RoleList");
            }

            RoleListString = RedisHelper.ItemGet <string>(RoleKey);
            if (RoleListString != null)
            {
                return(JsonHelper.DeserializeJsonToList <RoleInfo>(RoleListString));
            }
            else
            {
                //List<RoleInfo> _roleInfoList = _roleInfoDal.GetAll();
                List <RoleInfo> _roleInfoList = null;

                if (_roleInfoList.Count > 0)
                {
                    RoleListString = JsonHelper.SerializeObject(_roleInfoList);
                    RedisHelper.ItemSet <string>(RoleKey, RoleListString);
                    RedisHelper.CommonSetExpire(RoleKey, ToolMethod.GetNow().AddDays(1));
                }
                return(_roleInfoList);
            }
        }
示例#7
0
    void OnDrawGizmos()
    {
        if (closeLine)
        {
            return;
        }
        Gizmos.color = lineColor;

        if (Application.isPlaying)
        {
            Gizmos.DrawWireSphere(ToolGameVector.ChangeGameVectorToVector3(basePosition), ToolMethod.Config2Render(baseRadiusCon));
        }
        else
        {
            Gizmos.DrawWireSphere(ToolGameVector.ChangeGameVectorConToVector3(baseCenter), ToolMethod.Config2Render(baseRadiusCon));
        }

        if (fixPosition)
        {
            int _posX = (int)ToolMethod.Render2Config(transform.position.x) + 25;
            int _posY = (int)ToolMethod.Render2Config(transform.position.z) + 25;

            _posX = _posX - _posX % 50;
            _posY = _posY - _posY % 50;

            baseCenter.x = _posX;
            baseCenter.y = _posY;

            transform.position = ToolGameVector.ChangeGameVectorConToVector3(baseCenter);

            fixPosition = false;
        }
    }
示例#8
0
    public virtual void Logic_NormalAttack()
    {
        curAttackTime = attackTime;

        GameVector2 _bulletPos = objShape.GetPosition() + ToolMethod.Logic2Config(objShape.GetRadius()) * BattleData.Instance.GetSpeed(roleDirection);

        BattleCon.Instance.bulletManage.AddBullet(objShape.ObjUid.objectID, _bulletPos, roleDirection);
    }
示例#9
0
    public void InitSelf(ObjectType _objType, int _objID)
    {
        isInDestory = false;
        objUid      = new ObjectUid(_objType, _objID);

        basePosition = ToolGameVector.ChangeGameVectorConToGameVector2(baseCenter);
        baseRadius   = ToolMethod.Config2Logic(baseRadiusCon);
        InitData();
    }
示例#10
0
        public ActionResult AjaxFileUpload()
        {
            #region 验证用户信息
            string _SessionId       = HttpContext.Request.Cookies["SessionId"].Value;
            string _UserProfileJson = RedisHelper.ItemGet <string>(_SessionId);
            #endregion

            if (!string.IsNullOrEmpty(_UserProfileJson))
            {
                UserProfile _UserProfile = ToolMethod.GetUerProfile(_UserProfileJson);

                HttpFileCollection _Files = System.Web.HttpContext.Current.Request.Files;

                string _DateTimePath = ToolMethod.GetDateTimePath();
                string _PhysicalPath = ToolMethod.GetBlogsSurfacePlot_PhysicalPath(_DateTimePath);
                string _VirualPath   = ToolMethod.GetBlogsSurfacePlot_VirualPath(_DateTimePath);

                if (!Directory.Exists(_PhysicalPath))
                {
                    Directory.CreateDirectory(_PhysicalPath);
                }

                string _FileName         = _Files[0].FileName;
                string _StrFile          = System.DateTime.Now.ToString("yyyyMMddHHmmssms");
                string _FilePhysicalPath = _PhysicalPath + _StrFile + "_" + _FileName;
                string _FileVirualPath   = _VirualPath + _StrFile + "_" + _FileName;
                long   _FileSize         = _Files[0].ContentLength;
                //获取文件后缀
                string _FileType = _FileName.Substring(_FileName.LastIndexOf(@"."), _FileName.Length - _FileName.LastIndexOf(@"."));
                //保存文件
                _Files[0].SaveAs(_FilePhysicalPath);

                string    _FileId    = ToolMethod.GetGuid();
                ImageInfo _ImageInfo = new ImageInfo
                {
                    Id           = _FileId,
                    CDate        = ToolMethod.GetNow(),
                    Delflag      = EnumType.DelflagType.正常,
                    AccountId    = _UserProfile.Id,
                    AccountName  = _UserProfile.LoginName,
                    FileName     = _FileName,
                    FileSize     = _FileSize,
                    RelativePath = _StrFile + "_" + _FileName,
                    FileType     = _FileType
                };

                //保存文件集合
                _IImageInfoBLL.Add(_ImageInfo);

                return(Json(new { FileId = _FileId, FileName = _FileName, PhysicalPath = _FilePhysicalPath, VirualPath = _FileVirualPath }));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
示例#11
0
文件: Canvas.cs 项目: Yinigma/cliMate
        private void toolTypeRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            //Switch tools
            RadioButton button = (RadioButton)sender;

            if (button.Checked)
            {
                currentTool = toolButtonMap[button];
            }
        }
示例#12
0
        public ActionResult AddBlogs(FormCollection fc)
        {
            #region 验证用户信息
            string _SessionId       = HttpContext.Request.Cookies["SessionId"].Value;
            string _UserProfileJson = RedisHelper.ItemGet <string>(_SessionId);
            #endregion

            if (!string.IsNullOrEmpty(_UserProfileJson))
            {
                UserProfile _UserProfile = ToolMethod.GetUerProfile(_UserProfileJson);

                //获取标题
                var _BlogsHeading = fc["BlogsHeading"];
                //获取副标题
                string _BlogsSubHeading = fc["BlogsSubHeading"];
                //获取简介
                var _BlogsAbstract = fc["BlogsAbstract"];
                //获取Ueditor内容
                var _Content = fc["editor"];
                //获取封面图ID
                string _SurfacePlot = fc["SurfacePlot"];

                BlogsInfo _BlogsInfo = new BlogsInfo()
                {
                    Id               = ToolMethod.GetGuid(),
                    BlogAuthorId     = _UserProfile.Id,
                    BlogAuthorName   = _UserProfile.NickName,
                    BlogContent      = _Content,
                    BlogHeading      = _BlogsHeading,
                    BlogsSurfacePlot = _SurfacePlot,
                    BlogSubHeading   = _BlogsSubHeading,
                    CDate            = ToolMethod.GetNow(),
                    CommentNum       = 0,
                    Delflag          = EnumType.DelflagType.正常,
                    UDate            = ToolMethod.GetNow(),
                    LikeNum          = 0,
                    BlogAbstarct     = _BlogsAbstract,
                };

                RedisHelper.HashSet <BlogsInfo>("BlogsInfo", _BlogsInfo.Id, _BlogsInfo);

                BackgroundJobClient _Job = new BackgroundJobClient();
                _Job.Enqueue(() => _IBlogsInfoBLL.Add(_BlogsInfo));
            }

            return(Json(new { Success = true, SuccessModel = "添加博客成功!" }));
        }
示例#13
0
        public int GetPV(string Key)
        {
            int PVNum = 0;

            if (true)
            {
                PVNum = RedisHelper.ItemGet <int>(Key);
                if (PVNum != 0)
                {
                    return(PVNum);
                }
                else
                {
                    //读取数据库PV值
                    Statistics PVObj = _Dal.GetPV();

                    //初始值创建
                    if (PVObj != null)
                    {
                        PVNum = PVObj.PV;
                    }
                    else
                    {
                        Statistics _Statistics = new Statistics
                        {
                            Id = ToolMethod.GetGuid(),
                            PV = 0,
                            UV = 0
                        };
                        AddPV(_Statistics);
                    }

                    RedisHelper.ItemSet <int>(Key, PVNum);
                    //过期时间为1分钟
                    RedisHelper.CommonSetExpire(Key, DateTime.Now.AddMinutes(1));
                    return(PVNum);
                }
            }
            else
            {
                return(0);
            }
        }
示例#14
0
        public override void OnException(ExceptionContext filterContext)
        {
            string _ControllerName = filterContext.Controller.ToString();

            #region 记录异常日志
            if (_ControllerName != "Account")
            {
                if (filterContext.HttpContext.Request.Cookies["SessionId"] != null)
                {
                    string _SessionId       = filterContext.HttpContext.Request.Cookies["SessionId"].Value;
                    string _UserProfileJson = RedisHelper.ItemGet <string>(_SessionId);
                    if (_UserProfileJson != null)
                    {
                        //获取用户账号实体
                        _UserProfile = JsonConvert.DeserializeObject <UserProfile>(_UserProfileJson);

                        LogInfo _logInfo = new LogInfo()
                        {
                            Id      = ToolMethod.GetGuid(),
                            Content = "【请求异常】:"
                                      + "【请求路径:" + filterContext.HttpContext.Request.Path + "】"
                                      + "【请求方式:" + filterContext.HttpContext.Request.HttpMethod + "】"
                                      + "【异常内容:" + filterContext.Exception.Message.ToString() + "】",
                            AccountId   = _UserProfile.Id,
                            AccountName = _UserProfile.NickName,
                            Level       = EnumType.LogLevel.ERROR,
                            CDate       = ToolMethod.GetNow()
                        };

                        BackgroundJobClient _jobs             = new BackgroundJobClient();
                        Expression <Action> _actionExpression = () => _ILogInfoBLL.Add(_logInfo);
                        _jobs.Enqueue(_actionExpression);
                    }
                }
                else
                {
                    filterContext.HttpContext.Response.Redirect("/Account/Login?session=false");
                }
            }
            #endregion
        }
示例#15
0
        public ActionResult Update(UserProfile _UserProfile)
        {
            try
            {
                UserProfile _OldUserProfile = _Bll.Get(_UserProfile.Id);

                _OldUserProfile.Address    = _UserProfile.Address;
                _OldUserProfile.City       = _UserProfile.City;
                _OldUserProfile.Company    = _UserProfile.Company;
                _OldUserProfile.Country    = _UserProfile.Country;
                _OldUserProfile.Describe   = _UserProfile.Describe;
                _OldUserProfile.Email      = _UserProfile.Email;
                _OldUserProfile.FirstName  = _UserProfile.FirstName;
                _OldUserProfile.LastName   = _UserProfile.LastName;
                _OldUserProfile.NickName   = _UserProfile.NickName;
                _OldUserProfile.PostalCode = _UserProfile.PostalCode;
                _OldUserProfile.LastDate   = ToolMethod.GetNow();

                if (_Bll.Update(_OldUserProfile))
                {
                    string _SessionId         = Request.Cookies["sessionId"].Value;
                    string _UserProfileString = ToolMethod.GetUerProfileString(_OldUserProfile);
                    if (RedisHelper.ItemSet <string>(_SessionId, _UserProfileString))
                    {
                        return(Json(new { Success = true, Message = "修改信息成功!", SuccessModel = _UserProfile }));
                    }
                    else
                    {
                        return(Json(new { Success = true, Message = "修改信息失败!", ErrorMessage = "" }));
                    }
                }
                else
                {
                    return(Json(new { Success = true, Message = "添加失败!", ErrorMessage = "" }));
                }
            }
            catch (Exception ee)
            {
                return(Json(new { Success = false, Message = "添加异常!", ErrorMessage = ee }));
            }
        }
示例#16
0
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            #region 获取Action & Controller信息
            string _ActionName     = filterContext.ActionDescriptor.ActionName;
            string _ControllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName;
            #endregion

            #region 记录操作日志
            if (_ControllerName != "Account")
            {
                if (filterContext.HttpContext.Request.Cookies["SessionId"] != null)
                {
                    string _SessionId       = filterContext.HttpContext.Request.Cookies["SessionId"].Value;
                    string _UserProfileJson = RedisHelper.ItemGet <string>(_SessionId);
                    if (_UserProfileJson != null)
                    {
                        //获取用户账号实体
                        _UserProfile = JsonConvert.DeserializeObject <UserProfile>(_UserProfileJson);

                        LogInfo _logInfo = new LogInfo()
                        {
                            Id          = ToolMethod.GetGuid(),
                            Content     = _UserProfile.NickName + "调用了 " + _ControllerName + "Controller下的" + _ActionName + "操作",
                            AccountId   = _UserProfile.Id,
                            AccountName = _UserProfile.NickName,
                            Level       = EnumType.LogLevel.INFO,
                            CDate       = ToolMethod.GetNow()
                        };

                        BackgroundJobClient _jobs             = new BackgroundJobClient();
                        Expression <Action> _actionExpression = () => _ILogInfoBLL.Add(_logInfo);
                        _jobs.Enqueue(_actionExpression);
                    }
                }
                else
                {
                    filterContext.HttpContext.Response.Redirect("/Account/Login?session=false");
                }
            }
            #endregion
        }
示例#17
0
 public static Vector3 ChangeGameVectorToVector3(GameVector2 _vec2, float _y = 0f)
 {
     return(new Vector3(ToolMethod.Logic2Render(_vec2.x), _y, ToolMethod.Logic2Render(_vec2.y)));
 }
示例#18
0
        /// <summary>
        /// 自动装载角色权限映射关系列表
        /// </summary>
        /// <returns></returns>
        public ActionResult InstallRolePermissions()
        {
            try
            {
                //获取缓存中映射数据
                List <RolePermission> _oldRolePermissionList = _IRolePermissionBLL.GetModels(x => x.Delflag == EnumType.DelflagType.正常, true, null, "RolePermission").ToList();

                List <RoleInfo> _roleInfoList = _IRoleInfoBLL.GetModels(x => x.Delflag == EnumType.DelflagType.正常, true, null, "RoleList").ToList();

                List <PermissionInfo> _PermissionInfoList = _IPermissionInfoBLL.GetModels(x => x.Delflag == EnumType.DelflagType.正常, true, null, "PermissionList").ToList();

                //获取新的映射数据
                List <RolePermission> _newRolePermissionList = new List <RolePermission>();
                _roleInfoList.ForEach(x =>
                {
                    _PermissionInfoList.ForEach(y =>
                    {
                        RolePermission _rolePermission = new RolePermission
                        {
                            Id                    = ToolMethod.GetGuid(),
                            RoleId                = x.Id,
                            RoleName              = x.Name,
                            PermissionId          = y.Id,
                            CDate                 = ToolMethod.GetNow(),
                            Controller            = y.Controller,
                            ControllerDescription = y.ControllerDescription,
                            Action                = y.Action,
                            ActionDescription     = y.ActionDescription,
                            UsedType              = EnumType.UsedType.未启用,
                            Delflag               = EnumType.DelflagType.正常
                        };
                        _newRolePermissionList.Add(_rolePermission);
                    });
                });

                BackgroundJobClient _jobs = new BackgroundJobClient();

                //不存在映射关系
                if (_oldRolePermissionList.Count == 0)
                {
                    //直接创建映射关系
                    _newRolePermissionList.ForEach(x =>
                    {
                        //更新缓存
                        _IRolePermissionBLL.UpdateCache("RolePermission", x.Id, x);

                        //异步更新数据库
                        _jobs.Enqueue(() => _IRolePermissionBLL.Add(x));
                    });
                }
                //已存在映射关系
                else
                {
                    //对比新旧映射关系列表 不存在的删除 存在的保留
                    RolePermission_EqualityCompare _comparer   = new RolePermission_EqualityCompare();
                    List <RolePermission>          _createList = _newRolePermissionList.Except(_oldRolePermissionList, _comparer).ToList();
                    List <RolePermission>          _deleteList = _oldRolePermissionList.Except(_newRolePermissionList, _comparer).ToList();

                    _createList.ForEach(x =>
                    {
                        //更新缓存
                        _IRolePermissionBLL.UpdateCache("RolePermission", x.Id, x);

                        //异步更新数据库
                        _jobs.Enqueue(() => _IRolePermissionBLL.Add(x));
                    });

                    _deleteList.ForEach(x =>
                    {
                        x.Delflag = EnumType.DelflagType.已删除;

                        //更新缓存
                        _IRolePermissionBLL.UpdateCache("RolePermission", x.Id, x);

                        //异步更新数据库
                        _jobs.Enqueue(() => _IRolePermissionBLL.Update(x));
                    });
                }

                return(Json(new { Success = true, SuccessModel = "生成角色权限映射关系成功!" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ee)
            {
                return(Json(new { Success = false, ErrorModel = "生成角色权限映射关系失败!", ErrorMessage = ee.ToString() }, JsonRequestBehavior.AllowGet));
            }
        }
示例#19
0
 public static Vector3 ChangeGameVectorConToVector3(GameVec2Con _vec2)
 {
     return(new Vector3(ToolMethod.Config2Render(_vec2.x), 0f, ToolMethod.Config2Render(_vec2.y)));
 }
示例#20
0
        /// <summary>
        /// 自动装载权限列表
        /// </summary>
        /// <returns></returns>
        public ActionResult InstallPermissions()
        {
            try
            {
                AutoGeneraterBLL _autoGeneraterBll = new AutoGeneraterBLL();
                List <KeyValuePair <string, string> > _controllerList = _autoGeneraterBll.ControllerList();
                List <KeyValuePair <string, string> > _actionList     = new List <KeyValuePair <string, string> >();

                //获取缓存中权限数据
                List <PermissionInfo> _oldPermissionInfoList = _IPermissionInfoBLL.GetModels(x => x.Delflag == EnumType.DelflagType.正常, true, null, "PermissionList").ToList();

                //获取新的权限数据
                List <PermissionInfo> _newPermissionInfoList = new List <PermissionInfo>();
                _controllerList.ForEach(x =>
                {
                    _actionList = _autoGeneraterBll.ActionList(x.Key);
                    if (_actionList != null)
                    {
                        _actionList.ForEach(y =>
                        {
                            PermissionInfo _permissionInfo = new PermissionInfo()
                            {
                                Id                    = ToolMethod.GetGuid(),
                                Controller            = x.Key,
                                Action                = y.Key,
                                ControllerDescription = x.Value,
                                ActionDescription     = y.Value,
                                CDate                 = ToolMethod.GetNow(),
                                Delflag               = EnumType.DelflagType.正常
                            };
                            _newPermissionInfoList.Add(_permissionInfo);
                        });
                    }
                });

                BackgroundJobClient _jobs = new BackgroundJobClient();

                //不存在权限列表
                if (_oldPermissionInfoList.Count == 0)
                {
                    //直接创建映射关系
                    _newPermissionInfoList.ForEach(x =>
                    {
                        //更新缓存
                        _IPermissionInfoBLL.UpdateCache("PermissionList", x.Id, x);

                        //异步更新数据库
                        _jobs.Enqueue(() => _IPermissionInfoBLL.Add(x));
                    });
                }
                //已存在映射关系
                else
                {
                    //对比新旧映射关系列表 不存在的删除 存在的保留
                    PermissionInfo_EqualityCompare _comparer   = new PermissionInfo_EqualityCompare();
                    List <PermissionInfo>          _createList = _newPermissionInfoList.Except(_oldPermissionInfoList, _comparer).ToList();
                    List <PermissionInfo>          _deleteList = _oldPermissionInfoList.Except(_newPermissionInfoList, _comparer).ToList();

                    _createList.ForEach(x =>
                    {
                        //更新缓存
                        _IPermissionInfoBLL.UpdateCache("PermissionList", x.Id, x);

                        //异步更新数据库
                        _jobs.Enqueue(() => _IPermissionInfoBLL.Add(x));
                    });

                    _deleteList.ForEach(x =>
                    {
                        x.Delflag = EnumType.DelflagType.已删除;

                        //更新缓存
                        _IPermissionInfoBLL.UpdateCache("PermissionList", x.Id, x);

                        //异步更新数据库
                        _jobs.Enqueue(() => _IPermissionInfoBLL.Update(x));
                    });
                }


                return(Json(new { Success = true, SuccessModel = "生成项目权限列表成功!" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ee)
            {
                return(Json(new { Success = false, ErrorModel = "生成项目权限列表失败!", ErrorMessage = ee.ToString() }, JsonRequestBehavior.AllowGet));
            }
        }
示例#21
0
文件: Canvas.cs 项目: Yinigma/cliMate
 private RadioButton AddTool(string name, ToolMethod type)
 {
     //Creates a radio button for the tool
     return(AddRadioButtonOption <ToolMethod>(name, type, toolButtonMap, toolLayoutPanel, toolTypeRadioButton_CheckedChanged));
 }
示例#22
0
    void OnDrawGizmos()
    {
        if (closeLine)
        {
            return;
        }

        Vector3 _center;

        if (Application.isPlaying)
        {
            _center = ToolGameVector.ChangeGameVectorToVector3(basePosition);
        }
        else
        {
            _center = ToolGameVector.ChangeGameVectorConToVector3(baseCenter);
        }

        if (!hideCircle)
        {
            Gizmos.color = Color.blue;

            Gizmos.DrawWireSphere(_center, ToolMethod.Config2Render(baseRadiusCon));
        }


        Gizmos.color = lineColor;

        float _width = ToolMethod.Config2Render(halfWidthCon);
        float _heigh = ToolMethod.Config2Render(halfHeightCon);

        Vector3[] topVec = new Vector3[4];
        topVec [0] = _center + new Vector3(-_width, 0, -_heigh);
        topVec [1] = _center + new Vector3(-_width, 0, _heigh);
        topVec [2] = _center + new Vector3(_width, 0, _heigh);
        topVec [3] = _center + new Vector3(_width, 0, -_heigh);

        Gizmos.DrawLine(topVec[0], topVec[1]);
        Gizmos.DrawLine(topVec[1], topVec[2]);
        Gizmos.DrawLine(topVec[2], topVec[3]);
        Gizmos.DrawLine(topVec[3], topVec[0]);


        if (updateRadius)
        {
            baseRadiusCon = (int)Mathf.Sqrt(halfWidthCon * halfWidthCon + halfHeightCon * halfHeightCon) + 1;

            updateRadius = false;
        }


        if (fixPosition)
        {
            int _posX = (int)ToolMethod.Render2Config(transform.position.x) + 25;
            int _posY = (int)ToolMethod.Render2Config(transform.position.z) + 25;

            _posX = _posX - _posX % 50;
            _posY = _posY - _posY % 50;

            baseCenter.x = _posX;
            baseCenter.y = _posY;

            transform.position = ToolGameVector.ChangeGameVectorConToVector3(baseCenter);

            fixPosition = false;
        }
    }
示例#23
0
 public override void InitData()
 {
     type        = ShapeType.polygon;
     colliRadius = ToolMethod.Config2Logic(colliRadiusCon);
 }
示例#24
0
 public static GameVector2 ChangeGameVectorConToGameVector2(GameVec2Con _vec2)
 {
     return(new GameVector2(ToolMethod.Config2Logic(_vec2.x), ToolMethod.Config2Logic(_vec2.y)));
 }