-(int) SendCustomData:(NSData *)data repeatCout:(int)reaptCout;
public abstract int SendCustomData(byte[] data,int repeatCout);
public abstract int SendCustomData(byte[] customdata,int repeatCout);
매개변수 | 유형 | 의미 |
data | NSData * , byte[] | 전달할 메시지 |
reaptCout | int | 반복 횟수, -1 입력 시 무제한 반복 전송 |
-(IBAction)SendCustData:(UIButton*)sender {int ret = 0;NSString *typeString;switch (sender.tag) {case 1:ret = [[[ITMGContext GetInstance] GetRoom] SendCustomData:[NSData dataWithBytes:_shareRoomID.text.UTF8String length:_roomIdText.text.length] repeatCout:_shareOpenID.text.intValue];typeString = @"sendCustData";break;case 2:ret = [[[ITMGContext GetInstance] GetRoom] StopSendCustomData];typeString = @"recvCustData";break;default:break;}if(ret != 0) {UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"set fail" message:[NSString stringWithFormat:@"%@:errorcode :%d",typeString,ret] delegate:NULL cancelButtonTitle:@"OK" otherButtonTitles:nil];[alert show];}}
String strData = mEditData.getText().toString();String repeatCount = mEditRepeatCount.getText().toString();int nRet = ITMGContext.GetInstance(getActivity()).GetRoom().SendCustomData(strData.getBytes(), Integer.parseInt(repeatCount));
InputField SendCustom_Count_InputField = transform.Find("inroomPanel/imPanel/SendCustom_Count_InputField").GetComponent<InputField>();InputField SendCustom_Data_InputField = transform.Find("inroomPanel/imPanel/SendCustom_Data_InputField").GetComponent<InputField>();transform.Find("inroomPanel/imPanel/SendCustom_Btn").GetComponent<Button>().onClick.AddListener(delegate (){string data = SendCustom_Data_InputField.text;string str_count = SendCustom_Count_InputField.text;int count = 0;if (int.TryParse(str_count, out count)) {Debug.Log(data+ count.ToString());byte[] byteData = Encoding.Default.GetBytes(data);int ret = ITMGContext.GetInstance().GetRoom().SendCustomData(byteData, count);if(ret != 0 ) {ShowWarnning(string.Format("send customdata failed err:{0}",ret));}}});}
-(IBAction)SendCustData:(UIButton*)sender {int ret = ret = [[[ITMGContext GetInstance] GetRoom] SendCustomData:[NSData dataWithBytes:dataInput_textfiled_.text.UTF8String length:dataInput_textfiled_.text.length] repeatCout:-1];if(ret != 0) {UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"set fail" message:[NSString stringWithFormat:@"SendCustomData:errorcode :%d",ret] delegate:NULL cancelButtonTitle:@"OK" otherButtonTitles:nil];[alert show];}}
if (ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_CUSTOMDATA_UPDATE == type) {int subtype = data.getIntExtra("sub_event",-1);if (subtype == 0) {String content = data.getStringExtra("content");String sender = data.getStringExtra("senderid");Toast.makeText(getActivity(), String.format("recv content =%s, from:%s", content,sender), Toast.LENGTH_SHORT).show();}
void OnEvent(int eventType,int subEventType,string data){Debug.Log (data);switch (eventType) {case (int)ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_CUSTOMDATA_UPDATE:{if(subEventType == (int)ITMG_CUSTOMDATA_SUB_EVENT.ITMG_CUSTOMDATA_AV_SUB_EVENT_UPDATE) {_customData = JsonUtility.FromJson<CustomDataInfo>(data);ShowWarnning(string.Format("recve customdata {0} from {1}",_customData.content,_customData.senderid));}}break;}
-(int) StopSendCustomData;
public abstract int StopSendCustomData();
public abstract int StopSendCustomData();
문제 해결에 도움이 되었나요?