コード例 #1
0
        public MultiplayerBase(string address, int port, PGGI.PGGIProvider provider)
        {
            ISpriteBatchService spriteService = Atom.Shared.Globals.Engine.GetService<ISpriteBatchService>();
            IInputService inputService = Atom.Shared.Globals.Engine.GetService<IInputService>();

            contract = inputService.CreateContract();
            contract.Enabled = true;
            contract.SubscribedTouchEvents = TouchStates.OnDoubleTap | TouchStates.OnDrag | TouchStates.OnTap;
            contract.TouchEventHandler += contract_TouchEventHandler;

            spriteBatch = spriteService.SpriteBatch;

            SelectionState = SelectionState.Selection;
            GameState = MultiplayerGameState.Connecting;
            GameCounter = 0;
            client = new Client();
            client.OnConnection += new EventHandler<ConnectionArgs>(ClientOnConnection);
            client.OnPacketRecieved += new EventHandler<PacketRecievedArgs>(ClientOnPacket);
            Packet ConnectionPacket = new Packet();
            ConnectionPacket.Write(provider.PGGI);
            ConnectionPacket.Write(provider.Token);
            client.Connect(new System.Net.DnsEndPoint(address, port), ConnectionPacket);
            Syncing = false;
            FramesToSpin = int.MaxValue;
            Manager = new MultiplayerGameManager();
            Content = new ContentManager(Atom.Shared.Globals.Engine, "Content");

            Fleet = Content.Load<Texture2D>("Graphics/Fleets/1");
        }
コード例 #2
0
ファイル: MapState.cs プロジェクト: Nessphoro/VelesConflict
 public MultiplayerMapState(MultiplayerGameManager manager, int Frame)
 {
     Manager = manager;
     Actions = new List<GameAction>();
     Fleets = new List<Fleet>();
     Planets = new List<Planet>();
     StateFrame = Frame;
 }