Пример #1
0
            public static void Postfix(EjectRoutine __instance)
            {
                try
                {
                    var ejectedId = new PlayerData(__instance.field_Public_CNNGMDOPELD_0.LNMDIKCFBAK).PlayerController.PlayerId;
                    var available = AllRoles.Where(x => x.PlayerController.PlayerId == ejectedId);

                    if (available.Count() == 0)
                    {
                        return;
                    }

                    var rolePlayer  = available.ToList()[0];
                    var roleEjected = rolePlayer.RoleEjected;

                    roleEjected.ExecuteEjectMoveNext(rolePlayer);

                    if (!roleEjected.UseRoleEjected)
                    {
                        return;
                    }

                    var field = __instance.field_Public_CNNGMDOPELD_0;

                    field.EOFFAJKKDMI = roleEjected.EjectedText;
                }
                catch { }
            }
Пример #2
0
        public void Win()
        {
            if (AllRoles.Where(x => x.RoleType == RoleEnum.Jester).Any(x => ((Jester)x).VotedOut))
            {
                return;
            }

            /*var lover1 = Player;
             * var lover2 = OtherLover.Player;
             * //System.Console.WriteLine("reached révoila");
             * lover1.Data.IsImpostor = true;
             * lover1.Data.IsDead = false;
             * lover2.Data.IsImpostor = true;
             * lover2.Data.IsDead = false;
             * foreach (var player in PlayerControl.AllPlayerControls)
             * {
             *  if (player.PlayerId == lover1.PlayerId) continue;
             *  if (player.PlayerId == lover2.PlayerId) continue;
             *  player.RemoveInfected();
             *  player.Die(0);
             *  player.Data.IsDead = true;
             *  player.Data.IsImpostor = false;
             * }*/

            LoveCoupleWins            = true;
            OtherLover.LoveCoupleWins = true;
        }
Пример #3
0
            public static void Postfix(OutroRoutine __instance)
            {
                try
                {
                    if (!IsLocalRolePlayer)
                    {
                        return;
                    }

                    var rolePlayer = AllRoles.Where(x => x.PlayerController.IsLocalPlayer).ToList()[0];
                    var roleOutro  = rolePlayer.RoleOutro;

                    roleOutro.ExecuteOutroMoveNext(rolePlayer);

                    if (!roleOutro.UseRoleOutro)
                    {
                        return;
                    }

                    __instance.field_Public_ABNGEPFHMHP_0.WinText.Text  = roleOutro.WinText;
                    __instance.field_Public_ABNGEPFHMHP_0.WinText.Color = roleOutro.WinTextColor;
                    __instance.field_Public_ABNGEPFHMHP_0.BackgroundBar.material.color = roleOutro.BackgroundColor;
                }
                catch { }
            }
        private void EditConfirmResponseHandler(MsgBxResultMessage obj)
        {
            if (obj.Result == eMessageBoxResult.Yes)
            {
                //Edit Code
                SelectedRole.ParentRoleId = SelectedRole.ParentRole.Id;
                SelectedRole.ParentRole   = null;
                string jsonObj     = JsonConvert.SerializeObject(SelectedRole);
                var    httpContent = new StringContent(jsonObj, Encoding.UTF8, "application/json");
                var    response    = HttpManager.Instance.Post(httpContent, APIPaths.RoleUpdate);
                ActionResult <OrgRoleDTO> actionResult = JsonConvert.DeserializeObject <ActionResult <OrgRoleDTO> >(response);
                if (actionResult.ReturnCode == eReturnCode.Success)
                {
                    ShowMessageBox(eMessageBoxType.Info, Application.Current.MainWindow.Resources["txtMsgTitleSuccess"].ToString(),
                                   Application.Current.MainWindow.Resources["txtMsgTextRoleEditSuccess"].ToString());
                }
                else
                {
                    ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                                   Application.Current.MainWindow.Resources["txtMsgTextRoleEditError"].ToString());
                }
                FetchData();
                SelectedRole            = new OrgRoleDTO();
                SelectedRole.ParentRole = AllRoles.Where(r => r.ParentRoleId == 0).FirstOrDefault().Clone() as OrgRoleDTO;
                RaisePropertyChanged("SelectedRole");
            }


            SelectedRole            = new OrgRoleDTO();
            SelectedRole.ParentRole = AllRoles.Where(r => r.ParentRoleId == 0).FirstOrDefault().Clone() as OrgRoleDTO;
            RaisePropertyChanged("SelectedRole");
            Messenger.Default.Unregister <MsgBxResultMessage>(this, DeleteConfirmResponseHandler);
        }
        private void SaveCommandHandler()
        {
            AppLogger.Instance.LogBegin(this.GetType().Name, System.Reflection.MethodInfo.GetCurrentMethod().Name);
            try
            {
                if (!_isEdit)
                {
                    //Add Code
                    SelectedRole.ParentRoleId = SelectedRole.ParentRole.Id;
                    SelectedRole.ParentRole   = null;
                    string jsonObj     = JsonConvert.SerializeObject(SelectedRole);
                    var    httpContent = new StringContent(jsonObj, Encoding.UTF8, "application/json");
                    var    response    = HttpManager.Instance.Post(httpContent, APIPaths.RoleCreate);
                    ActionResult <OrgRoleDTO> actionResult = JsonConvert.DeserializeObject <ActionResult <OrgRoleDTO> >(response);
                    if (actionResult.ReturnCode == eReturnCode.Success)
                    {
                        ShowMessageBox(eMessageBoxType.Info, Application.Current.MainWindow.Resources["txtMsgTitleSuccess"].ToString(),
                                       Application.Current.MainWindow.Resources["txtMsgTextRoleAddSuccess"].ToString());
                    }
                    else
                    {
                        ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                                       Application.Current.MainWindow.Resources["txtMsgTextRoleAddError"].ToString());
                    }
                    FetchData();

                    SelectedRole            = new OrgRoleDTO();
                    SelectedRole.ParentRole = AllRoles.Where(r => r.ParentRoleId == 0).FirstOrDefault().Clone() as OrgRoleDTO;
                    RaisePropertyChanged("SelectedRole");
                }
                else
                {
                    if (SelectedRole.Id == SelectedRole.ParentRole.Id)
                    {
                        ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                                       Application.Current.MainWindow.Resources["txtMsgTextParentRoleModifiedToSelf"].ToString());
                        return;
                    }

                    if (!ValidateRoleEdit(SelectedRole.ParentRole))
                    {
                        ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                                       Application.Current.MainWindow.Resources["txtMsgTextParentRoleModifiedToSelf"].ToString());
                        return;
                    }
                    Messenger.Default.Register <MsgBxResultMessage>(this, EditConfirmResponseHandler);
                    ShowMessageBox(eMessageBoxType.Confirmation, Application.Current.MainWindow.Resources["txtMsgTitleConfirm"].ToString(),
                                   Application.Current.MainWindow.Resources["txtMsgTextRoleEditConfirm"].ToString());
                    return;
                }
            }
            catch (Exception ex)
            {
                AppLogger.Instance.Log(eLogType.Error, ex.ToString());
            }
            finally
            {
                AppLogger.Instance.LogEnd(this.GetType().Name, System.Reflection.MethodInfo.GetCurrentMethod().Name);
            }
        }
 private string RoleFormat(FrameworkUser_View entity, object val)
 {
     if (AllRoles == null)
     {
         return("");
     }
     return(AllRoles.Where(x => entity.Roles.Contains(x.ID)).Select(x => x.RoleName).ToList().ToSpratedString());
 }
Пример #7
0
        public IEnumerable <SelectListItem> EditableSelectedRoles()
        {
            var list = AllRoles.ToList();

            foreach (var item in AllRoles.Where(item => (VisibilityRoles ?? "").Contains(item.Text)))
            {
                item.Selected = true;
            }
            return(list);
        }
        private void DeleteConfirmResponseHandler(MsgBxResultMessage obj)
        {
            if (obj.Result == eMessageBoxResult.Yes)
            {
                string jsonObj     = JsonConvert.SerializeObject(SelectedRole);
                var    httpContent = new StringContent(jsonObj, Encoding.UTF8, "application/json");
                var    response    = HttpManager.Instance.Post(httpContent, APIPaths.RoleDelete);
                ActionResult <string> actionResult = JsonConvert.DeserializeObject <ActionResult <string> >(response);

                switch (actionResult.ReturnCode)
                {
                case eReturnCode.Success:
                    ShowMessageBox(eMessageBoxType.Info, Application.Current.MainWindow.Resources["txtMsgTitleSuccess"].ToString(),
                                   Application.Current.MainWindow.Resources["txtMsgTextRoleDelSuccess"].ToString());
                    break;

                case eReturnCode.Failure:
                    ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                                   Application.Current.MainWindow.Resources["txtMsgTextRoleDelError"].ToString());
                    break;

                case eReturnCode.EmployeeExists:
                    ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                                   Application.Current.MainWindow.Resources["txtMsgTextRoleDelErrorEmployeeExists"].ToString());
                    break;

                case eReturnCode.SubOrdinateExists:
                    ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                                   Application.Current.MainWindow.Resources["txtMsgTextRoleDelErrorSubOrdinatesExists"].ToString());
                    break;
                }
                //else
                //{
                //    ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                //        Application.Current.MainWindow.Resources["txtMsgTextRoleDelError"].ToString());
                //}
                FetchData();
            }


            SelectedRole            = new OrgRoleDTO();
            SelectedRole.ParentRole = AllRoles.Where(r => r.ParentRoleId == 0).FirstOrDefault().Clone() as OrgRoleDTO;
            RaisePropertyChanged("SelectedRole");

            Messenger.Default.Unregister <MsgBxResultMessage>(this, DeleteConfirmResponseHandler);
        }
Пример #9
0
            public static void Postfix(IntroRoutine __instance)
            {
                try
                {
                    if (!IsLocalRolePlayer)
                    {
                        return;
                    }

                    var rolePlayer = AllRoles.Where(x => x.PlayerController.IsLocalPlayer).ToList()[0];
                    var roleIntro  = rolePlayer.RoleIntro;

                    roleIntro.ExecuteIntroMoveNext(rolePlayer);

                    if (!roleIntro.UseRoleIntro)
                    {
                        return;
                    }

                    var field = __instance.field_Public_PENEIDJGGAF_0;

                    __instance.isImpostor = roleIntro.IsRoleImpostor;

                    __instance.yourTeam = new Il2CppSystem.Collections.Generic.List <PlayerControlClass>();

                    foreach (var player in roleIntro.TeamPlayers)
                    {
                        __instance.yourTeam.Add(player.PlayerControl);
                    }

                    field.BackgroundBar.material.color = roleIntro.BackgroundColor;

                    field.ImpostorText.Text = roleIntro.RoleDescription;

                    field.ImpostorText.gameObject.SetActive(true);

                    field.Title.Text  = roleIntro.RoleName;
                    field.Title.Color = roleIntro.RoleNameColor;
                }
                catch { }
            }
 private void CancelCommandHandler()
 {
     AppLogger.Instance.LogBegin(this.GetType().Name, System.Reflection.MethodInfo.GetCurrentMethod().Name);
     try
     {
         _isEdit                 = false;
         SelectedRole            = new OrgRoleDTO();
         SelectedRole.ParentRole = AllRoles.Where(r => r.ParentRoleId == 0).FirstOrDefault().Clone() as OrgRoleDTO;
         RaisePropertyChanged("SelectedRole");
         PageTitle = Application.Current.MainWindow.Resources["txtAddRole"].ToString();
         RaisePropertyChanged("PageTitle");
     }
     catch (Exception ex)
     {
         AppLogger.Instance.Log(eLogType.Error, ex.ToString());
     }
     finally
     {
         AppLogger.Instance.LogEnd(this.GetType().Name, System.Reflection.MethodInfo.GetCurrentMethod().Name);
     }
 }
Пример #11
0
        public void LoadRoles(Guid?specificBusinessUnitId = null)
        {
            listView1.Items.Clear();

            var rManager = new RoleManager(service);
            var rootBuId = rManager.GetRootBusinessUnitId();

            AllRoles = rManager.GetRoles();

            listView1.Items.AddRange(AllRoles
                                     .Where(role => role.GetAttributeValue <EntityReference>("parentrootroleid").Id == role.Id)
                                     .Select(role => new ListViewItem
            {
                Text     = role.GetAttributeValue <string>("name"),
                SubItems =
                {
                    role.GetAttributeValue <EntityReference>("businessunitid").Name,
                    (rootBuId != role.GetAttributeValue <EntityReference>("businessunitid").Id).ToString()
                },
                ImageIndex      = 0,
                StateImageIndex = 0,
                Tag             = role
            }).ToArray());
        }
Пример #12
0
 private void AddMultipleRoles(string v) =>
 AllRoles.Where(role => role.DefaultGroup == v)
 .Select(role => role.Name)
 .ToList()
 .ForEach(role => AddRole(role));
Пример #13
0
 public UserRoles()
 {
     roles = AllRoles.Where(x => x.Id == RoleId);
 }