// Use this for initialization void Start() { peer = new PhotonPeer(this, ConnectionProtocol.Udp); bool isConnected = peer.Connect("10.0.0.115:5055", "StarCollectorServer"); Debug.Log(isConnected); StartCoroutine(DoService()); }
public ChatPeerListener(ChatClient chatClient, PlayerInfo playerInfo, string serverAddress, string applicationName) { Player = playerInfo; ChatClient = chatClient; _connected = false; _operations = new Dictionary<byte, IBaseOp>(); foreach (var item in typeof(IBaseOp).Assembly.GetTypes().Where(_ => !_.IsAbstract && typeof(IBaseOp).IsAssignableFrom(_))) { var obj = (IBaseOp)Activator.CreateInstance(item); _operations[obj.OpCode] = obj; } _peer = new PhotonPeer(this, ConnectionProtocol.Udp); _peer.Connect(serverAddress, applicationName); while (!_connected) { _peer.Service(); } var t = new Timer { Enabled = true, Interval = 10 }; t.Elapsed += (sender, args) => _peer.Service(); t.Start(); }
public Chat() { peer = new PhotonPeer(this, ConnectionProtocol.Tcp); ChatGUI.MessagesTab1.Add("Connecting to chat server..."); peer.Connect("191.238.97.27:4530", "ChatServer"); }
// Use this for initialization void Start() { // connect to Photon Server peer = new PhotonPeer(this, ConnectionProtocol.Udp); peer.Connect ("10.0.2.15:5055", "PhotonAckServer"); StartCoroutine (doService ()); }
// Use this for initialization void Start() { Application.runInBackground = true; m_photonServer = new PhotonServer(); PhotonPeer peer = new PhotonPeer(m_photonServer, ConnectionProtocol.Udp); m_photonServer.Init(peer, "localhost:5055", "JustGameServer", this); m_isConnected = true; }
void Awake() { _instance = this; peer = new PhotonPeer(this,protocol); //peer连接服务器 peer.Connect(serverAddress, applicationName); DontDestroyOnLoad(this.gameObject); }
public void Start() { _photonPeer = new PhotonPeer(this, ConnectionProtocol.Udp); if (!_photonPeer.Connect("127.0.0.1:5055", "RuneSlinger")) Debug.LogError("Could not connect to photon."); _message = ""; _messages = new List<string> { }; }
public bool Connect() { peer = new PhotonPeer (this, ConnectionProtocol.Udp); if( peer.Connect("app.exitgamescloud.com:5055","912399f0-c8d8-4d11-bf0a-88924aa6ba31")) { return true; } return false; }
public LRClient() { ServerConnected = false; OnLogin = false; this.peer = new PhotonPeer(this, ConnectionProtocol.Udp); this.fiber = new PoolFiber(); this.fiber.Start(); }
public void Connect() { connected = false; //peer = new PhotonPeer(this, ConnectionProtocol.Tcp); //peer.Connect("127.0.0.1:4530", "ChatServer"); peer = new PhotonPeer(this, ConnectionProtocol.WebSocket); peer.Connect("46.52.15.26:9090", "ChatServer"); }
public Client(string username) { this.username = username; this.fiber = new PoolFiber(); this.fiber.Start(); this.peerListener = new PeerListener(username, this.OnConnectCallback); this.peer = new PhotonPeer(this.peerListener, Settings.UseTcp ? ConnectionProtocol.Tcp : ConnectionProtocol.Udp); this.connectResetEvent = new AutoResetEvent(false); }
public bool Connect(string ip, string appname) { peer = new PhotonPeer(this, ConnectionProtocol.Udp); //"localhost:5055" "CSServer" if (peer.Connect(ip, appname)) { return true; } //peer.OpCustom( ) return false; }
void Awake() { //Dns.GetHostName(); IPAddress ipAddr = Dns.GetHostEntry("1462z254b3.iok.la").AddressList[0]; string ip = ipAddr.ToString();//"1462z254b3.iok.la";//ipAddr.ToString(); Debug.Log(ip); _instance = this; peer = new PhotonPeer(this, protocol); peer.Connect(ip+serverAddress, applicationName); DontDestroyOnLoad(this.gameObject); }
public MasterClient() { Peer = new PhotonPeer(this, ConnectionProtocol.Udp); _connected = false; _operations = new Dictionary<byte, IBaseMasterOp>(); foreach (var item in typeof(IBaseMasterOp).Assembly.GetTypes().Where(_ => !_.IsAbstract && typeof(IBaseMasterOp).IsAssignableFrom(_))) { var obj = (IBaseMasterOp)Activator.CreateInstance(item); _operations[obj.OpCode] = obj; } }
public MainWindow() { InitializeComponent(); PeerConnecting = false; PeerConnected = false; PhotonListener listener = new PhotonListener {Main = this}; Peer = new PhotonPeer(listener, ConnectionProtocol.Udp); DisconnectButton.IsEnabled = false; DispatcherTimer = new DispatcherTimer(); DispatcherTimer.Tick += dispatcherTimer_tick; DispatcherTimer.Interval = new TimeSpan(0,0,0,1); StatusIndicator.Fill = new SolidColorBrush(Colors.Red); StatusTextBox.Foreground = new SolidColorBrush(Colors.Black); }
public bool Connect() { stopwatch.Start(); peer = new PhotonPeer(this, ConnectionProtocol.Udp); //连接Photon Cloud if (peer.Connect("app.exitgamescloud.com:5055", "d2482745-4d35-474c-96ce-4f5362e385a6")) { return true; } ////连接Photon Server //if (peer.Connect("localhost:5055", "LRServer")) //{ // return true; //} return false; }
// Fonction de base // ================ // Connection au serveur public void Connect() { this.peer = new PhotonPeer(this, this.protocol); try { Console.WriteLine("Connecting to " + this.serverAddress + " by using " + this.protocol); this.peer.Connect(this.serverAddress, this.applicationName); } catch (Exception e) { Console.WriteLine(e); } myTime = new System.Timers.Timer(50); myTime.Elapsed += new System.Timers.ElapsedEventHandler(OnTimerElapsed); myTime.Enabled = true; }
public void Connect(string ip, int port, string serverNmae) { try { string serverAddress = ip + ":" + port.ToString(); peer = new PhotonPeer(this, ConnectionProtocol.Udp); if (!peer.Connect(serverAddress, serverNmae)) { OnConnectResponse(false); } } catch (Exception ex) { OnConnectResponse(false); DebugReturn(DebugLevel.ERROR, ex.Message); DebugReturn(DebugLevel.ERROR, ex.StackTrace); } }
public WorldForm() { this.gameCounter = 0; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_OnUnhandledException; Application.ThreadException += Application_OnThreadException; this.InitializeComponent(); this.MouseWheel += this.OnMouseWheel; // diagnostics this.fiber = new FormFiber(this, new DefaultExecutor()); this.fiber.Start(); Settings settings = Program.GetDefaultSettings(); this.diagnosticsPeer = new PhotonPeer(this, settings.UseTcp ? ConnectionProtocol.Tcp : ConnectionProtocol.Udp); this.counterGraph.GraphPane.Title.Text = "Server Performance"; this.counterGraph.GraphPane.YAxis.Title.Text = "Value"; this.counterGraph.GraphPane.YAxis.Scale.Min = 0; this.counterGraph.GraphPane.XAxis.Title.Text = "Time"; this.counterGraph.GraphPane.XAxis.Scale.MajorUnit = DateUnit.Second; }
public static void Main() { var client = new ChatClient(); var peer = new PhotonPeer(client, ConnectionProtocol.Tcp); // connect client.connected = false; peer.Connect("127.0.0.1:4530", "ChatServer"); while (!client.connected) { peer.Service(); } var buffer = new StringBuilder(); while (true) { peer.Service(); // read input if (Console.KeyAvailable) { ConsoleKeyInfo key = Console.ReadKey(); if (key.Key != ConsoleKey.Enter) { // store input buffer.Append(key.KeyChar); } else { // send to server var parameters = new Dictionary<byte, object> { { 1, buffer.ToString() } }; peer.OpCustom(1, parameters, true); buffer.Length = 0; } } } }
private static bool CheckConnection(string serverAddress, string appId, ConnectionProtocol protocol) { var listner = new PhotonListener(false); var peer = new PhotonPeer(listner, protocol); if (!peer.Connect(serverAddress, appId)) { return false; } var counter = 100; while (--counter > 0) { peer.Service(); if (listner.WaitForConnection(0)) { var res = peer.PeerState == PeerStateValue.Connected; peer.Disconnect(); return res; } Thread.Sleep(50); } return false; }
// Use this for initialization private void Start() { peer = new PhotonPeer(this, ConnectionProtocol.Udp); peer.Connect(ServerIp + ":5055", "Server"); }
private void StartGame(GameTabPage page, Settings settings) { var game = new Game(page, settings, Environment.UserName + ++this.gameCounter); var peer = new PhotonPeer(game, settings.UseTcp ? ConnectionProtocol.Tcp : ConnectionProtocol.Udp); ////{ //// DebugOut = log.IsDebugEnabled ? DE.Exitgames.Neutron.Client.NPeer.DebugLevel.ALL : DE.Exitgames.Neutron.Client.NPeer.DebugLevel.INFO ////}; if (!this.tabPageRadar.Initialized) { page.WorldEntered += this.HandleGameWorldEntered; } game.Initialize(peer); page.Initialize(game); game.Connect(); // set focus on game tab this.tabControlTabs.SelectedTab = page; }
// Use this for initialization void Start() { respAction = GetComponent <responesAction>(); this.peer = new PhotonPeer(this, ConnectionProtocol.Udp); this.Connect(); }
/// <summary> /// registers RoomMaster as custom type and returns the result /// </summary> /// <returns></returns> public bool RegisterRoomMaster() { return(PhotonPeer.RegisterType(typeof(RoomMaster), (byte)RoomMaster.CODE, SerializeRoomMaster, DeserializeRoomMaster)); }
/// <summary> /// Initializes a new instance of the <see cref="Client"/> class. /// </summary> /// <param name="username"> /// The username. /// </param> public Client(string username) { this.username = username; this.fiber = new PoolFiber(); this.fiber.Start(); this.peerListener = new PeerListener(username, this.OnConnectCallback); this.peer = new PhotonPeer(this.peerListener, Settings.UseTcp) { ChannelCount = 3 }; this.connectResetEvent = new AutoResetEvent(false); }
public override void OnEnter() { PhotonPeer.RegisterType(typeof(tnMultiplayerIndexTable), (byte)'M', tnMultiplayerIndexTable.PhotonSerialize, tnMultiplayerIndexTable.PhotonDeserialize); Finish(); }
public bool RegisterSerializableType(Type customType, byte code, SerializeMethod serializeMethod, DeserializeMethod constructor) { return(PhotonPeer.RegisterType(customType, code, serializeMethod, constructor)); }
private void Start() { PhotonPeer.RegisterType(typeof(NetData), (byte)'U', SerializeNetData, DeserializeNetData); }
// Use this for initialization void Start() { connection = new PhotonPeer(this, ConnectionProtocol.Udp); connection.Connect(ServerIP, AppName); StartCoroutine(DoService()); }
private void RegisterPlayerIDTypeToPhoton() { PhotonPeer.RegisterType(typeof(PlayerID), (byte)'D', PlayerIDSerializer.Serialize, PlayerIDSerializer.Deserialize); }
public void Setup() { mPeer = new PhotonPeer(this, ConnectionProtocol.Udp); mPeer.Connect(IPADDRESS + ":" + PORT, APPLICATION); }
// Use this for initialization void Start() { Peer = new PhotonPeer(this, ConnectionProtocol.Tcp); }
public bool Init(INetChannelConsumer factory) { _channelFactory = factory; _photon = new PhotonPeer(this, ConnectionProtocol.Udp); return true; }
private void Awake() { //register wordclass type as a serializable type and tell photon how to (de)serialize it PhotonPeer.RegisterType(typeof(WordClass), (byte)'M', CustomSerializer.Serialize, CustomSerializer.Deserialize); nickName = MasterManager.instance.user.username; }
protected override void Initialize() { PhotonPeer.RegisterType(typeof(PunPacketWrapperType), SerializationCode, Serialize, Deserialize); base.Initialize(); }
private void Start() { PhotonPeer.RegisterType(typeof(MyCustomSerialization), (byte)'M', MyCustomSerialization.Serialize, MyCustomSerialization.Deserialize); }
void Start() { peer = new PhotonPeer(this, ConnectionProtocol.Tcp); peer.Connect(IP, "MmoServer"); }
public Multi() { Global.Multi = this; peer = new PhotonPeer(this, ConnectionProtocol.Udp); }
// Register our custom Line class with PUN 2 public static void RegisterCustomTypes() { var result = PhotonPeer.RegisterType(typeof(Line), (byte)'L', SerializeLine, DeserializeLine); //Debug.Log("Registering Custom Line Class:" + ((result) ? "Success" : "Failure")); }
public void Connect() { peer = new PhotonPeer(this, protocol); peer.Connect(serverAddress, applicationName); }
/// <summary>Register de/serializer methods for PUN specific types. Makes the type usable in RaiseEvent, RPC and sync updates of PhotonViews.</summary> internal static void Register() { PhotonPeer.RegisterType(typeof(Player), (byte)'P', SerializePhotonPlayer, DeserializePhotonPlayer); }
/// <summary>Register</summary> internal static void Register() { PhotonPeer.RegisterType(typeof(Vector2), (byte)'W', SerializeVector2, DeserializeVector2); PhotonPeer.RegisterType(typeof(Vector3), (byte)'V', SerializeVector3, DeserializeVector3); PhotonPeer.RegisterType(typeof(Quaternion), (byte)'Q', SerializeQuaternion, DeserializeQuaternion); }
public void Initialize() { Peer = new PhotonPeer(this, false); Peer.Connect(ServerAddress, ApplicationName); State = new WaitingForConnection(this); }
public PhotonService() { peer = null; ServerConnected = false; }
public PhotonList() { peer = new PhotonPeer(this, ConnectionProtocol.Udp); }
void Awake() { PhotonPeer.RegisterType(typeof(Color), 128, ColorSerialization.SerializeColor, ColorSerialization.DeserializeColor); }
public void Initialize() { Peer = new PhotonPeer(this, ConnectionProtocol.Udp); Peer.Connect(ServerAddress, ApplicationName); State = new WaitingForConnection(_instance); }
// Start is called before the first frame update void Start() { photonView = GetComponent <PhotonView>(); PhotonPeer.RegisterType(typeof(Stats), (byte)244, SerializeStats, DeserializeStats); }
public void Awake() { PhotonNetwork.AutomaticallySyncScene = true; PhotonNetwork.ConnectUsingSettings(); PhotonPeer.RegisterType(typeof(int), 242, SerializeInt, DeserializeInt); }
// Use this for initialization void Start() { PhotonPeer = new PhotonPeer(this, ConnectionProtocol.Udp); Connect(); }
// Start is called before the first frame update void Start() { //通过Listener接受服务器端的响应,链接协议 peer = new PhotonPeer(this, ConnectionProtocol.Udp); peer.Connect("127.0.0.1:5055", "MyGame1"); }
public void Start() { this.Peer = PhotonNetwork.networkingPeer; }