/// <summary> /// بررسی و مقداردهی مدیر از روی شناسه کاربری /// </summary> /// <returns></returns> private bool InitManager() { if (manager == null) { if (Utility.IsEmpty(this.Username)) { this.Username = Security.BUser.CurrentUser.UserName; } BManager businessManager = new BManager(); manager = businessManager.GetManagerByUsername(this.Username); } if (manager.ID == 0)// جانشین { SubstituteRepository subRep = new SubstituteRepository(false); if (subRep.IsSubstitute(Security.BUser.CurrentUser.Person.ID)) { IList <Substitute> sub = subRep.GetSubstitute(Security.BUser.CurrentUser.Person.ID); manager = sub.First().Manager; } } if (manager.ID > 0) { return(true); } return(false); }
private void Awake() { bStateMachineC = GetComponent <BStateMachineC>(); bNavMeshC = GetComponent <BNavMeshC>(); bManager = GetComponent <BManager>(); attacking = false; }
public override void CleanUp() { ChangedBattleManagerEvent -= OnBattleChanged; if (Balloon != null) { Balloon.HealthStateChangedEvent -= OnBalloonHealthStateChanged; //Remove the balloon from battle if it's not dead if (Balloon.IsDead == false) { //Remove the balloon from the SkyGuy's current battle if (IsInBattle == true) { BManager.RemoveEntity(Balloon, true); } //Kill off the balloon Balloon.Die(); } Balloon = null; } base.CleanUp(); WingedBehavior?.CleanUp(); }
private void Initialize() { //Add all entities, then call the checker BManager.GetAllBattleEntities(NonLightSources, null); CheckUpdates(); RecalculateTargets(); }
private void Awake() { manager = FindObjectOfType <BManager>(); rg2d = GetComponent <Rigidbody2D>(); rg2d.bodyType = RigidbodyType2D.Static; bulletHealth = startBulletHealth; }
public override void OnEnteredBattle() { base.OnEnteredBattle(); //Add the Balloon to the current battle BManager.AddEntity(Balloon, null); Balloon.Position = Position + new Vector2(2, -40); Balloon.SetBattlePosition(Balloon.Position); }
private void Initialize() { //Add all existing entities BManager.GetAllBattleEntities(NoHPEntities, null); CheckShowEntityHP(); Texture2D battleGFX = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png"); HPBar = new CroppedTexture2D(battleGFX, new Rectangle(513, 275, 38, 13)); HPBarFill = new CroppedTexture2D(battleGFX, new Rectangle(516, 292, 1, 8)); HPTextOffset = HPBar.WidthHeightToVector2(); }
/// <summary> /// Moving the ghost piece to the bottom of the play area /// </summary> private void GhostPieceIndicator() { // resetting basic position GhostPiece.transform.position = transform.position; while (true) { GhostPiece.transform.position -= Vector3.up; if (!BManager.ValidatePosition(GhostPiece)) { GhostPiece.transform.position += Vector3.up; break; } } }
/// <summary> /// Lock the tetrimino into place, preventing any further actions. /// </summary> private void LockTetrimino() { StopAllCoroutines(); // remove tetrimino from player reference PController.CurrentTetrimino = null; // remove ghost piece. Destroy(GhostPiece); // mark final positions of tetrimino pieces BManager.MarkPosition(gameObject, true); // clear tetriminos if full lines exist BManager.ClearTetriminos(gameObject); // spawn new tetrimino TManager.SpawnTetrimino(null); // allow hold action PController.CanHold = true; }
/// <summary> /// USING SRS ROTATION SYSTEM || https://harddrop.com/wiki/SRS /// rotate the tetrimino left or right /// </summary> /// <param name="direction">-90 = left, 90 = right</param> public void Rotate(Vector3 rotation) { // rotate tetrimino transform.eulerAngles += rotation; // Check if the new position is clear bool isClear = BManager.ValidatePosition(gameObject); // try wall kicks if not clear if (!isClear) { isClear = WallKick(rotation); } // if rotation was successful if (isClear) { // adjust rotation marker if (rotation.z == -90) { currentRotation++; if (currentRotation > 3) { currentRotation = 0; } } else { currentRotation--; if (currentRotation < 0) { currentRotation = 3; } } GhostPieceIndicator(); hasMoved = true; } // if rotation was unsuccessful else { // revert rotation transform.eulerAngles -= rotation; } }
/// <summary> /// Move the tetrimino to a new position /// </summary> /// <param name="direction">The direction to move the tetrimino</param> /// <returns>True is movement is successful</returns> public bool Move(Vector3 direction) { // move tetrimino transform.position += direction; // Check if the position is clear if (!BManager.ValidatePosition(gameObject)) { // revert movement transform.position -= direction; return(false); } GhostPieceIndicator(); hasMoved = true; return(true); }
/// <summary> /// اعتبارسنجی عملیات حذف /// </summary> /// <param name="organizationUnit">پست سازمانی</param> protected override void DeleteValidate(OrganizationUnit organizationUnit) { if (organizationUnitRepository.IsRoot(organizationUnit.ID)) { UIValidationExceptions exception = new UIValidationExceptions(); exception.Add(ExceptionResourceKeys.OrganizationUnitRootDeleteIllegal, "ریشه چارت سازمانی نباید حذف شود", ExceptionSrc); throw exception; } if (organizationUnitRepository.HasPerson(organizationUnit.ID)) { UIValidationExceptions exception = new UIValidationExceptions(); exception.Add(ExceptionResourceKeys.OrganizationUnitUsedByPerson, "این چارت به اشخاص انتساب داده شده است", ExceptionSrc); throw exception; } string id = organizationUnit.ID.ToString(); IList <OrganizationUnit> list = NHibernateSessionManager.Instance.GetSession().QueryOver <OrganizationUnit>() .Where(x => x.ParentPath.IsInsensitiveLike("," + id + ",", MatchMode.Anywhere)) .List <OrganizationUnit>(); foreach (OrganizationUnit item in list) { if (organizationUnitRepository.HasPerson(item.ID)) { UIValidationExceptions exception = new UIValidationExceptions(); exception.Add(ExceptionResourceKeys.ChildOrganizationUnitUsedByPerson, "زیر مجموعه های این چارت به اشخاص انتساب داده شده است", ExceptionSrc); throw exception; } } BManager bManager = new BManager(); if (bManager.CheckOrganizationUnitUsedInFlowAsManager(organizationUnit, true)) { UIValidationExceptions exception = new UIValidationExceptions(); exception.Add(new ValidationException(ExceptionResourceKeys.OrganizationUnitUsedInFlowAsManager, "پست سازمانی در جریان کاری بعنوان مدیر تعریف شده است", ExceptionSrc)); throw exception; } this.organizationUnitRepository.DeleteHierarchicalByParentId(organizationUnit.ID); }
public List <TreeItem> GetAllManagerDepartmentTreeByMelliCode(string code) { try { BDepartment DepartmentBusiness = new BDepartment(); BPerson PersonBusinesss = new BPerson(); BManager ManagerBusiness = new BManager(); var person = PersonBusinesss.GetByBarcode(code); if (person == null) { return(new List <TreeItem>()); } decimal managerPersonId = person.ID; var manager = ManagerBusiness.GetManager(managerPersonId); IList <Department> departments = DepartmentBusiness.GetAllManagerDepartmentTree_JustOrgan(manager.ID); var result = departments.Select(c => new TreeItem() { id = (Int32)c.ID, parent = c.ParentID.ToString(), text = c.Name }).ToList(); result[0].parent = "#"; return(result); } catch (UIValidationExceptions ex) { this.exceptionHandler.ApiHandleException("ProfileServiceProvider", ex); throw ex; } catch (Exception ex) { this.exceptionHandler.ApiHandleException("ProfileServiceProvider", ex); throw ex; } }
public override void Draw() { //Don't render the HP bars if the UI shouldn't show up if (BManager.ShouldShowPlayerTurnUI() == false) { return; } //Render the HP bars for (int i = 0; i < HPShownEntities.Count; i++) { BattleEntity entity = HPShownEntities[i]; float hpRatio = entity.CurHP / (float)entity.BattleStats.MaxHP; Vector2 fillScale = new Vector2((int)(HPBarWidth * hpRatio), 1f); Vector2 hpBarPos = Camera.Instance.SpriteToUIPos(entity.GetDrawnPosBelow(HPBarOffset)); Vector2 hpBarOrigin = HPBar.SourceRect.Value.GetCenterOrigin(); SpriteRenderer.Instance.DrawUI(HPBar.Tex, hpBarPos, HPBar.SourceRect, Color.White, hpBarOrigin, false, false, .2f, true); SpriteRenderer.Instance.DrawUI(HPBarFill.Tex, hpBarPos - hpBarOrigin + FillOffset, HPBarFill.SourceRect, Color.White, 0f, Vector2.Zero, fillScale, false, false, .21f); SpriteRenderer.Instance.DrawUIText(AssetManager.Instance.TTYDFont, entity.CurHP.ToString(), hpBarPos - hpBarOrigin + HPTextOffset, Color.White, 0f, new Vector2(1f, 0f), 1f, .2f); } }
private void Awake() { bManager = GetComponent <BManager>(); bNavMeshC = GetComponent <BNavMeshC>(); }
public override void OnPhaseEnd() { base.OnPhaseEnd(); //Create Mini-Yuxes when the phase ends (they do this before Bobbery Bombs go in the actual games) //If the Yux is immobile or dead, don't do anything if (IsDead == true || this.IsImmobile() == true) { return; } const double moveTime = 800d; //Set these destinations for all existing Mini-Yuxes //If any are created, we need to do the following: /* 1. Show them moving into the Yux * 2. Show them, along with the new Mini-Yuxes, moving into their nwe positions, coming out of the Yux */ Vector2[] posArray = null; BattleEntity[] existingMinis = null; if (NumMiniYuxes > 0 && NumMiniYuxes < MaxMiniYuxes) { //Set positions for all existing Mini-Yuxes to move into the Yux existingMinis = MiniYuxes.ToArray(); posArray = new Vector2[existingMinis.Length]; for (int i = 0; i < existingMinis.Length; i++) { posArray[i] = Position; } } //Tell if we created any Mini-Yuxes so we can rearrange their formation if so bool createdAny = false; //Create Mini-Yuxes for (int i = 0; i < MiniYuxesPerTurn; i++) { //Stop if we have the max number of Mini-Yuxes if (NumMiniYuxes >= MaxMiniYuxes) { break; } //Create a new Mini-Yux MiniYux miniYux = new MiniYux(); //Mark it as a Helper, telling that it helps the Yux miniYux.EntityProperties.AddAdditionalProperty(AdditionalProperty.HelperEntity, this); //Handle when the Mini-Yux takes damage //If it dies, we want to remove it from the list miniYux.DamageTakenEvent -= OnMiniYuxDamageTaken; miniYux.DamageTakenEvent += OnMiniYuxDamageTaken; //Set position to the center of the Yux miniYux.Position = Position; //Add the Mini-Yux to the Yux's list MiniYuxes.Add(miniYux); //Add the Mini-Yux to battle with the same BattleIndex as the Yux BManager.AddEntity(miniYux, BattleIndex); createdAny = true; } //If we created any Mini-Yuxes, set the formation and add the shield if necessary if (createdAny == true) { //Add the shield if the Yux doesn't have it if (HasShield == false) { AddRemoveShield(true); } //Queue a battle event to rearrange with after-images //This first battle event moves the previous set of Mini-Yuxes, before the additional ones were created, into the Yux //If we didn't have any Mini-Yuxes, don't do anything if (existingMinis != null) { BManager.battleEventManager.QueueBattleEvent((int)BattleGlobals.BattleEventPriorities.YuxArrange + 1, new BattleGlobals.BattleState[] { BattleGlobals.BattleState.Turn, BattleGlobals.BattleState.TurnEnd }, new MoveWithAfterImagesBattleEvent(existingMinis, posArray, moveTime, new AfterImageVFX(null, 4, 3, .5f, AfterImageVFX.AfterImageAlphaSetting.Constant, AfterImageVFX.AfterImageAnimSetting.Current), Interpolation.InterpolationTypes.QuadInOut, Interpolation.InterpolationTypes.QuadInOut)); } //Get the end position array set up for arranging all Mini-Yuxes into their new positions Vector2[] battlePosArray = new Vector2[MiniYuxes.Count]; //Get the formation Vector2[] formation = GetMiniFormation(NumMiniYuxes); for (int i = 0; i < MiniYuxes.Count; i++) { //Set each Mini-Yux's new battle position Vector2 battlePosition = BattlePosition + formation[i]; MiniYuxes[i].SetBattlePosition(battlePosition); battlePosArray[i] = battlePosition; } //Re-sort the enemy list since their positions have changed BManager.SortEntityList(EntityType); //Queue a lower-priority battle event for the Mini-Yuxes to go to their battle positions after the initial event is done //Include after-images here as well BManager.battleEventManager.QueueBattleEvent((int)BattleGlobals.BattleEventPriorities.YuxArrange, new BattleGlobals.BattleState[] { BattleGlobals.BattleState.Turn, BattleGlobals.BattleState.TurnEnd }, new MoveWithAfterImagesBattleEvent(MiniYuxes.ToArray(), battlePosArray, moveTime, new AfterImageVFX(null, 4, 3, .5f, AfterImageVFX.AfterImageAlphaSetting.Constant, AfterImageVFX.AfterImageAnimSetting.Current), Interpolation.InterpolationTypes.QuadInOut, Interpolation.InterpolationTypes.QuadInOut)); } }
public void TestSetup() { manager_testObject = new Manager(); busManager = new BManager(); userTA.InsertQuery(ADOPerson1.ID, "TestADOPerson1"); userTA.InsertQuery(ADOPerson3.ID, "TestADOPerson3"); DatabaseGateway.TA_SecurityUserDataTable userTable = new DatabaseGateway.TA_SecurityUserDataTable(); userTable = userTA.GetDataByUserName("TestADOPerson1"); ADOUser1.ID = Convert.ToInt32(userTable.Rows[0]["user_ID"]); ADOUser1.UserName = "******"; userTable = userTA.GetDataByUserName("TestADOPerson3"); ADOUser2.ID = Convert.ToInt32(userTable.Rows[0]["user_ID"]); ADOUser2.UserName = "******"; DatabaseGateway.TA_OrganizationUnitDataTable table = organTA.GetDataByParent(); ADOOrganParent.ID = Convert.ToInt32(table.Rows[0]["organ_ID"]); ADOOrganParent.CustomCode = Convert.ToString(table.Rows[0]["organ_CustomCode"]); organTA.Insert("TestLevel2_1", "0-1", ADOPerson2.ID, ADOOrganParent.ID, String.Format(",{0},", ADOOrganParent.ID)); table = organTA.GetDataByCustomCode("0-1"); ADOOrgan.ID = Convert.ToInt32(table.Rows[0]["organ_ID"]); ADOOrgan.ParentID = Convert.ToInt32(table.Rows[0]["organ_ParentID"]); ADOOrgan.Name = Convert.ToString(table.Rows[0]["organ_Name"]); ADOOrgan.CustomCode = Convert.ToString(table.Rows[0]["organ_CustomCode"]); ADOOrgan.PersonID = Convert.ToInt32(table.Rows[0]["organ_PersonID"]); organTA.Insert("TestLevel2_2", "0-2", ADOPerson1.ID, ADOOrganParent.ID, String.Format(",{0},", ADOOrganParent.ID)); table = organTA.GetDataByCustomCode("0-2"); ADOOrgan2.ID = Convert.ToInt32(table.Rows[0]["organ_ID"]); ADOOrgan2.ParentID = Convert.ToInt32(table.Rows[0]["organ_ParentID"]); ADOOrgan2.Name = Convert.ToString(table.Rows[0]["organ_Name"]); ADOOrgan2.CustomCode = Convert.ToString(table.Rows[0]["organ_CustomCode"]); ADOOrgan2.PersonID = Convert.ToInt32(table.Rows[0]["organ_PersonID"]); organTA.Insert("TestLevel2_3", "0-3", ADOPerson3.ID, ADOOrganParent.ID, String.Format(",{0},", ADOOrganParent.ID)); table = organTA.GetDataByCustomCode("0-3"); ADOOrgan3.ID = Convert.ToInt32(table.Rows[0]["organ_ID"]); ADOOrgan3.ParentID = Convert.ToInt32(table.Rows[0]["organ_ParentID"]); ADOOrgan3.Name = Convert.ToString(table.Rows[0]["organ_Name"]); ADOOrgan3.CustomCode = Convert.ToString(table.Rows[0]["organ_CustomCode"]); ADOOrgan3.PersonID = Convert.ToInt32(table.Rows[0]["organ_PersonID"]); managerTA.Insert(ADOPerson1.ID, null); managerTA.Insert(null, ADOOrgan.ID); DatasetGatewayWorkFlow.TA_ManagerDataTable managetTable = new DatasetGatewayWorkFlow.TA_ManagerDataTable(); managerTA.FillByPersonID(managetTable, ADOPerson1.ID); ADOManager1.ID = Convert.ToInt32(managetTable.Rows[0]["MasterMng_ID"]); ADOManager1.Person = ADOPerson1; managerTA.FillByOrganID(managetTable, ADOOrgan.ID); ADOManager2.ID = Convert.ToInt32(managetTable.Rows[0]["MasterMng_ID"]); ADOManager2.OrganizationUnit = ADOOrgan; accessGroupTA.Insert("AccessGroup1_2"); accessGroupTA.Insert("AccessGroup1_3"); DatasetGatewayWorkFlow.TA_PrecardAccessGroupDataTable accessTable = accessGroupTA.GetDataBy1("AccessGroup1_2"); ADOAccessGroup1.ID = Convert.ToInt32(accessTable.Rows[0][0]); ADOAccessGroup1.Name = "AccessGroup1_2"; accessTable = accessGroupTA.GetDataBy1("AccessGroup1_3"); ADOAccessGroup2.ID = Convert.ToInt32(accessTable.Rows[0][0]); ADOAccessGroup2.Name = "AccessGroup1_3"; flowTA.Insert(ADOAccessGroup1.ID, false, false, "FlowTest"); DatasetGatewayWorkFlow.TA_FlowDataTable mangTAble = flowTA.GetDataByName("FlowTest"); ADOFlow1.ID = Convert.ToInt32(mangTAble.Rows[0][0]); ADOFlow1.FlowName = "FlowTest"; ADOFlow1.ActiveFlow = false; ADOFlow1.WorkFlow = false; mangFlowTA.Insert(ADOManager2.ID, 1, ADOFlow1.ID, true); mangFlowTA.Insert(ADOManager1.ID, 2, ADOFlow1.ID, true); undermanagmentTA.Insert(ADOFlow1.ID, ADOPerson3.ID, ADODepartment1.ID, false, true); undermanagmentTA.Insert(ADOFlow1.ID, ADOPerson5.ID, ADODepartment2.ID, false, false); dataAccessMngTA.Insert(BUser.CurrentUser.ID, ADOManager1.ID, false); dataAccessMngTA.Insert(BUser.CurrentUser.ID, ADOManager2.ID, false); }
private IList <RoleCustomCodeType> GetCurrentUserBusinessRole() { try { IList <RoleCustomCodeType> roles = new List <RoleCustomCodeType>(); if (!SessionHelper.HasSessionValue(SessionHelper.GTSCurrentUserManagmentState)) { bool isManager = new BManager().GetManager(personId).ID > 0 ? true : false; bool isSubstitute = new BSubstitute().GetSubstituteManager(personId) > 0 ? true : false; bool isOperator = new BOperator().IsOperator(); Dictionary <string, object> ManagementState = new Dictionary <string, object>(); if (isManager) { Role role = new BRole().GetRoleByCode(RoleCustomCodeType.Manager); if (role != null) { ManagementState.Add("ManagerRoleId", role.ID); } } if (isOperator) { Role role = new BRole().GetRoleByCode(RoleCustomCodeType.Operator); if (role != null) { ManagementState.Add("OperatorRoleId", role.ID); } } if (isSubstitute) { Role role = new BRole().GetRoleByCode(RoleCustomCodeType.Substitute); if (role != null) { ManagementState.Add("SubstituteRoleId", role.ID); } } ManagementState.Add("IsManager", isManager); ManagementState.Add("IsOperator", isOperator); ManagementState.Add("IsSubstitute", isSubstitute); SessionHelper.SaveSessionValue(SessionHelper.GTSCurrentUserManagmentState, ManagementState); } Dictionary <string, object> managementState = (Dictionary <string, object>)SessionHelper.GetSessionValue(SessionHelper.GTSCurrentUserManagmentState); if (Utility.ToBoolean(managementState["IsManager"])) { roles.Add(RoleCustomCodeType.Manager); } if (Utility.ToBoolean(managementState["IsOperator"])) { roles.Add(RoleCustomCodeType.Operator); } if (Utility.ToBoolean(managementState["IsSubstitute"])) { roles.Add(RoleCustomCodeType.Substitute); } return(roles); } catch (Exception ex) { BaseBusiness <GTS.Clock.Model.Entity> .LogException(ex); throw ex; } }
void Start() { bManager = GetComponent <BManager>(); }
/// <summary> /// Kicking tetriminos off of walls. /// </summary> /// <returns>True if the kick is successful</returns> private bool WallKick(Vector3 rotation) { int wallkickIndex = -1; if (currentRotation == 0) { if (rotation.z == -90) { wallkickIndex = 0; } else { wallkickIndex = 7; } } else if (currentRotation == 1) { if (rotation.z == -90) { wallkickIndex = 2; } else { wallkickIndex = 1; } } else if (currentRotation == 2) { if (rotation.z == -90) { wallkickIndex = 4; } else { wallkickIndex = 3; } } else if (currentRotation == 3) { if (rotation.z == -90) { wallkickIndex = 6; } else { wallkickIndex = 5; } } Vector2 startPos = transform.position; // selecting the proper array for the tetrimino Vector2[,] usedArray = wallkickArray; if (shape == 0) { usedArray = wallkickArrayI; } for (int i = 0; i < 4; i++) { // Based on current rotation, move to new position transform.position += (Vector3)usedArray[wallkickIndex, i]; // complete movement if position is clear if (BManager.ValidatePosition(gameObject)) { return(true); } } // reset position transform.position = startPos; return(false); }