Beispiel #1
0
        public override void LoadContent()
        {
            ProtoHelper.OnChatRecieve += OnChatRecive;
            _ = ProtoHelper.JoinToChatAsync();
            var camera = new OrthographicCamera(_sceneHandler._graphicsDevice);

            mouseSystem = new MouseSystem();

            MouseSystem.OnMouseLeftClick += mouseClick;
            spriteBatch = new SpriteBatch(_sceneHandler._graphicsDevice);
            world       = new WorldBuilder()
                          .AddSystem(new RenderSystem(spriteBatch, camera))
                          .AddSystem(mouseSystem)
                          .Build();

            _sceneHandler._gameComponents.Add(world);

            entityFactory = new EntityFactory(world, _sceneHandler._content, _sceneHandler._graphicsDevice);

            text = entityFactory.CreateText(new Vector2(100, 100), ProtoHelper.nickname, 100);
            playerReadyButtom = entityFactory.CreateReadySign(new Vector2(500, 110));
            readyText         = entityFactory.CreateText(new Vector2(530, 102), "Not ready", 0);
            enemyText         = entityFactory.CreateText(new Vector2(100, 200), "", 100);
            enemyReadyButtom  = entityFactory.CreateReadySign(new Vector2(500, 210));
            enemyReadyText    = entityFactory.CreateText(new Vector2(530, 202), "Not ready", 0);


            LoadGui();

            while (!ProtoHelper.IsChatLive)
            {
                Thread.Sleep(10);
            }

            Thread.Sleep(500);
            ProtoHelper.WriteToChat("!live");


            while (live == null)
            {
                Thread.Sleep(10);
            }

            if ((bool)live == true)
            {
                ChangeStateToGame();
            }

            var player  = _sceneHandler._content.Load <Texture2D>("MiniHead1");
            var upArrow = _sceneHandler._content.Load <Texture2D>("MiniHead1");

            playerSprite    = new Sprite(player);
            enemySprite     = new Sprite(player);
            upArrowSprite   = new Sprite(_sceneHandler._content.Load <Texture2D>("upArrow"));
            downArrowSprite = new Sprite(_sceneHandler._content.Load <Texture2D>("downArrow"));
        }