Пример #1
0
        protected override void OnLoadContent()
        {
            base.OnLoadContent();

            ESCMenu menu = new ESCMenu();

            AddChild(menu, 6);
            menu.SetPositionInScreenPercent(50, 50);

            ChampionState = new CurrentChampionState(100, 100);
            AddChild(new GameUI(ChampionState, new PingCounter(() => {
                return(Client.Instance.GetPing().TotalMilliseconds);
            }), GameScore),
                     3);
            AddChild(KillDisplay, 3);

            AddChild(DeathScreen   = new DeathScreen(), 4);
            AddChild(WinLoseScreen = new WinLoseScreen(), 5);
            AddChild(GameWorld, 1);

            Map = new DrawableTileMap(Match.World.Map, Match.World.Map.TileSet);
            GameWorld.AddChild(Map);

            Client.RegisterCommandHandler(ServerCommand.JoinedGame, OnJoinedGame);
            Client.RegisterCommandHandler(ServerCommand.NewRemotePlayer, OnNewRemotePlayer);
            Client.RegisterCommandHandler(ServerCommand.StateUpdate, OnStateUpdate);

            AddChild(Parallax, 0);

            ((SoundService)Services.GetService(typeof(SoundService))).PlayMusic("Sounds/Musics/SonOfARocket");
        }
Пример #2
0
        public SpellMenu(CurrentChampionState state)
        {
            Spell1Item = new SpellMenuItem(state.Spell1, new DrawableImage("UIObjects/spell1Icon"));
            Spell2Item = new SpellMenuItem(state.Spell2, new DrawableImage("UIObjects/spell2Icon"));
            Spell3Item = new SpellMenuItem(state.Spell3, new DrawableImage("UIObjects/spell3Icon"));
            Spell4Item = new SpellMenuItem(state.Spell4, new DrawableImage("UIObjects/spell4Icon"));

            AddItem(Spell1Item);
            AddItem(Spell2Item);
            AddItem(Spell3Item);
            AddItem(Spell4Item);
        }
Пример #3
0
        public GameUI(CurrentChampionState ccs, PingCounter ping, GameScore score)
        {
            ChampionState = ccs;

            UIFPSCounter = new FPSCounter();
            AddChild(UIFPSCounter, 2);
            UIPingCounter = ping;
            AddChild(UIPingCounter, 2);

            /*Map = new DrawableImage("UIObjects/map");
             * AddChild(Map);*/
            SpellBackground = new DrawableImage("UIObjects/spellBackground");
            AddChild(SpellBackground);

            LifeDropshadow = new DrawableImage("UIObjects/lifeDrop");
            LifeDropshadow.RelativeOrigin = new Vector2(0f, 1f);
            AddChild(LifeDropshadow);
            ResourceDropShadow = new DrawableImage("UIObjects/manaDrop");
            ResourceDropShadow.RelativeOrigin = new Vector2(0f, 1f);
            //AddChild(ResourceDropShadow);

            Life = new DrawableImage("UIObjects/life");
            Life.RelativeOrigin = new Vector2(0f, 1f);
            AddChild(Life);
            Resource = new DrawableImage("UIObjects/mana");
            Resource.RelativeOrigin = new Vector2(0f, 1f);
            //AddChild(Resource);

            ScoreBackground = new DrawableImage("UIObjects/boxBackground");
            AddChild(ScoreBackground);
            MoneyBackground = new DrawableImage("UIObjects/boxBackground");
            AddChild(MoneyBackground);

            /*ObjectBackground = new DrawableImage("UIObjects/boxBackground");
             * AddChild(ObjectBackground);*/


            UISpellMenu = new SpellMenu(ChampionState);
            AddChild(UISpellMenu, 3);

            GameScore = score;
        }
Пример #4
0
        protected override void OnLoadContent()
        {
            // Test paralax
            para   = new Parallax();
            ratioX = 0;

            AddChild(para);

            CCS = new CurrentChampionState(1000, 100);

            //AddChild(new GameUI(CCS),10);

            ESCMenu menu = new ESCMenu();

            AddChild(menu, 5);
            menu.SetPositionInScreenPercent(50, 50);

            champSprite = new DrawableChampionSprite(ChampionAnimation.idle, ChampionTypes.ManMega, ChampionsInfo)
            {
                Position = new Vector2(200f, 300f)
            };

            AddChild(champSprite);

            AS = new ActionSequence(ActionSequence.INFINITE_SEQUENCE,
                                    new ActionMoveBy(new TimeSpan(0, 0, 1), new Vector2(100, 100)),
                                    new ActionMoveBy(new TimeSpan(0, 0, 1), new Vector2(-100, -100)));

            champSprite.PerformAction(AS);

            DrawableTriangle tr = new DrawableTriangle(true);

            tr.Ascendant = false;
            tr.Tint      = Color.Blue;
            tr.Scale     = new Vector2(1f, 2f);


            //Test particle

            /*ParticleSystem sys = new ParticleSystem(Content, 1000, null);
             * sys.Position = new Vector2(100, 100);
             * AddChild(sys);*/

            //AddChild(new PingCounter(() => Client.Instance.GetPing().TotalMilliseconds));
            //inputManager.RegisterEvent(InputActions.Spell1, new EventHandler(Jump));

            inputManager.RegisterEvent(InputActions.Spell3, new EventHandler(Jump));
            inputManager.RegisterEvent(InputActions.GoRight, (sender, e) => {
                ratioX += 2;
                para.SetCurrentRatio(ratioX, 0f);
            });
            inputManager.RegisterEvent(InputActions.GoLeft, (sender, e) => {
                ratioX -= 2;
                para.SetCurrentRatio(ratioX, 0f);
            });

            //inputManager.RegisterEvent(InputActions.Jump, new EventHandler(Jump2));

            DrawableCircle circle = new DrawableCircle();

            circle.SetPositionRelativeToObject(champSprite, new Vector2(-150, -30));
            AddChild(circle);

            //AddChild(new DeathScreen(10),11);
        }