public FrameRecvSystem(Contexts ctxs) { gameCtx = ctxs.game; networkCtx = ctxs.network; packetGroup = networkCtx.GetGroup(NetworkMatcher.RecvPacket); }
public void FindNearestEdgeAtLocation() { //Arrange NetworkContext ctx = new NetworkContext("Hydro", new List <string>() { "FlowlineMerge" }, new List <string>() { "Hydro_Net_Junctions", "Barriers" }); ctx.LoadGeometricNetwork(GN_Path, null, null); IPoint pnt = new PointClass(); pnt.X = -86.118; pnt.Y = 43.971; Tuple <double, double> distD = GLC.AO.AOUtilities.GetEstimatedDistInDegree(pnt.X, pnt.Y, 1500, 0.1); //Act Tuple <int, IFeature, double> edgeFlag = GLC.AO.AOUtilities.FindNearestFeature(pnt, ctx.GetEdgeFeatureClassByAliasName("FlowlineMerge"), distD.Item1, null); //Assert Assert.IsTrue(edgeFlag.Item1 > 0 && edgeFlag.Item2 != null); //Arrange pnt.X = 86.118; pnt.Y = -43.971; distD = GLC.AO.AOUtilities.GetEstimatedDistInDegree(pnt.X, pnt.Y, 1500, 0.1); //Act edgeFlag = GLC.AO.AOUtilities.FindNearestFeature(pnt, ctx.GetEdgeFeatureClassByAliasName("FlowlineMerge"), distD.Item1, null); //Assert Assert.IsNull(edgeFlag); }
/// <summary> /// Try to join the lobby at the given IP end point as the given player. /// </summary> /// <param name="host">The IP address that the lobby server is running at.</param> /// <param name="mapManager">The map manager that will be used to check to see if we have a /// map and to save a downloaded map.</param> /// <param name="player">This player that will be used to uniquely identify /// ourselves.</param> /// <param name="password">The password that the lobby host has set.</param> public static Task<Maybe<LobbyMember>> JoinLobby(string host, Player player, IMapManager mapManager, string password) { /* return Task.Factory.StartNew(() => { try { Maybe<NetworkContext> context = NetworkContext.CreateClient(address, player, password); if (context.Exists) { LobbyMember lobbyMember = new LobbyMember(context.Value, mapManager); return Maybe.Just(lobbyMember); } } catch (Exception) { } return Maybe<LobbyMember>.Empty; }); */ Maybe<LobbyMember> result = Maybe<LobbyMember>.Empty; Maybe<NetworkContext> context = NetworkContext.CreateClient(host, player, password); if (context.Exists) { LobbyMember lobbyMember = new LobbyMember(context.Value, mapManager); result = Maybe.Just(lobbyMember); } return Task.Factory.StartNew(() => result); }
public void ConstrcutStartEdge() { //Arrange NetworkContext ctx = new NetworkContext("Hydro", new List <string>() { "FlowlineMerge" }, new List <string>() { "Hydro_Net_Junctions", "Barriers" }); ctx.LoadGeometricNetwork(GN_Path, null, null); //Flag IPoint pnt = new PointClass(); pnt.X = -86.291; pnt.Y = 43.941; IFeatureClass fc = ctx.GetEdgeFeatureClassByAliasName("FlowlineMerge"); int idx = AOUtilities.GetFieldIndexByName(fc, "FlowDir"); //Act StartFlagEdge flag = NetworkHelper.GetStartFlagEdge(ctx, -86.291, 43.941, 100, 5, "FlowlineMerge", idx, "0", null); //Assert Assert.IsNotNull(flag); Assert.IsTrue(flag.FeatureID == 1927894); }
// Start is called before the first frame update void Start() { FindLocalManagers(); try { context = NetworkScene.Register(this); } catch (NullReferenceException) { // The LogCollector does not have to be in a NetworkScene to have some functionality } // This snippet listens for new peers so the start transmitting message can be re-transmitted if necessary, // ensuring all new peers in the room transmit immediately and relieve the user of having to worry about // peer lifetimes once they start collection. if (context != null) { var roomClient = context.scene.GetComponentInChildren <Rooms.RoomClient>(); if (roomClient) { roomClient.OnPeerAdded.AddListener(Peer => { if (Collecting) { StartCollection(); } }); } } }
public void TestIdentifyUninitializedStreamSegment() { //Arrange NetworkContext ctx = new NetworkContext("Hydro", new List <string>() { "FlowlineMerge" }, new List <string>() { "Hydro_Net_Junctions", "Barriers" }); ctx.LoadGeometricNetwork(GN_Path, null, null); //Get FlowDir index IFeatureClass fc = ctx.GetEdgeFeatureClassByAliasName("FlowlineMerge"); int idx = AOUtilities.GetFieldIndexByName(fc, "FlowDir"); IPoint pnt = new PointClass() { X = -85.04465103149414, Y = 43.27143070627271 }; IGeometryArray pntArr = new GeometryArrayClass(); pntArr.Add(pnt); IGeometryArray geomArr = AOUtilities.TransfromGeometriesFrom2(4326, 4269, pntArr); IPoint pnt1 = geomArr.get_Element(0) as IPoint; //Act StartFlagEdge flag = NetworkHelper.GetStartFlagEdge(ctx, pnt1.X, pnt1.Y, 200, 5, "FlowlineMerge", idx, "0", null); //Assert Assert.IsNull(flag); }
public ChatMessageHandler(NetworkContext context) { _localPlayer = context.LocalPlayer; AllMessages = new List <ReceivedChatMessage>(); DisplayableMessages = new List <ReceivedChatMessage>(); }
public MapDownloadServerMessageHandler(NetworkContext context, IMapManager mapManager, string map) { _context = context; _mapManager = mapManager; ChangeMap(map); }
private void Start() { context = NetworkScene.Register(this); logger = new ContextEventLogger(context); client.OnJoinedRoom.AddListener(OnJoinedRoom); client.OnPeerRemoved.AddListener(OnPeerRemoved); client.OnRoomUpdated.AddListener(OnRoomUpdated); }
void Start() { Instance = this.GetComponentInParent <PuzzleManager>(); rectTransform = this.GetComponent <RectTransform>(); content = NetworkScene.Register(this); // initial grid position in Puzzle Manager Instance.UpdatePosition(transform.position, rectTransform.gameObject.name); }
public FrameSendSystem(Contexts ctxs) { gameCtx = ctxs.game; networkCtx = ctxs.network; syncedEntities = gameCtx.GetGroup(GameMatcher.FrameSync); serverConnectionGroup = networkCtx.GetGroup(NetworkMatcher.ServerConnection); }
private void Awake() { Instance = this; DontDestroyOnLoad(this.gameObject); content = NetworkScene.Register(this); gameController = GameObject.Find("GameController").GetComponent <GameController>(); puzzlespanwer = GameObject.Find("Generator").GetComponent <PuzzleSpanwer>(); }
public ServerStartConnectionSystem(Contexts ctxs) : base(ctxs.network) { serverConnectionGroup = ctxs.network.GetGroup(NetworkMatcher.ServerConnection); ctx = Contexts.sharedInstance.network; connInfoGroup = ctx.GetGroup(NetworkMatcher.ServerConnectionInfo); }
public PlayerManager(NetworkContext context) { _context = context; if (_context.IsServer) { _players.Add(_context.LocalPlayer); } }
public ConnectionSystem(Contexts contexts, LauncherSystems callBackCaller, GameSettings settings) : base(contexts.network) { _networkContext = contexts.network; _gameContext = contexts.game; _settings = settings; _callBackCaller = callBackCaller; _callBackCaller.onConnectedToMaster += OnConnectedToMaster; _callBackCaller.onPhotonRandomJoinFailed += OnPhotonRandomJoinFailed; _callBackCaller.onJoinedRoom += OnJoinedRoom; }
private LobbyHost(NetworkContext context, IMapManager mapManager, string map) : base(context) { _mapHandler = new MapDownloadServerMessageHandler(context, mapManager, map); _context.AddConnectionMonitor(_mapHandler); _context.AddMessageHandler(_mapHandler); _readinessHandler = new LobbyHostPlayerReadinessMessageHandler(context); _context.AddConnectionMonitor(_readinessHandler); _context.AddMessageHandler(_readinessHandler); }
public ContextEventLogger(NetworkContext context) : base(context.component.GetType(), EventType.Application) { this.context = context; try { LogManager.Find(context.scene).Register(this); } catch (NullReferenceException) { } }
public Core() { try { ctx = new NetworkContext(); } catch (Exception e) { throw new Exception($"Внутренняя ошибка сервера: {e.Message}"); } }
public GameEngineManager(string snapshotJson, string templateJson, int targetUpdatesPerSecond) { // allocate the engine // TODO: examine the maybe, make sure the game actually loaded _gameEngine = GameEngineFactory.CreateEngine(snapshotJson, templateJson).Value; // create the event monitors CreateEventMonitors(_gameEngine.EventNotifier); _networkContext = NetworkContext.CreateServer(new Player("test-player"), ""); _turnGame = new AutomaticTurnGame(_networkContext, targetUpdatesPerSecond); }
public ClientConnectionSystem(Contexts ctxs) { ctx = ctxs.network; connectionGroup = ctx.GetGroup(NetworkMatcher.ClientConnection); startConnectionGroup = ctx.GetGroup(NetworkMatcher.ClientStartConnection); recvPacketGroup = ctx.GetGroup(NetworkMatcher.RecvPacket); ctx.GetGroup(NetworkMatcher.ClientDisconnect).OnEntityAdded += (g, ent, index, component) => { var conn = connectionGroup.GetSingleEntity().clientConnection; Disconnect(conn); }; }
public static bool TryToStructure <T>(this NetworkContext context, out T result) where T : struct { try { result = context.ToStructure <T>(); return(true); } catch { result = default; return(false); } }
internal LobbyCommon(NetworkContext context) { _context = context; _lobbyLaunchedHandler = new LobbyLaunchedHandler(); _context.AddMessageHandler(_lobbyLaunchedHandler); _playerManager = new PlayerManager(_context); _context.AddMessageHandler(_playerManager); if (_context.IsServer) { _context.AddConnectionMonitor(_playerManager); } }
private void LoadNetwork(IPropertySet props) { if (null != props.GetProperty("NetworkName")) { m_networkName = props.GetProperty("NetworkName") as string; } else { throw new ArgumentNullException("NetworkName is unspecified."); } if (null == props.GetProperty("MaxFeatureCount") || false == int.TryParse(props.GetProperty("MaxFeatureCount") as string, out this.m_maxFeatureCount)) { this.m_maxFeatureCount = 5000; } this.m_outputFields = new List <string>() { "Shape_Length" }; this.m_networkContext = new NetworkContext(m_networkName, new List <string>() { FlowLineName }, new List <string>() { JunctionName, BarrierJunctionName }); this.m_networkContext.LoadGeometricNetwork(null, this.serverObjectHelper, this.logger); this.m_isReady = this.m_networkContext.IsNetworkLoaded; if (this.m_isReady) { this.m_disabledFeatureClassIDs = new List <int>() { this.m_networkContext.GetJunctionFeatureClassIdByAliasName(BarrierJunctionName).FeatureClassID }; IFeatureClass flowlineFeatureClass = this.m_networkContext.GetEdgeFeatureClassByAliasName(FlowLineName); ISpatialReference srs = AOUtilities.GetFeatureClassSpatialReference(flowlineFeatureClass, false); if (null != srs) { this.m_networkEPSG = srs.FactoryCode; } else { this.m_isReady = false; } this.m_flowDirFieldIndex = AOUtilities.GetFieldIndexByName(flowlineFeatureClass, "FlowDir"); if (this.m_flowDirFieldIndex < 0) { this.m_isReady = false; } } }
private Guid SaveNetworkToDB(CNN network, string name) { using (var context = new NetworkContext()) { if (context.NetworkModels.FirstOrDefault(item => item.Name == name) != null) { return(ProcessUpdate(network, name, context)); } else { return(ProcessSave(network, name, context)); } } }
/// <summary> /// Create a new AutomaticTurnGame. /// </summary> /// <param name="context">The networking context.</param> /// <param name="targetUpdatesPerSecond">The number of updates/turns that will occur every /// second.</param> public AutomaticTurnGame(NetworkContext context, int targetUpdatesPerSecond) { TargetUpdatesPerSecond = targetUpdatesPerSecond; _context = context; if (_context.IsServer) { _serverHandler = new GameServerHandler(_context); _context.AddMessageHandler(_serverHandler); } _clientHandler = new GameClientHandler(); _context.AddMessageHandler(_clientHandler); }
public Contexts() { game = new GameContext(); input = new InputContext(); network = new NetworkContext(); var postConstructors = System.Linq.Enumerable.Where( GetType().GetMethods(), method => System.Attribute.IsDefined(method, typeof(Entitas.CodeGeneration.Attributes.PostConstructorAttribute)) ); foreach (var postConstructor in postConstructors) { postConstructor.Invoke(this, null); } }
public void Setup(NetworkId objectId, string peerUuid, bool polite, VoipMicrophoneInput source, VoipAudioSourceOutput sink, Task <RTCPeerConnection> peerConnectionTask) { if (setupTask != null) { // Already setup or setup in progress return; } this.Id = objectId; this.PeerUuid = peerUuid; this.audioSource = source; this.audioSink = sink; this.context = NetworkScene.Register(this); this.setupTask = Task.Run(() => DoSetup(polite, peerConnectionTask)); }
public void GetFeatureClassEPSG() { //Arrange NetworkContext ctx = new NetworkContext("Hydro", new List <string>() { "FlowlineMerge" }, new List <string>() { "Hydro_Net_Junctions", "Barriers" }); ctx.LoadGeometricNetwork(GN_Path, null, null); //Act ISpatialReference srs = AOUtilities.GetFeatureClassSpatialReference(ctx.GetEdgeFeatureClassByAliasName("FlowlineMerge"), false); //Assert Assert.IsTrue(4269 == srs.FactoryCode); }
void Start() { context = NetworkScene.Register(this); factory = GetComponentInParent<WebRtcPeerConnectionFactory>(); if (factory == null) { factory = GetComponentInParent<NetworkScene>().gameObject.AddComponent<WebRtcPeerConnectionFactory>(); } // A single PeerConnection attaches to one other client, and transports any number of video and audio tracks. // Once the PeerConnection is created, tracks can be added and removed dynamically. // The re-negotiation needed event should prompt the exchange of SDP and ICE Candidate messages. factory.GetRtcConfiguration(config => { pc = factory.CreatePeerConnection(config, this); }); }
public void ConstructStoppersOnAllExistingBarriersEIDs() { //Arrange NetworkContext ctx = new NetworkContext("Hydro", new List <string>() { "FlowlineMerge" }, new List <string>() { "Hydro_Net_Junctions", "Barriers" }); ctx.LoadGeometricNetwork(GN_Path, null, null); //Act StopperJunctions stoppers = NetworkHelper.GetStoppersEID(ctx, "Barriers"); //Assert Assert.IsNotNull(stoppers); Assert.IsTrue(stoppers.Stoppers != null && stoppers.Stoppers.Length > 0); }
protected NetworkContextModule(NetworkContext network) { _network = network; }