private void OnMsgFromPlugin(string jsonPluginMsg) { if (jsonPluginMsg == null) { return; } JsonObject jsonMsg = new JsonObject(jsonPluginMsg); string msg = jsonMsg.GetString("msg"); if (msg.Equals(MSG_SHOW_KEYBOARD)) { bool bShow = jsonMsg.GetBool("show"); int nKeyHeight = (int)(jsonMsg.GetFloat("keyheight") * (float)Screen.height); //FileLog(string.Format("keyshow {0} height {1}", bShow, nKeyHeight)); if (OnShowKeyboard != null) { OnShowKeyboard(bShow, nKeyHeight); } } else { int nSenderId = jsonMsg.GetInt("senderId"); // In some cases the receiver might be already removed, for example if a button is pressed // that will destoy the receiver while the input field is focused an end editing message // will be sent from the plugin after the receiver is already destroyed on Unity side. if (m_dictReceiver.ContainsKey(nSenderId)) { PluginMsgReceiver receiver = PluginMsgHandler.getInst().GetReceiver(nSenderId); receiver.OnPluginMsgDirect(jsonMsg); } } }
private void OnMsgFromPlugin(string jsonPluginMsg) { if (jsonPluginMsg == null) { return; } JsonObject jsonMsg = new JsonObject(jsonPluginMsg); string msg = jsonMsg.GetString("msg"); if (msg.Equals(MSG_SHOW_KEYBOARD)) { bool bShow = jsonMsg.GetBool("show"); int nKeyHeight = (int)(jsonMsg.GetFloat("keyheight") * (float)Screen.height); //FileLog(string.Format("keyshow {0} height {1}", bShow, nKeyHeight)); if (OnShowKeyboard != null) { OnShowKeyboard(bShow, nKeyHeight); } } else { int nSenderId = jsonMsg.GetInt("senderId"); PluginMsgReceiver receiver = PluginMsgHandler.getInst().GetReceiver(nSenderId); receiver.OnPluginMsgDirect(jsonMsg); } }
public int RegisterAndGetReceiverId(PluginMsgReceiver receiver) { int index = snCurReceiverIdx; snCurReceiverIdx++; m_dictReceiver[index] = receiver; return(index); }
public static PluginMsgHandler GetInstanceForReceiver(PluginMsgReceiver receiver) { if (_instance == null) { GameObject handlerObject = new GameObject(DEFAULT_NAME); _instance = handlerObject.AddComponent <PluginMsgHandler>(); } return(_instance); }
public int RegisterAndGetReceiverId(PluginMsgReceiver receiver) { if (receiver == null) { throw new ArgumentNullException("MonoNativeEditBox: Receiver cannot be null while RegisterAndGetReceiverId!"); } int index = _curReceiverIndex; _curReceiverIndex++; _receiverDict[index] = receiver; return(index); }
private void OnMsgFromPlugin(string jsonPluginMsg) { if (jsonPluginMsg == null) { return; } JsonObject jsonMsg = new JsonObject(jsonPluginMsg); string msg = jsonMsg.GetString("msg"); int nSenderId = jsonMsg.GetInt("senderId"); // In some cases the receiver might be already removed, for example if a button is pressed // that will destroy the receiver while the input field is focused an end editing message // will be sent from the plugin after the receiver is already destroyed on Unity side. if (_receiverDict.ContainsKey(nSenderId)) { PluginMsgReceiver receiver = GetReceiver(nSenderId); receiver.OnPluginMsgDirect(jsonMsg); } }
public int RegisterAndGetReceiverId(PluginMsgReceiver receiver) { snCurReceiverIdx++; m_dictReceiver[snCurReceiverIdx] = receiver; return snCurReceiverIdx; }