public string ToColorizedString(ColorSettings colors, bool grammarSymbolsVisible = true)
        {
            var console = App.Host.Services.GetRequiredService <IConsole>();

            var f = GetCmd(EchoDirectives.f + "", console.DefaultForeground.ToString().ToLower());
            var r = $"{colors.ParameterName}{ParameterName}{f}";

            if (IsOption)
            {
                var    optVal = (HasValue) ? $" {colors.ParameterValueType}{ParameterInfo.ParameterType.UnmangledName()}" : "";
                string sepcar = grammarSymbolsVisible ? $"{colors.SyntaxSymbol}|" : ", ";
                //string longopt = OptionLongName != null ? $"{sepcar}{colors.OptionPrefix}{CommandLineSyntax.OptionLongPrefix}{colors.OptionName}{OptionLongName}" : "";

                string longopt = (OptionName != null && OptionLongName != null ? $"{sepcar}" : "")
                                 + (OptionLongName != null ? $"{colors.OptionPrefix}{CommandLineSyntax.OptionLongPrefix}{colors.OptionName}{OptionLongName}" : "");
                r = "";
                if (OptionName != null)
                {
                    r += $"{colors.OptionPrefix}{CommandLineSyntax.OptionPrefix}{colors.OptionName}{OptionName}";
                }
                r += $"{longopt}{optVal}{f}";
            }
            if (IsOptional && grammarSymbolsVisible)
            {
                r = $"{colors.SyntaxSymbol}[{r}{colors.SyntaxSymbol}]{f}";
            }
#if printDefaultValueInSyntax
            if (HasDefaultValue && grammarSymbolsVisible)
            {
                r += $"{Cyan}{{={($"{colors.Value}{DumpAsText(DefaultValue)}{Cyan}}}{f}")}";
            }
#endif
            return(r);
        }
Пример #2
0
    public static ColorSettings CopyColorSettings()
    {
        ColorSettings defaultColor = loadDefaultColor();
        ColorSettings newSettings  = (ColorSettings)ScriptableObject.CreateInstance("ColorSettings");

        // Create deep copy of material
        newSettings.planetMaterial = new Material(Resources.Load <Material>("Graphics/Planet Material"));

        // init some stuff
        newSettings.biomeColorSettings        = new ColorSettings.BiomeColorSettings();
        newSettings.biomeColorSettings.noise  = new NoiseSettings();
        newSettings.biomeColorSettings.biomes = new ColorSettings.BiomeColorSettings.Biome[defaultColor.biomeColorSettings.biomes.Length];

        // set biomeColorSettingw
        newSettings.biomeColorSettings.noiseOffset   = defaultColor.biomeColorSettings.noiseOffset;
        newSettings.biomeColorSettings.noiseStrength = defaultColor.biomeColorSettings.noiseStrength;
        newSettings.biomeColorSettings.blendAmount   = defaultColor.biomeColorSettings.blendAmount;

        // biomes
        for (int i = 0; i < newSettings.biomeColorSettings.biomes.Length; i++)
        {
            newSettings.biomeColorSettings.biomes[i]             = new ColorSettings.BiomeColorSettings.Biome();
            newSettings.biomeColorSettings.biomes[i].gradient    = defaultColor.biomeColorSettings.biomes[i].gradient;
            newSettings.biomeColorSettings.biomes[i].tint        = defaultColor.biomeColorSettings.biomes[i].tint;
            newSettings.biomeColorSettings.biomes[i].tintPercent = defaultColor.biomeColorSettings.biomes[i].tintPercent;
            newSettings.biomeColorSettings.biomes[i].startHeight = defaultColor.biomeColorSettings.biomes[i].startHeight;
        }
        return(newSettings);
    }
Пример #3
0
 public void Initialize(ShapeGenerator shapeGenerator, ColorSettings colorSettings, Vector3 localUp, Vector3 axisA, Vector3 axisB, int resolution = 2)
 {
     this.shapeGenerator         = shapeGenerator;
     this.colorSettings          = colorSettings;
     CurrentFace                 = new TerrainFace(shapeGenerator, Mesh, resolution, localUp, axisA, axisB);
     MeshRenderer.sharedMaterial = colorSettings.planetMaterial;
 }
Пример #4
0
        public static Bitmap Make(int Width, int Height, ColorSettings Settings)
        {
            Random random = new Random();

            switch (Settings.Color)
            {
            case ColorType.Random:
            {
                return(Make(Width, Height));
            }

            case ColorType.Range:
            {
                return(Make(Width, Height, Color.FromArgb(
                                random.Next(Settings.SelectedColorRangeRMin, Settings.SelectedColorRangeRMax),
                                random.Next(Settings.SelectedColorRangeGMin, Settings.SelectedColorRangeGMax),
                                random.Next(Settings.SelectedColorRangeBMin, Settings.SelectedColorRangeBMax))));
            }

            case ColorType.Selected:
            {
                return(Make(Width, Height, Settings.SelectedColor));
            }
            }

            return(Make(Width, Height));
        }
Пример #5
0
        public FormSettings(EntityBox entityBox)
        {
            InitializeComponent();

            savedEntityBox = entityBox;

            propertyGridEntityBox.SelectedObject = entityBox;

            globalSettings = new GlobalSettings(entityBox);
            propertyGridGlobal.SelectedObject = globalSettings;

            colorSettings = new ColorSettings(entityBox);
            propertyGridColors.SelectedObject = colorSettings;

            prioritySettings = new PrioritySettings(entityBox);
            propertyGridPriority.SelectedObject = prioritySettings;

            opacitySettings = new OpacitySettings(entityBox);
            propertyGridOpacity.SelectedObject = opacitySettings;

            sizeSettings = new SizeSettings(entityBox);
            propertyGridSize.SelectedObject = sizeSettings;

            shapeSettings = new ShapeSettings(entityBox);
            propertyGridShape.SelectedObject = shapeSettings;
        }
Пример #6
0
    protected override void Awake()
    {
        base.Awake();
        if (PlayerPrefs.HasKey("ColorSetting"))
        {
            SelectedColor = (ColorSettings)PlayerPrefs.GetInt("ColorSetting");
        }
        switch (SelectedColor)
        {
        case ColorSettings.Normal:
            CurrentSet = NormalSet;
            break;

        case ColorSettings.Protanopia:
            CurrentSet = ProtanopiaSet;
            break;

        case ColorSettings.Deuteranopia:
            CurrentSet = DeuteranopiaSet;
            break;

        case ColorSettings.Tritanopia:
            CurrentSet = TritanopiaSet;
            break;

        default:
            break;
        }
        Camera.main.backgroundColor = CurrentSet.BackgroundColor;
        for (int i = 0; i < GroundMat.Length; i++)
        {
            GroundMat[i].material.color = CurrentSet.GroundColor;
        }
    }
        private async Task <ColorSettings> ReadCssColorProperties(string section)
        {
            var colorSettings = new ColorSettings();
            var webPath       = _hostingEnvironment.WebRootPath;
            var path          = Path.Combine("", webPath + $"\\css\\{section}.css");

            var css = await System.IO.File.ReadAllTextAsync(path);

            var parts = css.Split($"{section}-", StringSplitOptions.RemoveEmptyEntries);
            var props = new Dictionary <string, string>();

            foreach (var part in parts)
            {
                var partClean = part.Substring(part.IndexOf("{") + 1).Replace("}.", "").Replace("}", "");
                var subParts  = partClean.Split(":", StringSplitOptions.RemoveEmptyEntries);
                if (partClean.StartsWith("background-color:"))
                {
                    colorSettings.BackgroundColor = subParts[1];
                }
                if (partClean.StartsWith("color:"))
                {
                    colorSettings.TextColor = subParts[1];
                }
            }
            return(colorSettings);
        }
Пример #8
0
        public DlgPaletteEditor(StudioCore Core, ColorSettings Colors)
        {
            PaletteMapping = new List <int>();
            OriginalOrder  = new List <Palette>();

            this.Colors = new ColorSettings(Colors);
            this.Core   = Core;
            InitializeComponent();

            int palIndex = 0;

            foreach (var pal in this.Colors.Palettes)
            {
                paletteList.Items.Add(new ArrangedItemEntry()
                {
                    Text = pal.Name, Tag = pal
                });

                OriginalOrder.Add(pal);
                PaletteMapping.Add(palIndex);
                ++palIndex;
            }
            for (int i = 0; i < Colors.Palette.NumColors; ++i)
            {
                listPalette.Items.Add(Colors.Palette.Colors[i]);
            }
            listPalette.SelectedIndex = 0;

            Core.Theming.ApplyTheme(this);
        }
        public override bool HandleImport(SpriteProject Project, SpriteEditor Editor)
        {
            string filename;

            if (!Editor.OpenFile("Import Sprites from Image", RetroDevStudio.Types.Constants.FILEFILTER_IMAGE_FILES, out filename))
            {
                return(false);
            }

            GR.Image.FastImage spriteImage;

            var mcSettings = new ColorSettings(Project.Colors);

            var importType = Types.GraphicType.SPRITES;

            if (Project.Mode == SpriteProject.SpriteProjectMode.MEGA65_16_X_21_16_COLORS)
            {
                importType = GraphicType.SPRITES_16_COLORS;
            }

            bool pasteAsBlock = false;

            if (!Core.MainForm.ImportImage(filename, null, importType, mcSettings, out spriteImage, out mcSettings, out pasteAsBlock))
            {
                return(false);
            }

            Project.Colors.BackgroundColor = mcSettings.BackgroundColor;
            Project.Colors.MultiColor1     = mcSettings.MultiColor1;
            Project.Colors.MultiColor2     = mcSettings.MultiColor2;
            if (mcSettings.Palettes.Count > Project.Colors.Palettes.Count)
            {
                // a palette was imported!
                Project.Colors.Palettes.Add(mcSettings.Palettes[mcSettings.Palettes.Count - 1]);
            }

            Editor.ChangeColorSettingsDialog();

            int currentSpriteIndex = 0;
            int curX = 0;
            int curY = 0;

            while (curY + Editor.m_SpriteHeight <= spriteImage.Height)
            {
                //DocumentInfo.UndoManager.AddUndoTask( new Undo.UndoSpritesetSpriteChange( this, Project, currentSpriteIndex ), firstUndoStep );

                Editor.ImportSprite(spriteImage.GetImage(curX, curY, Editor.m_SpriteWidth, Editor.m_SpriteHeight) as GR.Image.FastImage, currentSpriteIndex);
                Editor.SpriteChanged(currentSpriteIndex);

                ++currentSpriteIndex;
                curX += Editor.m_SpriteWidth;
                if (curX >= spriteImage.Width)
                {
                    curX  = 0;
                    curY += Editor.m_SpriteHeight;
                }
            }
            return(true);
        }
Пример #10
0
    ColorSettings CreateColourSettings()
    {
        ColorSettings newColorSettings = new ColorSettings();

        newColorSettings.gradient = CreateRandomGradient();
        newColorSettings.material = new Material(Shader.Find("Shader Graphs/Planet"));
        return(newColorSettings);
    }
Пример #11
0
    void OnEnable()
    {
        allPlayerCursors.Add(this);

        GetComponentInChildren <MeshRenderer>().material.color = ColorSettings.getPlayerColor(allPlayerCursors.Count - 1);

        Instantiate(playerCharacterPrefab, this.transform.position, Quaternion.identity).GetComponent <PlayerCharacter>().setPlayerCursor(this);
    }
Пример #12
0
 static ColorSettings Initialize()
 {
     if (i != null)
     {
         return(i);
     }
     return(i = Resources.Load <ColorSettings>("ColorSettings"));
 }
 public void updateSettings(ColorSettings colorSettings)
 {
     this.colorSettings = colorSettings;
     if (texture == null)
     {
         texture = new Texture2D(resolution, 1);
     }
 }
Пример #14
0
 // Start is called before the first frame update
 void Start()
 {
     planet              = GetComponent <Planet>();
     shapeSettings       = planet.shapeSettings;
     colorSettings       = planet.colorSettings;
     simpleNoiseSettings = shapeSettings.noiseLayers[0].noiseSettings;
     rigidNoiseSettings  = shapeSettings.noiseLayers[1].noiseSettings;
 }
        public ColorSettingsBase(StudioCore Core, ColorSettings Colors, int CustomColor)
        {
            this.Colors      = new ColorSettings(Colors);
            this.Core        = Core;
            this.CustomColor = CustomColor;

            InitializeComponent();
        }
Пример #16
0
 public void UpdateSettings(ColorSettings settings)
 {
     this.settings = settings;
     if (texture == null)
     {
         texture = new Texture2D(textureRes, 1);
     }
 }
Пример #17
0
 /// <summary>
 /// Initializes this instance.
 /// </summary>
 public void Initialize(ColorSettings settings)
 {
     if (settings != null)
     {
         PrimaryColor   = settings.Primary.GetColor();
         SecondaryColor = settings.Secondary.GetColor();
     }
 }
Пример #18
0
 public void UpdateSettings(ColorSettings settings)
 {
     colorSettings = settings;
     if (texture == null)
     {
         texture = new Texture2D(textureResolution, 1);
     }
 }
Пример #19
0
        public UndoSpritesetValuesChange(SpriteEditor Editor, SpriteProject Project)
        {
            this.Editor  = Editor;
            this.Project = Project;
            Mode         = Project.Mode;

            Colors = new ColorSettings(Project.Colors);
        }
        public UndoCharacterEditorValuesChange(CharacterEditor Editor, CharsetProject Project)
        {
            this.Editor  = Editor;
            this.Project = Project;
            Mode         = Project.Mode;

            Colors = new ColorSettings(Project.Colors);
        }
Пример #21
0
    // Rewrite to static method
    public Material GenerateMaterial(ColorSettings inputSettings)
    {
        var settings = inputSettings;

        UpdateSettings(settings);
        UpdateColors();

        return(settings.worldMaterial);
    }
Пример #22
0
    public void DrawMesh(MeshData meshData, MinMaxTracker heightTracker, ColorSettings colorSettings)
    {
        colorGen.UpdateSettings(colorSettings);
        colorGen.UpdateHeight(heightTracker);
        colorGen.UpdateColors();

        meshFilter.sharedMesh = meshData.CreateMesh();
        meshFilter.GetComponent <MeshRenderer>().sharedMaterial = colorSettings.terrainMaterial;
    }
Пример #23
0
        private void SetupColors(ColorSettings colors)
        {
            Dictionary <string, uint> d = colors.GetValueDictionary();

            foreach (KeyValuePair <string, uint> kvp in d)
            {
                this.Add(kvp.Key, NewColor(kvp.Value));
            }
        }
Пример #24
0
        public bool IsValid()
        {
            if (BotSettings == null || ColorSettings == null || DatabaseSettings == null)
            {
                return(false);
            }

            return(BotSettings.IsValid() && ColorSettings.IsValid() && DatabaseSettings.IsValid());
        }
Пример #25
0
 public void updateSettings(ColorSettings colorSettings)
 {
     this.colorSettings = colorSettings;
     if (texture == null)
     {
         //this.texture = new Texture2D(textureResolution, 1);
         this.texture = new Texture2D(textureResolution, 1, TextureFormat.RGBA32, false);
     }
 }
Пример #26
0
 public void UpdateSettings(ColorSettings settings)
 {
     this.settings = settings;
     if (texture == null || texture.height != settings.biomeColorSettings.biomes.Length)
     {
         texture = new Texture2D(textureResolution * 2, settings.biomeColorSettings.biomes.Length, TextureFormat.RGBA32, false);
     }
     biomeNoiseFilter = NoiseFilterFactory.CreateNoiseFilter(settings.biomeColorSettings.noise);
 }
Пример #27
0
 public Managers(frmMain mf)
 {
     instance            = this;
     this.mainForm       = mf;
     this.nodeManager    = new NodeManager();
     this.controlManager = new ControlManager();
     this.fileManager    = new FileManager();
     this.colorSettings  = new ColorSettings();
 }
Пример #28
0
 public void UpdateSettings(ColorSettings settings)
 {
     this.settings = settings;
     if (texture == null)
     {
         texture        = new Texture2D(textureResolution * 2, 1, TextureFormat.RGBA32, false);
         terrainTexture = new Texture2D(textureResolution * 2, 1, TextureFormat.RGBA32, false);
     }
 }
Пример #29
0
 public void UpdateSettings(ColorSettings settings)
 {
     this.settings = settings;
     if (texture == null || texture.height != settings.biomeColorSettings.biomes.Length)
     {
         //Uing first half of texture for ocean and second half for solid ground
         texture = new Texture2D(textureResolution * 2, settings.biomeColorSettings.biomes.Length, TextureFormat.RGBA32, false);
     }
     biomeNoiseFilter = NoiseFilterFactory.CreateNoiseFilter(settings.biomeColorSettings.noise);
 }
Пример #30
0
 static Settings()
 {
     Color   = new ColorSettings();
     Regions = new List <Region> {
         new Region {
             RegionName = Region.DefaultRegion, RColor = System.Drawing.Color.White
         }
     };
     Reset();
 }
Пример #31
0
 static Settings()
 {
     Color = new ColorSettings();
       Regions = new List<Region>
       {
     new Region {RegionName = Region.DefaultRegion, RColor = System.Drawing.Color.White}
       };
       RecentProjects = new MruList();
       Reset();
       ResetApplicationSettings();
       LoadApplicationSettings();
 }