public void Init(IMyGuiControlsParent controlsParent) { m_controlsParent = controlsParent; RefreshUserInfo(); m_tableFactions = (MyGuiControlTable)controlsParent.Controls.GetControlByName("FactionsTable"); m_tableFactions.SetColumnComparison(0, (a, b) => ((StringBuilder)a.UserData).CompareToIgnoreCase((StringBuilder)b.UserData)); m_tableFactions.SetColumnComparison(1, (a, b) => ((StringBuilder)a.UserData).CompareToIgnoreCase((StringBuilder)b.UserData)); m_tableFactions.ItemSelected += OnFactionsTableItemSelected; RefreshTableFactions(); m_tableFactions.SortByColumn(1); m_buttonCreate = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonCreate"); m_buttonJoin = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonJoin"); m_buttonCancelJoin = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonCancelJoin"); m_buttonLeave = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonLeave"); m_buttonSendPeace = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonSendPeace"); m_buttonCancelPeace = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonCancelPeace"); m_buttonAcceptPeace = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonAcceptPeace"); m_buttonMakeEnemy = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonEnemy"); m_buttonCreate.ShowTooltipWhenDisabled = true; m_buttonCreate.TextEnum = MySpaceTexts.TerminalTab_Factions_Create; m_buttonJoin.TextEnum = MySpaceTexts.TerminalTab_Factions_Join; m_buttonCancelJoin.TextEnum = MySpaceTexts.TerminalTab_Factions_CancelJoin; m_buttonLeave.TextEnum = MySpaceTexts.TerminalTab_Factions_Leave; m_buttonSendPeace.TextEnum = MySpaceTexts.TerminalTab_Factions_Friend; m_buttonCancelPeace.TextEnum = MySpaceTexts.TerminalTab_Factions_CancelPeaceRequest; m_buttonAcceptPeace.TextEnum = MySpaceTexts.TerminalTab_Factions_AcceptPeaceRequest; m_buttonMakeEnemy.TextEnum = MySpaceTexts.TerminalTab_Factions_Enemy; m_buttonJoin.SetToolTip(MySpaceTexts.TerminalTab_Factions_JoinToolTip); m_buttonSendPeace.SetToolTip(MySpaceTexts.TerminalTab_Factions_FriendToolTip); m_buttonCreate.ButtonClicked += OnCreateClicked; m_buttonJoin.ButtonClicked += OnJoinClicked; m_buttonCancelJoin.ButtonClicked += OnCancelJoinClicked; m_buttonLeave.ButtonClicked += OnLeaveClicked; m_buttonSendPeace.ButtonClicked += OnFriendClicked; m_buttonCancelPeace.ButtonClicked += OnCancelPeaceRequestClicked; m_buttonAcceptPeace.ButtonClicked += OnAcceptFriendClicked; m_buttonMakeEnemy.ButtonClicked += OnEnemyClicked; // RIGHT SIDE m_labelFactionName = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionName"); m_labelFactionDesc = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionDesc"); m_labelFactionPriv = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionPrivate"); m_labelMembers = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionMembers"); m_labelAutoAcceptMember = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionMembersAcceptEveryone"); m_labelAutoAcceptPeace = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionMembersAcceptPeace"); m_labelFactionDesc.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_CreateFactionDescription).ToString(); m_labelFactionPriv.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_Private).ToString(); m_labelMembers.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_Members).ToString(); m_labelAutoAcceptMember.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_AutoAccept).ToString(); m_labelAutoAcceptPeace.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_AutoAcceptRequest).ToString(); m_labelAutoAcceptMember.SetToolTip(MySpaceTexts.TerminalTab_Factions_AutoAcceptToolTip); m_labelAutoAcceptPeace.SetToolTip(MySpaceTexts.TerminalTab_Factions_AutoAcceptRequestToolTip); m_textFactionDesc = (MyGuiControlMultilineText)controlsParent.Controls.GetControlByName("textFactionDesc"); m_textFactionPriv = (MyGuiControlMultilineText)controlsParent.Controls.GetControlByName("textFactionPrivate"); m_textFactionDesc.BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK; m_textFactionPriv.BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK; m_tableMembers = (MyGuiControlTable)controlsParent.Controls.GetControlByName("tableMembers"); m_tableMembers.SetColumnComparison(1, (a, b) => ((int)((MyMemberComparerEnum)a.UserData)).CompareTo((int)((MyMemberComparerEnum)b.UserData))); m_tableMembers.ItemSelected += OnTableItemSelected; m_checkAutoAcceptMember = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("checkFactionMembersAcceptEveryone"); m_checkAutoAcceptPeace = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("checkFactionMembersAcceptPeace"); m_checkAutoAcceptMember.SetToolTip(MySpaceTexts.TerminalTab_Factions_AutoAcceptToolTip); m_checkAutoAcceptPeace.SetToolTip(MySpaceTexts.TerminalTab_Factions_AutoAcceptRequestToolTip); m_checkAutoAcceptMember.IsCheckedChanged += OnAutoAcceptChanged; m_checkAutoAcceptPeace.IsCheckedChanged += OnAutoAcceptChanged; m_buttonEdit = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonEdit"); m_buttonPromote = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonPromote"); m_buttonKick = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonKick"); m_buttonAcceptJoin = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonAcceptJoin"); m_buttonDemote = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonDemote"); m_buttonAddNpc = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonAddNpc"); m_buttonEdit.TextEnum = MyCommonTexts.Edit; m_buttonPromote.TextEnum = MyCommonTexts.Promote; m_buttonKick.TextEnum = MyCommonTexts.Kick; m_buttonAcceptJoin.TextEnum = MyCommonTexts.Accept; m_buttonDemote.TextEnum = MyCommonTexts.Demote; m_buttonAddNpc.TextEnum = MySpaceTexts.AddNpcToFaction; m_buttonAddNpc.SetToolTip(MySpaceTexts.AddNpcToFactionHelp); m_buttonEdit.ButtonClicked += OnCreateClicked; m_buttonPromote.ButtonClicked += OnPromotePlayerClicked; m_buttonKick.ButtonClicked += OnKickPlayerClicked; m_buttonAcceptJoin.ButtonClicked += OnAcceptJoinClicked; m_buttonDemote.ButtonClicked += OnDemoteClicked; m_buttonAddNpc.ButtonClicked += OnNewNpcClicked; MySession.Static.Factions.FactionCreated += OnFactionCreated; MySession.Static.Factions.FactionEdited += OnFactionEdited; MySession.Static.Factions.FactionStateChanged += OnFactionsStateChanged; MySession.Static.Factions.FactionAutoAcceptChanged += OnAutoAcceptChanged; Refresh(); }