예제 #1
0
        protected override void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated <MyBeacon>())
            {
                return;
            }
            base.CreateTerminalControls();
            //MyTerminalControlFactory.RemoveBaseClass<MyBeacon, MyTerminalBlock>(); // this removed also controls shared with other blocks

            //removed unnecessary controls
            var controlList = MyTerminalControlFactory.GetList(typeof(MyBeacon)).Controls;

            controlList.Remove(controlList[4]); //name
            controlList.Remove(controlList[4]); //show on HUD

            var customName = new MyTerminalControlTextbox <MyBeacon>("CustomName", MyCommonTexts.Name, MySpaceTexts.Blank);

            customName.Getter = (x) => x.CustomName;
            customName.Setter = (x, v) => x.SetCustomName(v);
            customName.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(customName);
            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator <MyBeacon>());

            var broadcastRadius = new MyTerminalControlSlider <MyBeacon>("Radius", MySpaceTexts.BlockPropertyTitle_BroadcastRadius, MySpaceTexts.BlockPropertyDescription_BroadcastRadius);

            broadcastRadius.SetLogLimits(1, MyEnergyConstants.MAX_RADIO_POWER_RANGE);
            broadcastRadius.DefaultValue = 10000;
            broadcastRadius.Getter       = (x) => x.RadioBroadcaster.BroadcastRadius;
            broadcastRadius.Setter       = (x, v) => x.m_radius.Value = v;
            broadcastRadius.Writer       = (x, result) => result.Append(new StringBuilder().AppendDecimal(x.RadioBroadcaster.BroadcastRadius, 0).Append(" m"));
            broadcastRadius.EnableActions();
            MyTerminalControlFactory.AddControl(broadcastRadius);
        }
예제 #2
0
 protected override void CreateTerminalControls()
 {
     if (!MyTerminalControlFactory.AreControlsCreated <MyBeacon>())
     {
         base.CreateTerminalControls();
         MyTerminalControlFactory.GetList(typeof(MyBeacon)).Controls.Remove(MyTerminalControlFactory.GetList(typeof(MyBeacon)).Controls[5]);
         MyTerminalControlFactory.GetList(typeof(MyBeacon)).Controls.Remove(MyTerminalControlFactory.GetList(typeof(MyBeacon)).Controls[5]);
         MyTerminalControlTextbox <MyBeacon> textbox3 = new MyTerminalControlTextbox <MyBeacon>("CustomName", MyCommonTexts.Name, MySpaceTexts.Blank);
         MyTerminalControlTextbox <MyBeacon> textbox4 = new MyTerminalControlTextbox <MyBeacon>("CustomName", MyCommonTexts.Name, MySpaceTexts.Blank);
         textbox4.Getter = x => x.CustomName;
         MyTerminalControlTextbox <MyBeacon> local24 = textbox4;
         MyTerminalControlTextbox <MyBeacon> local25 = textbox4;
         local25.Setter = (x, v) => x.SetCustomName(v);
         MyTerminalControlTextbox <MyBeacon> control = local25;
         control.SupportsMultipleBlocks = false;
         MyTerminalControlFactory.AddControl <MyBeacon>(control);
         MyTerminalControlFactory.AddControl <MyBeacon>(new MyTerminalControlSeparator <MyBeacon>());
         MyTerminalControlTextbox <MyBeacon> textbox1 = new MyTerminalControlTextbox <MyBeacon>("HudText", MySpaceTexts.BlockPropertiesTitle_HudText, MySpaceTexts.BlockPropertiesTitle_HudText_Tooltip);
         MyTerminalControlTextbox <MyBeacon> textbox2 = new MyTerminalControlTextbox <MyBeacon>("HudText", MySpaceTexts.BlockPropertiesTitle_HudText, MySpaceTexts.BlockPropertiesTitle_HudText_Tooltip);
         textbox2.Getter = x => x.HudText;
         MyTerminalControlTextbox <MyBeacon> local22 = textbox2;
         MyTerminalControlTextbox <MyBeacon> local23 = textbox2;
         local23.Setter = (x, v) => x.SetHudText(v);
         MyTerminalControlTextbox <MyBeacon> local6 = local23;
         local6.SupportsMultipleBlocks = false;
         MyTerminalControlFactory.AddControl <MyBeacon>(local6);
         MyTerminalControlSlider <MyBeacon> slider1 = new MyTerminalControlSlider <MyBeacon>("Radius", MySpaceTexts.BlockPropertyTitle_BroadcastRadius, MySpaceTexts.BlockPropertyDescription_BroadcastRadius);
         MyTerminalControlSlider <MyBeacon> slider2 = new MyTerminalControlSlider <MyBeacon>("Radius", MySpaceTexts.BlockPropertyTitle_BroadcastRadius, MySpaceTexts.BlockPropertyDescription_BroadcastRadius);
         slider2.SetLogLimits(x => 1f, x => (x.BlockDefinition as MyBeaconDefinition).MaxBroadcastRadius);
         MyTerminalValueControl <MyBeacon, float> .GetterDelegate local20 = (MyTerminalValueControl <MyBeacon, float> .GetterDelegate)slider2;
         MyTerminalValueControl <MyBeacon, float> .GetterDelegate local21 = (MyTerminalValueControl <MyBeacon, float> .GetterDelegate)slider2;
         local21.DefaultValueGetter = x => (x.BlockDefinition as MyBeaconDefinition).MaxBroadcastRadius / 10f;
         MyTerminalValueControl <MyBeacon, float> .GetterDelegate local18 = local21;
         MyTerminalValueControl <MyBeacon, float> .GetterDelegate local19 = local21;
         local19.Getter = x => x.RadioBroadcaster.BroadcastRadius;
         MyTerminalValueControl <MyBeacon, float> .GetterDelegate local16 = local19;
         MyTerminalValueControl <MyBeacon, float> .GetterDelegate local17 = local19;
         local17.Setter = (x, v) => x.m_radius.Value = v;
         MyTerminalValueControl <MyBeacon, float> .GetterDelegate local14 = local17;
         MyTerminalValueControl <MyBeacon, float> .GetterDelegate local15 = local17;
         local15.Writer = (x, result) => result.AppendDecimal(x.RadioBroadcaster.BroadcastRadius, 0).Append(" m");
         MyTerminalValueControl <MyBeacon, float> .GetterDelegate local13 = local15;
         ((MyTerminalControlSlider <MyBeacon>)local13).EnableActions <MyBeacon>(0.05f, null, null);
         MyTerminalControlFactory.AddControl <MyBeacon>((MyTerminalControl <MyBeacon>)local13);
     }
 }