示例#1
0
        /// <summary>If the splash text contains '*' then they get replace with a random character else does nothing</summary>
        public void Update()
        {
            if (splashTexts[id].Contains("*"))
            {
                //Do the char swap thingy
                char[] chars = splashTexts[id].ToCharArray();
                text = "";
                for (int i = 0; i < chars.Length; i++)
                {
                    //Change
                    if (chars[i] == '*')
                    {
                        chars[i] = (char)RandomEx.GenerateRandom(0, 128);

                        //Anti space and escape chars
                        while (chars[i] == ' ' || IsEscapeChar(chars[i]))
                        {
                            chars[i] = (char)RandomEx.GenerateRandom(0, 128);
                        }
                    }

                    //Rebuild
                    text = text + chars[i];
                }
            }
        }
示例#2
0
        /// <summary>Selects a new slpash text string from the splashTexts array at random</summary>
        public void GenerateNewSplashText()
        {
            int idx = RandomEx.GenerateRandom(0, splashTexts.Length);

            text    = splashTexts[idx];
            this.id = idx;

            //Check if would fit in one line
            if (text.Length >= Program.ViewWidth() - posX)
            {
                int change = text.Length - (Program.ViewWidth() - posX);
                posX -= change;
            }
            else
            {
                posX = Program.ViewWidth() / 2;
            }
        }