static MyLightingBlock()
        {
            var lightColor = new MyTerminalControlColor <MyLightingBlock>("Color", MySpaceTexts.BlockPropertyTitle_LightColor);

            lightColor.Getter = (x) => x.Color;
            lightColor.Setter = (x, v) => x.SyncObject.SendChangeLightColorRequest(v);
            MyTerminalControlFactory.AddControl(lightColor);

            var lightRadius = new MyTerminalControlSlider <MyLightingBlock>("Radius", MySpaceTexts.BlockPropertyTitle_LightRadius, MySpaceTexts.BlockPropertyDescription_LightRadius);

            lightRadius.SetLimits((x) => x.RadiusBounds.Min, (x) => x.RadiusBounds.Max);
            lightRadius.DefaultValueGetter = (x) => x.RadiusBounds.Default;
            lightRadius.Getter             = (x) => x.Radius;
            lightRadius.Setter             = (x, v) => x.SyncObject.SendChangeLightRadiusRequest(v);
            lightRadius.Writer             = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.m_light.Range, 1)).Append(" m");
            lightRadius.EnableActions();
            MyTerminalControlFactory.AddControl(lightRadius);

            var lightFalloff = new MyTerminalControlSlider <MyLightingBlock>("Falloff", MySpaceTexts.BlockPropertyTitle_LightFalloff, MySpaceTexts.BlockPropertyDescription_LightFalloff);

            lightFalloff.SetLimits((x) => x.FalloffBounds.Min, (x) => x.FalloffBounds.Max);
            lightFalloff.DefaultValueGetter = (x) => x.FalloffBounds.Default;
            lightFalloff.Getter             = (x) => x.Falloff;
            lightFalloff.Setter             = (x, v) => x.SyncObject.SendChangeLightFalloffRequest(v);
            lightFalloff.Writer             = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.m_light.Falloff, 1));
            lightRadius.EnableActions();
            MyTerminalControlFactory.AddControl(lightFalloff);

            var lightIntensity = new MyTerminalControlSlider <MyLightingBlock>("Intensity", MySpaceTexts.BlockPropertyTitle_LightIntensity, MySpaceTexts.BlockPropertyDescription_LightIntensity);

            lightIntensity.SetLimits((x) => x.IntensityBounds.Min, (x) => x.IntensityBounds.Max);
            lightIntensity.DefaultValueGetter = (x) => x.IntensityBounds.Default;
            lightIntensity.Getter             = (x) => x.Intensity;
            lightIntensity.Setter             = (x, v) => x.SyncObject.SendChangeLightIntensityRequest(v);
            lightIntensity.Writer             = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.Intensity, 1));
            lightRadius.EnableActions();
            MyTerminalControlFactory.AddControl(lightIntensity);

            var lightBlinkTime = new MyTerminalControlSlider <MyLightingBlock>("Blink Interval", MySpaceTexts.BlockPropertyTitle_LightBlinkInterval, MySpaceTexts.BlockPropertyDescription_LightBlinkInterval);

            lightBlinkTime.SetLimits((x) => x.BlinkIntervalSecondsBounds.Min, (x) => x.BlinkIntervalSecondsBounds.Max);
            lightBlinkTime.DefaultValueGetter = (x) => x.BlinkIntervalSecondsBounds.Default;
            lightBlinkTime.Getter             = (x) => x.BlinkIntervalSeconds;
            lightBlinkTime.Setter             = (x, v) => x.SyncObject.SendChangeLightBlinkIntervalRequest(v);
            lightBlinkTime.Writer             = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.BlinkIntervalSeconds, NUM_DECIMALS)).Append(" s");
            lightBlinkTime.EnableActions();
            MyTerminalControlFactory.AddControl(lightBlinkTime);

            var lightBlinkLenght = new MyTerminalControlSlider <MyLightingBlock>("Blink Lenght", MySpaceTexts.BlockPropertyTitle_LightBlinkLenght, MySpaceTexts.BlockPropertyDescription_LightBlinkLenght);

            lightBlinkLenght.SetLimits((x) => x.BlinkLenghtBounds.Min, (x) => x.BlinkLenghtBounds.Max);
            lightBlinkLenght.DefaultValueGetter = (x) => x.BlinkLenghtBounds.Default;
            lightBlinkLenght.Getter             = (x) => x.BlinkLength;
            lightBlinkLenght.Setter             = (x, v) => x.SyncObject.SendChangeLightBlinkLengthRequest(v);
            lightBlinkLenght.Writer             = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.BlinkLength, NUM_DECIMALS)).Append(" %");
            lightBlinkLenght.EnableActions();
            MyTerminalControlFactory.AddControl(lightBlinkLenght);

            var ligthBlinkOffset = new MyTerminalControlSlider <MyLightingBlock>("Blink Offset", MySpaceTexts.BlockPropertyTitle_LightBlinkOffset, MySpaceTexts.BlockPropertyDescription_LightBlinkOffset);

            ligthBlinkOffset.SetLimits((x) => x.BlinkOffsetBounds.Min, (x) => x.BlinkOffsetBounds.Max);
            ligthBlinkOffset.DefaultValueGetter = (x) => x.BlinkOffsetBounds.Default;
            ligthBlinkOffset.Getter             = (x) => x.BlinkOffset;
            ligthBlinkOffset.Setter             = (x, v) => x.SyncObject.SendChangeLightBlinkOffsetRequest(v);
            ligthBlinkOffset.Writer             = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.BlinkOffset, NUM_DECIMALS)).Append(" %");
            ligthBlinkOffset.EnableActions();
            MyTerminalControlFactory.AddControl(ligthBlinkOffset);
        }
Ejemplo n.º 2
0
        static void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated <MyLightingBlock>())
            {
                return;
            }

            var lightColor = new MyTerminalControlColor <MyLightingBlock>("Color", MySpaceTexts.BlockPropertyTitle_LightColor);

            lightColor.Getter = (x) => x.Color;
            lightColor.Setter = (x, v) => x.m_lightColor.Value = v;
            MyTerminalControlFactory.AddControl(lightColor);

            var lightRadius = new MyTerminalControlSlider <MyLightingBlock>("Radius", MySpaceTexts.BlockPropertyTitle_LightRadius, MySpaceTexts.BlockPropertyDescription_LightRadius);

            lightRadius.SetLimits((x) => x.m_light.IsTypeSpot ? x.ReflectorRadiusBounds.Min : x.RadiusBounds.Min,
                                  (x) => x.m_light.IsTypeSpot ? x.ReflectorRadiusBounds.Max : x.RadiusBounds.Max);
            lightRadius.DefaultValueGetter = (x) => x.m_light.IsTypeSpot ? x.ReflectorRadiusBounds.Default : x.RadiusBounds.Default;
            lightRadius.Getter             = (x) => x.m_light.IsTypeSpot ? x.ReflectorRadius : x.Radius;
            lightRadius.Setter             = (x, v) => x.m_lightRadius.Value = v;
            lightRadius.Writer             = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.m_light.IsTypeSpot ? x.m_light.ReflectorRange : x.m_light.Range, 1)).Append(" m");
            lightRadius.EnableActions();
            MyTerminalControlFactory.AddControl(lightRadius);

            var lightFalloff = new MyTerminalControlSlider <MyLightingBlock>("Falloff", MySpaceTexts.BlockPropertyTitle_LightFalloff, MySpaceTexts.BlockPropertyDescription_LightFalloff);

            lightFalloff.SetLimits((x) => x.FalloffBounds.Min, (x) => x.FalloffBounds.Max);
            lightFalloff.DefaultValueGetter = (x) => x.FalloffBounds.Default;
            lightFalloff.Getter             = (x) => x.Falloff;
            lightFalloff.Setter             = (x, v) => x.m_lightFalloff.Value = v;
            lightFalloff.Writer             = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.Falloff, 1));
            lightFalloff.EnableActions();
            MyTerminalControlFactory.AddControl(lightFalloff);

            var lightIntensity = new MyTerminalControlSlider <MyLightingBlock>("Intensity", MySpaceTexts.BlockPropertyTitle_LightIntensity, MySpaceTexts.BlockPropertyDescription_LightIntensity);

            lightIntensity.SetLimits((x) => x.IntensityBounds.Min, (x) => x.IntensityBounds.Max);
            lightIntensity.DefaultValueGetter = (x) => x.IntensityBounds.Default;
            lightIntensity.Getter             = (x) => x.Intensity;
            lightIntensity.Setter             = (x, v) => x.Intensity = v;
            lightIntensity.Writer             = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.Intensity, 1));
            lightIntensity.EnableActions();
            MyTerminalControlFactory.AddControl(lightIntensity);

            var lightBlinkTime = new MyTerminalControlSlider <MyLightingBlock>("Blink Interval", MySpaceTexts.BlockPropertyTitle_LightBlinkInterval, MySpaceTexts.BlockPropertyDescription_LightBlinkInterval);

            lightBlinkTime.SetLimits((x) => x.BlinkIntervalSecondsBounds.Min, (x) => x.BlinkIntervalSecondsBounds.Max);
            lightBlinkTime.DefaultValueGetter = (x) => x.BlinkIntervalSecondsBounds.Default;
            lightBlinkTime.Getter             = (x) => x.BlinkIntervalSeconds;
            lightBlinkTime.Setter             = (x, v) => x.BlinkIntervalSeconds = v;
            lightBlinkTime.Writer             = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.BlinkIntervalSeconds, NUM_DECIMALS)).Append(" s");
            lightBlinkTime.EnableActions();
            MyTerminalControlFactory.AddControl(lightBlinkTime);

            var lightBlinkLenght = new MyTerminalControlSlider <MyLightingBlock>("Blink Lenght", MySpaceTexts.BlockPropertyTitle_LightBlinkLenght, MySpaceTexts.BlockPropertyDescription_LightBlinkLenght);

            lightBlinkLenght.SetLimits((x) => x.BlinkLenghtBounds.Min, (x) => x.BlinkLenghtBounds.Max);
            lightBlinkLenght.DefaultValueGetter = (x) => x.BlinkLenghtBounds.Default;
            lightBlinkLenght.Getter             = (x) => x.BlinkLength;
            lightBlinkLenght.Setter             = (x, v) => x.BlinkLength = v;
            lightBlinkLenght.Writer             = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.BlinkLength, NUM_DECIMALS)).Append(" %");
            lightBlinkLenght.EnableActions();
            MyTerminalControlFactory.AddControl(lightBlinkLenght);

            var ligthBlinkOffset = new MyTerminalControlSlider <MyLightingBlock>("Blink Offset", MySpaceTexts.BlockPropertyTitle_LightBlinkOffset, MySpaceTexts.BlockPropertyDescription_LightBlinkOffset);

            ligthBlinkOffset.SetLimits((x) => x.BlinkOffsetBounds.Min, (x) => x.BlinkOffsetBounds.Max);
            ligthBlinkOffset.DefaultValueGetter = (x) => x.BlinkOffsetBounds.Default;
            ligthBlinkOffset.Getter             = (x) => x.BlinkOffset;
            ligthBlinkOffset.Setter             = (x, v) => x.BlinkOffset = v;
            ligthBlinkOffset.Writer             = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.BlinkOffset, NUM_DECIMALS)).Append(" %");
            ligthBlinkOffset.EnableActions();
            MyTerminalControlFactory.AddControl(ligthBlinkOffset);
        }
Ejemplo n.º 3
0
        static MyLightingBlock()
        {
            var lightColor = new MyTerminalControlColor<MyLightingBlock>("Color", MySpaceTexts.BlockPropertyTitle_LightColor);
            lightColor.Getter = (x) => x.Color;
            lightColor.Setter = (x, v) => x.m_lightColor.Value = v;
            MyTerminalControlFactory.AddControl(lightColor);

            var lightRadius = new MyTerminalControlSlider<MyLightingBlock>("Radius", MySpaceTexts.BlockPropertyTitle_LightRadius, MySpaceTexts.BlockPropertyDescription_LightRadius);
            lightRadius.SetLimits((x) => x.RadiusBounds.Min, (x) => x.RadiusBounds.Max);
            lightRadius.DefaultValueGetter = (x) => x.RadiusBounds.Default;
            lightRadius.Getter = (x) => x.Radius;
            lightRadius.Setter = (x, v) => x.m_lightRadius.Value = v;
            lightRadius.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.m_light.Range, 1)).Append(" m");
            lightRadius.EnableActions();
            MyTerminalControlFactory.AddControl(lightRadius);

            var lightFalloff = new MyTerminalControlSlider<MyLightingBlock>("Falloff", MySpaceTexts.BlockPropertyTitle_LightFalloff, MySpaceTexts.BlockPropertyDescription_LightFalloff);
            lightFalloff.SetLimits((x) => x.FalloffBounds.Min, (x) => x.FalloffBounds.Max);
            lightFalloff.DefaultValueGetter = (x) => x.FalloffBounds.Default;
            lightFalloff.Getter = (x) => x.Falloff;
            lightFalloff.Setter = (x, v) => x.m_lightFalloff.Value = v;
            lightFalloff.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.m_light.Falloff, 1));
            lightRadius.EnableActions();
            MyTerminalControlFactory.AddControl(lightFalloff);

            var lightIntensity = new MyTerminalControlSlider<MyLightingBlock>("Intensity", MySpaceTexts.BlockPropertyTitle_LightIntensity, MySpaceTexts.BlockPropertyDescription_LightIntensity);
            lightIntensity.SetLimits((x) => x.IntensityBounds.Min, (x) => x.IntensityBounds.Max);
            lightIntensity.DefaultValueGetter = (x) => x.IntensityBounds.Default;
            lightIntensity.Getter = (x) => x.Intensity;
            lightIntensity.Setter = (x, v) => x.Intensity = v;
            lightIntensity.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.Intensity, 1));
            lightRadius.EnableActions();
            MyTerminalControlFactory.AddControl(lightIntensity);

            var lightBlinkTime = new MyTerminalControlSlider<MyLightingBlock>("Blink Interval", MySpaceTexts.BlockPropertyTitle_LightBlinkInterval, MySpaceTexts.BlockPropertyDescription_LightBlinkInterval);
            lightBlinkTime.SetLimits((x) => x.BlinkIntervalSecondsBounds.Min, (x) => x.BlinkIntervalSecondsBounds.Max);
            lightBlinkTime.DefaultValueGetter = (x) => x.BlinkIntervalSecondsBounds.Default;
            lightBlinkTime.Getter = (x) => x.BlinkIntervalSeconds;
            lightBlinkTime.Setter = (x, v) => x.BlinkIntervalSeconds = v;
            lightBlinkTime.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.BlinkIntervalSeconds, NUM_DECIMALS)).Append(" s");
            lightBlinkTime.EnableActions();
            MyTerminalControlFactory.AddControl(lightBlinkTime);

            var lightBlinkLenght = new MyTerminalControlSlider<MyLightingBlock>("Blink Lenght", MySpaceTexts.BlockPropertyTitle_LightBlinkLenght, MySpaceTexts.BlockPropertyDescription_LightBlinkLenght);
            lightBlinkLenght.SetLimits((x) => x.BlinkLenghtBounds.Min, (x) => x.BlinkLenghtBounds.Max);
            lightBlinkLenght.DefaultValueGetter = (x) => x.BlinkLenghtBounds.Default;
            lightBlinkLenght.Getter = (x) => x.BlinkLength;
            lightBlinkLenght.Setter = (x, v) => x.BlinkLength = v;
            lightBlinkLenght.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.BlinkLength, NUM_DECIMALS)).Append(" %");
            lightBlinkLenght.EnableActions();
            MyTerminalControlFactory.AddControl(lightBlinkLenght);

            var ligthBlinkOffset = new MyTerminalControlSlider<MyLightingBlock>("Blink Offset", MySpaceTexts.BlockPropertyTitle_LightBlinkOffset, MySpaceTexts.BlockPropertyDescription_LightBlinkOffset);
            ligthBlinkOffset.SetLimits((x) => x.BlinkOffsetBounds.Min, (x) => x.BlinkOffsetBounds.Max);
            ligthBlinkOffset.DefaultValueGetter = (x) => x.BlinkOffsetBounds.Default;
            ligthBlinkOffset.Getter = (x) => x.BlinkOffset;
            ligthBlinkOffset.Setter = (x, v) => x.BlinkOffset = v;
            ligthBlinkOffset.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.BlinkOffset, NUM_DECIMALS)).Append(" %");
            ligthBlinkOffset.EnableActions();
            MyTerminalControlFactory.AddControl(ligthBlinkOffset);
        }
Ejemplo n.º 4
0
        static MyTextPanel()
        {
            var publicTitleField = new MyTerminalControlTextbox <MyTextPanel>("PublicTitle", MySpaceTexts.BlockPropertyTitle_TextPanelPublicTitle, MySpaceTexts.Blank);

            publicTitleField.Getter = (x) => x.PublicTitle;
            publicTitleField.Setter = (x, v) => x.SyncObject.SendChangeTitleMessage(v, true);
            publicTitleField.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(publicTitleField);

            var showPublicButton = new MyTerminalControlButton <MyTextPanel>("ShowPublicTextPanel", MySpaceTexts.BlockPropertyTitle_TextPanelShowPublicTextPanel, MySpaceTexts.Blank, (x) => x.OpenWindow(true, true, true));

            showPublicButton.Enabled = (x) => !x.IsOpen;
            showPublicButton.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(showPublicButton);

            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator <MyTextPanel>());

            var titleField = new MyTerminalControlTextbox <MyTextPanel>("Title", MySpaceTexts.BlockPropertyTitle_TextPanelTitle, MySpaceTexts.Blank);

            titleField.Getter = (x) => x.PrivateTitle;
            titleField.Setter = (x, v) => x.SyncObject.SendChangeTitleMessage(v, false);
            titleField.SupportsMultipleBlocks = false;

            MyTerminalControlFactory.AddControl(titleField);

            var showButton = new MyTerminalControlButton <MyTextPanel>("ShowTextPanel", MySpaceTexts.BlockPropertyTitle_TextPanelShowTextPanel, MySpaceTexts.Blank, (x) => x.OpenWindow(true, true, false));

            showButton.Enabled = (x) => !x.IsOpen;
            showButton.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(showButton);

            var comboAccess = new MyTerminalControlCombobox <MyTextPanel>("Access", MySpaceTexts.BlockPropertyTitle_TextPanelAccessType, MySpaceTexts.Blank);

            comboAccess.ComboBoxContent = (x) => FillComboBoxContent(x);
            comboAccess.Getter          = (x) => (long)x.AccessFlag;
            comboAccess.Setter          = (x, y) => x.SyncObject.SendChangeAccessFlagMessage((byte)y);
            comboAccess.Enabled         = (x) => x.OwnerId != 0;
            MyTerminalControlFactory.AddControl(comboAccess);
            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator <MyTextPanel>());

            var showTextOnScreen = new MyTerminalControlCombobox <MyTextPanel>("ShowTextOnScreen", MySpaceTexts.BlockPropertyTitle_ShowTextOnScreen, MySpaceTexts.Blank);

            showTextOnScreen.ComboBoxContent = (x) => FillShowOnScreenComboBoxContent(x);
            showTextOnScreen.Getter          = (x) => (long)x.ShowTextFlag;
            showTextOnScreen.Setter          = (x, y) => x.SyncObject.SendShowOnScreenChangeRequest((byte)y);
            showTextOnScreen.Enabled         = (x) => x.OwnerId != 0;

            MyTerminalControlFactory.AddControl(showTextOnScreen);

            var changeFontSlider = new MyTerminalControlSlider <MyTextPanel>("FontSize", MySpaceTexts.BlockPropertyTitle_LCDScreenTextSize, MySpaceTexts.Blank);

            changeFontSlider.SetLimits(0.1f, 10.0f);
            changeFontSlider.DefaultValue = 1.0f;
            changeFontSlider.Getter       = (x) => x.FontSize;
            changeFontSlider.Setter       = (x, v) => x.SyncObject.SendFontSizeChangeRequest(v);
            changeFontSlider.Writer       = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.FontSize, 1));
            changeFontSlider.EnableActions();
            MyTerminalControlFactory.AddControl(changeFontSlider);

            var fontColor = new MyTerminalControlColor <MyTextPanel>("FontColor", MySpaceTexts.BlockPropertyTitle_FontColor);

            fontColor.Getter = (x) => x.FontColor;
            fontColor.Setter = (x, v) => x.SyncObject.SendChangeFontColorRequest(v);
            MyTerminalControlFactory.AddControl(fontColor);

            var backgroundColor = new MyTerminalControlColor <MyTextPanel>("BackgroundColor", MySpaceTexts.BlockPropertyTitle_BackgroundColor);

            backgroundColor.Getter = (x) => x.BackgroundColor;
            backgroundColor.Setter = (x, v) => x.SyncObject.SendChangeBackgroundColorRequest(v);
            MyTerminalControlFactory.AddControl(backgroundColor);

            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator <MyTextPanel>());

            var imagesList = new MyTerminalControlListbox <MyTextPanel>("ImageList", MySpaceTexts.BlockPropertyTitle_LCDScreenDefinitionsTextures, MySpaceTexts.Blank, true);

            imagesList.ListContent  = (x, list1, list2) => x.FillListContent(list1, list2);
            imagesList.ItemSelected = (x, y) => x.SelectImageToDraw(y);
            MyTerminalControlFactory.AddControl(imagesList);

            var addToSelectionButton = new MyTerminalControlButton <MyTextPanel>("SelectTextures", MySpaceTexts.BlockPropertyTitle_LCDScreenSelectTextures, MySpaceTexts.Blank, (x) => x.AddImagesToSelection());

            MyTerminalControlFactory.AddControl(addToSelectionButton);

            var changeIntervalSlider = new MyTerminalControlSlider <MyTextPanel>("ChangeIntervalSlider", MySpaceTexts.BlockPropertyTitle_LCDScreenRefreshInterval, MySpaceTexts.Blank);

            changeIntervalSlider.SetLimits(0, 30.0f);
            changeIntervalSlider.DefaultValue = 0;
            changeIntervalSlider.Getter       = (x) => x.ChangeInterval;
            changeIntervalSlider.Setter       = (x, v) => x.SyncObject.SendIntervalChangeRequest(v);
            changeIntervalSlider.Writer       = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.ChangeInterval, NUM_DECIMALS)).Append(" s");
            changeIntervalSlider.EnableActions();
            MyTerminalControlFactory.AddControl(changeIntervalSlider);

            var selectedImagesList = new MyTerminalControlListbox <MyTextPanel>("SelectedImageList", MySpaceTexts.BlockPropertyTitle_LCDScreenSelectedTextures, MySpaceTexts.Blank, true);

            selectedImagesList.ListContent  = (x, list1, list2) => x.FillSelectedListContent(list1, list2);
            selectedImagesList.ItemSelected = (x, y) => x.SelectImage(y);
            MyTerminalControlFactory.AddControl(selectedImagesList);

            var removeSelectedButton = new MyTerminalControlButton <MyTextPanel>("RemoveSelectedTextures", MySpaceTexts.BlockPropertyTitle_LCDScreenRemoveSelectedTextures, MySpaceTexts.Blank, (x) => x.RemoveImagesFromSelection());

            MyTerminalControlFactory.AddControl(removeSelectedButton);
        }
Ejemplo n.º 5
0
        static void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated<MyTextPanel>())
                return;

            var publicTitleField = new MyTerminalControlTextbox<MyTextPanel>("PublicTitle", MySpaceTexts.BlockPropertyTitle_TextPanelPublicTitle, MySpaceTexts.Blank);
            publicTitleField.Getter = (x) => x.PublicTitle;
            publicTitleField.Setter = (x, v) => x.SendChangeTitleMessage(v, true);
            publicTitleField.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(publicTitleField);

            var showPublicButton = new MyTerminalControlButton<MyTextPanel>("ShowPublicTextPanel", MySpaceTexts.BlockPropertyTitle_TextPanelShowPublicTextPanel, MySpaceTexts.Blank, (x) => x.OpenWindow(true, true, true));
            showPublicButton.Enabled = (x) => !x.IsOpen;
            showPublicButton.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(showPublicButton);

            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator<MyTextPanel>());

            var titleField = new MyTerminalControlTextbox<MyTextPanel>("Title", MySpaceTexts.BlockPropertyTitle_TextPanelTitle, MySpaceTexts.Blank);
            titleField.Getter = (x) => x.PrivateTitle;
            titleField.Setter = (x, v) => x.SendChangeTitleMessage(v, false);
            titleField.SupportsMultipleBlocks = false;

            MyTerminalControlFactory.AddControl(titleField);

            var showButton = new MyTerminalControlButton<MyTextPanel>("ShowTextPanel", MySpaceTexts.BlockPropertyTitle_TextPanelShowTextPanel, MySpaceTexts.Blank, (x) => x.OpenWindow(true, true, false));
            showButton.Enabled = (x) => !x.IsOpen;
            showButton.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(showButton);

            var comboAccess = new MyTerminalControlCombobox<MyTextPanel>("Access", MySpaceTexts.BlockPropertyTitle_TextPanelAccessType, MySpaceTexts.Blank);
            comboAccess.ComboBoxContent = (x) => FillComboBoxContent(x);
            comboAccess.Getter = (x) => (long)x.AccessFlag;
            comboAccess.Setter = (x, y) => x.AccessFlag = (TextPanelAccessFlag)y;
            comboAccess.Enabled = (x) => x.OwnerId != 0;
            comboAccess.SetSerializerRange(0, (int)TextPanelAccessFlag.READ_AND_WRITE_ALL);
            MyTerminalControlFactory.AddControl(comboAccess);
            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator<MyTextPanel>());

            var showTextOnScreen = new MyTerminalControlCombobox<MyTextPanel>("ShowTextOnScreen", MySpaceTexts.BlockPropertyTitle_ShowTextOnScreen, MySpaceTexts.Blank);
            showTextOnScreen.ComboBoxContent = (x) => FillShowOnScreenComboBoxContent(x);
            showTextOnScreen.Getter = (x) => (long)x.ShowTextFlag;
            showTextOnScreen.Setter = (x, y) => x.ShowTextFlag = (ShowTextOnScreenFlag)y;
            showTextOnScreen.Enabled = (x) => x.OwnerId != 0;

            MyTerminalControlFactory.AddControl(showTextOnScreen);

            var changeFontSlider = new MyTerminalControlSlider<MyTextPanel>("FontSize", MySpaceTexts.BlockPropertyTitle_LCDScreenTextSize, MySpaceTexts.Blank);
            changeFontSlider.SetLimits(0.1f, 10.0f);
            changeFontSlider.DefaultValue = 1.0f;
            changeFontSlider.Getter = (x) => x.FontSize;
            changeFontSlider.Setter = (x, v) => x.FontSize = v;
            changeFontSlider.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.FontSize, 1));
            changeFontSlider.EnableActions();
            MyTerminalControlFactory.AddControl(changeFontSlider);

            var fontColor = new MyTerminalControlColor<MyTextPanel>("FontColor", MySpaceTexts.BlockPropertyTitle_FontColor);
            fontColor.Getter = (x) => x.FontColor;
            fontColor.Setter = (x, v) => x.FontColor = v;
            MyTerminalControlFactory.AddControl(fontColor);

            var backgroundColor = new MyTerminalControlColor<MyTextPanel>("BackgroundColor", MySpaceTexts.BlockPropertyTitle_BackgroundColor);
            backgroundColor.Getter = (x) => x.BackgroundColor;
            backgroundColor.Setter = (x, v) => x.BackgroundColor = v;
            MyTerminalControlFactory.AddControl(backgroundColor);

            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator<MyTextPanel>());

            var imagesList = new MyTerminalControlListbox<MyTextPanel>("ImageList", MySpaceTexts.BlockPropertyTitle_LCDScreenDefinitionsTextures, MySpaceTexts.Blank, true);
            imagesList.ListContent = (x, list1, list2) => x.FillListContent(list1, list2);
            imagesList.ItemSelected = (x, y) => x.SelectImageToDraw(y);
            MyTerminalControlFactory.AddControl(imagesList);

            var addToSelectionButton = new MyTerminalControlButton<MyTextPanel>("SelectTextures", MySpaceTexts.BlockPropertyTitle_LCDScreenSelectTextures, MySpaceTexts.Blank, (x) => x.AddImagesToSelection());
            MyTerminalControlFactory.AddControl(addToSelectionButton);

            var changeIntervalSlider = new MyTerminalControlSlider<MyTextPanel>("ChangeIntervalSlider", MySpaceTexts.BlockPropertyTitle_LCDScreenRefreshInterval, MySpaceTexts.Blank);
            changeIntervalSlider.SetLimits(0, 30.0f);
            changeIntervalSlider.DefaultValue = 0;
            changeIntervalSlider.Getter = (x) => x.ChangeInterval;
            changeIntervalSlider.Setter = (x, v) => x.ChangeInterval = v;
            changeIntervalSlider.Writer = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.ChangeInterval, NUM_DECIMALS)).Append(" s");
            changeIntervalSlider.EnableActions();
            MyTerminalControlFactory.AddControl(changeIntervalSlider);

            var selectedImagesList = new MyTerminalControlListbox<MyTextPanel>("SelectedImageList", MySpaceTexts.BlockPropertyTitle_LCDScreenSelectedTextures, MySpaceTexts.Blank, true);
            selectedImagesList.ListContent = (x, list1, list2) => x.FillSelectedListContent(list1, list2);
            selectedImagesList.ItemSelected = (x, y) => x.SelectImage(y);
            MyTerminalControlFactory.AddControl(selectedImagesList);

            var removeSelectedButton = new MyTerminalControlButton<MyTextPanel>("RemoveSelectedTextures", MySpaceTexts.BlockPropertyTitle_LCDScreenRemoveSelectedTextures, MySpaceTexts.Blank, (x) => x.RemoveImagesFromSelection());
            MyTerminalControlFactory.AddControl(removeSelectedButton);
        }
Ejemplo n.º 6
0
        protected override void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated <MyTextPanel>())
            {
                return;
            }
            base.CreateTerminalControls();
            var publicTitleField = new MyTerminalControlTextbox <MyTextPanel>("Title", MySpaceTexts.BlockPropertyTitle_TextPanelPublicTitle, MySpaceTexts.Blank);

            publicTitleField.Getter = (x) => x.PublicTitle;
            publicTitleField.Setter = (x, v) => x.SendChangeTitleMessage(v, true);
            publicTitleField.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(publicTitleField);

            var showPublicButton = new MyTerminalControlButton <MyTextPanel>("ShowTextPanel", MySpaceTexts.BlockPropertyTitle_TextPanelShowPublicTextPanel, MySpaceTexts.Blank, (x) => x.OpenWindow(true, true, true));

            showPublicButton.Enabled = (x) => !x.IsOpen;
            showPublicButton.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(showPublicButton);

            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator <MyTextPanel>());

            var showTextOnScreen = new MyTerminalControlOnOffSwitch <MyTextPanel>("ShowTextOnScreen", MySpaceTexts.BlockPropertyTitle_ShowTextOnScreen, MySpaceTexts.Blank);

            showTextOnScreen.Getter = (x) => x.ShowTextFlag != ShowTextOnScreenFlag.NONE;
            showTextOnScreen.Setter = (x, y) => x.ShowTextFlag = y ? ShowTextOnScreenFlag.PUBLIC : ShowTextOnScreenFlag.NONE;

            MyTerminalControlFactory.AddControl(showTextOnScreen);


            var comboFont = new MyTerminalControlCombobox <MyTextPanel>("Font", MySpaceTexts.BlockPropertyTitle_Font, MySpaceTexts.Blank);

            comboFont.ComboBoxContent = (x) => FillFontComboBoxContent(x);
            comboFont.Getter          = (x) => (long)x.Font.SubtypeId;
            comboFont.Setter          = (x, y) => x.Font = new MyDefinitionId(typeof(MyObjectBuilder_FontDefinition), MyStringHash.TryGet((int)y));
            MyTerminalControlFactory.AddControl(comboFont);
            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator <MyTextPanel>());

            var changeFontSlider = new MyTerminalControlSlider <MyTextPanel>("FontSize", MySpaceTexts.BlockPropertyTitle_LCDScreenTextSize, MySpaceTexts.Blank);

            changeFontSlider.SetLimits(0.1f, 10.0f);
            changeFontSlider.DefaultValue = 1.0f;
            changeFontSlider.Getter       = (x) => x.FontSize;
            changeFontSlider.Setter       = (x, v) => x.FontSize = v;
            changeFontSlider.Writer       = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.FontSize, NUM_DECIMALS));
            changeFontSlider.EnableActions();
            MyTerminalControlFactory.AddControl(changeFontSlider);

            var fontColor = new MyTerminalControlColor <MyTextPanel>("FontColor", MySpaceTexts.BlockPropertyTitle_FontColor);

            fontColor.Getter = (x) => x.FontColor;
            fontColor.Setter = (x, v) => x.FontColor = v;
            MyTerminalControlFactory.AddControl(fontColor);

            var backgroundColor = new MyTerminalControlColor <MyTextPanel>("BackgroundColor", MySpaceTexts.BlockPropertyTitle_BackgroundColor);

            backgroundColor.Getter = (x) => x.BackgroundColor;
            backgroundColor.Setter = (x, v) => x.BackgroundColor = v;
            MyTerminalControlFactory.AddControl(backgroundColor);

            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator <MyTextPanel>());

            var imagesList = new MyTerminalControlListbox <MyTextPanel>("ImageList", MySpaceTexts.BlockPropertyTitle_LCDScreenDefinitionsTextures, MySpaceTexts.Blank, true);

            imagesList.ListContent  = (x, list1, list2) => x.FillListContent(list1, list2);
            imagesList.ItemSelected = (x, y) => x.SelectImageToDraw(y);
            MyTerminalControlFactory.AddControl(imagesList);

            var addToSelectionButton = new MyTerminalControlButton <MyTextPanel>("SelectTextures", MySpaceTexts.BlockPropertyTitle_LCDScreenSelectTextures, MySpaceTexts.Blank, (x) => x.AddImagesToSelection());

            MyTerminalControlFactory.AddControl(addToSelectionButton);

            var changeIntervalSlider = new MyTerminalControlSlider <MyTextPanel>("ChangeIntervalSlider", MySpaceTexts.BlockPropertyTitle_LCDScreenRefreshInterval, MySpaceTexts.Blank);

            changeIntervalSlider.SetLimits(0, 30.0f);
            changeIntervalSlider.DefaultValue = 0;
            changeIntervalSlider.Getter       = (x) => x.ChangeInterval;
            changeIntervalSlider.Setter       = (x, v) => x.ChangeInterval = v;
            changeIntervalSlider.Writer       = (x, result) => result.Append(MyValueFormatter.GetFormatedFloat(x.ChangeInterval, NUM_DECIMALS)).Append(" s");
            changeIntervalSlider.EnableActions();
            MyTerminalControlFactory.AddControl(changeIntervalSlider);

            var selectedImagesList = new MyTerminalControlListbox <MyTextPanel>("SelectedImageList", MySpaceTexts.BlockPropertyTitle_LCDScreenSelectedTextures, MySpaceTexts.Blank, true);

            selectedImagesList.ListContent  = (x, list1, list2) => x.FillSelectedListContent(list1, list2);
            selectedImagesList.ItemSelected = (x, y) => x.SelectImage(y);
            MyTerminalControlFactory.AddControl(selectedImagesList);

            var removeSelectedButton = new MyTerminalControlButton <MyTextPanel>("RemoveSelectedTextures", MySpaceTexts.BlockPropertyTitle_LCDScreenRemoveSelectedTextures, MySpaceTexts.Blank, (x) => x.RemoveImagesFromSelection());

            MyTerminalControlFactory.AddControl(removeSelectedButton);
        }