Пример #1
0
    // Use this for initialization
    void Start()
    {
        Initialize();
        AllButtonsList.Clear();
        WordsButtons.Clear();

        canvasManager = GameObject.FindObjectOfType <CanvasManager>();
        screenBuilder = GameObject.FindObjectOfType <ScreenBuilder>();
        int randomIndex = Random.Range(0, Words.Length);

        print(Words.Length);
        print(randomIndex);
        currentWord = Words[randomIndex];
        screenBuilder.Build(currentWord);
    }
Пример #2
0
        void ProcessLine(string sub)
        {
            Regex subPattern = new Regex("Dialogue: 0,(?<hs>\\d+):(?<ms>\\d+):(?<ss>\\d+).(?<mss>\\d+),"
                                         + "(?<he>\\d+):(?<me>\\d+):(?<se>\\d+).(?<mse>\\d+),Default,,0,0,0,,(?<text>.+)");
            var match = subPattern.Match(sub);

            if (!match.Success)
            {
                Console.WriteLine("Failed to parse a line");
                return;
            }

            var text         = match.Groups["text"].Value;
            var symbolsCount = CountSymbols(text);
            var lines        = text.Split("\\N", StringSplitOptions.RemoveEmptyEntries);

            var startTime = new DateTime(2000, 1, 1, int.Parse(match.Groups["hs"].Value)
                                         , int.Parse(match.Groups["ms"].Value)
                                         , int.Parse(match.Groups["ss"].Value)
                                         , int.Parse(match.Groups["mss"].Value) * 10);
            var endTime = new DateTime(2000, 1, 1, int.Parse(match.Groups["he"].Value)
                                       , int.Parse(match.Groups["me"].Value)
                                       , int.Parse(match.Groups["se"].Value)
                                       , int.Parse(match.Groups["mse"].Value) * 10);

            var length           = endTime - startTime;
            var symbolsPerSecond = symbolsCount / length.TotalSeconds;

            var builder = new ScreenBuilder();

            foreach (var item in lines)
            {
                foreach (var line in SplitToLimit(item, _options.MaxSymbols))
                {
                    builder.Add(line);
                }
            }

            foreach (var item in builder.Build())
            {
                int subtitleLength = CountSymbols(item);
                startTime = PrintSubtitle(startTime, symbolsPerSecond, item, subtitleLength);
            }
        }
Пример #3
0
        public override void LoadContent()
        {
            ScreenBuilder            sb      = new ScreenBuilder(this);
            List <GameObjectPackage> objekty = sb.LoadScreen();

            foreach (GameObjectPackage package in objekty)
            {
                object o = Activator.CreateInstance(Type.GetType(package.Type), this,
                                                    package.Position, package.MetaData);
                Layers[package.Layer].AddObject((GameObject)o);
            }
            MainCam = new FreeCamera(this, 30f);
            //uncomment to enable editor
            //_selectedObject = new TextObject(this, "", new Vector2(ScreenManager.GraphicsDevice.Viewport.Bounds.Width - 20, 10))
            //{
            //    HorizontAlignment = TextObject.TextAlignment.Far,
            //    VerticalAlignment = TextObject.TextAlignment.Near,
            //    Scale = new Vector2(0.3f, 0.3f)
            //};
            //Layers["Gui"].Objekty.Add(_selectedObject);
            base.LoadContent();
        }