public static void OnBinary(IWebSocketConnection client, byte[] buf) { if (buf == null || buf.Length == 0) { return; } MSG item = MSG.Deserialize(buf); if (item == null) { return; } MSG_TYPE type = item.Type; if (type == MSG_TYPE.SET_ID_IN_APP || type == MSG_TYPE.SET_ID_IN_COMPUTER || type == MSG_TYPE.SET_ID_IN_LAN_INTERNET) { Join(item, client); } else { ReceiverData(item); } }
private MessageBoxIcon ChooseIcon(MSG_TYPE iconType) { var result = MessageBoxIcon.Exclamation; switch (iconType) { case MSG_TYPE.INFORMATION: result = MessageBoxIcon.Information; break; case MSG_TYPE.SUCCESS: result = MessageBoxIcon.Information; break; case MSG_TYPE.WARNING: result = MessageBoxIcon.Warning; break; case MSG_TYPE.ERROR: result = MessageBoxIcon.Error; break; } return(result); }
public void SendMessage(string msg, MSG_TYPE type) { foreach (Listener l in listeners) { l.ReceiveMessage(msg, type); } }
protected override void WndProc(ref Message m) { ////// Listen for operating system messages ////switch (m.Msg) ////{ //// case WM_ACTIVATEAPP: //// // Notify the form that this message was received. //// // Application is activated or deactivated, //// // based upon the WParam parameter. //// parent.f_api_messageReceiver((int)m.WParam); //// break; ////} ////base.WndProc(ref m); switch (m.Msg) { case WM_COPYDATA: COPYDATASTRUCT CD = (COPYDATASTRUCT)m.GetLParam(typeof(COPYDATASTRUCT)); byte[] B = new byte[CD.cbData]; MSG_TYPE type = (MSG_TYPE)(new IntPtr(CD.dwData)); IntPtr lpData = new IntPtr(CD.lpData); Marshal.Copy(lpData, B, 0, CD.cbData); string strData = Encoding.Default.GetString(B); parent.f_api_messageReceiver(type, strData); break; default: base.WndProc(ref m); break; } }
public static void Output(MSG_TYPE msgType, string name, string str) { if (s_myInstance == null) { s_myInstance = new SystemLog(); } s_myInstance.logout(msgType, name, str); }
public static void Output(MSG_TYPE msgType, string name, string format, params object[] args) { if (s_myInstance == null) { s_myInstance = new SystemLog(); } s_myInstance.logout(msgType, name, string.Format(format, args)); }
public oMsgSocket(bool ok, MSG_TYPE msgType, long msgId = 0, string msgRequest = "", string msgResponse = "") { this.Ok = ok; this.MsgType = msgType; this.MsgId = msgId; this.MsgRequest = msgRequest; this.MsgResponse = msgResponse; }
////private void f_hook_mouse_HookManager_MouseWheel(object sender, MouseEventArgs e) ////{ //// //Debug.WriteLine(string.Format("Wheel={0:000}", e.Delta)); //// //f_hook_mouse_wheel_CallBack(e); ////} ////private void f_hook_mouse_HookManager_MouseWheelExt(object sender, MouseEventExtArgs e) ////{ //// //Debug.WriteLine(string.Format("Wheel={0:000}", e.Delta)); //// //Debug.WriteLine("Mouse Wheel Move Suppressed.\n"); //// e.Handled = true; //// //e.Handled = true; // true: break event at here, stop mouse wheel at here ////} ///////////////////////////////////////////////////////////// #endregion /*////////////////////////////////////////////////////////////////////////*/ public void f_api_messageReceiver(MSG_TYPE type, string data) { switch (type) { case MSG_TYPE.URL_REQUEST_SUCCESS: ui_browser.Load(data); break; } }
public static byte[] f_createMessage(MSG_TYPE type, string message) { byte[] a = Encoding.UTF8.GetBytes(message); List <byte> ls = new List <byte>(a.Length + 1); ls.Add((byte)type); ls.AddRange(a); return(ls.ToArray()); }
public static byte[] f_createMessage(MSG_TYPE type, int value) { byte[] a = BitConverter.GetBytes(value); List <byte> ls = new List <byte>(a.Length + 1); ls.Add((byte)type); ls.AddRange(a); return(ls.ToArray()); }
public bool SendBoolMessage(string msg, MSG_TYPE type) { int i = 0; while (i < listeners.Count && listeners[i].ReceiveBoolMessage(msg, type)) { i++; } return(i >= listeners.Count); }
public static void f_sendMessage(int handle, MSG_TYPE type, string message) { COPYDATASTRUCT cds; cds.dwData = (int)type; cds.lpData = (int)Marshal.StringToHGlobalAnsi(message); cds.cbData = message.Length; //SendMessage(MSG_WINDOW.MainWindowHandle, (int)WM_COPYDATA, 0, ref cds); SendMessage((IntPtr)handle, (int)WM_COPYDATA, 0, ref cds); }
public override bool ReceiveBoolMessage(string msg, MSG_TYPE type) { string[] args = msg.Split(' '); switch (type) { case MSG_TYPE.CELL_OCCUPIED: return(CellsOccupied(int.Parse(args[0]))); default: return(false); } }
private void logout(MSG_TYPE msgType, string name, string str) { string filePath = m_startUpPath + DateTime.Now.ToString("yyyyMMdd") + ".txt"; string output = name + " : " + str; try { using (System.IO.StreamWriter file = new System.IO.StreamWriter(@filePath, true)) { file.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff ") + output); } } catch (Exception) { } EventBroker.AsyncSend(EventBroker.EventID.etLog, new EventBroker.EventParam(this, (int)msgType, output)); }
public static long JoinClient(this WebSocket client, MSG_TYPE TYPE_ID, string client_Name) { long id = 0; byte type = (byte)TYPE_ID; long.TryParse(type.ToString() + DateTime.Now.ToString("0yyyyMMddHHmmssfff"), out id); MSG it = new MSG() { ToClientName = client_Name, FromClientID = id, Type = TYPE_ID }; byte[] buf = it.Serialize(); client.Send(buf); return(id); }
/// <summary> /// tip message display function /// </summary> /// <param name="msg"></param> /// <param name="type"></param> private void Msg(string msg, MSG_TYPE type) { Color color = Color.Blue; switch (type) { case MSG_TYPE.ERROR: color = Color.Red; break; case MSG_TYPE.BLUE: color = Color.Blue; break; case MSG_TYPE.GREEN: color = Color.Green; break; } this.tsslMsg.ForeColor = color; this.tsslMsg.Text = msg; }
public StatusMessage(MSG_TYPE type, string text) { MsgType = type; MsgText = text; }
public override void ReceiveMessage(string msg, MSG_TYPE type) { try { string[] args = msg.Split(' '); string name; int amount = 0, index = -1, rot = 0; float intensity = 0.0f, time = 0.5f; bool active; Vector2Int dir; switch (type) { case MSG_TYPE.MOVE_LASER: amount = int.Parse(args[0]); dir = GetDirectionFromString(args[1]); time = Mathf.Min(UBlockly.Times.instructionWaitTime / (amount + 1), 0.5f) - 0.05f; StartCoroutine(MoveObject(laserName, 0, dir, amount, time)); break; case MSG_TYPE.MOVE: name = args[0].Split('_')[0]; index = int.Parse(args[0].Split('_')[1]); amount = int.Parse(args[1]); dir = GetDirectionFromString(args[2]); time = Mathf.Min(UBlockly.Times.instructionWaitTime / (amount + 1), 0.5f) - 0.05f; StartCoroutine(MoveObject(name, index - 1, dir, amount, time)); break; case MSG_TYPE.ROTATE_LASER: amount = int.Parse(args[0]) * 2; rot = GetRotationFromString(args[1]); time = Mathf.Min(UBlockly.Times.instructionWaitTime / ((amount % 8) + 1), 0.5f) - 0.05f; StartCoroutine(RotateObject(laserName, 0, rot, amount, time)); break; case MSG_TYPE.ROTATE: name = args[0].Split('_')[0]; index = int.Parse(args[0].Split('_')[1]); amount = int.Parse(args[1]) * 2; rot = GetRotationFromString(args[2]); time = Mathf.Min(UBlockly.Times.instructionWaitTime / ((amount % 8) + 1), 0.5f) - 0.05f; StartCoroutine(RotateObject(name, index - 1, rot, amount, time)); break; case MSG_TYPE.CHANGE_INTENSITY: index = int.Parse(args[0]); intensity = float.Parse(args[1]); ChangeLaserIntensity(index - 1, intensity); break; case MSG_TYPE.ACTIVATE_DOOR: name = args[0].Split('_')[0]; index = int.Parse(args[0].Split('_')[1]); active = bool.Parse(args[1]); ActivateDoor(name, index - 1, active); break; case MSG_TYPE.CODE_END: if (AllReceiving()) { completed = true; } else { LevelFailed(); } break; } } catch { LevelFailed(); } }
public EditorMessages(MSG_TYPE type) { this.type = type; text = null; msgSource = null; }
public EditorMessages(MSG_TYPE type, string source, string text) { this.type = type; this.msgSource = source; this.text = text; }
private IEnumerator RunScript() { Transform camera_t = MonoBehaviourSingleton <AppMain> .I.mainCameraTransform; for (int cmd_row = 0; cmd_row < scriptCommands.Count; cmd_row++) { string cmd = scriptCommands[cmd_row].cmd; string p0 = scriptCommands[cmd_row].p0; string p = scriptCommands[cmd_row].p1; string p2 = scriptCommands[cmd_row].p2; string p3 = scriptCommands[cmd_row].p3; string msg = scriptCommands[cmd_row].msg; switch (cmd) { case "WAIT": { float time = (!string.IsNullOrEmpty(p0)) ? float.Parse(p0) : 0f; while (true) { yield return((object)null); if (time > 0f) { time -= Time.get_deltaTime(); } else if (!MonoBehaviourSingleton <ResourceManager> .I.isLoading && !InstantiateManager.isBusy && !MonoBehaviourSingleton <TransitionManager> .I.isTransing && !(charas.Find((StoryCharacter o) => o.isMoving) != null) && !cameraPosAnim.IsPlaying()) { break; } } break; } case "FADE_IN": eventReceiver.FadeIn(); break; case "FADE_OUT": { Color c = Color.get_black(); switch (p0) { case "BLUE": c = Color.get_blue(); break; case "WHITE": c = Color.get_white(); break; case "RED": c = Color.get_red(); break; case "YELLOW": c = Color.get_yellow(); break; } eventReceiver.FadeOut(c); break; } case "CHR_EASE": { StoryCharacter.EaseDir type = (!(p == "L")) ? StoryCharacter.EaseDir.RIGHT : StoryCharacter.EaseDir.LEFT; bool forward = (!(p2 == "IN")) ? true : false; StoryCharacter chara = FindChara(p0); if (chara != null) { while (chara.isLoading) { yield return((object)null); } chara.PlayTween(type, forward, null); } break; } case "EFF_SHOW": { LoadObject load_obj = effectPrefabs.Get(p0); if (load_obj != null) { while (load_obj.isLoading) { yield return((object)null); } Transform effect = ResourceUtility.Realizes(load_obj.loadedObject, effectRenderTex.modelTransform, 1); Vector3 pos = Vector3.get_zero(); StoryCharacter chara2 = FindChara(p); if (chara2 != null) { pos = chara2.model.get_position(); } Vector3 position = camera_t.get_position(); pos.y = position.y; effect.set_position(pos); if (float.TryParse(p2, out float scale)) { effect.set_localScale(new Vector3(scale, scale, scale)); } } break; } case "SE_PLAY": { int se_id = int.Parse(p0); SoundManager.PlayOneShotUISE(se_id); break; } case "BGM_CHANGE": { int bgm_id = int.Parse(p0); MonoBehaviourSingleton <SoundManager> .I.requestBGMID = bgm_id; break; } case "CHR_SHOW": { StoryCharacter chara5 = FindChara(p0); if (chara5 != null) { while (chara5.isLoading) { yield return((object)null); } FadeCharacter(true, chara5); yield return((object)new WaitForSeconds(MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.charaFadeTime)); } break; } case "CHR_HIDE": { StoryCharacter chara7 = FindChara(p0); if (chara7 != null) { while (chara7.isLoading) { yield return((object)null); } FadeCharacter(false, chara7); yield return((object)new WaitForSeconds(MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.charaFadeTime)); } break; } case "CHR_ROT": { StoryCharacter chara8 = FindChara(p0); if (chara8 != null) { float angle; if (string.IsNullOrEmpty(p)) { chara8.RotateDefault(); } else if (p == "F") { chara8.RotateFront(); } else if (float.TryParse(p, out angle)) { chara8.RotateAngle(angle); } } break; } case "CHR_POSE": { StoryCharacter chara9 = FindChara(p0); if (chara9 != null) { chara9.RequestPose(p); } break; } case "CHR_STAND": { StoryCharacter chara10 = FindChara(p0); if (chara10 != null) { chara10.SetStandPosition(p, true); } break; } case "CHR_SCALE": { StoryCharacter chara11 = FindChara(p0); if (chara11 != null) { Vector3 scale2 = new Vector3 { x = float.Parse(p), y = float.Parse(p), z = float.Parse(p) }; chara11.SetModelScale(scale2); } break; } case "CHR_FACE": { StoryCharacter chara12 = FindChara(p0); if (chara12 != null) { chara12.RequestFace(p, p2); } break; } case "CAM_SET": { int camIndex2 = int.Parse(p0); if (0 <= camIndex2 && cameraPositions.Length > camIndex2) { float x = float.Parse(p); float y = float.Parse(p2); float z = float.Parse(p3); cameraPositions[camIndex2] = new Vector3(x, y, z); } break; } case "CAM_MOV": { int camIndex = int.Parse(p0); if (0 <= camIndex && cameraPositions.Length > camIndex) { ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, cameraPositions[camIndex], null, default(Vector3), null); cameraPosAnim.Play(); } break; } case "CAM_PAN": { StoryCharacter chara6 = FindChara(p0); if (chara6 != null) { int charaShowCount = GetCharaShowCount(); switch (charaShowCount) { case 1: { Vector3 position2 = chara6.model.get_position(); Vector3 pos3; pos3.x = position2.x; Transform chara_neck = (!(p == "F")) ? Utility.Find(chara6.model, "Neck") : Utility.Find(chara6.model, "Spine01"); if (chara_neck != null) { Vector3 position3 = chara_neck.get_position(); pos3.y = position3.y; } else { pos3.y = initCameraPos.y; } if (p == "N") { pos3.z = MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.cameraPanNearZ; } else if (p == "F") { pos3.z = MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.cameraPanFarZ; } else { pos3.z = MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.cameraPanNormalZ; } ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, pos3, null, default(Vector3), null); cameraPosAnim.Play(); break; } case 2: ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.duoCameraPos, null, default(Vector3), null); cameraPosAnim.Play(); break; default: if (3 <= charaShowCount) { ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.trioCameraPos, null, default(Vector3), null); cameraPosAnim.Play(); } break; } } else { Vector3 pos2; pos2.x = 0f; pos2.y = initCameraPos.y; pos2.z = 0f; ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, pos2, null, default(Vector3), null); cameraPosAnim.Play(); } break; } case "CHR_ALIAS": { StoryCharacter chara4 = FindChara(p0); if (chara4 != null) { chara4.SetAliasName(p); } break; } case "MSG": { MSG_TYPE msg_type = MSG_TYPE.NORMAL; if (p == "M" || p == "MONOLOGUE") { msg_type = MSG_TYPE.MONOLOGUE; } waitMessage = true; StoryCharacter chara3 = FindChara(p0); msg = GetReplacedText(msg); eventReceiver.AddMessage((!(chara3 != null)) ? p0 : chara3.displayName, msg, (chara3 != null) ? chara3.dir : POS.NONE, msg_type); if (!string.IsNullOrEmpty(p2)) { int voice_id = int.Parse(p2); SoundManager.PlayVoice(voice_id, 1f, 0u, null, null); } break; } case "BG": { bool isFirstLoad = false; LoadingQueue load_queue = new LoadingQueue(this); if (locationRednerTex != null) { locationRednerTex.Release(); } else { isFirstLoad = true; } int loc_image_id = int.Parse(p0); int loc_sky_id = int.Parse(p); ResourceManager.enableCache = false; LoadObject lo_loc_image = (loc_image_id <= 0) ? null : load_queue.Load(RESOURCE_CATEGORY.STORY_LOCATION_IMAGE, ResourceName.GetStoryLocationImage(loc_image_id), false); LoadObject lo_loc_sky = (loc_sky_id <= 0) ? null : load_queue.Load(RESOURCE_CATEGORY.STORY_LOCATION_SKY, ResourceName.GetStoryLocationSky(loc_sky_id), false); yield return((object)load_queue.Wait()); ResourceManager.enableCache = true; locationRednerTex = UIRenderTexture.Get(locationTex, -1f, false, 0); locationRednerTex.Disable(); locationRednerTex.orthographicSize = (float)locationTex.height * 0.5f * 0.01f; locationRednerTex.modelTransform.set_position(new Vector3(0f, 0f, 10f)); locationRoot = Utility.CreateGameObject("LocationRoot", locationRednerTex.modelTransform, locationRednerTex.renderLayer); locationRoot.set_localPosition(new Vector3(0f, 0f, 3f)); locationRoot.set_localScale(new Vector3(0.01f, 0.01f, 1f)); if (lo_loc_image != null) { locationImageRoot = Utility.CreateGameObject("LocationImageRoot", locationRoot, locationRednerTex.renderLayer); locationImage = ResourceUtility.Realizes(lo_loc_image.loadedObject, locationImageRoot, locationRednerTex.renderLayer); } if (lo_loc_sky != null) { locationSky = ResourceUtility.Realizes(lo_loc_sky.loadedObject, locationRoot, locationRednerTex.renderLayer); locationSky.set_localPosition(new Vector3(0f, 0f, 1f)); } locationRednerTex.Enable(0.25f); if (isFirstLoad) { eventReceiver.EndLoadFirstBG(); } break; } } while (waitMessage) { yield return((object)null); } } isRunning = false; FocusChara(null); eventReceiver.EndStory(); }
private void receive(string a_message) { MSG_TYPE msg_type = m_messageManager.parse(a_message); switch (msg_type) { case MSG_TYPE.MSG_CLIENT_INFO_TYPE: connectedBox.Invoke(new Action(() => connectedBox.Items.Add(m_messageManager.getClientLogin() + " - " + m_messageManager.getClientIP()))); break; case MSG_TYPE.MSG_RESET_INFO_TYPE: m_tcpServer.send(a_message); connectedBox.Invoke(new Action(() => connectedBox.Items.Clear())); connectedBox.Invoke(new Action(() => connectedBox.Items.Add(Regex.Replace(File.ReadAllText("./login.txt"), @"\s+", "") + " - " + Regex.Replace(File.ReadAllText("./ipaddress.txt"), @"\s+", "")))); send(m_messageManager.buildClientInfo(File.ReadAllText("./login.txt"), File.ReadAllText("./ipaddress.txt"))); break; case MSG_TYPE.MSG_SERVER_INFO_TYPE: m_udpClient.stop(); m_tcpClient.start(tcp_client_received_callback, m_messageManager.getServerIP()); send(m_messageManager.buildResetInfo()); break; case MSG_TYPE.MSG_HOST_INFO_TYPE: if (!(File.ReadAllText("./ipaddress.txt").Contains(m_messageManager.getHostIP()))) { File.WriteAllText("./hostip.txt", m_messageManager.getHostIP()); if (m_messageManager.getHostGame() == GAME_TYPE.GAME_H3_NEW_TYPE) { try { var startInfo = new ProcessStartInfo(); startInfo.WorkingDirectory = Path.GetDirectoryName(File.ReadAllText("./h3.txt")); startInfo.FileName = File.ReadAllText("./h3.txt"); Process.Start(startInfo); Process.Start("AutoIt3_x64.exe", "h3newjoin.au3").WaitForExit(); } catch (Exception) { MessageBox.Show("H3 start failed. Please detect H3 again."); } } else if (m_messageManager.getHostGame() == GAME_TYPE.GAME_H3_LOAD_TYPE) { try { var startInfo = new ProcessStartInfo(); startInfo.WorkingDirectory = Path.GetDirectoryName(File.ReadAllText("./h3.txt")); startInfo.FileName = File.ReadAllText("./h3.txt"); Process.Start(startInfo); Process.Start("AutoIt3_x64.exe", "h3loadjoin.au3").WaitForExit(); } catch (Exception) { MessageBox.Show("H3 start failed. Please detect H3 again."); } } } break; default: break; } }
// 각 메시지 타입에 따른 데이터 타입 정보 확인 public static DATA_TYPE[] GetMessageTypeList(MSG_TYPE type) { return(_dataTypeList[type]); }
// 각 메시지 타입에 따른 메시지 데이터 사이즈 정보 확인 public static int[] GetMessageSizeList(MSG_TYPE type) { return(_dataSizeList[type]); }
// 각 메시지 타입에따라 전체 메시지 크기 확인 public static int GetMessageTotalSIze(MSG_TYPE type) { return(_totalDataSizeList[(int)type]); }
public abstract bool ReceiveBoolMessage(string msg, MSG_TYPE type);
public abstract void ReceiveMessage(string msg, MSG_TYPE type);
public EditorMessages() { this.type = MSG_TYPE.UNDEFINED; }
public static byte[] f_sendApi(this Rpc.RpcClientApi client, MSG_TYPE type, int message) { byte[] m = f_createMessage(type, message); return(client.Execute(m)); }