//List<Room> room = new List<Room>(); // Use this for initialization void Start() { so = SocketObject.Instance; dw = DataWorker.Instance; gm = GameManager.Instance; //StartCoroutine ("RequestRoomData"); /* * gm._GameState * .DistinctUntilChanged() * .Where(x => x == GameState.ConnectionComp) * .Subscribe(_ => setMenu01Player()); */ gm._GameState .DistinctUntilChanged() .Where(x => x == GameState.CheckRoomData) .Subscribe(_ => QuickStart()); gm._GameState .DistinctUntilChanged() .Where(x => x == GameState.RoomDataUpdate) .Subscribe(_ => RoomDataCheck()); }
// Start is called before the first frame update void Start() { so = SocketObject.Instance; dw = DataWorker.Instance; mine = GetComponent <PlayerScript> (); StartCoroutine(AttackByTime()); }
// Start is called before the first frame update void Start() { so = SocketObject.Instance; dw = DataWorker.Instance; if (!debug) { ps = transform.parent.GetComponent <PlayerScript>(); } copyMesh = Instantiate(originMesh); mf = GetComponent <SkinnedMeshRenderer>(); mc = GetComponent <MeshCollider>(); mf.sharedMesh = copyMesh; mf.sharedMesh.RecalculateBounds(); mf.sharedMesh.RecalculateNormals(); mc.sharedMesh = mf.sharedMesh; for (int i = 0; i < GetComponent <Renderer>().sharedMaterials.Length; i++) { GetComponent <Renderer>().sharedMaterials[i] = mat; } start = end = Vector3.zero; if (!debug) { ps.model = this; } }
private static void GameSearchLogicStart() { BitmapSource capturedImage = ScreenCapture.GetGameType(gameWindowX, gameWindowY); string googleApiResult = SocketObject.GetImageSearching(LoginViewModel.LoginUser, ImageSearchClass.BufferFromImage(capturedImage)); if (googleApiResult != null && googleApiResult != string.Empty) { googleApiResult = googleApiResult.Split('\n')[1].Split('\n')[0]; } if (googleApiResult == "비공개 선택") { gameType = GameType.비공개_선택; } else if (googleApiResult == "개인/2인 랭크 게임") { gameType = GameType.랭크_게임; } else if (googleApiResult == "무작위 총력전") { gameType = GameType.무작위_총력전; } else { //Debug.Assert(false); } Debug.WriteLine("게임 타입 : " + googleApiResult); return; }
// Use this for initialization void Start() { so = SocketObject.Instance; Ray ray = new Ray(transform.position, -transform.up); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity, mask)) { if (hit.transform.gameObject.CompareTag("Stage")) { pre = null; preComponent = null; } else { pre = hit.transform.gameObject; preComponent = pre.GetComponent <ObsUpdate>(); if (preComponent.fall) { fall = true; } else { preComponent.next = this.gameObject; } } return; } fall = true; if (core == null) { core = this.gameObject; } }
private void OnUpdateComplete(IAsyncResult ar) { SocketObject socketObj = (SocketObject)ar.AsyncState; Socket socket = socketObj.socket; SocketError errorCode; int nBytesRec = socket.EndReceive(ar, out errorCode); if (errorCode != SocketError.Success) { nBytesRec = 0; } if (nBytesRec != 1024) { log.Error("error"); socket.EndConnect(socketObj.cResult); } else { //parse recipe step data byte[] cDataBytes = new byte[1024]; Array.Copy(socketObj.buffer, 0, cDataBytes, 0, 1024); DecryptProcess(socketObj.tubeGroup, cDataBytes); //socket.Shutdown(SocketShutdown.Both); //socket.EndConnect(socketObj.cResult); //socket.Close(); Thread.Sleep(1000); //connect(socketObj.tubeGroup); UpdateProcessInfo(socketObj.tubeGroup); } }
private void OnReceiveSendEditSetpointsComplete(IAsyncResult ar) { SocketError errorCode; SocketObject so = (SocketObject)ar.AsyncState; int nBytesRec = so.socket.EndReceive(ar, out errorCode); if (errorCode != SocketError.Success) { nBytesRec = 0; } if (nBytesRec != 1 && 100 != so.endCommand[0]) { //return with error code //MessageBox.Show("error"); log.Error("error:step "); } else { //parse recipe step data } { //finish recipe // mSocketObj.socket.EndConnect(mSocketObj.cResult); if (so.cesCallback != null) { so.cesCallback(); } } }
// Use this for initialization void Start() { so = SocketObject.Instance; dw = DataWorker.Instance; gm = GameManager.Instance; IChaos = new IntermittentChaos(); StartCoroutine("Chaos"); }
// Start is called before the first frame update void Start() { so = SocketObject.Instance; dw = DataWorker.Instance; mine = GetComponent <PlayerScript>(); handPos = hand.transform.localPosition; StartCoroutine(AttackByTime()); }
private static async Task AddUsers() { BitmapSource capturedImage = await ScreenCapture.GetUsersAllImageAsync(gameWindowX, gameWindowY, gameType); string googleApiResult = SocketObject.GetImageSearching(LoginViewModel.LoginUser, ImageSearchClass.BufferFromImage(capturedImage)); if (googleApiResult == null || googleApiResult == string.Empty) { Debug.Assert(false); return; } string[] googleAPIResuluts = googleApiResult.Split('\n'); if (gameType == GameType.비공개_선택) { for (int index = 0; index < googleAPIResuluts.Length; index++) { if (index % 2 == 0) { continue; } GameUser user = await CreateUserAsync(googleAPIResuluts[index]); user.index = index / 2; Users.Add(user); } } else if (gameType == GameType.무작위_총력전) { for (int index = 0; index < googleAPIResuluts.Length; index++) { GameUser user = await CreateUserAsync(googleAPIResuluts[index]); user.index = index; Users.Add(user); } } else if (gameType == GameType.랭크_게임) { for (int index = 0; index < googleAPIResuluts.Length; index++) { if (googleAPIResuluts[index] == "상단 (탑)" || googleAPIResuluts[index] == "중단 (미드)" || googleAPIResuluts[index] == "정글" || googleAPIResuluts[index] == "하단 (봇)" || googleAPIResuluts[index] == "서포터" || googleAPIResuluts[index] == "희망 챔피언 선택" || googleAPIResuluts[index] == string.Empty) { continue; } GameUser user = await CreateUserAsync(googleAPIResuluts[index]); user.index = index / 2; Users.Add(user); } } }
private void HandlexSocketRequest() { this.Context.Response.Header.AddOrUpdate("Content-Type", this._DomainControl.ServiceMimeType); this.Context.Response.Header.AddOrUpdate("Content-Encoding", "identity"); // Decode Encoded Call Function to Readable Basics.Execution.Bind bind = this._DomainControl.GetxSocketBind(); bind.Parameters.Prepare( (parameter) => { Property property = new Property(0, parameter.Query, null); property.InstanceRequested += (ref Basics.Domain.IDomain instance) => instance = this._DomainControl.Domain; property.Setup(); property.Render(null); return(property.ObjectResult); } ); List <KeyValuePair <string, object> > keyValueList = new List <KeyValuePair <string, object> >(); foreach (Basics.Execution.ProcedureParameter item in bind.Parameters) { keyValueList.Add(new KeyValuePair <string, object>(item.Key, item.Value)); } IHttpContext context = this.Context; SocketObject xSocketObject = new SocketObject(ref context, keyValueList.ToArray()); bind.Parameters.Override(new string[] { "xso" }); bind.Parameters.Prepare( (parameter) => xSocketObject ); Basics.Execution.InvokeResult <object> invokeResult = Manager.AssemblyCore.InvokeBind <object>(Helpers.Context.Request.Header.Method, bind, Manager.ExecuterTypes.Undefined); if (invokeResult.Exception != null) { throw new Exception.ServiceSocketException(invokeResult.Exception.ToString()); } if (invokeResult.Result is Message) { Message MessageResult = (Message)invokeResult.Result; if (MessageResult.Type == Message.Types.Error) { throw new Exception.ServiceSocketException(MessageResult.Content); } } }
// Start is called before the first frame update void Start() { so = SocketObject.Instance; dw = DataWorker.Instance; gm = GameManager.Instance; a = AttackUI.GetComponent <filledImage> (); d = DiffenceUI.GetComponent <filledImage> (); s = SpeedUI.GetComponent <filledImage> (); }
// Use this for initialization void Start() { so = SocketObject.Instance; dw = DataWorker.Instance; gm = GameManager.Instance; pd = new PlayerData(); //toPos = transform.position; //transform.LookAt(new Vector3(0, transform.position.y, 0)); //fpsCam.hRotation = transform.rotation; }
// Use this for initialization void Start() { so = SocketObject.Instance; dw = DataWorker.Instance; gm = GameManager.Instance; if (this.gameObject.name.Equals("NameInputField") && so.connecting) { GetComponent <InputField> ().text = SocketObject.Instance.name; } }
private void connectCallBack(IAsyncResult iar) { try { SocketObject sb = (SocketObject)iar.AsyncState; sb.socketWorker.EndConnect(iar); } catch { } }
public static void StartCapture(SocketObject state) { var deviceState = new DeviceState(); lock (deviceState) { deviceState.Device = state.Device; deviceState.Handle = IntPtr.Zero; deviceState.Cancel = false; deviceState.State = state; var num = Marshal.AllocHGlobal(12); try { if (_activeDevices.ContainsKey(state.Device.Name)) { StopCapture(state.Device.Name); } var errbuff = new StringBuilder(256); deviceState.Handle = pcap_open(state.Device.Name, 65536, 0, 500, IntPtr.Zero, errbuff); if (deviceState.Handle == IntPtr.Zero) { throw new ApplicationException($"Cannot Open PCap Interface [{state.Device.Name}] => Error: {errbuff}"); } deviceState.LinkType = pcap_datalink(deviceState.Handle); if (deviceState.LinkType != 1 && deviceState.LinkType != 0) { throw new ApplicationException($"Interface [{state.Device.Description}] Does Not Appear To Support Ethernet"); } if (pcap_compile(deviceState.Handle, num, "ip and tcp", 1, 0U) != 0) { throw new ApplicationException("Unable To Create TCP Packet Filter"); } if (pcap_setfilter(deviceState.Handle, num) != 0) { throw new ApplicationException("Unable To Apply TCP Packet Filter"); } pcap_freecode(num); _activeDevices[state.Device.Name] = deviceState; } catch (Exception ex) { if (deviceState.Handle != IntPtr.Zero) { pcap_close(deviceState.Handle); } NetworkHandler.Instance.RaiseException(Logger, new ApplicationException($"Unable To Open WinPCap Device [{state.Device.Name}]", ex)); } finally { Marshal.FreeHGlobal(num); } ThreadPool.QueueUserWorkItem(PollNetworkDevice, _activeDevices[state.Device.Name]); } }
private void Connect(SocketObject so, byte tubeGroup) { Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); int port = 2000; IPAddress ip = IPAddress.Parse(hosts[tubeGroup - 1]); IPEndPoint ipe = new IPEndPoint(ip, port); so.socket = socket; so.ipe = ipe; so.tubeGroup = tubeGroup; socket.BeginConnect(ipe, new AsyncCallback(OnConnectComplete), so); }
private SocketClient() { //Connect(); mSocket1 = new SocketObject(); mSocket1.callback = OnConnectSocket1End; mSocket2 = new SocketObject(); mSocket2.callback = OnConnectSocket2End; mSocket3 = new SocketObject(); mSocket3.callback = OnConnectSocket3End; mSocket4 = new SocketObject(); mSocket4.callback = OnConnectSocket4End; }
private ProcessService() { mProcesses = new Process[6]; for (int i = 0; i < 6; ++i) { mProcesses[i] = new Process(); } mEditProcess = new EditProcess(); socketObjs = new SocketObject[2]; socketObjs[0] = new SocketObject(); socketObjs[1] = new SocketObject(); commitSocketObj = new SocketObject(); }
// Use this for initialization void Start() { so = SocketObject.Instance; dw = DataWorker.Instance; gm = GameManager.Instance; //pd = new PlayerData (); StartCoroutine("SyncPosition"); fpsCam = GetComponent <fpsCamera> (); anim = GetComponent <Animator> (); toPos = transform.position; transform.LookAt(new Vector3(0, transform.position.y, 0)); fpsCam.hRotation = transform.rotation; //avater.GetComponent<MeshCollider>().sharedMesh = avater.GetComponent<SkinnedMeshRenderer>().sharedMesh; }
private void SendEditSetpoints(SocketObject so) { byte[] command = { 40, so.tubeIndex, 0 }; so.socket.BeginSend(command, 0, 3, SocketFlags.None, ar => { SocketError errorCode; int nBytesSend = so.socket.EndSend(ar, out errorCode); if (errorCode != SocketError.Success) { nBytesSend = 0; } if (nBytesSend != 3) { //return with error code //MessageBox.Show("error"); log.Error("error"); } else { so.sResult = ar; byte[] setpointBytes = new byte[66]; byte[] tSetpointData = EncryptEditSetpointData(so.tubeIndex); Array.Copy(tSetpointData, 0, setpointBytes, 0, tSetpointData.Length); so.socket.BeginSend(setpointBytes, 0, setpointBytes.Length, SocketFlags.None, ar1 => { SocketError errorCode1; int nBytesSend1 = so.socket.EndSend(ar1, out errorCode1); if (errorCode1 != SocketError.Success) { nBytesSend1 = 0; } if (nBytesSend1 != setpointBytes.Length) { //return with error code //MessageBox.Show("error"); log.Error("error"); } else { so.sResult = ar1; so.socket.BeginReceive(so.endCommand, 0, so.endCommand.Length, SocketFlags.None, new AsyncCallback(OnReceiveSendEditSetpointsComplete), so); } }, null); } } , null); }
private void sendCallBack(IAsyncResult iar) { try { SocketObject sb = (SocketObject)iar.AsyncState; int b = sb.socketWorker.EndSend(iar); Console.WriteLine("客户端发送了{0}字节", b); if (sb.allDone != null) { sb.allDone.Set(); } } catch { } }
public void asyncAccept(ManualResetEvent allDone) { try { SocketObject sb = new SocketObject(); if (allDone != null) { sb.allDone = allDone; } sb.socketWorker = socketWatch; sb.socketWorker.BeginAccept(new AsyncCallback(acceptCallBack), sb); } catch { } }
public void asyncConnect(ManualResetEvent allDone) { try { SocketObject sb = new SocketObject(); if (allDone != null) { sb.allDone = allDone; } sb.socketWorker = socketSend; sb.socketWorker.BeginConnect(new IPEndPoint(IPAddress.Parse(ip), Int32.Parse(point)), new AsyncCallback(connectCallBack), sb); } catch { } }
private void HandlexSocketRequest() { this.Context.Response.Header.AddOrUpdate("Content-Type", this._DomainControl.ServiceMimeType); this.Context.Response.Header.AddOrUpdate("Content-Encoding", "identity"); // Decode Encoded Call Function to Readable Basics.Execution.Bind bind = this._DomainControl.GetxSocketBind(); bind.Parameters.Prepare( parameter => Property.Render(null, parameter.Query).Item2 ); List <KeyValuePair <string, object> > keyValueList = new List <KeyValuePair <string, object> >(); foreach (Basics.Execution.ProcedureParameter item in bind.Parameters) { keyValueList.Add(new KeyValuePair <string, object>(item.Key, item.Value)); } IHttpContext context = this.Context; SocketObject xSocketObject = new SocketObject(ref context, keyValueList.ToArray()); bind.Parameters.Override(new [] { "xso" }); bind.Parameters.Prepare( parameter => xSocketObject ); Basics.Execution.InvokeResult <object> invokeResult = Web.Manager.Executer.InvokeBind <object>(Helpers.Context.Request.Header.Method, bind, Web.Manager.ExecuterTypes.Undefined); if (invokeResult.Exception != null) { throw new Exceptions.ServiceSocketException(invokeResult.Exception.ToString()); } if (!(invokeResult.Result is Message messageResult)) { return; } if (messageResult.Type == Message.Types.Error) { throw new Exceptions.ServiceSocketException(messageResult.Content); } }
private void acceptCallBack(IAsyncResult iar) { try { SocketObject sb = (SocketObject)iar.AsyncState; Socket socketSend = sb.socketWorker.EndAccept(iar); socketSends.Add(socketSend.RemoteEndPoint.ToString(), socketSend); Console.WriteLine(socketSend.RemoteEndPoint.ToString() + "连接成功"); if (sb.allDone != null) { sb.allDone.Set(); } } catch { } }
public LoginWindow() { InitializeComponent(); rect_window_fadein(); UsernameTextbox.Text = "Username"; PasswordTextbox.Text = "Password"; Username = ""; Password = ""; client = new SocketObject(new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), new IPEndPoint(IPAddress.Parse("172.16.1.68"), 11002)); UIGlobal.LoginWindowUI = this; UIGlobal.sharedTCPObject = client; Connect(); }
// Use this for initialization void Start() { // -> FirstProcessing() so = SocketObject.Instance; dw = DataWorker.Instance; gm = GameManager.Instance; jj = new JsonInJson(); GameObject g = Instantiate(DestroyPlane, new Vector3(0, -50, 0), Quaternion.identity); g.GetComponent <DestroyPlane> ().ocs = this; g.transform.parent = dw.GameInstance.transform; gm._GameState .DistinctUntilChanged() .Where(x => x == GameState.DefaultObstacleSetting) .Subscribe(_ => SendDefaultObstacle()); }
public void asyncSend(Command comd, ManualResetEvent allDone) { try { SocketObject sb = new SocketObject(); sb.socketWorker = socketSend; if (allDone != null) { sb.allDone = allDone; } byte[] buffer = Interpreter.getSerialization(comd); sb.socketWorker.BeginSend(buffer, 0, buffer.Length, 0, new AsyncCallback(sendCallBack), sb); } catch { } }
public void asyncReceive(string socket, ManualResetEvent allDone) { try { SocketObject sb = new SocketObject(); if (allDone != null) { sb.allDone = allDone; } sb.socketWorker = socketSend; sb.buffer = new byte[SocketObject.allocate]; sb.socketWorker.BeginReceive(sb.buffer, 0, SocketObject.allocate, 0, new AsyncCallback(receiveCallBack), sb); } catch { } }