Ejemplo n.º 1
0
        public override bool Simulate()
        {
            bool flag = CalculateHighInputsCount() > 0;

            if (flag && m_isMessageAllowed && (!m_lastMessageTime.HasValue || base.SubsystemElectricity.SubsystemTime.GameTime - m_lastMessageTime.Value > 0.5))
            {
                m_isMessageAllowed = false;
                m_lastMessageTime  = base.SubsystemElectricity.SubsystemTime.GameTime;
                SignData signData = base.SubsystemElectricity.Project.FindSubsystem <SubsystemSignBlockBehavior>(throwOnError: true).GetSignData(new Point3(base.CellFaces[0].X, base.CellFaces[0].Y, base.CellFaces[0].Z));
                if (signData != null)
                {
                    string text = string.Join("\n", signData.Lines);
                    text = text.Trim('\n');
                    text = text.Replace("\\\n", "");
                    Color color = (signData.Colors[0] == Color.Black) ? Color.White : signData.Colors[0];
                    color *= 255f / (float)MathUtils.Max(color.R, color.G, color.B);
                    foreach (ComponentPlayer componentPlayer in base.SubsystemElectricity.Project.FindSubsystem <SubsystemPlayers>(throwOnError: true).ComponentPlayers)
                    {
                        componentPlayer.ComponentGui.DisplaySmallMessage(text, color, blinking: true, playNotificationSound: true);
                    }
                }
            }
            if (!flag)
            {
                m_isMessageAllowed = true;
            }
            return(false);
        }
Ejemplo n.º 2
0
        public EditSignDialog(SubsystemSignBlockBehavior subsystemSignBlockBehavior, Point3 signPoint)
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/EditSignDialog");

            LoadContents(this, node);
            m_linesPage     = Children.Find <ContainerWidget>("EditSignDialog.LinesPage");
            m_urlPage       = Children.Find <ContainerWidget>("EditSignDialog.UrlPage");
            m_textBox1      = Children.Find <TextBoxWidget>("EditSignDialog.TextBox1");
            m_textBox2      = Children.Find <TextBoxWidget>("EditSignDialog.TextBox2");
            m_textBox3      = Children.Find <TextBoxWidget>("EditSignDialog.TextBox3");
            m_textBox4      = Children.Find <TextBoxWidget>("EditSignDialog.TextBox4");
            m_colorButton1  = Children.Find <ButtonWidget>("EditSignDialog.ColorButton1");
            m_colorButton2  = Children.Find <ButtonWidget>("EditSignDialog.ColorButton2");
            m_colorButton3  = Children.Find <ButtonWidget>("EditSignDialog.ColorButton3");
            m_colorButton4  = Children.Find <ButtonWidget>("EditSignDialog.ColorButton4");
            m_urlTextBox    = Children.Find <TextBoxWidget>("EditSignDialog.UrlTextBox");
            m_urlTestButton = Children.Find <ButtonWidget>("EditSignDialog.UrlTestButton");
            m_okButton      = Children.Find <ButtonWidget>("EditSignDialog.OkButton");
            m_cancelButton  = Children.Find <ButtonWidget>("EditSignDialog.CancelButton");
            m_urlButton     = Children.Find <ButtonWidget>("EditSignDialog.UrlButton");
            m_linesButton   = Children.Find <ButtonWidget>("EditSignDialog.LinesButton");
            m_subsystemSignBlockBehavior = subsystemSignBlockBehavior;
            m_signPoint = signPoint;
            SignData signData = m_subsystemSignBlockBehavior.GetSignData(m_signPoint);

            if (signData != null)
            {
                m_textBox1.Text      = signData.Lines[0];
                m_textBox2.Text      = signData.Lines[1];
                m_textBox3.Text      = signData.Lines[2];
                m_textBox4.Text      = signData.Lines[3];
                m_colorButton1.Color = signData.Colors[0];
                m_colorButton2.Color = signData.Colors[1];
                m_colorButton3.Color = signData.Colors[2];
                m_colorButton4.Color = signData.Colors[3];
                m_urlTextBox.Text    = signData.Url;
            }
            else
            {
                m_textBox1.Text      = string.Empty;
                m_textBox2.Text      = string.Empty;
                m_textBox3.Text      = string.Empty;
                m_textBox4.Text      = string.Empty;
                m_colorButton1.Color = Color.Black;
                m_colorButton2.Color = Color.Black;
                m_colorButton3.Color = Color.Black;
                m_colorButton4.Color = Color.Black;
                m_urlTextBox.Text    = string.Empty;
            }
            m_linesPage.IsVisible = true;
            m_urlPage.IsVisible   = false;
            UpdateControls();
        }
Ejemplo n.º 3
0
        public override bool OnInteract(TerrainRaycastResult raycastResult, ComponentMiner componentMiner)
        {
            AudioManager.PlaySound("Audio/UI/ButtonClick", 1f, 0f, 0f);
            Point3 point = new Point3(raycastResult.CellFace.X, raycastResult.CellFace.Y, raycastResult.CellFace.Z);

            if (m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Adventure)
            {
                SignData signData = GetSignData(point);
                if (signData != null && !string.IsNullOrEmpty(signData.Url))
                {
                    WebBrowserManager.LaunchBrowser(signData.Url);
                }
            }
            else if (componentMiner.ComponentPlayer != null)
            {
                DialogsManager.ShowDialog(componentMiner.ComponentPlayer.GuiWidget, new EditSignDialog(this, point));
            }
            return(true);
        }