コード例 #1
0
 /// <summary>
 /// Сохраняются настройки компонента
 /// </summary>
 /// <param name="node">Узел с настройками</param>
 public void SaveState(XmlElement node)
 {
     node.RemoveAll();
     node.SetAttribute("ScaleX", ScaleX.ToString());
     node.SetAttribute("ScaleY", ScaleY.ToString());
     if (viewChannelsGrid != null)
     {
         viewChannelsGrid.SaveState(node.AppendChild(node.OwnerDocument.CreateElement("Channels")) as XmlElement);
     }
 }
コード例 #2
0
        public void DisplayInfo(Player p)
        {
            p.Message("Bot {0} &S({1}) has:", ColoredName, name);
            p.Message("  Owner: &f{0}", string.IsNullOrEmpty(Owner) ? "no one" : p.FormatNick(Owner));
            if (!String.IsNullOrEmpty(AIName))
            {
                p.Message("  AI: &f{0}", AIName);
            }
            if (hunt || kill)
            {
                p.Message("  Hunt: &f{0}&S, Kill: %f{1}", hunt, kill);
            }
            if (SkinName != name)
            {
                p.Message("  Skin: &f{0}", SkinName);
            }
            if (Model != "humanoid")
            {
                p.Message("  Model: &f{0}", Model);
            }
            if (!(ScaleX == 0 && ScaleY == 0 && ScaleZ == 0))
            {
                p.Message("  X scale: &a{0}&S, Y scale: &a{1}&S, Z scale: &a{2}",
                          ScaleX == 0 ? "none" : ScaleX.ToString(),
                          ScaleY == 0 ? "none" : ScaleY.ToString(),
                          ScaleZ == 0 ? "none" : ScaleZ.ToString()
                          );
            }

            if (String.IsNullOrEmpty(ClickedOnText))
            {
                return;
            }
            ItemPerms perms = CommandExtraPerms.Find("About", 1) ?? new ItemPerms(LevelPermission.AdvBuilder);

            if (!perms.UsableBy(p.Rank))
            {
                return;                          //don't show bot's ClickedOnText if player isn't allowed to see message block contents
            }
            p.Message("  Clicked-on text: {0}", ClickedOnText);
        }
コード例 #3
0
        public string ToRawAss(string styleFormat = DefaultAssStyleFormat)
        {
            var sb = new StringBuilder();

            sb.Append("Style: ");
            var format = styleFormat.ToLowerInvariant().Substring(8).Split(',');

            for (int i = 0; i < format.Length; i++)
            {
                string f = format[i].Trim();
                if (f == "name")
                {
                    sb.Append(Name);
                }
                else if (f == "fontname")
                {
                    sb.Append(FontName);
                }
                else if (f == "fontsize")
                {
                    sb.Append(FontSize.ToString(CultureInfo.InvariantCulture));
                }
                else if (f == "primarycolour")
                {
                    sb.Append(AdvancedSubStationAlpha.GetSsaColorString(Primary));
                }
                else if (f == "secondarycolour")
                {
                    sb.Append(AdvancedSubStationAlpha.GetSsaColorString(Secondary));
                }
                else if (f == "outlinecolour")
                {
                    sb.Append(AdvancedSubStationAlpha.GetSsaColorString(Outline));
                }
                else if (f == "backcolour")
                {
                    sb.Append(AdvancedSubStationAlpha.GetSsaColorString(Background));
                }
                else if (f == "bold")
                {
                    sb.Append(BoolToRawSsa(Bold));
                }
                else if (f == "italic")
                {
                    sb.Append(BoolToRawSsa(Italic));
                }
                else if (f == "underline")
                {
                    sb.Append(BoolToRawSsa(Underline));
                }
                else if (f == "strikeout")
                {
                    sb.Append(BoolToRawSsa(Strikeout));
                }
                else if (f == "outline")
                {
                    sb.Append(OutlineWidth.ToString(CultureInfo.InvariantCulture));
                }
                else if (f == "shadow")
                {
                    sb.Append(ShadowWidth.ToString(CultureInfo.InvariantCulture));
                }
                else if (f == "alignment")
                {
                    sb.Append(Alignment);
                }
                else if (f == "marginl")
                {
                    sb.Append(MarginLeft);
                }
                else if (f == "marginr")
                {
                    sb.Append(MarginRight);
                }
                else if (f == "marginv")
                {
                    sb.Append(MarginVertical);
                }
                else if (f == "borderstyle")
                {
                    sb.Append(BorderStyle);
                }
                else if (f == "encoding")
                {
                    sb.Append('1');
                }
                else if (f == "strikeout")
                {
                    sb.Append('0');
                }
                else if (f == "scalex")
                {
                    sb.Append(ScaleX.ToString(CultureInfo.InvariantCulture));
                }
                else if (f == "scaley")
                {
                    sb.Append(ScaleY.ToString(CultureInfo.InvariantCulture));
                }
                else if (f == "spacing")
                {
                    sb.Append(Spacing.ToString(CultureInfo.InvariantCulture));
                }
                else if (f == "angle")
                {
                    sb.Append(Angle.ToString(CultureInfo.InvariantCulture));
                }

                sb.Append(',');
            }

            var s = sb.ToString().Trim();

            return(s.Substring(0, s.Length - 1));
        }