/// <summary> /// Instance the grid /// </summary> /// <param name="width">width</param> /// <param name="height">height</param> /// <param name="iGraphic">Instance o type "IGraphic"</param> /// <param name="userInterface">Instance of type "IUserInterface"</param> public TetrisGridV2(int width, int height, IGraphic iGraphic, IUserParameter userParameter) { _width = width; _height = height; _graphic = iGraphic; _userParameter = userParameter; _arrayOfGridCells = new Transform[_width, _height]; }
void Start() { _userInterface = FindObjectOfType <TetrisUI>(); _userParameter = new UserParameter(_userInterface); _tetrisCollection = new TetrisCollection(Figures); _tetrisGraphic = new TetrisGraphic(); _tetrisGrid = new TetrisGrid(10, 20, _tetrisGraphic, _userParameter); _figureMovement = new FigureMovement(_tetrisGrid); _tetrisGraphic.DrawGrid(10, 20, GridCell); Speed = (Speed == 0) ? 1 : Speed; }
/// <summary> /// Executes the specified parameter. /// </summary> /// <param name="parameter">The parameter.</param> /// <returns></returns> public IUserResult Execute(IUserParameter parameter) { IUser user = parameter != null && parameter.User != null?this.UserRepository.GetByKey(parameter.User.Id) : null; string token = string.Empty; UserStatus status = user != null && user.Password.Equals(parameter.User.Password) && (token = this.BuildToken()) != null ? UserStatus.Success : UserStatus.InvalidCredentials; return(new UserResult() { Authorization = status == UserStatus.Success ? new Data.Imp.Authorization() { Token = token } : null, Status = status }); }
public static IQueryOver <T, T> ApplyUser <T>(this IQueryOver <T, T> query, IUserParameter param, ISession session, SecurityInfo securityInfo) where T : IHasUser, IHasCustomer { var dbMyProfile = session.Load <Profile>(securityInfo.SessionData.Profile.GlobalId); var dbProfile = dbMyProfile; if (param.UserId.HasValue) { dbProfile = session.Get <Profile>(param.UserId.Value); } if (param.CustomerId != null && dbProfile.GlobalId != securityInfo.SessionData.Profile.GlobalId) { throw new CrossProfileOperationException("This customer doesn't belong to your profile"); } //privacy settings have effect only for paid accounts. Free users have always public calendar if (IsPrivateCalendar(dbProfile, dbMyProfile)) { return(null); } query = query.Where(x => x.Profile == dbProfile); if (param.CustomerId.HasValue) { Customer customer = session.Get <Customer>(param.CustomerId.Value); if (customer.Profile != dbProfile) { throw new CrossProfileOperationException("This customer doesn't belong to your profile"); } query = query.Where(day => day.Customer == customer); } else { query = query.Where(day => day.Customer == null); } return(query); }
/// <summary> /// Adds parameters to the parameters panel. /// </summary> /// <param name="parameters">A list of parameters.</param> /// <param name="chooserMap">A mapping between a type to a function that instantiates a new chooser-control.</param> private void AddParameters(IUserParameter[] parameters, Dictionary<Type, Func<IParamChooser>> chooserMap) { foreach (IUserParameter p in parameters) parameterPanel.AddParameter(p.Name, chooserMap[p.Type]()); }
/// <summary> /// 根据类名称和用户标识获取参数配置内容 /// </summary> /// <param name="name">类名称</param> /// <param name="creator">用户标识</param> /// <returns></returns> public string LoadParameter(string name, string creator = null) { IUserParameter dal = baseDal as IUserParameter; return(dal.LoadParameter(name, creator)); }
/// <summary> /// 保存配置(插入或更新)到数据库 /// </summary> /// <param name="info">信息对象</param> /// <returns></returns> public bool SaveParamater(UserParameterInfo info) { IUserParameter dal = baseDal as IUserParameter; return(dal.SaveParamater(info)); }