Example #1
0
        public object Convert(object value, System.Type targetType,
                              object parameter, System.Globalization.CultureInfo culture)
        {
            ColorTag colorTag = (ColorTag)value;

            return(new SolidColorBrush(NoteWindow.colorsBackground[(int)colorTag]));
        }
 public override void UpdateVariables(Dictionary <string, TemplateObject> vars)
 {
     Color    = ColorTag.For(vars["color"]);
     Text     = new TextTag(vars["text"].ToString());
     ChatMode = new TextTag(vars["chat_mode"].ToString());
     base.UpdateVariables(vars);
 }
Example #3
0
        private void NormalModeText()
        {
            string   text;
            string   current;
            string   max;
            ColorTag color = ColorTag.Grey;

            string version = GetComponent <GameVersion>().Version;

            text = GetText(UITextDataTag.Version, version);
            SearchText(UITag.Line1).text = GetColorfulText(text, color);

            string seed = "123-456-789";

            text = GetText(UITextDataTag.Seed, seed);
            SearchText(UITag.Line2).text = GetColorfulText(text, color);

            string difficulty = "Hard";

            text = GetText(UITextDataTag.Difficulty, difficulty);
            SearchText(UITag.Line3).text = GetColorfulText(text, color);

            current = "12";
            max     = "50";
            text    = GetText(UITextDataTag.GameProgress, current, max);
            SearchText(UITag.Line4).text = text;

            AltarLevel();
            AltarCooldown();
        }
Example #4
0
        private void CreateHighlights_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                selection = (dte.ActiveDocument.Selection as TextSelection).Text;
                colorTag  = new ColorTag
                {
                    ColorSwatch = Colors.Purple,
                    Criteria    = selection,
                    isFullLine  = true
                };
                foreach (ComboBoxItem l in Lighthouse.colors.Select(color => new ComboBoxItem
                {
                    Foreground = new SolidColorBrush(color),
                    Background = new SolidColorBrush(color)
                }))
                {
                    cboColors.Items.Add(l);
                }

                allowColoring = true;
            }
            catch (Exception ex)
            {
                Lighthouse.output.OutputString(ex.Message + "\n\n" + ex.StackTrace);
            }

            MoveToMousePosition();
            ShowEditor();
        }
Example #5
0
        public override void Execute(FreneticScript.CommandSystem.CommandQueue queue, CommandEntry entry)
        {
            TemplateObject tcolor = entry.GetArgumentObject(queue, 0);
            ColorTag       color  = ColorTag.For(tcolor);

            if (color == null)
            {
                queue.HandleError(entry, "Invalid color: " + TagParser.Escape(tcolor.ToString()));
                return;
            }
            string    message  = entry.GetArgument(queue, 1);
            EChatMode chatMode = EChatMode.SAY;

            if (entry.Arguments.Count > 2)
            {
                string mode = entry.GetArgument(queue, 2);
                try
                {
                    chatMode = (EChatMode)Enum.Parse(typeof(EChatMode), mode.ToUpper());
                } catch (ArgumentException)
                {
                    queue.HandleError(entry, "Invalid chat mode: " + mode);
                    return;
                }
            }
            ChatManager.manager.channel.send("tellChat", ESteamCall.OTHERS, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[]
            {
                CSteamID.Nil,
                (byte)chatMode,
                color.Internal,
                message
            });
        }
Example #6
0
   public SetColorTagCommand(IEnumerable<IMaxNode> nodes, ColorTag tag)
   {
      Throw.IfNull(nodes, "nodes");

      this.nodes = nodes;
      this.tag = tag;
   }
Example #7
0
 public static void SetColorTag(this IMaxNode node, ColorTag tag)
 {
    if (node.IsAggregate)
       node.ChildNodes.SetColorTag(tag);
    else
       ColorTags.SetTag(node.BaseObject as IAnimatable, tag);
 }
Example #8
0
        public void SetColor(string text, ColorTag colorTag,
                             out string colorfulText)
        {
            string hex = GetComponent <ColorData>().GetHexColor(colorTag);

            colorfulText = $"<color={hex}>{text}</color>";
        }
Example #9
0
   /// <summary>
   /// Tests if the supplied node has got one or more of the supplied tags set.
   /// </summary>
   public static Boolean HasTag(IAnimatable node, ColorTag tags)
   {
      if (node == null)
         return false;

      ColorTag nodeTag = ColorTags.GetTag(node);
      return (nodeTag & tags) != 0;
   }
Example #10
0
 private void SetAltarColor(ColorTag colorTag)
 {
     foreach (GameObject go in altars)
     {
         GetComponent <ColorManager>().SetColor(
             go.GetComponent <SpriteRenderer>(), colorTag);
     }
 }
Example #11
0
        public void ChangeColorTag(ColorTag newTag)
        {
            Debug.LogFormat("ChangeColorTag {0}", newTag);

            foreach (var item in itemList)
            {
                item.Tag = newTag;
            }
        }
Example #12
0
 // Start is called before the first frame update
 void Start()
 {
     FindObjectOfType <SprayCan>().color = colors[0];
     foreach (var color in colors)
     {
         ColorTag tag = Instantiate(tagInstance, transform);
         tag.tagColor = color;
     }
 }
Example #13
0
        public void SetSelectedBrushesTag(ColorTag tag)
        {
            Undo.RegisterCompleteObjectUndo(PrefabPainterSettings.current, "PP: Set Brush(es) Tag");

            brushes.ForEach((brush) => { if (brush.selected)
                                         {
                                             brush.colorTag = tag;
                                         }
                            });
        }
Example #14
0
        public override TemplateObject Handle(TagData data)
        {
            ColorTag ctag = ColorTag.For(data.GetModifierObject(0));

            if (ctag == null)
            {
                return(new TextTag("&{NULL}"));
            }
            return(ctag.Handle(data.Shrink()));
        }
Example #15
0
        public override TemplateObject Handle(TagData data)
        {
            string   cname = data.GetModifier(0);
            ColorTag ctag  = ColorTag.For(cname);

            if (ctag == null)
            {
                data.Error("Invalid color '" + TagParser.Escape(cname) + "'!");
                return(new NullTag());
            }
            return(ctag.Handle(data.Shrink()));
        }
        internal ColorAdornment(ColorTag colorTag, IWpfTextView view)
        {
            this.Padding = new Thickness(0);
            this.BorderThickness = new Thickness(1);
            this.Margin = new Thickness(0, 0, 2, 3);
            this.Width = OptionHelpers.FontSize;
            this.Height = this.Width;
            this.Cursor = System.Windows.Input.Cursors.Arrow;
            this.MouseUp += delegate { ColorAdornmentMouseUp(view); };

            Update(colorTag);
        }
Example #17
0
        internal void ShowEditor()
        {
            // Change stacks
            selection = (dte.ActiveDocument.Selection as TextSelection).Text;
            if (!string.IsNullOrWhiteSpace(selection) && !string.IsNullOrEmpty(selection))
            {
                // Exists
                if (Lighthouse.Options.ColorTags.Any(x => x.Criteria == selection))
                {
                    stackExists.Visibility = btnChange.Visibility = Visibility.Visible;
                    btnCreate.Visibility   = Visibility.Collapsed;
                    allowSelectionChange   = false;
                    colorTag = Lighthouse.Options.ColorTags.First(x => x.Criteria == selection);

                    cboColors.Items.Cast <ComboBoxItem>()
                    .First(item => (item.Foreground as SolidColorBrush).Color == colorTag.ColorSwatch)
                    .IsSelected = true;

                    allowSelectionChange   = true;
                    cboBlur.SelectedIndex  = (int)colorTag.Blur;
                    chkLine.IsChecked      = colorTag.isFullLine;
                    chkUnderline.IsChecked = colorTag.isUnderline;
                    chkActive.IsChecked    = colorTag.isActive;

                    chkSolution.Visibility = Visibility.Collapsed;
                }
                else // NEW
                {
                    stackExists.Visibility = btnChange.Visibility = Visibility.Collapsed;
                    btnCreate.Visibility   = Visibility.Visible;
                    chkSolution.Visibility = Visibility.Visible;
                    allowSelectionChange   = true;

                    cboColors.SelectedIndex = new Random().Next(0, cboColors.Items.Count - 1);
                    colorTag = new ColorTag
                    {
                        Criteria    = selection,
                        ColorSwatch = ((SolidColorBrush)((ComboBoxItem)cboColors.SelectedItem).Foreground).Color,
                        isFullLine  = chkLine.IsChecked == true,
                        isUnderline = chkUnderline.IsChecked == true,
                        Blur        = (BlurIntensity)cboBlur.SelectedIndex,
                        isActive    = chkActive.IsChecked == true
                    };
                    cboBlur.SelectedIndex = (int)Lighthouse.Options.Blur;
                }

                chkLine.IsChecked   = colorTag.isFullLine;
                chkActive.IsChecked = colorTag.isActive;

                CreatePreview();
            }
        }
Example #18
0
        /// <summary>
        /// Constructor Note Window - Create New Note Window
        /// </summary>
        public NoteWindow(IEnumerable <Tag> listAllTags)
        {
            InitializeComponent();

            colorTag         = 0;
            titleWindow.Text = "Create New Note";
            noteTags         = new ObservableCollection <QuickNote.Tag>(listAllTags);

            if (lstTags != null)
            {
                lstTags.DataContext = new TagsViewModelLstBox(noteTags);
            }
        }
Example #19
0
        public string GetHexColor(ColorTag colorTag)
        {
            if (!hexColor.ContainsKey(colorTag))
            {
                string color
                    = (string)xmlFile
                      .Element(colorTag.ToString())
                      .Element(hexTag);

                hexColor[colorTag] = "#" + color;
            }
            return(hexColor[colorTag]);
        }
Example #20
0
        /// <summary>
        /// Constructor Note Window - Show Note and Editable Note
        /// </summary>
        /// <param name="note"></param>
        /// <param name="listTagsOfNote"></param>
        /// <param name="listAllTags"></param>
        public NoteWindow(Note note, IEnumerable <Tag> listTagsOfNote, IEnumerable <Tag> listAllTags)
        {
            InitializeComponent();

            editableNote = note;
            colorTag     = note.ColorNote;
            if (this != null)
            {
                this.Background = new SolidColorBrush(colorsBackground[(int)colorTag]);
            }

            titleNote.Text = note.Title;
            ByteArrayToFlowDocument converter = new ByteArrayToFlowDocument();

            contentNote.Document = converter.Convert(note.Document, null, null, null) as FlowDocument;

            noteTags = new ObservableCollection <QuickNote.Tag>(listAllTags);

            foreach (var tag in listTagsOfNote)
            {
                Tag res = null;
                res = noteTags.FirstOrDefault(x => x.Id == tag.Id);
                if (res != null)
                {
                    res.IsSelected = true;
                }
            }

            if (lstTags != null)
            {
                lstTags.DataContext = new TagsViewModelLstBox(noteTags);
            }
            UpdateTagNoteText();

            titleWindow.Text = "Edit Note";

            foreach (object child in groupColorPicker.Children)
            {
                if (child is RadioButton)
                {
                    RadioButton pick     = child as RadioButton;
                    ColorTag    colorBtn = (ColorTag)Int32.Parse(pick.Tag as string);

                    if (colorBtn == colorTag)
                    {
                        pick.IsChecked = true;
                    }
                }
            }
        }
 internal void Update(ColorTag colorTag)
 {
     this.Background = new SolidColorBrush(colorTag.Color);
     if (!HasContrastToBackground(colorTag.Color))
     {
         this.BorderThickness = new Thickness(1);
         this.BorderBrush = _borderColor;
     }
     else
     {
         this.BorderThickness = new Thickness(0);
         this.BorderBrush = this.Background;
     }
 }
        public static NSColor GetNSColor(this Color c)
        {
            var t = c.Tag as ColorTag;

            if (t == null)
            {
                t     = new ColorTag();
                c.Tag = t;
            }
            if (t.NSColor == null)
            {
                t.NSColor = NSColor.FromDeviceRgba(c.Red / 255.0f, c.Green / 255.0f, c.Blue / 255.0f, c.Alpha / 255.0f);
            }
            return(t.NSColor);
        }
        public static UIColor GetUIColor(this Color c)
        {
            var t = c.Tag as ColorTag;

            if (t == null)
            {
                t     = new ColorTag();
                c.Tag = t;
            }
            if (t.UIColor == null)
            {
                t.UIColor = UIColor.FromRGBA(c.Red / 255.0f, c.Green / 255.0f, c.Blue / 255.0f, c.Alpha / 255.0f);
            }
            return(t.UIColor);
        }
        public static CGColor GetCGColor(this Color c)
        {
            var t = c.Tag as ColorTag;

            if (t == null)
            {
                t     = new ColorTag();
                c.Tag = t;
            }
            if (t.CGColor == null)
            {
                t.CGColor = new CGColor(c.Red / 255.0f, c.Green / 255.0f, c.Blue / 255.0f, c.Alpha / 255.0f);
            }
            return(t.CGColor);
        }
Example #25
0
    ///////////////////////////////////////////////////////////////////
    //   Overridden Godot callbacks
    ////////////////////////////////////////////////////////////////////
    public override void _Ready()
    {
        base._Ready();
        State     = new StateManager <Unit>();
        hpDisplay = Spawner.Spawn("HpDisplay").In(this).As <HpDisplay>();
        colorTag  = Spawner.Spawn("ColorTag").In(this).As <ColorTag>();
        AddChild(State);
        SetStats();
        SetAbilities();

        hpDisplay.SetValue(Hp);
        AddToGroup("units");

        SpawnAction();
        State.Change <BasicIdleState>();
    }
Example #26
0
        private void BtnChange_Click(object sender, RoutedEventArgs e)
        {
            if (Lighthouse.Options.ColorTags.Any(x => x.Criteria == selection))
            {
                ColorTag ct = Lighthouse.Options.ColorTags.Find(x => x.Criteria == selection);
                ct.ColorSwatch = ((SolidColorBrush)((ComboBoxItem)cboColors.SelectedItem).Foreground).Color;
                ct.isFullLine  = chkLine.IsChecked == true;
                ct.isUnderline = chkUnderline.IsChecked == true;
                ct.Blur        = (BlurIntensity)cboBlur.SelectedIndex;
                ct.isActive    = chkActive.IsChecked == true;

                Lighthouse.Options.SaveSettingsToStorage();

                Lighthouse.LoadColorTags();
            }
            RefreshDocument();
            Close();
        }
Example #27
0
        public Color GetRGBAColor(ColorTag colorTag)
        {
            if (!rgbaColor.ContainsKey(colorTag))
            {
                XElement e
                    = xmlFile
                      .Element(colorTag.ToString())
                      .Element(rgbaTag);

                byte r = (byte)(int)e.Element(redTag);
                byte g = (byte)(int)e.Element(greenTag);
                byte b = (byte)(int)e.Element(blueTag);
                byte a = (byte)(int)e.Element(alphaTag);

                rgbaColor[colorTag] = new Color32(r, g, b, a);
            }
            return(rgbaColor[colorTag]);
        }
Example #28
0
        /// <summary>
        /// Constructor Note Window - Show Note Only Not Editable
        /// </summary>
        /// <param name="note"></param>
        public NoteWindow(Note note, IEnumerable <Tag> listTagsOfNote)
        {
            InitializeComponent();

            colorTag = note.ColorNote;
            if (this != null)
            {
                this.Background = new SolidColorBrush(colorsBackground[(int)colorTag]);
            }

            settingBtn.IsEnabled  = false;
            settingBtn.Visibility = Visibility.Collapsed;
            addBtn.IsEnabled      = false;
            addBtn.Visibility     = Visibility.Collapsed;
            addBtnImg.Visibility  = Visibility.Collapsed;

            btnsControlNewNote.Visibility  = Visibility.Collapsed;
            btnsControlShowNote.Visibility = Visibility.Visible;

            titleNote.Text       = note.Title;
            titleNote.IsReadOnly = true;

            ByteArrayToFlowDocument converter = new ByteArrayToFlowDocument();

            contentNote.Document   = converter.Convert(note.Document, null, null, null) as FlowDocument;
            contentNote.IsReadOnly = true;

            string tagsName = "";
            bool   first    = false;

            foreach (var tag in listTagsOfNote)
            {
                if (first)
                {
                    tagsName += ", ";
                }
                tagsName += tag.Name;
                first     = true;
            }

            tagNote.Text = tagsName;

            titleWindow.Text = "Show Note";
        }
Example #29
0
        /// <summary>
        /// Popup radio button checked event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void colorRadioBtnChecked(object sender, RoutedEventArgs e)
        {
            RadioButton radioButton = sender as RadioButton;
            int         tag         = -1;
            bool        check       = Int32.TryParse(radioButton.Tag as string, out tag);

            if (check)
            {
                colorTag = (ColorTag)tag;
                if (titleBar != null)
                {
                    titleBar.Background = new SolidColorBrush(colorsHighLight[tag]);
                }
                if (tagBar != null)
                {
                    tagBar.Background = new SolidColorBrush(colorsHighLight[tag]);
                }
                if (this != null)
                {
                    this.Background = new SolidColorBrush(colorsBackground[tag]);
                }
            }
        }
Example #30
0
        public override void Execute(FreneticScript.CommandSystem.CommandQueue queue, CommandEntry entry)
        {
            ListTag        players = ListTag.For(entry.GetArgument(queue, 0));
            TemplateObject tcolor  = entry.GetArgumentObject(queue, 1);
            ColorTag       color   = ColorTag.For(tcolor);

            if (color == null)
            {
                queue.HandleError(entry, "Invalid color: " + TagParser.Escape(tcolor.ToString()));
                return;
            }
            string    tchatter = entry.GetArgument(queue, 2);
            PlayerTag chatter  = PlayerTag.For(tchatter);

            if (chatter == null)
            {
                queue.HandleError(entry, "Invalid chatting player: " + TagParser.Escape(tchatter));
                return;
            }
            string message = entry.GetArgument(queue, 3);

            foreach (TemplateObject tplayer in players.ListEntries)
            {
                PlayerTag player = PlayerTag.For(tplayer.ToString());
                if (player == null)
                {
                    queue.HandleError(entry, "Invalid player: " + TagParser.Escape(tplayer.ToString()));
                    continue;
                }
                ChatManager.manager.channel.send("tellChat", player.Internal.playerID.steamID, ESteamPacket.UPDATE_UNRELIABLE_BUFFER,
                                                 chatter.Internal.playerID.steamID, (byte)0 /* TODO: Configurable mode? */, color.Internal, message);
                if (entry.ShouldShowGood(queue))
                {
                    entry.Good(queue, "Successfully sent a message.");
                }
            }
        }
Example #31
0
 public void OnEquipped(Inventory inventory)
 {
     ColorTag.TagObject(gameObject, Color.red);
 }
Example #32
0
        public override void Execute(PlayerCommandEntry entry)
        {
            if (entry.InputArguments.Count <= 0)
            {
                ShowUsage(entry);
                return;
            }
            string arg0 = entry.InputArguments[0];

            if (arg0 == "spawnCar" && entry.InputArguments.Count > 1)
            {
                CarEntity ve = new CarEntity(entry.InputArguments[1], entry.Player.TheRegion);
                ve.SetPosition(entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 5);
                entry.Player.TheRegion.SpawnEntity(ve);
            }
            else if (arg0 == "spawnHeli" && entry.InputArguments.Count > 1)
            {
                HelicopterEntity ve = new HelicopterEntity(entry.InputArguments[1], entry.Player.TheRegion);
                ve.SetPosition(entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 5);
                entry.Player.TheRegion.SpawnEntity(ve);
            }
            else if (arg0 == "spawnPlane" && entry.InputArguments.Count > 1)
            {
                PlaneEntity ve = new PlaneEntity(entry.InputArguments[1], entry.Player.TheRegion);
                ve.SetPosition(entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 5);
                entry.Player.TheRegion.SpawnEntity(ve);
            }
            else if (arg0 == "heloTilt" && entry.InputArguments.Count > 1)
            {
                if (entry.Player.CurrentSeat != null && entry.Player.CurrentSeat.SeatHolder is HelicopterEntity)
                {
                    ((HelicopterEntity)entry.Player.CurrentSeat.SeatHolder).TiltMod = Utilities.StringToFloat(entry.InputArguments[1]);
                }
            }
            else if (arg0 == "shortRange")
            {
                entry.Player.ViewRadiusInChunks  = 3;
                entry.Player.ViewRadExtra2       = 0;
                entry.Player.ViewRadExtra2Height = 0;
                entry.Player.ViewRadExtra5       = 0;
                entry.Player.ViewRadExtra5Height = 0;
            }
            else if (arg0 == "countEnts")
            {
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Ents: " + entry.Player.TheRegion.Entities.Count);
            }
            else if (arg0 == "fly")
            {
                if (entry.Player.IsFlying)
                {
                    entry.Player.Unfly();
                    entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Unflying!");
                }
                else
                {
                    entry.Player.Fly();
                    entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Flying!");
                }
            }
            else if (arg0 == "playerDebug")
            {
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "YOU: " + entry.Player.Name + ", tractionForce: " + entry.Player.CBody.TractionForce
                                         + ", mass: " + entry.Player.CBody.Body.Mass + ", radius: " + entry.Player.CBody.BodyRadius + ", hasSupport: " + entry.Player.CBody.SupportFinder.HasSupport
                                         + ", hasTraction: " + entry.Player.CBody.SupportFinder.HasTraction + ", isAFK: " + entry.Player.IsAFK + ", timeAFK: " + entry.Player.TimeAFK);
            }
            else if (arg0 == "playBall")
            {
                // TODO: Item for this?
                ModelEntity me = new ModelEntity("sphere", entry.Player.TheRegion);
                me.SetMass(5);
                me.SetPosition(entry.Player.GetCenter() + entry.Player.ForwardVector());
                me.mode = ModelCollisionMode.SPHERE;
                me.SetVelocity(entry.Player.ForwardVector());
                me.SetBounciness(0.95f);
                entry.Player.TheRegion.SpawnEntity(me);
            }
            else if (arg0 == "playDisc")
            {
                // TODO: Item for this?
                ModelEntity me = new ModelEntity("flyingdisc", entry.Player.TheRegion);
                me.SetMass(5);
                me.SetPosition(entry.Player.GetCenter() + entry.Player.ForwardVector() * 1.5f); // TODO: 1.5 -> 'reach' value?
                me.mode = ModelCollisionMode.AABB;
                me.SetVelocity(entry.Player.ForwardVector() * 25f);                             // TODO: 25 -> 'strength' value?
                me.SetAngularVelocity(new Location(0, 0, 10));
                entry.Player.TheRegion.SpawnEntity(me);
                entry.Player.TheRegion.AddJoint(new JointFlyingDisc(me));
            }
            else if (arg0 == "secureMovement")
            {
                entry.Player.SecureMovement = !entry.Player.SecureMovement;
                entry.Player.SendLanguageData(TextChannel.COMMAND_RESPONSE, "voxalia", "commands.player.devel.secure_movement", entry.Player.Network.GetLanguageData("voxalia", "common." + (entry.Player.SecureMovement ? "true" : "false")));
                if (entry.Player.SecureMovement)
                {
                    entry.Player.Flags &= ~YourStatusFlags.INSECURE_MOVEMENT;
                }
                else
                {
                    entry.Player.Flags |= YourStatusFlags.INSECURE_MOVEMENT;
                }
                entry.Player.SendStatus();
            }
            else if (arg0 == "chunkDebug")
            {
                Location posBlock = entry.Player.GetPosition().GetBlockLocation();
                double   h        = entry.Player.TheRegion.Generator.GetHeight(entry.Player.TheRegion.TheWorld.Seed, entry.Player.TheRegion.TheWorld.Seed2, entry.Player.TheRegion.TheWorld.Seed3,
                                                                               entry.Player.TheRegion.TheWorld.Seed4, entry.Player.TheRegion.TheWorld.Seed5, (double)posBlock.X, (double)posBlock.Y, (double)posBlock.Z, out Biome biome);
                BlockInternal bi = entry.Player.TheRegion.GetBlockInternal_NoLoad((entry.Player.GetPosition() + new Location(0, 0, -0.05f)).GetBlockLocation());
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Mat: " + bi.Material + ", data: " + ((int)bi.BlockData) + ", locDat: " + ((int)bi.BlockLocalData)
                                         + ", Damage: " + bi.Damage + ", Paint: " + bi.BlockPaint
                                         + ", xp: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesXP() + ", xm: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesXM()
                                         + ", yp: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesYP() + ", ym: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesYM()
                                         + ", zp: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesTOP() + ", zm: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesBOTTOM());
                double temp = entry.Player.TheRegion.Generator.GetBiomeGen().GetTemperature(entry.Player.TheRegion.TheWorld.Seed2, entry.Player.TheRegion.TheWorld.Seed3, (double)posBlock.X, (double)posBlock.Y);
                double down = entry.Player.TheRegion.Generator.GetBiomeGen().GetDownfallRate(entry.Player.TheRegion.TheWorld.Seed3, entry.Player.TheRegion.TheWorld.Seed4, (double)posBlock.X, (double)posBlock.Y);
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Height: " + h + ", temperature: " + temp + ", downfallrate: " + down + ", biome yield: " + biome.GetName());
                BlockUpperArea.TopBlock top = entry.Player.TheRegion.GetHighestBlock(posBlock);
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Material: " + top.BasicMat + ", height: " + top.Height);
            }
            else if (arg0 == "structureSelect" && entry.InputArguments.Count > 1)
            {
                string arg1 = entry.InputArguments[1];
                entry.Player.Items.GiveItem(new ItemStack("structureselector", arg1, entry.Player.TheServer, 1, "items/admin/structure_selector",
                                                          "Structure Selector", "Selects and creates a '" + arg1 + "' structure!", System.Drawing.Color.White, "items/admin/structure_selector", false, 0));
            }
            else if (arg0 == "structureCreate" && entry.InputArguments.Count > 1)
            {
                string arg1 = entry.InputArguments[1];
                entry.Player.Items.GiveItem(new ItemStack("structurecreate", arg1, entry.Player.TheServer, 1, "items/admin/structure_create",
                                                          "Structure Creator", "Creates a '" + arg1 + "' structure!", System.Drawing.Color.White, "items/admin/structure_create", false, 0));
            }
            else if (arg0 == "musicBlock" && entry.InputArguments.Count > 3)
            {
                int    arg1 = Utilities.StringToInt(entry.InputArguments[1]);
                double arg2 = Utilities.StringToFloat(entry.InputArguments[2]);
                double arg3 = Utilities.StringToFloat(entry.InputArguments[3]);
                entry.Player.Items.GiveItem(new ItemStack("customblock", entry.Player.TheServer, 1, "items/custom_blocks/music_block",
                                                          "Music Block", "Plays music!", System.Drawing.Color.White, "items/custom_blocks/music_block", false, 0,
                                                          new KeyValuePair <string, TemplateObject>("music_type", new IntegerTag(arg1)),
                                                          new KeyValuePair <string, TemplateObject>("music_volume", new NumberTag(arg2)),
                                                          new KeyValuePair <string, TemplateObject>("music_pitch", new NumberTag(arg3)))
                {
                    Datum = new BlockInternal((ushort)Material.DEBUG, 0, 0, 0).GetItemDatum()
                });
            }
            else if (arg0 == "structurePaste" && entry.InputArguments.Count > 1)
            {
                string arg1 = entry.InputArguments[1];
                entry.Player.Items.GiveItem(new ItemStack("structurepaste", arg1, entry.Player.TheServer, 1, "items/admin/structure_paste",
                                                          "Structor Paster", "Pastes a ;" + arg1 + "; structure!", System.Drawing.Color.White, "items/admin/structure_paste", false, 0));
            }
            else if (arg0 == "testPerm" && entry.InputArguments.Count > 1)
            {
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Testing " + entry.InputArguments[1] + ": " + entry.Player.HasPermission(entry.InputArguments[1]));
            }
            else if (arg0 == "spawnTree" && entry.InputArguments.Count > 1)
            {
                entry.Player.TheRegion.SpawnTree(entry.InputArguments[1].ToLowerFast(), entry.Player.GetPosition(), null);
            }
            else if (arg0 == "spawnTarget")
            {
                TargetEntity te = new TargetEntity(entry.Player.TheRegion);
                te.SetPosition(entry.Player.GetPosition() + entry.Player.ForwardVector() * 5);
                te.TheRegion.SpawnEntity(te);
            }
            else if (arg0 == "spawnSlime" && entry.InputArguments.Count > 2)
            {
                SlimeEntity se = new SlimeEntity(entry.Player.TheRegion, Utilities.StringToFloat(entry.InputArguments[2]))
                {
                    mod_color = ColorTag.For(entry.InputArguments[1]).Internal
                };
                se.SetPosition(entry.Player.GetPosition() + entry.Player.ForwardVector() * 5);
                se.TheRegion.SpawnEntity(se);
            }
            else if (arg0 == "timePathfind" && entry.InputArguments.Count > 1)
            {
                double dist = Utilities.StringToDouble(entry.InputArguments[1]);
                entry.Player.TheServer.Schedule.StartAsyncTask(() =>
                {
                    Stopwatch sw = new Stopwatch();
                    sw.Start();
                    List <Location> locs = entry.Player.TheRegion.FindPath(entry.Player.GetPosition(), entry.Player.GetPosition() + new Location(dist, 0, 0), dist * 2, 1.5f);
                    sw.Stop();
                    entry.Player.TheRegion.TheWorld.Schedule.ScheduleSyncTask(() =>
                    {
                        if (locs != null)
                        {
                            entry.Player.Network.SendPacket(new PathPacketOut(locs));
                        }
                        entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Took " + sw.ElapsedMilliseconds + "ms, passed: " + (locs != null));
                    });
                });
            }
            else if (arg0 == "findPath")
            {
                Location eye  = entry.Player.GetEyePosition();
                Location forw = entry.Player.ForwardVector();
                Location goal;
                if (entry.Player.TheRegion.SpecialCaseRayTrace(eye, forw, 150, MaterialSolidity.FULLSOLID, entry.Player.IgnorePlayers, out RayCastResult rcr))
                {
                    goal = new Location(rcr.HitData.Location);
                }
                else
                {
                    goal = eye + forw * 50;
                }
                entry.Player.TheServer.Schedule.StartAsyncTask(() =>
                {
                    Stopwatch sw = new Stopwatch();
                    sw.Start();
                    List <Location> locs;
                    try
                    {
                        locs = entry.Player.TheRegion.FindPath(entry.Player.GetPosition(), goal, 75, 1.5f);
                    }
                    catch (Exception ex)
                    {
                        Utilities.CheckException(ex);
                        SysConsole.Output("pathfinding", ex);
                        locs = null;
                    }
                    sw.Stop();
                    entry.Player.TheRegion.TheWorld.Schedule.ScheduleSyncTask(() =>
                    {
                        if (locs != null)
                        {
                            entry.Player.Network.SendPacket(new PathPacketOut(locs));
                        }
                        entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Took " + sw.ElapsedMilliseconds + "ms, passed: " + (locs != null));
                    });
                });
            }
            else if (arg0 == "gameMode" && entry.InputArguments.Count > 1)
            {
                if (Enum.TryParse(entry.InputArguments[1].ToUpperInvariant(), out GameMode mode))
                {
                    entry.Player.Mode = mode;
                }
            }
            else if (arg0 == "teleport" && entry.InputArguments.Count > 1)
            {
                entry.Player.Teleport(Location.FromString(entry.InputArguments[1]));
            }
            else if (arg0 == "loadPos")
            {
                entry.Player.UpdateLoadPos = !entry.Player.UpdateLoadPos;
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Now: " + (entry.Player.UpdateLoadPos ? "true" : "false"));
            }
            else if (arg0 == "tickRate")
            {
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Intended tick rate: " + entry.Player.TheServer.CVars.g_fps.ValueI + ", actual tick rate (last second): " + entry.Player.TheServer.TPS);
            }
            else if (arg0 == "paintBrush" && entry.InputArguments.Count > 1)
            {
                ItemStack its = entry.Player.TheServer.Items.GetItem("tools/paintbrush");
                byte      col = Colors.ForName(entry.InputArguments[1]);
                its.Datum     = col;
                its.DrawColor = Colors.ForByte(col);
                entry.Player.Items.GiveItem(its);
            }
            else if (arg0 == "paintBomb" && entry.InputArguments.Count > 1)
            {
                ItemStack its = entry.Player.TheServer.Items.GetItem("weapons/grenades/paintbomb", 10);
                byte      col = Colors.ForName(entry.InputArguments[1]);
                its.Datum     = col;
                its.DrawColor = Colors.ForByte(col);
                entry.Player.Items.GiveItem(its);
            }
            else if (arg0 == "sledgeHammer" && entry.InputArguments.Count > 1)
            {
                ItemStack its = entry.Player.TheServer.Items.GetItem("tools/sledgehammer");
                int       bsd = BlockShapeRegistry.GetBSDFor(entry.InputArguments[1]);
                its.Datum = bsd;
                entry.Player.Items.GiveItem(its);
            }
            else if (arg0 == "blockDamage" && entry.InputArguments.Count > 1)
            {
                if (Enum.TryParse(entry.InputArguments[1], out BlockDamage damage))
                {
                    Location      posBlock = (entry.Player.GetPosition() + new Location(0, 0, -0.05f)).GetBlockLocation();
                    BlockInternal bi       = entry.Player.TheRegion.GetBlockInternal(posBlock);
                    bi.Damage = damage;
                    entry.Player.TheRegion.SetBlockMaterial(posBlock, bi);
                }
                else
                {
                    entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "/devel <subcommand> [ values ... ]");
                }
            }
            else if (arg0 == "blockShare" && entry.InputArguments.Count > 1)
            {
                Location      posBlock = (entry.Player.GetPosition() + new Location(0, 0, -0.05f)).GetBlockLocation();
                BlockInternal bi       = entry.Player.TheRegion.GetBlockInternal(posBlock);
                bool          temp     = entry.InputArguments[1].ToLowerFast() == "true";
                bi.BlockShareTex = temp;
                entry.Player.TheRegion.SetBlockMaterial(posBlock, bi);
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Block " + posBlock + " which is a " + bi.Material + " set ShareTex mode to " + temp + " yields " + bi.BlockShareTex);
            }
            else if (arg0 == "webPass" && entry.InputArguments.Count > 1)
            {
                entry.Player.PlayerConfig.Set("web.passcode", Utilities.HashQuick(entry.Player.Name.ToLowerFast(), entry.InputArguments[1]));
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Set.");
            }
            else if (arg0 == "spawnMessage" && entry.InputArguments.Count > 1)
            {
                string             mes = entry.InputArguments[1].Replace("\\n", "\n");
                HoverMessageEntity hme = new HoverMessageEntity(entry.Player.TheRegion, mes)
                {
                    Position = entry.Player.GetEyePosition()
                };
                entry.Player.TheRegion.SpawnEntity(hme);
            }
            else if (arg0 == "chunkTimes")
            {
                foreach (Tuple <string, double> time in entry.Player.TheRegion.Generator.GetTimings())
                {
                    entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> " + time.Item1 + ": " + time.Item2);
                }
#if TIMINGS
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_General);
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/A]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_A);
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/B]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_B);
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/C]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_C);
                entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/D]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_D);
                if (entry.InputArguments.Count > 1 && entry.InputArguments[1] == "clear")
                {
                    entry.Player.TheRegion.Generator.ClearTimings();
                    entry.Player.TheRegion.TheServer.BlockImages.Timings_General = 0;
                    entry.Player.TheRegion.TheServer.BlockImages.Timings_A       = 0;
                    entry.Player.TheRegion.TheServer.BlockImages.Timings_B       = 0;
                    entry.Player.TheRegion.TheServer.BlockImages.Timings_C       = 0;
                    entry.Player.TheRegion.TheServer.BlockImages.Timings_D       = 0;
                }
#endif
            }
            else if (arg0 == "fireWork" && entry.InputArguments.Count > 1)
            {
                ParticleEffectPacketOut pepo;
                Location pos = entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 10;
                switch (entry.InputArguments[1])
                {
                case "rainbow_huge":
                    pepo = new ParticleEffectPacketOut(ParticleEffectNetType.FIREWORK, 15, pos, new Location(-1, -1, -1), new Location(-1, -1, -1), 150);
                    break;

                case "red_big":
                    pepo = new ParticleEffectPacketOut(ParticleEffectNetType.FIREWORK, 10, pos, new Location(1, 0, 0), new Location(1, 0, 0), 100);
                    break;

                case "green_medium":
                    pepo = new ParticleEffectPacketOut(ParticleEffectNetType.FIREWORK, 7.5, pos, new Location(0.25, 1, 0.25), new Location(0.25, 1, 1), 100);
                    break;

                case "blue_small":
                    pepo = new ParticleEffectPacketOut(ParticleEffectNetType.FIREWORK, 5, pos, new Location(0, 0, 1), new Location(0, 0, -1), 50);
                    break;

                default:
                    ShowUsage(entry);
                    return;
                }
                entry.Player.Network.SendPacket(pepo);
            }
            else
            {
                ShowUsage(entry);
                return;
            }
        }
Example #33
0
        public static ItemStack FromString(Server tserver, string input)
        {
            int    brack    = input.IndexOf('[');
            string name     = input.Substring(0, brack);
            string contents = input.Substring(brack + 1, input.Length - (brack + 1));
            List <KeyValuePair <string, string> > pairs = SplitUpPairs(contents);
            string secname     = "";
            int    count       = 1;
            string tex         = "";
            string display     = "";
            string descrip     = "";
            string model       = "";
            string components  = "";
            bool   bound       = false;
            string shared      = "";
            string local       = "";
            double weight      = 1;
            double volume      = 1;
            int    datum       = 0;
            double temperature = 0;

            System.Drawing.Color color = System.Drawing.Color.White;
            bool     renderComp        = true;
            Location renderCompOffs    = Location.Zero;

            foreach (KeyValuePair <string, string> pair in pairs)
            {
                string tkey = UnescapeTagBase.Unescape(pair.Key);
                string tval = UnescapeTagBase.Unescape(pair.Value);
                switch (tkey)
                {
                case "secondary":
                    secname = tval;
                    break;

                case "display":
                    display = tval;
                    break;

                case "count":
                    count = Utilities.StringToInt(tval);
                    break;

                case "description":
                    descrip = tval;
                    break;

                case "texture":
                    tex = tval;
                    break;

                case "model":
                    model = tval;
                    break;

                case "bound":
                    bound = tval == "true";
                    break;

                case "drawcolor":
                    color = (ColorTag.For(tval) ?? new ColorTag(color)).Internal;
                    break;

                case "datum":
                    datum = IntDatumFor(tval);
                    break;

                case "weight":
                    weight = Utilities.StringToFloat(tval);
                    break;

                case "volume":
                    volume = Utilities.StringToFloat(tval);
                    break;

                case "temperature":
                    temperature = Utilities.StringToFloat(tval);
                    break;

                case "shared":
                    shared = tval;
                    break;

                case "local":
                    local = tval;
                    break;

                case "components":
                    components = tval;
                    break;

                case "renderascomponent":
                    renderComp = tval.ToLowerFast() == "true";
                    break;

                case "componentrenderoffset":
                    renderCompOffs = Location.FromString(tval);
                    break;

                default:
                    break;     // Ignore errors as much as possible here.
                    // TODO: Maybe actually just error?
                }
            }
            ItemStack item = new ItemStack(name, secname, tserver, count, tex, display, descrip, color, model, bound, datum);

            item.Weight      = weight;
            item.Volume      = volume;
            item.Temperature = temperature;
            pairs            = SplitUpPairs(shared.Substring(1, shared.Length - 2));
            foreach (KeyValuePair <string, string> pair in pairs)
            {
                string         dat     = UnescapeTagBase.Unescape(pair.Value);
                string         type    = dat.Substring(0, 4);
                string         content = dat.Substring(5);
                TemplateObject togive  = TOFor(tserver, type, content);
                item.SharedAttributes.Add(UnescapeTagBase.Unescape(pair.Key), togive);
            }
            pairs = SplitUpPairs(local.Substring(1, local.Length - 2));
            foreach (KeyValuePair <string, string> pair in pairs)
            {
                string         dat     = UnescapeTagBase.Unescape(pair.Value);
                string         type    = dat.Substring(0, 4);
                string         content = dat.Substring(5);
                TemplateObject togive  = TOFor(tserver, type, content);
                item.Attributes.Add(UnescapeTagBase.Unescape(pair.Key), togive);
            }
            string[] npairs = components.Substring(1, local.Length - 2).SplitFast(';', 2);
            foreach (string pair in npairs)
            {
                string dat = UnescapeTagBase.Unescape(pair);
                if (dat.Length > 0)
                {
                    item.Components.Add(FromString(tserver, dat));
                }
            }
            item.RenderAsComponent     = renderComp;
            item.ComponentRenderOffset = renderCompOffs;
            return(item);
        }
 public static UIColor GetUIColor(this Color c)
 {
     var t = c.Tag as ColorTag;
     if (t == null) {
         t = new ColorTag ();
         c.Tag = t;
     }
     if (t.UIColor == null) {
         t.UIColor = UIColor.FromRGBA (c.Red / 255.0f, c.Green / 255.0f, c.Blue / 255.0f, c.Alpha / 255.0f);
     }
     return t.UIColor;
 }
 public static NSColor GetNSColor(this Color c)
 {
     var t = c.Tag as ColorTag;
     if (t == null) {
         t = new ColorTag ();
         c.Tag = t;
     }
     if (t.NSColor == null) {
         t.NSColor = NSColor.FromDeviceRgba (c.Red / 255.0f, c.Green / 255.0f, c.Blue / 255.0f, c.Alpha / 255.0f);
     }
     return t.NSColor;
 }
 public static CGColor GetCGColor(this Color c)
 {
     var t = c.Tag as ColorTag;
     if (t == null) {
         t = new ColorTag ();
         c.Tag = t;
     }
     if (t.CGColor == null) {
         t.CGColor = new CGColor (c.Red / 255.0f, c.Green / 255.0f, c.Blue / 255.0f, c.Alpha / 255.0f);
     }
     return t.CGColor;
 }
Example #37
0
   /// <summary>
   /// Sets a color tag on the supplied node.
   /// </summary>
   public static void SetTag(IAnimatable node, ColorTag tag)
   {
      Throw.IfNull(node, "node");
      
      node.RemoveAppDataChunk(ColorTags.classID, SClass_ID.Utility, 0);

      if (tag != ColorTag.None)
      {
         byte[] data = new byte[1] { (byte)tag };
         node.AddAppDataChunk(ColorTags.classID, SClass_ID.Utility, 0, data);
      }

      if (MaxInterfaces.Global != null)
         MaxInterfaces.Global.BroadcastNotification(ColorTags.TagChanged, node);

      //Broadcast changed notification for all layer nodes.
      IILayer layer = node as IILayer;
      if (layer != null)
      {
         //TODO: fix dependency.
         //if (tag == ColorTag.WireColor)
         //   AutoInheritProperties.SetAutoInherit(layer, NodeLayerProperty.Color, true);

         IILayerProperties layerProperties = MaxInterfaces.IIFPLayerManager.GetLayer(layer.Name);
         if (layerProperties != null)
         {
            ITab<IINode> nodes = MaxInterfaces.Global.INodeTabNS.Create();
            layerProperties.Nodes(nodes);

            foreach (IINode layerNode in nodes.ToIEnumerable())
            {
               if (MaxInterfaces.Global != null)
                  MaxInterfaces.Global.BroadcastNotification(ColorTags.TagChanged, layerNode);
            }
         }
      }
   }
 public ColorTagToolStripButton(ColorTag colorTag)
 {
    this.ColorTag = colorTag;
 }
Example #39
0
 public void OnUnequipped(Inventory inventory)
 {
     ColorTag.UntagObject(gameObject);
 }
Example #40
0
   /// <summary>
   /// Gets the color of the supplied tag.
   /// </summary>
   public static Color GetTagColor(ColorTag tag)
   {
      if (tag == ColorTag.WireColor)
         throw new ArgumentException("ColorTag.WireColor is not a valid value for GetTagColor");

      if (tag == ColorTag.None)
         return Color.Empty;

      IIColorManager colorMan = MaxInterfaces.Global.ColorManager;
      Tuple<uint, Color> colorEntry;
      if (ColorTags.colors.TryGetValue(tag, out colorEntry))
      {
         Color color = colorMan.GetColor((GuiColors)colorEntry.Item1);
         return Colors.FromMaxColor(color);
      }
      else
         return Color.Empty;
   }
Example #41
0
 /// <summary>
 /// Gets the tag (or wire-) color of the supplied node.
 /// </summary>
 public static Color GetColor(IAnimatable node, ColorTag tag)
 {
    if (tag == ColorTag.None)
       return Color.Empty;
    else if (tag == ColorTag.WireColor)
       return ColorTags.GetWireColor(node);
    else
       return ColorTags.GetTagColor(tag);
 }
Example #42
0
        private void AddMarker(SnapshotSpan span,
                               Geometry markerGeometry,
                               ColorTag ct)
        {
            double cornerRadius;

            try
            {
                switch (Lighthouse.Options.HighlightCorner)
                {
                case CornerStyle.Square:
                    cornerRadius = 0.0;
                    break;

                case CornerStyle.RoundedCorner:
                    cornerRadius = 2.0;
                    break;

                case CornerStyle.Soft:
                    cornerRadius = 6.0;
                    break;

                default:
                    cornerRadius = 2.0;
                    break;
                }
            }
            catch (Exception)
            {
                cornerRadius = 2.0;
            }

            Rectangle r = new Rectangle
            {
                Fill    = new SolidColorBrush(ct.ColorSwatch.ChangeAlpha(60)),
                RadiusX = cornerRadius,
                RadiusY = cornerRadius,
                Width   = markerGeometry.Bounds.Width,
                Height  = ct.isUnderline ? 4 : markerGeometry.Bounds.Height,
                Stroke  = new SolidColorBrush(ct.ColorSwatch.ChangeAlpha(100))
            };

            if (ct.isFullLine)
            {
                r.Width = textView.ViewportWidth - markerGeometry.Bounds.Left;
            }

            if (isBlurred != BlurType.NoBlur)
            {
                if (isBlurred == BlurType.BlurAll)
                {
                    ct.Blur = Lighthouse.Options.Blur;
                }

                if (ct.Blur != BlurIntensity.None)
                {
                    r.Effect = new BlurEffect
                    {
                        KernelType    = KernelType.Gaussian,
                        RenderingBias = RenderingBias.Performance
                    };
                    bool isLine = ct.isUnderline;
                    switch (ct.Blur)
                    {
                    case BlurIntensity.Low:
                        ((SolidColorBrush)r.Fill).Color.ChangeAlpha(80);
                        ((BlurEffect)r.Effect).Radius = isLine ? 2 : 4.0;
                        break;

                    case BlurIntensity.Medium:
                        ((SolidColorBrush)r.Fill).Color.ChangeAlpha(120);
                        ((BlurEffect)r.Effect).Radius = isLine ? 4 : 7.0;
                        break;

                    case BlurIntensity.High:
                        ((SolidColorBrush)r.Fill).Color.ChangeAlpha(170);
                        ((BlurEffect)r.Effect).Radius = isLine ? 6 : 11.0;
                        break;

                    case BlurIntensity.Ultra:
                        ((SolidColorBrush)r.Fill).Color.ChangeAlpha(255);
                        ((BlurEffect)r.Effect).Radius = isLine ? 8 : 20.0;
                        break;

                    default:
                    case BlurIntensity.None:
                        r.Effect = null;
                        break;
                    }

                    r.Stroke = null;
                }
            }

            // Align the image with the top of the bounds of the text geometry
            Canvas.SetLeft(r, markerGeometry.Bounds.Left);
            Canvas.SetTop(r, ct.isUnderline ? (markerGeometry.Bounds.Top + markerGeometry.Bounds.Height - 2) : markerGeometry.Bounds.Top);

            adornmentLayer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, null, r, null);
        }
Example #43
0
 public static void SetColorTag(this IEnumerable<IMaxNode> nodes, ColorTag tag)
 {
    nodes.Select(n => n.BaseObject)
         .Where(n => n is IAnimatable)
         .ForEach(n => ColorTags.SetTag((IAnimatable)n, tag));
 }