bool PairCheck(List <CardScript> cardScript, CardRole role) { for (int i = 0; i < Const_int.MaxCard; i++) { CardIndex.Clear(); for (int j = 0; j < Const_int.MaxCard; j++) { if (cardScript[i].CardNum == cardScript[j].CardNum) { CardIndex.Add(cardScript[j].CardIndex); } } if (CardIndex.Count == 4 && role == CardRole.FourCard) { Role = CardRole.FourCard; return(true); } if (CardIndex.Count == 3 && role == CardRole.ThreeCard) { Role = CardRole.ThreeCard; return(true); } if (CardIndex.Count == 2 && role == CardRole.OnePair) { Role = CardRole.OnePair; return(true); } } return(false); }
public bool EditCardRole(CardRole p) { var entity = new TagRoleService(db).Put(p); RefreshData(); return(entity != null); }
public CGMessage SaveCardRole(CardRole inputCardRole) { CGMessage returnMessage = new(); try { CardRole cardRole = _context.CardRoles.FirstOrDefault(c => c.Id.Equals(inputCardRole.Id)); if (cardRole != null) { cardRole.Name = inputCardRole.Name; cardRole.DiceNumber = inputCardRole.DiceNumber; _context.SaveChanges(); } else { _context.CardRoles.Add(inputCardRole); _context.SaveChanges(); } return(GetCardRoles()); } catch (Exception ex) { _logger.Log(LogLevel.Error, $"SaveCardRole; Error: {ex.Message}"); } return(returnMessage); }
private void Window_Loaded(object sender, RoutedEventArgs e) { bll = AppContext.GetLocationBll(); areaService = new AreaService(bll); aarService = new AreaAuthorizationRecordService(bll); ITagRoleService service = new TagRoleService(); _roles = service.GetList(); var tree = areaService.GetTree(); TopoTreeView1.LoadData(tree, false, true); TopoTreeView1.ExpandLevel(2); DataGrid1.ItemsSource = _roles; CardRole selectedRole = _roles.Find(i => i.Id == roleId); if (selectedRole != null) { selectedRole.IsChecked = true; DataGrid1.SelectedItem = selectedRole; //CheckRoleAreas(selectedRole.Id); } }
public void GetAddLocationPerInfo(CardRole info) { EditCardRole = new CardRole(); EditCardRole = info; InputName.text = info.Name; InputDetail.text = info.Description; }
public LocationCard AddTagByPos(Position pos) { LocationCard tag = new LocationCard(); tag.Name = pos.Code; tag.Code = pos.Code; CardRole role = roles.Find(p => p.Name == "管理人员"); if (role == null) { role = roles[0]; } tag.CardRoleId = roles[0].Id; bool r1 = bll.LocationCards.Add(tag); pos.CardId = tag.Id; pos.RoleId = tag.CardRoleId;//角色 if (r1) { var person = AddPersonByTag(pos, tag); if (person != null) { pos.PersonnelID = person.Id; } } return(tag); }
private void MenuSave_Click(object sender, RoutedEventArgs e) { CardRole role = DataGrid1.SelectedItem as CardRole; if (role == null) { return; } var nodes = TopoTreeView1.GetCheckedItems(); List <int> ids = new List <int>(); foreach (var node in nodes) { var tag = node.Tag; var id = (tag as IId).Id; ids.Add(id); } var result = new LocationService().SetCardRoleAccessAreas(role.Id, ids); if (result) { MessageBox.Show("修改成功"); } else { MessageBox.Show("修改失败"); } }
public void SaverCardRoleData(Action action = null) { EditCardRole = new CardRole(); if (string.IsNullOrEmpty(InputDetail.text) || string.IsNullOrEmpty(InputName.text)) { UGUIMessageBox.Show("角色缺少必填信息,请补充完整再进行提交!", "确定", "", null, null, null); } else { EditCardRole.Name = InputName.text; EditCardRole.Description = InputDetail.text; int CardRoleId = CommunicationObject.Instance.AddCardRole(EditCardRole); EditCardRole.Id = CardRoleId; UGUIMessageBox.Show("新建角色成功!", "确定", "", () => { CloseEditRoleWindow(); }, null, null); } if (action != null) { action(); } }
/// <summary>获取卡牌</summary> /// <param name="did"></param> /// <returns></returns> public CardRole GetCardRoleByPos(bool isTeamA, int pos) { CardRole cdrole = null; if (isTeamA) { foreach (var itmA in TransformCardRoleTeamA) { if (itmA.Value.SerData.pos == pos) { cdrole = itmA.Value; break; } } } else { foreach (var itmB in TransformCardRoleTeamB) { if (itmB.Value.SerData.pos == pos) { cdrole = itmB.Value; break; } } } return(cdrole); }
public void OnRec_ChangeData(INotification noti) { CardRole hero = noti.Body as CardRole; fightrolehppanel_item itemUI = CardRoleHPDic[hero]; UpdateData(itemUI, hero.SerData); }
public void GetEditPersonnelRoleInfo(CardRole info) { EditCardRole = new CardRole(); EditCardRole = info; IdText.text = "<color=#60D4E4FF>Id:</color>" + info.Id.ToString(); InputName.text = info.Name; InputDetail.text = info.Description; }
public void Update() { if (HitTest) { HitCard(); mUpdateHitTestCardRole = HitCardRole(); } }
public void RolePowerInstruction(int vale) { CardRole Role = addPosCardDropdown.CardRoleList.Find(i => i.Name == addPosCardDropdown.CardRoleDropdownItem.captionText.text); if (Role != null) { Instruction.text = Role.Description; } }
public void SaveAddReloInfo(CardRole info) { int CardRoleID = CommunicationObject.Instance.AddCardRole(info); info.Id = CardRoleID; UGUIMessageBox.Show("角色信息已保存!", "确定", "", () => { CloseAddRoleWindow(); }, null, null); }
IEnumerator RoleCheck() { FinishCardRole = Straight_FlashCheck(); RoleText[0].text = FinishCardRole.ToString(); RolePanel[0].SetActive(true); while (!enemy.showEnd) { yield return(null); } if (FinishCardRole > enemy.Role) { EndFlagNum = 1; player.PlayerPoint += 1; } else if (FinishCardRole == enemy.Role) { EndFlagNum = 0; } else { EndFlagNum = -1; } switch (EndFlagNum) { case 1: RoleText[2].text = "Your Winner"; RoleText[2].color = Color.red; break; case 0: RoleText[2].text = "Draw"; RoleText[2].color = Color.black; break; case -1: RoleText[2].text = "Your Loser"; RoleText[2].color = Color.blue; break; } RoleText[1].text = enemy.Role.ToString(); RolePanel[1].SetActive(true); yield return(new WaitForSeconds(1)); RolePanel[2].SetActive(true); if (EndFlagNum != 0) { PlayCount--; } StartCoroutine(NextGame()); }
public void InitData() { role1 = AddCardRole("超级管理员", "可以进入全部区域"); role2 = AddCardRole("管理人员", "可以进入大部分区域"); role3 = AddCardRole("巡检人员", "能够进入生产区域"); role4 = AddCardRole("操作人员", "能够进入生产区域"); role5 = AddCardRole("维修人员", "能够进入生产区域"); role6 = AddCardRole("外维人员", "能够进入生活区域和指定生产区域"); role7 = AddCardRole("参观人员(高级)", "能够进入生活区域和大部分生产区域"); role8 = AddCardRole("参观人员(一般)", "能够进入生活区域和少部分生产区域"); }
/// <summary>获取卡牌</summary> /// <param name="did"></param> /// <returns></returns> public CardRole GetCardRoleByTransform(Transform trans) { CardRole cdrole = null; if (!TransformCardRoleTeamA.TryGetValue(trans, out cdrole)) { TransformCardRoleTeamB.TryGetValue(trans, out cdrole); } return(cdrole); }
protected override void OnDragDropMove(Vector3 delta) { base.OnDragDropMove(delta); if (mUpdateHitTestCardRole != mCardRole && mUpdateHitTestCardRole != null) { mCardRole.HideHighlighter(); mCardRole = null; PureMVC.Patterns.Facade.Instance.SendNotification(NotificationID.Fihgt_ShowOpPan, false); } }
/// <summary>交换槽位</summary> /// <param name="role0"></param> /// <param name="role1"></param> public void ChangeSlotPostion(CardRole role0, CardRole role1) { Vector3 pos = role0.SlotPostion; role0.SlotPostion = role1.SlotPostion; role1.SlotPostion = pos; int indx = role0.SlotIndex; role0.SlotIndex = role1.SlotIndex; role1.SlotIndex = indx; }
public int AddCardRole(CardRole p) { var entity = new TagRoleService(db).Post(p); RefreshData(); if (entity != null) { return(entity.Id); } else { return(-1); } }
private CardRole AddCardRole(string name, string description = "") { if (string.IsNullOrEmpty(description)) { description = name; } var role = new CardRole() { Name = name, Description = description }; _bll.CardRoles.Add(role); roles.Add(role); return(role); }
private void SetRoleAuthorization3(CardRole role, List <Area> buildAreaList) { foreach (var area in buildAreaList) { var aa = AreaAuthorization.New(); aa.AreaId = area.Id; //根节点 aa.AccessType = AreaAccessType.可以进出; //可进入的权限 aa.RangeType = AreaRangeType.WithParent; aa.Name = string.Format("权限[园区参观(高级)]"); aa.Description = string.Format("权限:可以进入园区参观,可以靠近建筑物。"); areaAuthorizations.Add(aa); AreaAuthorizations.Add(aa); AddAAR(role, aa); } }
private void SetRoleAuthorization4(List <Area> floors, CardRole role) { foreach (var area in floors) { var aa = AreaAuthorization.New(); aa.AreaId = area.Id; //根节点 aa.AccessType = AreaAccessType.可以进出; //可进入的权限 aa.RangeType = AreaRangeType.WithParent; aa.Name = string.Format("权限[大楼内部]"); aa.Description = string.Format("权限:可以进入大楼内部,不能进入机房。"); areaAuthorizations.Add(aa); AreaAuthorizations.Add(aa); AddAAR(role, aa); } }
public void RoleCheck(GamePhase gamePhase) { SelectEnd = false; Role = CardRole.Non; if (PairCheck(EnemyCardScript, CardRole.FourCard)) { DebugCardNum(); } else if (FullHouse_TwoPairCheck(EnemyCardScript, CardRole.FullHouse)) { DebugCardNum(); } else if (FlashCheck(EnemyCardScript)) { DebugCardNum(); } else if (PairCheck(EnemyCardScript, CardRole.ThreeCard)) { DebugCardNum(); } else if (FullHouse_TwoPairCheck(EnemyCardScript, CardRole.TwoPair)) { DebugCardNum(); } else if (PairCheck(EnemyCardScript, CardRole.OnePair)) { DebugCardNum(); } if (Role == CardRole.Non) { CardIndex.Clear(); } for (int i = 0; i < CardIndex.Count; i++) { EnemyCardScript[CardIndex[i]].Select = true; } switch (gamePhase) { case GamePhase.Change: CardChange(); break; case GamePhase.Select: StartCoroutine(CardShow()); break; } Debug.Log(Role); }
public ActionResult Create(CardRole cardRole) { if (ModelState.IsValid) { var result = db.CardRoles.Add(cardRole); if (result) { return(Json(new { success = result })); } else { return(Json(new { success = result, errors = db.CardRoles.ErrorMessage })); } } return(View(cardRole)); }
bool FullHouse_TwoPairCheck(List <CardScript> cardScript, CardRole role) { for (int i = 0; i < Const_int.MaxCard; i++) { CardIndex.Clear(); switch (role) { case CardRole.FullHouse: if (PairCheck(cardScript, CardRole.ThreeCard) || PairCheck(cardScript, CardRole.ThreeCard)) { for (int j = 0; j < Const_int.MaxCard; j++) { if (cardScript[i].CardNum == cardScript[j].CardNum && cardScript[CardIndex[0]].CardNum != cardScript[j].CardNum) { CardIndex.Add(cardScript[j].CardIndex); } if (CardIndex.Count == 5) { Role = CardRole.FullHouse; return(true); } } } break; case CardRole.TwoPair: if (PairCheck(cardScript, CardRole.OnePair)) { for (int j = 0; j < Const_int.MaxCard; j++) { if (cardScript[i].CardNum == cardScript[j].CardNum && cardScript[CardIndex[0]].CardNum != cardScript[j].CardNum) { CardIndex.Add(cardScript[j].CardIndex); } if (CardIndex.Count == 4) { Role = CardRole.TwoPair; return(true); } } } break; } } return(false); }
public CGMessage DeleteCardRole(CardRole inputCardRole) { CGMessage returnMessage = new(); try { _context.CardRoles.Remove(inputCardRole); _context.SaveChanges(); return(GetCardRoles()); } catch (Exception ex) { _logger.Log(LogLevel.Error, $"DeleteCardRole; Error: {ex.Message}"); } return(returnMessage); }
private void SetRoleAuthorization1(CardRole role) { //foreach (var area in areaList) { var aa = AreaAuthorization.New(); aa.AreaId = 1; //根节点 aa.AccessType = AreaAccessType.可以进出; //可进入的权限 aa.RangeType = AreaRangeType.All; aa.Name = string.Format("权限[全部区域]"); aa.Description = string.Format("权限:可以进入全部区域"); aa.SetTime(0, 0, 23, 59, 59); areaAuthorizations.Add(aa); AreaAuthorizations.Add(aa); AddAAR(role, aa); } }
private void SetAlarmArea(CardRole role, int areaId) { var aa = AreaAuthorization.New(); aa.AreaId = areaId; //根节点 aa.AccessType = AreaAccessType.能进入; //不能进入 aa.RangeType = AreaRangeType.Single; aa.Name = string.Format("权限[不能进入]"); aa.Description = string.Format("权限:告警区域"); if (areaAuthorizations == null) { areaAuthorizations = new List <AreaAuthorization>(); } areaAuthorizations.Add(aa); AreaAuthorizations.Add(aa); AddAAR(role, aa); }
protected override void OnDragDropRelease(GameObject surface) { base.OnDragDropRelease(surface); HitTest = false; transform.DOMove(SlotPostion, 0.2f); NGUITools.AdjustDepth(gameObject, -100); if (mCardRole != null) { mCardRole.HideHighlighter(); } PureMVC.Patterns.Facade.Instance.SendNotification(NotificationID.Fihgt_ShowOpPan, false); mCardRole = null; mUpdateHitTestCardRole = null; }