protected override void EndProcessing()
        {
            Endpoint onClick = null;

            if (OnClick != null)
            {
                onClick = GenerateCallback(Id + "onClick", OnClick, null);
            }

            var counter = new Counter
            {
                AutoRefresh     = AutoRefresh,
                RefreshInterval = RefreshInterval,
                Callback        = GenerateCallback(Id),
                OnClick         = onClick,
                Format          = Format,
                Icon            = FontAwesomeIconsExtensions.GetIconName(Icon),
                Title           = Title,
                Id = Id,
                BackgroundColor = BackgroundColor?.HtmlColor,
                FontColor       = FontColor?.HtmlColor,
                Links           = Links,
                TextAlignment   = TextAlignment.GetName(),
                TextSize        = TextSize.GetName(),
                HasOnClick      = onClick != null
            };

            Log.Debug(JsonConvert.SerializeObject(counter));

            WriteObject(counter);
        }
        private List <SSB64Char> GetChars(string str, TextSize size, int maxLength)
        {
            var ssb64Chars = new List <SSB64Char>();


            while (str.Length < maxLength)
            {
                str += " ";
            }

            foreach (var c in str)
            {
                SSB64Char ssb64char = null;

                switch (size)
                {
                case TextSize.Small:
                {
                    ssb64char = CharSet.SSB64CharSet.Single(x => x.CharacterSmall == c.ToString());
                    break;
                }

                case TextSize.Large:
                {
                    ssb64char = CharSet.SSB64CharSet.Single(x => x.CharacterLarge == c.ToString());
                    break;
                }
                }

                ssb64Chars.Add(ssb64char);
            }

            return(ssb64Chars);
        }
Esempio n. 3
0
        public static void SetTextMode(TextSize Size)
        {
            switch (Size)
            {
            case TextSize.Size40x25:
                mScreen.SetTextMode(VGADriver.TextSize.Size40x25);
                break;

            case TextSize.Size40x50:
                mScreen.SetTextMode(VGADriver.TextSize.Size40x50);
                break;

            case TextSize.Size80x25:
                mScreen.SetTextMode(VGADriver.TextSize.Size80x25);
                break;

            case TextSize.Size80x50:
                mScreen.SetTextMode(VGADriver.TextSize.Size80x50);
                break;

            case TextSize.Size90x30:
                mScreen.SetTextMode(VGADriver.TextSize.Size90x30);
                break;

            case TextSize.Size90x60:
                mScreen.SetTextMode(VGADriver.TextSize.Size90x60);
                break;

            default:
                throw new Exception("This situation is not implemented!");
            }
        }
Esempio n. 4
0
 public UIText(Rectangle container, string text, Alignment alignment, TextSize textSize)
 {
     this.text      = text;
     this.alignment = alignment;
     this.container = container;
     this.textSize  = textSize;
 }
 public TitleAttribute(string content, float overrideHeight = 1, LabelStyle style = LabelStyle.bold, TextSize textSize = TextSize.normal)
 {
     this.content        = content;
     this.overrideHeight = overrideHeight;
     this.style          = style;
     this.textSize       = textSize;
 }
Esempio n. 6
0
 // Use this for initialization
 void Awake()
 {
     this.textMesh       = this.GetComponentInChildren <TextMesh>();
     this.textSize       = new TextSize(textMesh);
     this.flyInAnimation = this.GetComponent <FlyIn>();
     this.startColor     = this.renderer ? this.renderer.material.color : Color.white;
 }
Esempio n. 7
0
 private static void AddTextBlock(Column column, string text, TextSize size, HorizontalAlignment alignment)
 {
     column.Items.Add(new TextBlock()
     {
         Text = text,
         Size = size,
         HorizontalAlignment = alignment
     });
 }
Esempio n. 8
0
    private void Start()
    {
        textSize = new TextSize(textMesh);
        //textMesh.text = "aaa aa aa aaaaa";
        //textMesh.text = "a b c d e f g h i j k l m n o p qqqqqqqqq";
        //textMesh.text = "a b c d e f g h i j";

        textMesh.text = WrapTextGreedy(textMesh.text);
    }
        /// <summary>
        /// Requests the remote HTML.
        /// </summary>
        /// <param name="cacheProvider">Strategy for caching the remote HTML.</param>
        /// <param name="selectedSection">The selected section.</param>
        private void RequestRemoteHtml(RemoteMasterPageCacheProviderBase cacheProvider, string selectedSection)
        {
            try
            {
                // Get the URL to request the cached control from.
                // Include text size so that header knows which links to apply
                var textSize        = new TextSize(HttpContext.Current.Request.Cookies, HttpContext.Current.Request.QueryString);
                Uri urlToRequest    = new Uri(HttpContext.Current.Request.Url, String.Format(CultureInfo.CurrentCulture, config["MasterPageControlUrl"], this.Control));
                var applicationPath = HttpUtility.UrlEncode(HttpRuntime.AppDomainAppVirtualPath.ToLower(CultureInfo.CurrentCulture).TrimEnd('/'));
                var query           = HttpUtility.ParseQueryString(urlToRequest.Query);
                query.Add("section", selectedSection);
                query.Add("host", Page.Request.Url.Host);
                query.Add("textsize", textSize.CurrentTextSize().ToString(CultureInfo.InvariantCulture));
                query.Add("path", applicationPath);
                urlToRequest = new Uri(urlToRequest.Scheme + "://" + urlToRequest.Authority + urlToRequest.AbsolutePath + "?" + query);

                // Create the request. Pass current user-agent so that library catalogue PCs can be detected by the remote script.
                var webRequest = (HttpWebRequest)WebRequest.Create(urlToRequest);
                webRequest.UseDefaultCredentials = true;
                webRequest.UserAgent             = Page.Request.UserAgent;
                webRequest.Proxy   = new ConfigurationProxyProvider().CreateProxy();
                webRequest.Timeout = 4000;
                if (!String.IsNullOrEmpty(this.config["Timeout"]))
                {
                    int timeout;
                    if (Int32.TryParse(this.config["Timeout"], out timeout))
                    {
                        webRequest.Timeout = timeout;
                    }
                }
#if DEBUG
                // Turn off SSL check in debug mode as it will always fail against a self-signed certificate used for development
                webRequest.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
#endif

                // Prepare the information we'll need when the response comes back
                var state = new RequestState();
                state.Request       = webRequest;
                state.CacheProvider = cacheProvider;

                // Kick off the request and, only if there's nothing already cached which we can use, wait for it to come back
                if (cacheProvider.SupportsAsync)
                {
                    RequestRemoteHtmlAsynchronous(cacheProvider, webRequest, state);
                }
                else
                {
                    RequestRemoteHtmlSynchronous(cacheProvider, webRequest);
                }
            }
            catch (UriFormatException ex)
            {
                throw new ConfigurationErrorsException(String.Format(CultureInfo.CurrentCulture, config["MasterPageControlUrl"], this.Control) + " is not a valid absolute URL", ex);
            }
        }
Esempio n. 10
0
 private static void AddTextBlock(Column column, string text, TextSize size, bool isSubTitle = true)
 {
     column.Items.Add(new TextBlock()
     {
         Text = text,
         Size = size,
         HorizontalAlignment = HorizontalAlignment.Center,
         IsSubtle            = isSubTitle,
         Separation          = SeparationStyle.None
     });
 }
Esempio n. 11
0
 /// <summary>
 ///     Gets the hash code
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (TranslationText != null ? TranslationText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Text != null ? Text.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Background != null ? Background.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TextSize.GetHashCode();
         hashCode = (hashCode * 397) ^ (PartName != null ? PartName.GetHashCode() : 0);
         return(hashCode);
     }
 }
Esempio n. 12
0
        public void AddLine(string line, TextSize size = TextSize.Normal, TextAlignment align = TextAlignment.Left, TextWeight weight = TextWeight.Normal)
        {
            ReceiptLine l = new ReceiptLine();

            l.Text      = (line ?? string.Empty);
            l.Size      = size;
            l.Weight    = weight;
            l.Alignment = align;
            l.TextRight = null;

            _lines.Add(l);
        }
Esempio n. 13
0
        private void FontButtonClicked(object sender, RoutedEventArgs e)
        {
            // Toggle size
            this.textSize = this.textSize == TextSize.Small ? TextSize.Large : TextSize.Small;

            // Apply new size to all text
            StepOne.FontSize           = StepTwo.FontSize = StepThree.FontSize = (double)this.textSize;
            UserNotifications.FontSize = UserHelpContact.FontSize = UserHelpSkype.FontSize = (double)this.textSize;
            EmailHeader.FontSize       = SkypeHeader.FontSize = PhoneHeader.FontSize = (double)this.textSize;
            EmailHeader.Height         = SkypeHeader.Height = PhoneHeader.Height = this.textSize == TextSize.Small ? 20 : 30;
            RequestHelp.FontSize       = AvailableDoctors.FontSize = (double)this.textSize;
        }
Esempio n. 14
0
        protected override void Render(HtmlTextWriter writer)
        {
            HttpContext context = HttpContext.Current;

            writer.Write("<img src='" + "GradientLabel.aspx?" +
                         "Text=" + context.Server.UrlEncode(Text) +
                         "&TextSize=" + TextSize.ToString() +
                         "&TextColor=" + TextColor.ToArgb() +
                         "&GradientColorA=" + GradientColorA.ToArgb() +
                         "&GradientColorB=" + GradientColorB.ToArgb() +
                         "'>");
        }
Esempio n. 15
0
        public void AddLineValuePair(string name, string value, TextSize size = TextSize.Large, TextWeight weight = TextWeight.Normal)
        {
            ReceiptLine l = new ReceiptLine();

            l.Text      = (name ?? string.Empty);
            l.TextRight = (value ?? string.Empty);
            l.Size      = size;
            l.Weight    = weight;
            l.Alignment = TextAlignment.Center;

            _lines.Add(l);
        }
        internal static TextSize FromClassList(HTMLElement element, TextSize defaultValue)
        {
            var curFontSize = element.classList.FirstOrDefault(t => t.StartsWith("tss-fontsize-"));

            if (curFontSize is object && Enum.TryParse <TextSize>(curFontSize.Substring("tss-fontsize-".Length), true, out var result))
            {
                return(result);
            }
            else
            {
                return(defaultValue);
            }
        }
Esempio n. 17
0
 public override void Update(GameTime gameTime)
 {
     if (Active)
     {
         Point size = (TextSize * Scale).ToPoint();
         Rect        = new Rectangle(Position, size);
         DefaultSize = TextSize.ToPoint();
     }
     if (Property != null)
     {
         Property.Update(gameTime);
     }
 }
Esempio n. 18
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected new void Page_Load(object sender, EventArgs e)
        {
            // Apply selected text size to page
            var textSize     = new TextSize(Request.Cookies, Request.QueryString);
            int baseTextSize = textSize.CurrentTextSize();

            if (baseTextSize > 1)
            {
                // Add a space if there are other classes, then add to body tag
                this.bodyclass.Controls.Add(new LiteralControl(" size" + baseTextSize.ToString(CultureInfo.InvariantCulture)));
            }

            // Support web fonts required by the current skin
            if (Skin != null)
            {
                var fontsHtml = new StringBuilder();
                foreach (var font in Skin.RequiresGoogleFonts())
                {
                    fontsHtml.Append("<link href=\"").Append(font.FontUrl).Append("\" rel=\"stylesheet\" type=\"text/css\" />");
                }

                if (Skin.RequiresTypekitFonts().Any())
                {
                    foreach (var font in Skin.RequiresTypekitFonts())
                    {
                        fontsHtml.Append("<script src=\"").Append(font.TypekitUrl).Append("\"></script>");
                    }
                    this.Typekit.Visible = true;
                }
                this.fonts.Text = fontsHtml.ToString();

                AddClientDependencies(Skin);
            }

            // Support web chat
            var context = new HostingEnvironmentContext();

            if (context.WebChatSettingsUrl != null)
            {
                var webChat = new WebChat();
                webChat.WebChatSettings         = new WebChatSettingsFromApi(context.WebChatSettingsUrl, new ConfigurationProxyProvider(), new ApplicationCacheStrategy <WebChatSettings>(TimeSpan.FromMinutes(context.WebChatSettingsCacheDuration))).ReadWebChatSettings();
                webChat.WebChatSettings.PageUrl = new Uri(Request.Url.AbsolutePath, UriKind.Relative);
                if (webChat.IsRequired())
                {
                    AddClientDependencies(webChat);
                }
            }

            // Run the base method as well
            base.Page_Load(sender, e);
        }
Esempio n. 19
0
        public bool PrintFieldValue(String nameText, String valueText, int textSize, int textWeight)
        {
            TextSize   size   = TextSize.Normal;
            TextWeight weight = TextWeight.Normal;

            if (Enum.IsDefined(typeof(TextSize), textSize))
            {
                size = (TextSize)textSize;
            }
            if (Enum.IsDefined(typeof(TextWeight), textWeight))
            {
                weight = (TextWeight)textWeight;
            }

            if (_printer == null)
            {
                _printer = FindPrinter(_deviceName);
            }

            if (_printer != null)
            {
                string textField = nameText.Replace("ESC", ((char)27).ToString());
                string textValue = valueText.Replace("ESC", ((char)27).ToString());

                string mods = "";
                switch (size)
                {
                case TextSize.Large:
                    mods += DoubleWideAndHightCharacters;
                    break;
                }

                switch (weight)
                {
                case TextWeight.Bold:
                    mods += Bold;
                    break;
                }

                //add padding to fill expected receipt width
                while (textField.Length + textValue.Length < RECEIPT_CHAR_WIDTH)
                {
                    textValue = " " + textValue;
                }

                _printer.PrintNormal(PrinterStation.Receipt, mods + textField + textValue + NewLine);
                return(true);
            }
            return(false);
        }
Esempio n. 20
0
        public void SaveSettings()
        {
            // Открываем узел appSettings, в котором содержится перечень настроек.
            XmlNode node = doc.SelectSingleNode("//appSettings");

            if (node == null)
            {
                node = doc.CreateNode(XmlNodeType.Element, "appSettings", "");
                XmlElement root = doc.DocumentElement;
                root.AppendChild(node);
            }

            // Массив ключей (создан для упрощения обращения к файлу конфигурации).
            string[] keys = new string[] { "BackColor",
                                           "TextColor",
                                           "TextSize",
                                           "TextFont" };

            // Массив значений (создан для упрощения обращения к файлу конфигурации).
            string[] values = new string[] { BackColor.ToString(),
                     TextColor.ToString(),
                     TextSize.ToString(),
                     TextFont.ToString() };

            // Цикл модификации файла конфигурации.
            for (int i = 0; i < keys.Length; i++)
            {
                // Обращаемся к конкретной строке по ключу.
                XmlElement element = node.SelectSingleNode(string.Format("//add[@key='{0}']", keys[i])) as XmlElement;

                // Если строка с таким ключем существует - записываем значение.
                if (element != null)
                {
                    element.SetAttribute("value", values[i]);
                }
                else
                {
                    // Иначе: создаем строку и формируем в ней пару [ключ]-[значение].
                    element = doc.CreateElement("add");
                    element.SetAttribute("key", keys[i]);
                    element.SetAttribute("value", values[i]);
                    node.AppendChild(element);
                }
            }
            // Сохраняем результат модификации.
            doc.Save(Assembly.GetExecutingAssembly().Location + ".config");
        }
Esempio n. 21
0
    private void Awake()
    {
        Size = size;        //set values based on size value

        dialogueChunk = -1; //default no dialogue
        chunks        = new List <string>();

        text = new List <SpriteRenderer>();
        GameObject     newLetter;
        SpriteRenderer textRender;

        //Create all the placeHolders for charachter positions
        for (int line = 0; line < numLines; line++)
        {
            for (int cha = 0; cha < charsPerLine; cha++)
            {
                newLetter      = Instantiate(charPrefab, transform);
                newLetter.name = "char" + line + "." + cha;
                newLetter.transform.position = transform.position +
                                               new Vector3((cha * offset.x) + initialOffset.x, (line * offset.y) + initialOffset.y, 0); //TODO: make variables for adjustable 'font size'
                textRender = newLetter.GetComponent <SpriteRenderer>();

                textRender.color          = letterColor;
                textRender.sortingLayerID = GetComponent <SpriteRenderer>().sortingLayerID;
                textRender.sortingOrder   = GetComponent <SpriteRenderer>().sortingOrder + 1;

                text.Add(newLetter.GetComponent <SpriteRenderer>());
            }
        }
        //Create the placeholder for the face image
        GameObject charachterFace = Instantiate(charPrefab, transform);

        charachterFace.name = "faceImage";
        charachterFace.transform.position = transform.position + new Vector3(-9.0f, 0.0f, 0.0f);
        charachterImage = charachterFace.GetComponent <SpriteRenderer>();
        charachterImage.sortingLayerID = GetComponent <SpriteRenderer>().sortingLayerID;
        charachterImage.sortingOrder   = GetComponent <SpriteRenderer>().sortingOrder + 1;
        charachterImage.sprite         = letters[letters.Length - 1];

        SetAllRenderers(false);

        audioPlayer = GetComponent <AudioPlayer>();
    }
Esempio n. 22
0
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if (titleExists == false) {
            gameObject.name = "\""+value+"\"";
        }

        gameObject.AddComponent("TextMesh");

        textMesh = gameObject.GetComponent(typeof(TextMesh)) as TextMesh;
        ts = new TextSize(gameObject.GetComponent<TextMesh>());

        textMesh.font = PlanetUnityGameObject.FindFontNamed(font);
        textMesh.text = "";

        textMesh.color = new Color (textColor.r, textColor.g, textColor.b, textColor.a);

        // magic numbers explained here: http://answers.unity3d.com/questions/55433/textmesh-charactersize-vs-fontsize.html
        textMesh.characterSize = fontSize*10.0f/(fontSize*2);
        textMesh.fontSize = (fontSize*2);

        textMesh.lineSpacing = 0.93f;

        CreateGeometry ();

        if (shaderExists == false) {
            shader = "PlanetUnity/Label";
        }

        MeshRenderer meshRendererComponent = gameObject.GetComponent(typeof(MeshRenderer)) as MeshRenderer;
        var shaderObj = Shader.Find (fullShaderPath (shader));
        Material mat = new Material (shaderObj);
        mat.mainTexture = textMesh.font.material.mainTexture;
        mat.mainTexture.filterMode = FilterMode.Bilinear;
        meshRendererComponent.materials = new Material[] { mat };

        gameObject.renderer.material.renderQueue = scope ().getRenderQueue () + renderQueueOffset;

        LoadTextString(value);
    }
Esempio n. 23
0
        private void TextSize()
        {
            // If the current top-level domain is not *.eastsussex.gov.uk, either the page to change text size won't be there or it
            // will change the text size for the wrong domain, so just hide the links. However we want the links available on internal
            // copies of the main site, so check for hostnames without a ., which must be internal servers.
            var host = Request.Url.Host;

            if (!String.IsNullOrEmpty(Request.QueryString["host"]))
            {
                host = Request.QueryString["host"];
            }
            if (host.Contains(".") && !host.Contains(".eastsussex.gov.uk") && !host.Contains(".azurewebsites.net"))
            {
                this.textSize.Visible = false;
                return;
            }

            int baseTextSize = new TextSize(Request.Cookies, Request.QueryString).CurrentTextSize();

            if (baseTextSize > 1)
            {
                // Add the link to make it smaller again
                var smallerText = new HtmlAnchor();
                smallerText.HRef = this._textSizeUrl + "?textsize=" + (baseTextSize - 1).ToString(CultureInfo.InvariantCulture);
                smallerText.Attributes["class"] = "zoom-out screen";
                smallerText.Attributes["rel"]   = "nofollow";
                smallerText.InnerText           = "Make text smaller";
                this.textSize.Controls.Add(smallerText);
            }

            // Add the link to make text bigger
            if (baseTextSize < 3)
            {
                var biggerText = new HtmlAnchor();
                biggerText.HRef = this._textSizeUrl + "?textsize=" + (baseTextSize + 1).ToString(CultureInfo.InvariantCulture);
                biggerText.Attributes["class"] = "zoom-in screen";
                biggerText.Attributes["rel"]   = "nofollow";
                biggerText.InnerText           = "Make text bigger";
                this.textSize.Controls.Add(biggerText);
            }
        }
Esempio n. 24
0
        protected override void EndProcessing()
        {
            var card = new Card
            {
                Title           = Title,
                Text            = Text,
                Links           = Links,
                Id              = Id,
                Language        = Language,
                FontColor       = FontColor?.HtmlColor,
                BackgroundColor = BackgroundColor?.HtmlColor,
                Icon            = Watermark.GetIconName(),
                TextAlignment   = TextAlignment.GetName(),
                TextSize        = TextSize.GetName(),
                Content         = Content?.Invoke().Select(m => m?.BaseObject).ToArray()
            };

            Log.Debug(JsonConvert.SerializeObject(card));

            WriteObject(card);
        }
Esempio n. 25
0
        public void Start()
        {
            if (VRManager.VRMode)
            {
                LetterTextLabel = LetterTextLabelVR;
                LetterTextLabelNormal.gameObject.SetActive(false);
            }
            else
            {
                LetterTextLabel = LetterTextLabelNormal;
                LetterTextLabelVR.gameObject.SetActive(false);
            }

            Size = new TextSize(LetterTextLabel);
            LetterTextLabel.text             = string.Empty;
            LetterWriter.WritingLetter       = true;
            LetterWriter.OnQuickCreateStart += OnQuickCreateStart;
            Creator.StartEditing(Profile.Get.CurrentGame.Character);
            HighlightColor   = Color.white;
            HighlightColor.a = 0f;
        }
        /// <summary>
        /// Fetches the master page control from a remote URL.
        /// </summary>
        private void LoadRemoteControl()
        {
            if (BreadcrumbProvider == null)
            {
                BreadcrumbProvider = new BreadcrumbTrailFromConfig(HttpContext.Current.Request.Url);
            }
            var textSize = new TextSize(Page.Request.Cookies?["textsize"]?.Value, Page.Request.QueryString).CurrentTextSize();
            var isLibraryCatalogueRequest = new LibraryCatalogueContext(Page.Request.UserAgent).RequestIsFromLibraryCatalogueMachine();

            var html = HtmlControlProvider.FetchHtmlForControl(
                HttpRuntime.AppDomainAppVirtualPath,
                HttpContext.Current.Request.Url,
                Control,
                BreadcrumbProvider,
                textSize,
                isLibraryCatalogueRequest
                ).Result;

            // Output the HTML
            this.Controls.Add(new LiteralControl(html));
        }
        public void SaveSettings()
        {
            XmlNode node = doc.SelectSingleNode("//appSettings");

            if (node == null)
            {
                node = doc.CreateNode(XmlNodeType.Element, "appSettings", "");
                XmlElement root = doc.DocumentElement;
                root.AppendChild(node);
            }

            string[] keys = new string[] { "BackColor",
                                           "TextColor",
                                           "TextSize",
                                           "TextFont" };

            string[] values = new string[] { BackColor.ToString(),
                     TextColor.ToString(),
                     TextSize.ToString(),
                     TextFont.ToString() };


            for (int i = 0; i < keys.Length; i++)
            {
                XmlElement element = node.SelectSingleNode(string.Format("//add[@key='{0}']", keys[i])) as XmlElement;
                if (element != null)
                {
                    element.SetAttribute("value", values[i]);
                }
                else
                {
                    element = doc.CreateElement("add");
                    element.SetAttribute("key", keys[i]);
                    element.SetAttribute("value", values[i]);
                    node.AppendChild(element);
                }
            }

            doc.Save(Assembly.GetExecutingAssembly().Location + ".config");
        }
Esempio n. 28
0
        private float GetFontSize(TextSize textSize)
        {
            switch (textSize)
            {
            case TextSize.ExtraLarge:
                return(24);

            case TextSize.Large:
                return(18);

            case TextSize.Medium:
                return(14);

            case TextSize.Default:
                return(11);

            case TextSize.Small:
                return(9);
            }

            return(11);
        }
        public static string ToSSB64String(this string text, TextSize size)
        {
            var sb = new StringBuilder();

            foreach (var c in text)
            {
                SSB64Char ssb64Char;

                switch (size)
                {
                case TextSize.Small:
                {
                    ssb64Char = CharSet.SSB64CharSet.SingleOrDefault(x => c.ToString() == x.CharacterLarge);

                    if (ssb64Char != null)
                    {
                        sb.Append(ssb64Char.CharacterSmall);
                    }

                    break;
                }

                case TextSize.Large:
                {
                    ssb64Char = CharSet.SSB64CharSet.SingleOrDefault(x => c.ToString() == x.CharacterSmall);

                    if (ssb64Char != null)
                    {
                        sb.Append(ssb64Char.CharacterLarge);
                    }

                    break;
                }
                }
            }

            return(sb.ToString());
        }
Esempio n. 30
0
        protected override void ExportGeometry(XElement xParent)
        {
            var nfi = new NumberFormatInfo();

            nfi.NumberDecimalSeparator = ".";

            var tmpDoc = new XDocument(new XElement("TextGeometry",
                                                    new XAttribute("TopLeft", TopLeft.ToString(nfi)),
                                                    new XAttribute("BottomRight", BottomRight.ToString(nfi)),
                                                    new XAttribute("Text", Text),
                                                    new XAttribute("FontFamily", FontFamily),
                                                    new XAttribute("FontStyle", FontStyle),
                                                    new XAttribute("FontWeight", FontWeight),
                                                    new XAttribute("TextSize", TextSize.ToString(nfi)),
                                                    new XAttribute("Alignment", Alignment),
                                                    new XAttribute("Trimming", Trimming)));

            xParent.Add(new XComment(tmpDoc.Root.ToString()));

            if (Path.Data is GeometryGroup)
            {
                ExportGeometryGroup(xParent, Path.Data as GeometryGroup);
            }
        }
Esempio n. 31
0
 public void SetTextMode(TextSize aSize)
 {
     switch (aSize)
     {
         case TextSize.Size40x25:
             WriteVGARegisters(g_40x25_text);
             WriteFont(g_8x16_font, 16);
             break;
         case TextSize.Size40x50:
             WriteVGARegisters(g_40x50_text);
             WriteFont(g_8x8_font, 8);
             break;
         case TextSize.Size80x25:
             WriteVGARegisters(g_80x25_text);
             WriteFont(g_8x16_font, 16);
             break;
         case TextSize.Size80x50:
             WriteVGARegisters(g_80x50_text);
             WriteFont(g_8x8_font, 8);
             break;
         case TextSize.Size90x30:
             WriteVGARegisters(g_90x30_text);
             WriteFont(g_8x16_font, 16);
             break;
         case TextSize.Size90x60:
             WriteVGARegisters(g_90x60_text);
             WriteFont(g_8x8_font, 8);
             break;
         default:
             throw new Exception("Invalid text size.");
     }
 }
Esempio n. 32
0
 void Start() {
     textMesh = GetComponent<TextMesh>();
     textSize = new TextSize(textMesh);
     setText(textMesh.text);
 }
Esempio n. 33
0
        public SettingsPanelViewModel()
        {
            timeoutPresets.Add("10 seconds", 10000);
            timeoutPresets.Add("30 seconds", 30000);
            timeoutPresets.Add("1 minute", 60000);

            reversedTimeoutPresets.Add(10000, "10 seconds");
            reversedTimeoutPresets.Add(30000, "30 seconds");
            reversedTimeoutPresets.Add(60000, "1 minute");

            selectedTextSize = (TextSize)Settings.PostTextSize;

            Settings.PropertyChanged += (obj, args) =>
            {
                if (args.PropertyName.Equals("LoggingEnabled"))
                    NotifyPropertyChangedAsync("LoggingStatus");
            };
        }
Esempio n. 34
0
 /// <summary>
 /// Text(正则验证)
 /// </summary>
 /// <param name="id">id/name</param>
 /// <param name="size">大小</param>
 /// <param name="reg">正则表达式</param>
 /// <param name="tip">提示</param>
 /// <param name="description">描述</param>
 /// <returns></returns>
 public static IHtmlString TextKeyUp(string id, TextSize size, string reg, string tip = "", string description = "")
 {
     return
        new HtmlString(string.Format("<input type=\"text\" class=\"{1} regexonly\" reg=\"{2}\" id=\"{0}\" name=\"{0}\"/>", id,
            size, reg)).AddTitle(tip, description);
 }
Esempio n. 35
0
    private void showRules()
    {
        //contain everything else inside of it
        GUI.BeginGroup(buttonRect);

        //tabs
        GUILayout.BeginHorizontal(GUILayout.Height(buttonRect.height * 0.1f));

        if (GUILayout.Button("Prospecting"))
        {
            currentTab = RulesTab.PROSPECTING;
        }
        else if (GUILayout.Button("Mining"))
        {
            currentTab = RulesTab.MINING;
        }
        else if (GUILayout.Button("Scoring"))
        {
            currentTab = RulesTab.SCORING;
        }
        else if (GUILayout.Button("Back"))
        {
            //return rules to default
            currentTab = RulesTab.PROSPECTING;
            textSize   = TextSize.BULLET;

            currentMenuState = MenuState.MAIN;
        }
        GUILayout.EndHorizontal();

        GUILayoutOption[] options = { GUILayout.Width(buttonRect.width), GUILayout.Height(buttonRect.height * 0.75f) };
        if (textSize == TextSize.BULLET)
        {
            GUILayout.Box(rulesText[(int)currentTab], GuiStyle, options);
        }
        else
        {
            GUILayout.Box(fullText[(int)currentTab], GuiStyle, options);
        }

        string title = "Bullet Form";

        if (textSize == TextSize.BULLET)
        {
            title = "More Info";
        }

        if (GUILayout.Button(title))
        {
            if (textSize == TextSize.BULLET)
            {
                textSize = TextSize.FULL;
            }
            else
            {
                textSize = TextSize.BULLET;
            }
        }

        GUI.EndGroup();
    }
Esempio n. 36
0
 /// <summary>
 /// Text(验证)
 /// </summary>
 /// <param name="id">id/name</param>
 /// <param name="size">大小</param>
 /// <param name="validation">验证类型</param>
 /// <param name="tip">提示</param>
 /// <param name="description">描述</param>
 /// <returns></returns>
 public static IHtmlString TextKeyUp(string id, TextSize size, ValidationText validation, string tip = "", string description = "")
 {
     return
         new HtmlString(string.Format("<input type=\"text\" class=\"{1} {2}\" id=\"{0}\" name=\"{0}\"/>", id,
             size, validation.ToString())).AddTitle(tip, description);
 }
Esempio n. 37
0
 /// <summary>
 /// Text(字母限制长度)
 /// </summary>
 /// <param name="id">id/name</param>
 /// <param name="size">大小</param>
 /// <param name="maxlength">最大长度</param>
 /// <param name="tip">提示</param>
 /// <param name="description">描述</param>
 /// <returns></returns>
 public static IHtmlString TextKeyUp(string id, TextSize size, int maxlength, string tip = "", string description = "")
 {
     return
         new HtmlString(string.Format("<input type=\"text\" class=\"{1} alphaonly\" maxlength=\"{2}\" id=\"{0}\" name=\"{0}\"/>", id,
             size, maxlength)).AddTitle(tip, description);
 }
Esempio n. 38
0
 /// <summary>
 /// Text
 /// </summary>
 /// <param name="id">is/name</param>
 /// <param name="size">size</param>
 /// <param name="isValidation">是否验证必填</param>
 /// <param name="description"></param>
 /// <param name="reg">Custom</param>
 /// <param name="tip"></param>
 /// <returns></returns>
 public static IHtmlString Text(string id, TextSize size, string tip, bool isValidation, string description = "", params string[] reg)
 {
     var regTxt = new StringBuilder();
     foreach (var r in reg)
     {
         regTxt.AppendFormat("{0},", r);
     }
     var regt = regTxt.ToString();
     return
         new HtmlString(
             string.Format("<input type=\"text\"  name=\"{0}\" id=\"{0}\" class=\"validate[{2}{3}] {1}\"  />", id,
                 size.ToString(), isValidation ? "required," : "",
                 string.IsNullOrEmpty(regt) ? "" : regt.Substring(0,regt.Length - 1))).AddTitle(
                     tip, description);
 }
Esempio n. 39
0
 /// <summary>
 /// Text
 /// </summary>
 /// <param name="id">is/name</param>
 /// <param name="size">size</param>
 /// <param name="isValidation">是否验证必填</param>
 /// <param name="reg">Custom</param>
 /// <returns></returns>
 public static IHtmlString Text(string id, TextSize size, bool isValidation, params string[] reg)
 {
     return Text(id, size, "", isValidation, "", reg);
 }
Esempio n. 40
0
 /// <summary>
 /// Text
 /// </summary>
 /// <param name="id">is/name</param>
 /// <param name="size">size</param>
 /// <param name="isValidation">是否验证必填</param>
 /// <param name="reg">Custom</param>
 /// <param name="tip">提示</param>
 /// <param name="description">描述</param>
 /// <param name="isPsw">是否为password</param>
 /// <returns></returns>
 public static IHtmlString Text(string id, TextSize size,
     string reg, bool isValidation, string tip = "", string description = "", bool isPsw = false)
 {
     return
         new HtmlString(
             string.Format("<input type=\"{4}\"  name=\"{0}\" id=\"{0}\" class=\"validate[{2}{3}] {1}\"  />", id,
                 size.ToString(), isValidation ? "required," : "", reg, isPsw ? "password" : "text")).AddTitle(
                     tip, description);
 }
Esempio n. 41
0
 // Use this for initialization
 void Start()
 {
     ts = new TextSize(gameObject.GetComponent<TextMesh>());
     //	Debug.Log("Initial width of string: " + ts.width);
     ts.FitToWidth(lineWidth);
 }
Esempio n. 42
0
    private void SetTextBoxText(string text)
    {
        //unescape the string to allow newlines
        _currentAppendingText = System.Text.RegularExpressions.Regex.Unescape(text);

        //Text size needs a text mesh
        _textMesh.text = _currentAppendingText;

        TextSize ts = new TextSize(_textMesh);
        ts.FitToWidth(lineLength);

        //Retrieve the modified string
        _currentAppendingText = _textMesh.text;

        //Split the tag and the text from the whole text line
        string[] splitLines = _currentAppendingText.Split(delimArray, System.StringSplitOptions.RemoveEmptyEntries);

        //Catch if we split correctly
        if(splitLines.Length == 2)
        {
            _currentTBIdentifier = splitLines[0];
            _currentAppendingText = splitLines[1];

            HideAllTextBoxes();

            ShowSpecifiedText(_currentTBIdentifier);
        }
        else
        {
            HideAllTextBoxes();

            //manually set this to interactable tag because the split didn't work
            _currentTBIdentifier = interactionTag;

            ShowSpecifiedText(interactionTag);
        }

        //Clear the textmesh since we're going to be appending to it
        _textMesh.text = "";

        StartAppendingText();
    }
Esempio n. 43
0
 /// <summary>
 /// Select
 /// </summary>
 /// <param name="id">id</param>
 /// <param name="size">size</param>
 /// <param name="selectItems">data</param>
 /// <param name="validation">是否验证为空</param>
 /// <param name="tip">提示</param>
 /// <param name="description">描述</param>
 /// <returns></returns>
 public static IHtmlString Select(string id, TextSize size, IEnumerable<SelectItem> selectItems, bool validation = false, string tip = "", string description = "")
 {
     var str = new StringBuilder();
     str.AppendFormat("<select class=\"{1}\" id=\"{0}\"  class=\"validate[{2}]\"  name=\"{0}\">", id, size.ToString(), validation ? " required" : "");
     str.Append("<option value=\"\">请选择</option>");
     foreach (var item in selectItems)
     {
         str.AppendFormat("<option value=\"{0}\" {2}>{1}</option>", item.Value, item.Text,
             item.Selected ? "selected=\"selected\"" : "");
     }
     str.Append("</select>");
     return new HtmlString(str.ToString()).AddTitle(tip, description);
 }
Esempio n. 44
0
    private void showRules()
    {
        //contain everything else inside of it
        GUI.BeginGroup(buttonRect);

        //tabs
        GUILayout.BeginHorizontal(GUILayout.Height(buttonRect.height * 0.1f));

        if (GUILayout.Button("Prospecting"))
            currentTab = RulesTab.PROSPECTING;
        else if (GUILayout.Button("Mining"))
            currentTab = RulesTab.MINING;
        else if (GUILayout.Button("Scoring"))
            currentTab = RulesTab.SCORING;
        else if (GUILayout.Button("Back"))
        {
            //return rules to default
            currentTab = RulesTab.PROSPECTING;
            textSize = TextSize.BULLET;

            currentMenuState = MenuState.MAIN;
        }
        GUILayout.EndHorizontal();

        GUILayoutOption[] options = { GUILayout.Width(buttonRect.width), GUILayout.Height(buttonRect.height * 0.75f) };
        if (textSize == TextSize.BULLET)
            GUILayout.Box(rulesText[(int)currentTab], GuiStyle, options);
        else
            GUILayout.Box(fullText[(int)currentTab], GuiStyle, options);

        string title = "Bullet Form";
        if (textSize == TextSize.BULLET)
            title = "More Info";

        if (GUILayout.Button(title))
        {
            if (textSize == TextSize.BULLET)
                textSize = TextSize.FULL;
            else
                textSize = TextSize.BULLET;
        }

        GUI.EndGroup();
    }
Esempio n. 45
0
 public static void SetTextMode(TextSize Size)
 {
     switch (Size)
     {
         case TextSize.Size40x25:
             mScreen.SetTextMode(HALVGAScreen.TextSize.Size40x25);
             break;
         case TextSize.Size40x50:
             mScreen.SetTextMode(HALVGAScreen.TextSize.Size40x50);
             break;
         case TextSize.Size80x25:
             mScreen.SetTextMode(HALVGAScreen.TextSize.Size80x25);
             break;
         case TextSize.Size80x50:
             mScreen.SetTextMode(HALVGAScreen.TextSize.Size80x50);
             break;
         case TextSize.Size90x30:
             mScreen.SetTextMode(HALVGAScreen.TextSize.Size90x30);
             break;
         case TextSize.Size90x60:
             mScreen.SetTextMode(HALVGAScreen.TextSize.Size90x60);
             break;
         default:
             throw new Exception("This situation is not implemented!");
     }
 }
Esempio n. 46
0
 void Awake()
 {
     textMesh = transform.Find("Text").GetComponent<TextMesh>();
     textSize = new TextSize( textMesh );
     maxWidth = MiscUtils.GetGlobalScaleInLocalXDirection( transform.Find("Boundary") );
 }