コード例 #1
0
        public MyGuiScreenTriggerBlockDestroyed(MyTrigger trig) : base(trig,new Vector2(0.5f,0.8f))
        {
            trigger=(MyTriggerBlockDestroyed)trig;
            AddCaption(MySpaceTexts.GuiTriggerCaptionBlockDestroyed);

            var layout = new MyLayoutTable(this);
            layout.SetColumnWidthsNormalized(10, 30, 3, 30, 10);
            layout.SetRowHeightsNormalized(20, 35, 6, 4, 4, 5, 33);

            m_selectedBlocks = new MyGuiControlTable();
            m_selectedBlocks.VisibleRowsCount = 8;
            m_selectedBlocks.ColumnsCount = 1;
            m_selectedBlocks.SetCustomColumnWidths(new float[]{1});
            m_selectedBlocks.SetColumnName(0, MyTexts.Get(MySpaceTexts.GuiTriggerBlockDestroyed_ColumnName));

            layout.AddWithSize(m_selectedBlocks, MyAlignH.Left, MyAlignV.Top, 1, 1, rowSpan: 1, colSpan: 3);

            m_buttonPaste = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.GuiTriggerPasteBlocks),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                onButtonClick: OnPasteButtonClick
                );
            m_buttonPaste.SetToolTip(MySpaceTexts.GuiTriggerPasteBlocksTooltip);
            layout.AddWithSize(m_buttonPaste, MyAlignH.Left, MyAlignV.Top, 2, 1, rowSpan: 1, colSpan: 1);

            m_buttonDelete = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.GuiTriggerDeleteBlocks),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                onButtonClick: OnDeleteButtonClick);
            layout.AddWithSize(m_buttonDelete, MyAlignH.Left, MyAlignV.Top, 2, 3, rowSpan: 1, colSpan: 1);

            m_labelSingleMessage = new MyGuiControlLabel(
                text: MyTexts.Get(MySpaceTexts.GuiTriggerBlockDestroyedSingleMessage).ToString()
                );
            layout.AddWithSize(m_labelSingleMessage, MyAlignH.Left, MyAlignV.Top, 3, 1, rowSpan: 1, colSpan: 1);
            m_textboxSingleMessage = new MyGuiControlTextbox(
                defaultText: trigger.SingleMessage,
                maxLength: 85);
            layout.AddWithSize(m_textboxSingleMessage, MyAlignH.Left, MyAlignV.Top, 4, 1, rowSpan: 1, colSpan: 3);

            foreach(var block in trigger.Blocks)
                AddRow(block.Key);
            m_tempSb.Clear().Append(trigger.SingleMessage);
            m_textboxSingleMessage.SetText(m_tempSb);

        }
コード例 #2
0
        public void Init(IMyGuiControlsParent controlsParent)
        {
            m_playerList = (MyGuiControlListbox)controlsParent.Controls.GetControlByName("PlayerListbox");
            m_factionList = (MyGuiControlListbox)controlsParent.Controls.GetControlByName("FactionListbox");

            m_chatHistory = (MyGuiControlMultilineText)controlsParent.Controls.GetControlByName("ChatHistory");
            m_chatbox = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("Chatbox");

            m_playerList.ItemsSelected += m_playerList_ItemsSelected;
            m_playerList.MultiSelect = false;

            m_factionList.ItemsSelected += m_factionList_ItemsSelected;
            m_factionList.MultiSelect = false;

            m_sendButton = (MyGuiControlButton)controlsParent.Controls.GetControlByName("SendButton");
            m_sendButton.ButtonClicked += m_sendButton_ButtonClicked;

            m_chatbox.TextChanged += m_chatbox_TextChanged;
            m_chatbox.EnterPressed += m_chatbox_EnterPressed;

            if (MySession.Static.LocalCharacter != null)
            {
                MySession.Static.ChatSystem.PlayerMessageReceived += MyChatSystem_PlayerMessageReceived;
                MySession.Static.ChatSystem.FactionMessageReceived += MyChatSystem_FactionMessageReceived;
                MySession.Static.ChatSystem.GlobalMessageReceived += MyChatSystem_GlobalMessageReceived;

                MySession.Static.ChatSystem.FactionHistoryDeleted += ChatSystem_FactionHistoryDeleted;
                MySession.Static.ChatSystem.PlayerHistoryDeleted += ChatSystem_PlayerHistoryDeleted;
            }

            MySession.Static.Players.PlayersChanged += Players_PlayersChanged;
            
            RefreshLists();

            m_chatbox.SetText(m_emptyText);
            m_sendButton.Enabled = false;

            if (MyMultiplayer.Static != null)
            {
                MyMultiplayer.Static.ChatMessageReceived += Multiplayer_ChatMessageReceived;
            }


            m_closed = false;
        }