示例#1
0
        /// <summary>
        /// Appends a <paramref name="setting"/> in the form <code>SettingName = SettingValue</code>.
        /// The setting will be written only if the value is different from the default value in the
        /// corresponding <paramref name="parameter"/>.
        /// </summary>
        /// <param name="setting"></param>
        /// <param name="parameter"></param>
        public LoliCodeWriter AppendSetting(BlockSetting setting, BlockParameter parameter = null,
                                            int spaces = 2, bool printDefaults = false)
        {
            if (parameter == null)
            {
                AppendLine($"{setting.Name} = {GetSettingValue(setting)}", spaces);
                return(this);
            }

            var isDefaultValue = setting.FixedSetting switch
            {
                StringSetting x => x.Value == (parameter as StringParameter).DefaultValue,
                IntSetting x => x.Value == (parameter as IntParameter).DefaultValue,
                FloatSetting x => x.Value == (parameter as FloatParameter).DefaultValue,
                BoolSetting x => x.Value == (parameter as BoolParameter).DefaultValue,
                ByteArraySetting x => Compare(x.Value, (parameter as ByteArrayParameter).DefaultValue),
                ListOfStringsSetting x => Compare(x.Value, (parameter as ListOfStringsParameter).DefaultValue),
                DictionaryOfStringsSetting x =>
                Compare(x.Value?.Keys, (parameter as DictionaryOfStringsParameter).DefaultValue?.Keys) &&
                Compare(x.Value?.Values, (parameter as DictionaryOfStringsParameter).DefaultValue?.Values),
                EnumSetting x => x.Value == (parameter as EnumParameter).DefaultValue,
                _ => throw new NotImplementedException(),
            };

            if (setting.InputMode != SettingInputMode.Fixed || !isDefaultValue || printDefaults)
            {
                AppendLine($"{parameter.Name} = {GetSettingValue(setting)}", spaces);
            }

            return(this);
        }
示例#2
0
        protected IBoolSetting GetBoolSetting(int key, bool defaultValue)
        {
            var setting = new BoolSetting(this.data.BooleanValues, key, defaultValue);

            this.settings.Add(setting);
            return(setting);
        }
示例#3
0
 public override void OnLoad(int version, int subversion, int buildversion)
 {
     this.Setting = new IPluginSetting[4];
     Setting[0]   = new NumberSetting("Eat when hunger is below X", "When should the bot eat normal food (-1 if it shouldn't eat them).", -1, -1, 19, 1);
     Setting[1]   = new NumberSetting("Eat gapples when below X hp", "When should the bot eat golden apples (-1 if it shouldn't eat them).", -1, -1, 19, 1);
     Setting[2]   = new ComboSetting("Mode", null, new string[] { "Efficient", "Accurate" }, 0);
     Setting[3]   = new BoolSetting("Soup", "Can the bot use soup for healing?", false);
 }
示例#4
0
        public void TestThatGenericGetSettingReturnsNullWhenSettingIsNotFound()
        {
            BasicToolbar toolbar = new BasicToolbar();

            BoolSetting actual = toolbar.GetSetting <BoolSetting>("invalid");

            Assert.Null(actual);
        }
 public override void OnLoad(int version, int subversion, int buildversion)
 {
     this.Setting = new IPluginSetting[4];
     Setting[0]   = new BoolSetting("Strength", null, true);
     Setting[1]   = new BoolSetting("Speed", null, true);
     Setting[2]   = new BoolSetting("Fire resistance", null, true);
     Setting[3]   = new NumberSetting("Health", "At how much health should the bot use health potions.", 10, -1, 20, 1);
 }
示例#6
0
 public override void OnLoad(int version, int subversion, int buildversion)
 {
     this.Setting = new IPluginSetting[4];
     Setting[0]   = new BoolSetting("Keep rotation", "Should the bot not change it's head rotation?", false);
     Setting[1]   = new ComboSetting("Sensitivity", null, new string[] { "High", "Medium", "Low" }, 1);
     Setting[2]   = new ComboSetting("Reaction speed", null, new string[] { "Fast", "Medium", "Slow" }, 1);
     Setting[3]   = new BoolSetting("Diconnect on TNT detect", "Should the bot disconnect if it detects tnt nearby (mcmmo plugin)", false);
 }
示例#7
0
        public void SettingChanged()
        {
            BoolSetting channelSetting = Settings.Instance.GetSetting <BoolSetting>("debug_" + channelPrefix);

            if (channelSetting != null)
            {
                enabled = channelSetting.Value;
            }
        }
 public override void OnLoad(int version, int subversion, int buildversion)
 {
     this.Setting = new IPluginSetting[5];
     Setting[0]   = new PathSetting("Text file path", "Picks lines from the selected file to spam.", "");
     Setting[1]   = new NumberSetting("Min delay", "", 1000, 0, 60 * 60 * 60);
     Setting[2]   = new NumberSetting("Max delay", "(-1 to always use 'Min delay')", -1, -1, 60 * 60 * 60);
     Setting[3]   = new BoolSetting("Anti-spam", "Should random numbers be added at the end?", false);
     Setting[4]   = new BoolSetting("Random lines", "Should it pick a random line each time or go top to bottom?", true);
 }
 public override void OnLoad(int version, int subversion, int buildversion)
 {
     this.Setting = new IPluginSetting[5];
     Setting[0]   = new StringSetting("Start x y z", "", "0 0 0");
     Setting[1]   = new StringSetting("End x y z", "", "0 0 0");
     Setting[2]   = new ComboSetting("Mode", null, new string[] { "Fast", "Accurate" }, 1);
     Setting[3]   = new BoolSetting("Sand walking", "Can the bot walk on sand (might cause it falling off with multiple bots)", false);
     Setting[4]   = new BoolSetting("No movement", "Should the bot place all the sand from the spot it is in?", false);
 }
示例#10
0
 public void Serialize(ref JsonWriter writer, BoolSetting value, IJsonFormatterResolver formatterResolver)
 {
     if (!value.IsEnabled)
     {
         return;
     }
     writer.WritePropertyName(value.Name);
     writer.WriteBoolean(value.TypedValue);
     WriteSeparatorIfNotTheLast(ref writer, value);
 }
示例#11
0
        public CodeViewCompletion(CodeView codeView, ITextView textView)
        {
            _codeView = codeView;
            _textView = textView;
            _document = textView.Document;
            _enabled  = new BoolSetting("CompletionEnabled", false, textView.Settings);

            _document.Buffer.Changed += OnBufferChanged;
            _textView.TextViewEvent  += OnTextViewEvent;
        }
 public override void OnLoad(int version, int subversion, int buildversion)
 {
     this.Setting = new IPluginSetting[7];
     Setting[0]   = new StringSetting("Owner name/uuid", "Player that the bots will follow.", "");
     Setting[1]   = new NumberSetting("Clicks per second", "How fast should the bot attack?", 5, 1, 60, 1);
     Setting[2]   = new NumberSetting("Miss rate", "How often does the bot miss?", 15, 0, 100, 1);
     Setting[3]   = new StringSetting("Friendly name(s)/uuid(s)", "Uuids of the user that own't be hit. Split by spaces'", "");
     Setting[4]   = new BoolSetting("Auto equip best armor?", "Should the bot auto equip the best armor it has?", true);
     Setting[5]   = new BoolSetting("Equip best weapon?", "Should the best item be auto equiped?", true);
     Setting[6]   = new ComboSetting("Mode", null, new string[] { "Passive", "Aggressive" }, 0);
 }
 public override void OnLoad(int version, int subversion, int buildversion)
 {
     this.Setting = new IPluginSetting[8];
     Setting[0]   = new StringSetting("Macro on inventory full", "Starts the macro when the bots inventory is full.", "");
     Setting[1]   = new BoolSetting("Diamond ore", "", true);
     Setting[2]   = new BoolSetting("Emerald ore", "", true);
     Setting[3]   = new BoolSetting("Iron ore", "", true);
     Setting[4]   = new BoolSetting("Gold ore", "", true);
     Setting[5]   = new BoolSetting("Redstone ore", "", false);
     Setting[6]   = new BoolSetting("Lapis Lazuli ore", "", false);
     Setting[7]   = new BoolSetting("Coal ore", "", false);
 }
示例#14
0
 public PenTool()
 {
     Cursor              = Cursors.Pen;
     ActionDisplay       = "Click and move to draw.";
     Tooltip             = "Standard brush. (B)";
     Toolbar             = new PenToolbar();
     toolSizeSetting     = Toolbar.GetSetting <SizeSetting>("ToolSize");
     pixelPerfectSetting = Toolbar.GetSetting <BoolSetting>("PixelPerfectEnabled");
     pixelPerfectSetting.ValueChanged += PixelPerfectSettingValueChanged;
     lineTool = new LineTool();
     ClearPreviewLayerOnEachIteration = false;
 }
示例#15
0
 public PenTool(BitmapManager bitmapManager)
 {
     Cursor              = Cursors.Pen;
     ActionDisplay       = "Click and move to draw.";
     Toolbar             = new PenToolbar();
     toolSizeSetting     = Toolbar.GetSetting <SizeSetting>("ToolSize");
     pixelPerfectSetting = Toolbar.GetSetting <BoolSetting>("PixelPerfectEnabled");
     pixelPerfectSetting.ValueChanged += PixelPerfectSettingValueChanged;
     ClearPreviewLayerOnEachIteration  = false;
     BitmapManager = bitmapManager;
     lineTool      = new LineTool();
 }
示例#16
0
        public void TestThatGenericGetSettingReturnsSettingWithCorrectType()
        {
            const string   settingName  = "test";
            const bool     settingValue = true;
            Setting <bool> expected     = new BoolSetting(settingName, settingValue);

            BasicToolbar toolbar = new BasicToolbar();

            toolbar.Settings.Add(expected);

            BoolSetting actual = toolbar.GetSetting <BoolSetting>(settingName);

            Assert.Equal(expected.Value, actual.Value);
        }
示例#17
0
    // Update audio settings in accordance with global audio values
    private void UpdateSettings()
    {
        // Grab the setting and enabled or disable the audio-listener as appropriate.
        BoolSetting audioEnabled = Settings.Instance.GetSetting <BoolSetting>("audio_enabled");

        if (audioEnabled != null && audioEnabled.Value)
        {
            AudioListener.pause = false;
        }
        else
        {
            AudioListener.pause = true;
        }
    }
示例#18
0
 public override void OnLoad(int version, int subversion, int buildversion)
 {
     this.Setting = new IPluginSetting[10];
     Setting[0]   = new NumberSetting("Height", "Height level that the bots should mine at", 12, 1, 256);
     Setting[1]   = new ComboSetting("Pattern", "", new[] { PATTERNS[0].GetName(), PATTERNS[1].GetName(), PATTERNS[2].GetName() }, 1);
     Setting[2]   = new StringSetting("Macro on inventory full", "Starts the macro when the bots inventory is full.", "");
     Setting[3]   = new BoolSetting("Diamond ore", "", true);
     Setting[4]   = new BoolSetting("Emerald ore", "", true);
     Setting[5]   = new BoolSetting("Iron ore", "", true);
     Setting[6]   = new BoolSetting("Gold ore", "", true);
     Setting[7]   = new BoolSetting("Redstone ore", "", false);
     Setting[8]   = new BoolSetting("Lapis Lazuli ore", "", false);
     Setting[9]   = new BoolSetting("Coal ore", "", false);
 }
        void CloseBranchesTab()
        {
            BoolSetting.Save(false, UnityConstants.SHOW_BRANCHES_VIEW_KEY_NAME);

            ShowView(mPreviousSelectedTab);

            mViewHost.RemoveRefreshableView(
                ViewType.BranchesView, BranchesTab);

            BranchesTab.OnDisable();
            BranchesTab = null;

            mParentWindow.Repaint();
        }
示例#20
0
        internal void OnDisable()
        {
            mDiffPanel.OnDisable();

            mSearchField.downOrUpArrowKeyPressed -=
                SearchField_OnDownOrUpArrowKeyPressed;

            TreeHeaderSettings.Save(
                mChangesetsListView.multiColumnHeader.state,
                UnityConstants.CHANGESETS_TABLE_SETTINGS_NAME);

            BoolSetting.Save(
                mIsChangesPanelVisible,
                UnityConstants.CHANGESETS_SHOW_CHANGES_SETTING_NAME);
        }
示例#21
0
文件: Config.cs 项目: haefele/Mileage
 static Config()
 {
     LicensePath          = new StringSetting("Mileage/LicensePath", string.Empty);
     EnableDefaultMetrics = new BoolSetting("Mileage/EnableDefaultMetrics", false);
     CompressResponses    = new BoolSetting("Mileage/CompressResponses", true);
     EnableDebugRequestResponseLogging = new BoolSetting("Mileage/EnableDebugRequestResponseLogging", false);
     FormatResponses       = new BoolSetting("Mileage/FormatResponses", false);
     RavenHttpServerPort   = new IntSetting("Mileage/RavenHttpServerPort", 8000);
     RavenName             = new StringSetting("Mileage/RavenName", "Mileage");
     EnableRavenHttpServer = new BoolSetting("Mileage/EnableRavenHttpServer", false);
     Addresses             = new UriListSetting("Mileage/Addresses", new List <Uri>()
     {
         new Uri("http://localhost")
     }, "|");
 }
示例#22
0
 public override void OnLoad(int version, int subversion, int buildversion)
 {
     this.Setting = new IPluginSetting[11];
     Setting[0]   = new StringSetting("User or Channel ID", "Enable developer mode: Settings->Appearance->Developer mode. Copy id: right click channel and click 'Copy ID'.", "");
     Setting[1]   = new BoolSetting("Local notifications", "", true);
     Setting[2]   = new BoolSetting("Explosion notifications", "", true);
     Setting[3]   = new BoolSetting("Wither notifications", "", true);
     Setting[4]   = new BoolSetting("Creeper notifications", "", true);
     Setting[5]   = new BoolSetting("Player notifications", "", true);
     Setting[6]   = new StringSetting("Friendly uuid(s)/name(s)", "Uuids/name(s) split by space.", "");
     Setting[7]   = new StringSetting("Lamp coordinates", "Coordinates in the [X Y Z] format, split by a space", "[-1 -1 -1] [0 0 0] [1 1 1]");
     Setting[8]   = new ComboSetting("Mode", "Notification mode", new [] { "none", "@everyone", "@everyone + tts" }, 1);
     Setting[9]   = new LinkSetting("Add bot", "Adds the bot to your discord channel (you must have administrator permissions).", "https://discordapp.com/oauth2/authorize?client_id=299708378236583939&scope=bot&permissions=6152");
     Setting[10]  = new BoolSetting("Detect falling blocks", "Should the bot detected falling sand and falling tnt", true);
 }
示例#23
0
        /// <summary>
        /// Initializes the settings in the category.
        /// </summary>
        protected override void InitializeSettings()
        {
            viewCube = this.CreateBool("View Cube")
                       .SetDescription("Toggles the View Cube")
                       .SetDefault(true);

            viewCubeScale = this.CreateNumeric <float> ("View Cube Scale", 10f, 200f, 1)
                            .SetDescription("Changes the size of the View Cube")
                            .SetDefault(100f);

            DevMode = this.CreateBool("BetaDev Mode")
                      .SetDescription("Turns all the hidden Designer Tools features that are currently in developpment, DO NOT LEAVE THIS SETTING ON")
                      .AddWarningOnEnabled("Do not leave this setting on when playing, turn on at your own risk")
                      .SetDefault(false);
        }
示例#24
0
        public void SettingTestBoolToString()
        {
            string     expextedString = "mySetting=True";
            const bool value          = true;
            var        setting        = new BoolSetting()
            {
                Category           = "none",
                Description        = "none",
                HumanReadableName  = "Test setting",
                IdentificationName = "mySetting",
                Value = value
            };

            Assert.AreEqual(expextedString, setting.ToString());
        }
示例#25
0
        public void SettingTestBoolStringFalse()
        {
            const bool value   = false;
            var        setting = new BoolSetting()
            {
                Category           = "none",
                Description        = "none",
                HumanReadableName  = "Test setting",
                IdentificationName = "mySetting",
                Value = value
            };

            string convSetting = (string)setting;

            Assert.AreEqual(value.ToString(), convSetting);
        }
示例#26
0
        public void SettingTestBoolBoolTrue()
        {
            const bool value   = true;
            var        setting = new BoolSetting()
            {
                Category           = "none",
                Description        = "none",
                HumanReadableName  = "Test setting",
                IdentificationName = "mySetting",
                Value = value
            };

            bool convSetting = (bool)setting;

            Assert.AreEqual(value, convSetting);
        }
示例#27
0
        public void SettingTestBoolFloatFalse()
        {
            const bool value   = false;
            var        setting = new BoolSetting()
            {
                Category           = "none",
                Description        = "none",
                HumanReadableName  = "Test setting",
                IdentificationName = "mySetting",
                Value = value
            };

            int convSetting = (int)setting;

            Assert.AreEqual(0.0f, convSetting);
        }
示例#28
0
 public PenTool(BitmapManager bitmapManager)
 {
     Cursor              = Cursors.Pen;
     ActionDisplay       = "Click and move to draw.";
     Toolbar             = new PenToolbar();
     toolSizeSetting     = Toolbar.GetSetting <SizeSetting>("ToolSize");
     pixelPerfectSetting = Toolbar.GetSetting <BoolSetting>("PixelPerfectEnabled");
     ClearPreviewLayerOnEachIteration = false;
     BitmapManager   = bitmapManager;
     paint.BlendMode = SKBlendMode.Src;
     Brushes.Add(new CircleBrush());
     Brush    = Brushes[0];
     lineTool = new LineTool
     {
         AutomaticallyResizeCanvas = AutomaticallyResizeCanvas
     };
 }
示例#29
0
    void Start()
    {
        for (int i = ((int)LogChannel.Default) + 1; i < (int)LogChannel.Count; i++)
        {
            BoolSetting channelSetting = Settings.Instance.GetSetting <BoolSetting>("debug_" + System.Enum.GetName(typeof(LogChannel), (LogChannel)i));

            m_enabledChannels[i]               = new ChannelInfo();
            m_enabledChannels[i].channel       = (LogChannel)i;
            m_enabledChannels[i].enabled       = channelSetting != null ? channelSetting.Value : false;
            m_enabledChannels[i].color         = i < s_channelColors.Length ? s_channelColors[i] : "white";
            m_enabledChannels[i].channelPrefix = System.Enum.GetName(typeof(LogChannel), (LogChannel)i);

            if (channelSetting != null)
            {
                channelSetting.AddChangedCallback(m_enabledChannels[i].SettingChanged);
            }
        }
    }
        void OpenBranchesTab()
        {
            if (BranchesTab == null)
            {
                BranchesTab = new BranchesTab(
                    mWkInfo,
                    mWorkspaceWindow,
                    this,
                    this,
                    mWorkspaceWindow,
                    mDeveloperNewIncomingChangesUpdater,
                    mParentWindow);

                mViewHost.AddRefreshableView(
                    ViewType.BranchesView, BranchesTab);
            }

            BoolSetting.Save(true, UnityConstants.SHOW_BRANCHES_VIEW_KEY_NAME);
        }
示例#31
0
 public static bool GetSetting( BoolSetting key )
 {
    return Convert.ToBoolean( PlayerPrefs.GetInt( Enum.GetName( key.GetType(), key ) ) );
 }
示例#32
0
 public static void SetSetting( BoolSetting key, bool value )
 {
    PlayerPrefs.SetInt( Enum.GetName( key.GetType(), key ), Convert.ToInt16( value ) );
    PlayerPrefs.Save();
 }