コード例 #1
0
ファイル: TestScreen.cs プロジェクト: DrPandemic/EraParadox
		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);
		}
コード例 #2
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");

		}