public void JumpSwitchCheckerboard(ERoleType Rtype, ECheckerboardType Ctype, Action Callback) { Transform[] pathTrans = new Transform[2]; switch (Ctype) { case ECheckerboardType.eNormal: GameApp.Instance.SoundInstance.PlayBgm("BGM_MainGame_Normal"); pathTrans[0] = BossSquaresLst[GetSchedule()].transform; pathTrans[1] = NormalSquaresLst[0].transform; break; case ECheckerboardType.eBoss: GameApp.Instance.SoundInstance.PlayBgm("BGM_MainGame_Boss"); pathTrans[0] = NormalSquaresLst[GetSchedule()].transform; pathTrans[1] = BossSquaresLst[0].transform; break; } CurCheckerboardType[(int)Rtype] = Ctype; ChangeSchedule(0); JumpOverCallback = Callback; StartCoroutine(Teleport(pathTrans, Callback)); }
// --------------------------------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Returns a role link with the supplied role type or the first participant. /// </summary> public LinkRoleDefinition GetLinkForRole(ERoleType RoleType) { if (this.IsDirectional && RoleType == ERoleType.Target) { return(this.TargetLinkRoleDef); } return(this.OriginOrParticipantLinkRoleDef); }
public void Move(ERoleType _type, int _num, Action _end) { if (!EnableMove) { return; } CurRoleType = _type; ECheckerboardType cType = CurCheckerboardType[(int)CurRoleType]; MoveEndCB = _end; EnableMove = false; if (_num > 0) { switch (cType) { case ECheckerboardType.eNormal: Advance(_num); break; case ECheckerboardType.eBoss: AdvanceOnBossCheckerboard(_num); break; } } else if (_num < 0) { switch (cType) { case ECheckerboardType.eNormal: Retreat(_num); break; case ECheckerboardType.eBoss: break; } } else { EnableMove = true; if (MoveEndCB != null) { MoveEndCB(); MoveEndCB = null; } } }
public static string GetRoleAnimPath(ERoleType type, string animName) { StringBuilder sb = new StringBuilder(AssetPath.GetAssetStorePathWithSlash() + "Characters/animation/"); switch(type) { case ERoleType.UserL: sb.Append("user_l"); break; case ERoleType.UserM: sb.Append("user_m"); break; case ERoleType.UserX: sb.Append("user_x"); break; default: sb.Append("user_x"); break; } sb.Append("/"); sb.Append(animName); sb.Append(".unity3d"); return sb.ToString(); }
public async Task <ServiceResult <PostLongDto> > VoteOnPostAsync(int postId, EPostVoteType postVoteType, int userId, ERoleType userRole) { var post = await _unitOfWork.PostRepository .GetSingleAsync(p => p.Id == postId, p => p.User, p => p.Files, p => p.Votes, p => p.Group, p => p.Answers); var existingVote = await _unitOfWork.PostVoteRepository .GetSingleAsync(p => p.UserId == userId && p.PostId == postId); var validationResult = await PerformVoteRequestValidationAsync(post, userId, userRole, existingVote, postVoteType); if (!validationResult.IsSuccess) { return(validationResult); } var postVote = new PostVote() { Post = post, UserId = userId, VoteTypeId = (int)postVoteType }; post.VotesCount = CountNewVotes(postVoteType, post.VotesCount, existingVote); await _unitOfWork.PostVoteRepository.AddAsync(postVote); if (existingVote != null) { _unitOfWork.PostVoteRepository.Delete(existingVote); } post.User.CurrencyCount = CountUserCurrencyCount(postVoteType, post.User.CurrencyCount); await _unitOfWork.CommitAsync(); var postDto = _mapper.Map <Post, PostLongDto>(post); postDto.UserVoteType = postVoteType; return(ServiceResult <PostLongDto> .Ok(postDto)); }
public Vector3 GetToSidePos(ERoleType type, Transform grid = null) { /*float offect = 0.4f; * Square s = (grid == null ? RecordLocationGrid : grid).GetComponent<Square>(); * switch (s.GridDirType) * { * case EGridDirType.eZ_Positive: * switch (type) * { * case ERoleType.eProtagonist: * return new Vector3(offect, 0, 0); * case ERoleType.eOpponent: * return new Vector3(-offect, 0, 0); * } * break; * case EGridDirType.eZ_Negative: * switch (type) * { * case ERoleType.eProtagonist: * return new Vector3(-offect, 0, 0); * case ERoleType.eOpponent: * return new Vector3(offect, 0, 0); * } * break; * case EGridDirType.eX_Positive: * switch (type) * { * case ERoleType.eProtagonist: * return new Vector3(0, 0, -offect); * case ERoleType.eOpponent: * return new Vector3(0, 0, offect); * } * break; * case EGridDirType.eX_Negative: * switch (type) * { * case ERoleType.eProtagonist: * return new Vector3(0, 0, offect); * case ERoleType.eOpponent: * return new Vector3(0, 0, -offect); * } * break; * }*/ return(Vector3.zero); }
//Alt.: public static readonly IEnumerable<Tuple<ERoleType, string, string>> LinkRoleTypes = null; /// <summary> /// Constructor for a previously existing Relationship Definition. /// </summary> /// <param name="OwnerRelationshipDef">Relationship Definition owning this link-role def.</param> /// <param name="RoleType">Type of the relationship link-role definition.</param> /// <param name="Name">Name of the link-role definition.</param> /// <param name="TechName">Technical Name of the link-role definition.</param> /// <param name="Summary">Summary of the link-role definition.</param> /// <param name="Pictogram">Image representing the link-role definition.</param> /// <param name="AllowedVariants">Allowed link-role variants of the link-role definition.</param> public LinkRoleDefinition(RelationshipDefinition OwnerRelationshipDef, ERoleType RoleType, string Name, string TechName, string Summary = "", ImageSource Pictogram = null, params SimplePresentationElement[] AllowedVariants) : base(Name, TechName, Summary, Pictogram) { this.OwnerRelationshipDef = OwnerRelationshipDef; // Can be null this.RoleType = RoleType; this.AllowedVariants = new EditableList <SimplePresentationElement>(__AllowedVariants.TechName, this); if (AllowedVariants != null && AllowedVariants.Length > 0) { this.AllowedVariants.AddRange(AllowedVariants); } /*T this.AllowedVariants.CollectionChanged += ((sdr, args) => * { * if (!args.Action.IsOneOf(System.Collections.Specialized.NotifyCollectionChangedAction.Remove, * System.Collections.Specialized.NotifyCollectionChangedAction.Reset)) * return; * * Console.WriteLine("Deleting Variant."); * }); */ this.PropertyChanged += ((sender, args) => { if (args.PropertyName != __OwnerRelationshipDef.TechName || this.OwnerRelationshipDef == null || this.AllowedVariants.Count > 0) { return; } var Variant = this.OwnerRelationshipDef.OwnerDomain.LinkRoleVariants.FirstOrDefault(); if (Variant != null) { this.AllowedVariants.Add(Variant); } }); this.AssociableIdeaDefs = new EditableList <IdeaDefinition>(__AssociableIdeaDefs.TechName, this); }
/// <summary> /// Constructor for a not-created-yet Relationship Definition. /// </summary> /// <param name="RoleType">Type of the relationship link-role definition.</param> /// <param name="Name">Name of the link-role definition.</param> /// <param name="TechName">Technical Name of the link-role definition.</param> /// <param name="Summary">Summary of the link-role definition.</param> /// <param name="Pictogram">Image representing the link-role definition.</param> /// <param name="AllowedVariants">Allowed link-role variants of the link-role definition.</param> public LinkRoleDefinition(ERoleType RoleType, string Name, string TechName, string Summary = "", ImageSource Pictogram = null, params SimplePresentationElement[] AllowedVariants) : this(null, RoleType, Name, TechName, Summary, Pictogram, AllowedVariants) { }
public void UpdateRole(ERoleType role) { Role = role; }
public BaseObject(uint objectKey) { this.m_objectKey = objectKey; this.m_roleType = ERoleType.None; this.m_flag = EFlag.None; }
/*protected virtual void Update() * { * * }*/ /*protected void SetInitPos(ERoleType type) * { * switch (type) * { * case ERoleType.eProtagonist: * //transform.localPosition = new Vector3(-0.6f, 0, -1); * break; * case ERoleType.eOpponent: * //transform.localPosition = new Vector3(-1.6f, 0, -1); * break; * } * }*/ public void ToSide(ERoleType type) { transform.localPosition += GetToSidePos(type); }
private async Task <ServiceResult <PostLongDto> > PerformVoteRequestValidationAsync(Post post, int userId, ERoleType userRole, PostVote existingVote, EPostVoteType newPostVoteType) { ServiceResult <PostLongDto> validationResult = null; if (post == null) { validationResult = ServiceResult <PostLongDto> .Fail(EOperationResult.EntityNotFound, "Post not found"); } var isUserUnlockedPost = await _unitOfWork.UserAvailablePostRepository.AnyAsync(up => up.UserId == userId && up.PostId == post.Id); if (!isUserUnlockedPost && userRole != ERoleType.Admin) { validationResult = ServiceResult <PostLongDto> .Fail(EOperationResult.ValidationError, "You need to unlock the post before voting"); } if (existingVote?.VoteTypeId == (int)newPostVoteType) { validationResult = ServiceResult <PostLongDto> .Fail(EOperationResult.AlreadyExist, "You already voted on this post"); } return(validationResult ?? (validationResult = ServiceResult <PostLongDto> .Ok())); }
public async Task <ServiceResult <PostLongDto> > GetPostFullInfoAsync(int postId, int userId, ERoleType roleType) { Post post = await _unitOfWork.PostRepository.GetSingleAsync(p => p.Id == postId, p => p.Files, p => p.Votes, p => p.Group, p => p.Answers); post.LastVisit = _dateHelper.GetDateTimeUtcNow(); var postVoteType = (EPostVoteType?)post.Votes.FirstOrDefault(v => v.UserId == userId)?.VoteTypeId ?? EPostVoteType.None; if (roleType == ERoleType.Student) { bool isPostAvailable = await _unitOfWork.UserAvailablePostRepository.AnyAsync(up => up.UserId == userId && up.PostId == postId); if (!isPostAvailable) { return(ServiceResult <PostLongDto> .Fail(EOperationResult.ValidationError, "You need to unlock the post first!")); } } var postDto = _mapper.Map <Post, PostLongDto>(post); postDto.UserVoteType = postVoteType; await _unitOfWork.CommitAsync(); return(ServiceResult <PostLongDto> .Ok(postDto)); }
/// <summary> /// Sets link href's according to the role with which /// user is logged in. /// </summary> /// <param name="userrole"></param> public void SetLinks(ERoleType userrole) { pFranchiseeNameHeader.Visible = false; }
public void SwitchCamFocus(ERoleType type) { CameraControl.CamTarget.Target = TypeToTargetDic[(int)type].transform; }