/// <summary> /// 读取通讯模块与探测器的连接状态 /// </summary> /// <param name="timeout">超时</param> /// <param name="isConnected">是否连接</param> /// <returns></returns> public bool ReadConnectState(TimeSpan timeout) { if (this.EasySerialPort == null) { return(false); } try { //例如 返回数据:SR,00,195,****\r\n 触发接收事件输入缓冲区为16个字节 this.EasySerialPort.SerialPort.ReceivedBytesThreshold = 16; //读取状态正确返回格式:****,將“*”表示為“0~9”的任意一個數字, ByteData reply = this.EasySerialPort.WriteAndGetReply(this.CmdConnectState + Environment.NewLine, timeout); if (reply == null || reply.ToString().Count() != 16) { return(false); } string[] splitArray = reply.ToString().Split(','); if (splitArray[0] == "ER") { return(false); } if (splitArray[3].Substring(0, 4) == "0001")//0001代表IL-030 { return(true); } return(false); } catch (Exception) { return(false); } }
public bool OnSendIOSRecharge(string OrderInfo) { if (OrderInfo.Length == 0) { return(false); } //处理IOS的充值 CL_Cmd_IOSRecharge ncb = new CL_Cmd_IOSRecharge(); ncb.OrderInfo = new IOSRechargeInfo(); ncb.SetCmdType(NetCmdType.CMD_CL_IOSRecharge); ByteData[] bytedata = new ByteData[] { new ByteData(System.Text.Encoding.ASCII.GetBytes(OrderInfo)), }; ncb.OrderInfo.HandleSum = 1; ncb.OrderInfo.Sum = 0; for (int i = 0; i < bytedata.Length; ++i) { ncb.OrderInfo.Sum += (uint)(bytedata[i].strData.Length + 2); } ncb.OrderInfo.Array = new byte[ncb.OrderInfo.Sum]; int idx = 0; for (int i = 0; i < bytedata.Length; ++i) { byte[] len = System.BitConverter.GetBytes((ushort)bytedata[i].strData.Length); ncb.OrderInfo.Array[idx++] = len[0]; ncb.OrderInfo.Array[idx++] = len[1]; System.Array.Copy(bytedata[i].strData, 0, ncb.OrderInfo.Array, idx, bytedata[i].strData.Length); idx += bytedata[i].strData.Length; } NetServices.Instance.Send <CL_Cmd_IOSRecharge>(ncb); return(true); }
public void AdaptorUtilTest() { var msg = new ByteData("024bdd11f2144e825db05759bdd9041367a420fad14b665fd08af5b42056e5e2"); var adaptor = new Pubkey("038d48057fc4ce150482114d43201b333bf3706f3cd527e8767ceb4b443ab5d349"); var sk = new Privkey("90ac0d5dc0a1a9ab352afb02005a5cc6c4df0da61d8149d729ff50db9b5a5215"); var pubkey = new Pubkey("03490cec9a53cd8f2f664aea61922f26ee920c42d2489778bb7c9d9ece44d149a7"); var adaptorSig = new ByteData("00cbe0859638c3600ea1872ed7a55b8182a251969f59d7d2da6bd4afedf25f5021a49956234cbbbbede8ca72e0113319c84921bf1224897a6abd89dc96b9c5b208"); var adaptorProof = new ByteData("00b02472be1ba09f5675488e841a10878b38c798ca63eff3650c8e311e3e2ebe2e3b6fee5654580a91cc5149a71bf25bcbeae63dea3ac5ad157a0ab7373c3011d0fc2592a07f719c5fc1323f935569ecd010db62f045e965cc1d564eb42cce8d6d"); var adaptorSig2 = new ByteData("01099c91aa1fe7f25c41085c1d3c9e73fe04a9d24dac3f9c2172d6198628e57f47bb90e2ad6630900b69f55674c8ad74a419e6ce113c10a21a79345a6e47bc74c1"); // var sigDer = new ByteData("30440220099c91aa1fe7f25c41085c1d3c9e73fe04a9d24dac3f9c2172d6198628e57f4702204d13456e98d8989043fd4674302ce90c432e2f8bb0269f02c72aafec60b72de101"); var sig = new ByteData("099c91aa1fe7f25c41085c1d3c9e73fe04a9d24dac3f9c2172d6198628e57f474d13456e98d8989043fd4674302ce90c432e2f8bb0269f02c72aafec60b72de1"); var secret = new Privkey("475697a71a74ff3f2a8f150534e9b67d4b0b6561fab86fcaa51f8c9d6c9db8c6"); var pair = EcdsaAdaptorUtil.Sign(msg, sk, adaptor); Assert.Equal(adaptorSig.ToHexString(), pair.Signature.ToHexString()); Assert.Equal(adaptorProof.ToHexString(), pair.Proof.ToHexString()); var isVerify = EcdsaAdaptorUtil.Verify(pair.Signature, pair.Proof, adaptor, msg, pubkey); Assert.True(isVerify); var adaptSig = EcdsaAdaptorUtil.Adapt(adaptorSig2, secret); Assert.Equal(sig.ToHexString(), adaptSig.ToHexString()); var adaptorSecret = EcdsaAdaptorUtil.ExtractSecret(adaptorSig2, adaptSig, adaptor); Assert.Equal(secret.ToHexString(), adaptorSecret.ToHexString()); }
//클라에서 서버로 대기방초대 대한 답변 정보보내기 public void Send_CTS_Answer_IntiveRoom(uint invitorUserID, bool isAccept, int unitIdx = 0, byte refLv = 0, int mainWpIdx = 0, int subWpIdx = 0, int decoIdx1 = 0, int decoIdx2 = 0, int decoIdx3 = 0, byte subSkill = 0) { //uint : 초대자 UsreID //bool : true : 초대 수락, false : 초대 거절 //int : 유닛 인덱스 //byte : 유닛 강화도 //int : 메인무기 //int : 보조무기 //int : 치장1 인덱스 //int : 치장2 인덱스 SendBuffer = new ByteData(512, 0); SendBuffer.InPutByte(invitorUserID); SendBuffer.InPutByte(isAccept); SendBuffer.InPutByte(unitIdx); SendBuffer.InPutByte(refLv); SendBuffer.InPutByte(mainWpIdx); SendBuffer.InPutByte(subWpIdx); SendBuffer.InPutByte(decoIdx1); SendBuffer.InPutByte(decoIdx2); SendBuffer.InPutByte(decoIdx3); SendBuffer.InPutByte(subSkill); Net_Script.Send_Data(NETKIND.CTS_INVITE_ROOM_ANSWER, SendBuffer.GetTrimByteData()); }
/** * Constructor. */ public ByteDataLinkedList() { this.first = new ByteData((byte)0); this.last = new ByteData((byte)0); this.first.setNext(this.last); this.last.setPrevious(this.first); }
//================================================================================================================================================================================ void Send_Quick_Join() { //byte : 전투 종류 (BattleKind) //int : 유닛 인덱스 //byte : 유닛 강화도 //int : 메인무기 //int : 보조무기 //int : 치장1 인덱스 //int : 치장2 인덱스 //int : 치장3 인덱스 //byte : 서브 스킬 Send_Buffer = new ByteData(512, 0); Send_Buffer.InPutByte((byte)Link_Script.i.Play_Mode); Send_Buffer.InPutByte(Link_Script.i.Char_Index); Send_Buffer.InPutByte(Link_Script.i.Char_Level); Send_Buffer.InPutByte(Link_Script.i.Main_Gun_Index); Send_Buffer.InPutByte(Link_Script.i.Sub_Gun_Index); Send_Buffer.InPutByte(Link_Script.i.Costume_Kind_1); Send_Buffer.InPutByte(Link_Script.i.Costume_Kind_2); Send_Buffer.InPutByte(Link_Script.i.Costume_Kind_3); Send_Buffer.InPutByte(Link_Script.i.Get_ALL_Char_Data[(uint)Link_Script.i.Char_Index].SubSkill); Data_Send(NETKIND.CTS_QUICK_JOIN, Send_Buffer.GetTrimByteData()); }
//킬링 메시지 void Recv_Killing_Message(ByteData _Receive_data) { // byte : 유저수 // uint : 방 유저 WebUserID // string : KILL 문구 byte Total_User_Count = 0; uint _User_ID = 0; String _User_Killing_Message = ""; //전체 플레이어 숫자 _Receive_data.OutPutVariable(ref Total_User_Count); for (int i = 0; i < Total_User_Count; i++) { _Receive_data.OutPutVariable(ref _User_ID); _Receive_data.OutPutVariable(ref _User_Killing_Message); if (Link_Script.i.User_Data.ContainsKey(_User_ID) == false) { continue; } //Debug.Log("_User_ID = " + _User_ID + ", _User_Killing_Message = " + _User_Killing_Message); Link_Script.i.User_Data[_User_ID].Killing_Message = _User_Killing_Message; } }
public void ReciveData_Delegate(byte[] packet_Data) { RecieveBuffer = new ByteData(packet_Data); Recieved_NetKind = (NETKIND)RecieveBuffer.Getbyte(); if (IsOwnRecieveNetKind(Recieved_NetKind)) { lock (Lockobject) { RecieveBuffer.DataIndex--; Que_Bytedata.Enqueue(RecieveBuffer); } } else if (Recieved_NetKind == NETKIND.STC_CONNECTION_RETENTION) { lock (Lockobject) { RecieveBuffer.DataIndex--; Que_Bytedata.Enqueue(RecieveBuffer); } Link_Script.i.GamePlay_Receive_Data(packet_Data); } else { //나머지는 배틀 쪽 KIND다 그쪽으로 보내서 처리토록하자 Link_Script.i.GamePlay_Receive_Data(packet_Data); } }
public void Send_CTS_FriendRoomJoin(uint _freindID, int _unitIdx, byte _refLv, int _mainWpnIdx, int _subWpnIdx, int _decoIdx1, int _decoIdx2, int _decoIdx3, byte subSkill) { //함께 하기 //uint : 방 들어갈 친구 UserID //int : 유닛 인덱스 //byte : 유닛 강화도 //int : 메인무기 //int : 보조무기 //int : 치장1 인덱스 //int : 치장2 인덱스 SendBuffer = new ByteData(512, 0); SendBuffer.InPutByte(_freindID); SendBuffer.InPutByte(_unitIdx); SendBuffer.InPutByte(_refLv); SendBuffer.InPutByte(_mainWpnIdx); SendBuffer.InPutByte(_subWpnIdx); SendBuffer.InPutByte(_decoIdx1); SendBuffer.InPutByte(_decoIdx2); SendBuffer.InPutByte(_decoIdx3); SendBuffer.InPutByte(subSkill); Net_Script.Send_Data(NETKIND.CTS_FRIEND_ROOM_JOIN, SendBuffer.GetTrimByteData()); }
static PointerDataPacket _unpackPointerDataPacket(ByteData packet) { const int kStride = 8; // Its an 8 const anyway - Int64List.bytesPerElement; const int kBytesPerPointerData = _kPointerDataFieldCount * kStride; int length = packet.lengthInBytes / kBytesPerPointerData; List <PointerData> data = new List <PointerData>(length); for (int i = 0; i < length; ++i) { int offset = i * _kPointerDataFieldCount; data[i] = new PointerData( timeStamp: new Duration(microseconds: packet.getInt64(kStride * offset++, (int)_kFakeHostEndian)), change: (PointerChange)packet.getInt64(kStride * offset++, (int)_kFakeHostEndian), kind: (PointerDeviceKind)packet.getInt64(kStride * offset++, (int)_kFakeHostEndian), device: packet.getInt64(kStride * offset++, (int)_kFakeHostEndian), physicalX: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), physicalY: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), buttons: packet.getInt64(kStride * offset++, (int)_kFakeHostEndian), obscured: packet.getInt64(kStride * offset++, (int)_kFakeHostEndian) != 0, pressure: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), pressureMin: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), pressureMax: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), distance: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), distanceMax: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), radiusMajor: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), radiusMinor: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), radiusMin: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), radiusMax: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), orientation: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), tilt: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian) ); } return(new PointerDataPacket(data: data)); }
static void _dispatchPointerDataPacket(ByteData packet) { if (Window.Instance.onPointerDataPacket != null) { _invoke1 <PointerDataPacket>((d) => Window.Instance.onPointerDataPacket(d), Window.Instance.OnPointerDataPacketZone, _unpackPointerDataPacket(packet)); } }
/** * Creates binary tree from the ByteData binary coded labels. * * @param byteDatas ByteDatas in the array */ public void createBinaryTreeFromBinaryCodedCodes(ByteData[] byteDatas) { this.root = new ByteData((byte)0); for (int i = 0; i < 256; i++) { if (byteDatas[i].getCompressedLength() > 0) { ByteData current = this.root; int length = (byteDatas[i].getCompressedLength() & 0xFF); long compressed = byteDatas[i].getCompressedChar(); for (int k = length - 1; k >= 0; k--) { current = createLeafForTheCharacter(compressed, k, current); } byteDatas[i].setParent(current.getParent()); if (current.getParent().getLeftChild() == current) { byteDatas[i].getParent().setLeftChild(byteDatas[i]); } else { byteDatas[i].getParent().setRightChild(byteDatas[i]); } } } }
private ByteData createLeafForTheCharacter(long compressed, int k, ByteData current) { if ((compressed & (1L << k)) == 0) { if (current.getLeftChild() == null) { ByteData newChild = new ByteData((byte)0); newChild.setParent(current); current.setLeftChild(newChild); current = newChild; } else { current = current.getLeftChild(); } } else { if (current.getRightChild() == null) { ByteData newChild = new ByteData((byte)0); newChild.setParent(current); current.setRightChild(newChild); current = newChild; } else { current = current.getRightChild(); } } return(current); }
public void ScriptSignTest() { ExtPrivkey privkey = new ExtPrivkey("xprv9zt1onyw8BdEf7SQ6wUVH3bQQdGD9iy9QzXveQQRhX7i5iUN7jZgLbqFEe491LfjozztYa6bJAGZ65GmDCNcbjMdjZcgmdisPJwVjcfcDhV"); Transaction tx = new Transaction("020000000201000000000000000000000000000000000000000000000000000000000000000200000000ffffffff01000000000000000000000000000000000000000000000000000000000000000300000000ffffffff0310270000000000001600148b756cbd98f4f55e985f80437a619d47f0732a941027000000000000160014c0a3dd0b7c1b3281be91112e16ce931dbac2a97950c3000000000000160014ad3abd3c325e40e20d89aa054dd980b97494f16c00000000"); OutPoint outpoint2 = new OutPoint("0000000000000000000000000000000000000000000000000000000000000001", 3); long amount = 25000; Privkey privkey21 = privkey.DerivePrivkey(21).GetPrivkey(); Privkey privkey22 = privkey.DerivePrivkey(22).GetPrivkey(); Privkey privkey23 = privkey.DerivePrivkey(23).GetPrivkey(); Pubkey pubkey21 = privkey21.GetPubkey(); Pubkey pubkey22 = privkey22.GetPubkey(); Pubkey pubkey23 = privkey23.GetPubkey(); Script multisigScript = Script.CreateMultisigScript(2, new[] { pubkey21, pubkey22, pubkey23, }); SignatureHashType sighashType = new SignatureHashType(CfdSighashType.All, false); ByteData sighash = tx.GetSignatureHash(outpoint2, CfdHashType.P2shP2wsh, multisigScript, amount, sighashType); SignParameter sig22 = privkey22.CalculateEcSignature(sighash); SignParameter sig23 = privkey23.CalculateEcSignature(sighash); sig22.SetDerEncode(sighashType); sig22.SetRelatedPubkey(pubkey22); sig23.SetDerEncode(sighashType); sig23.SetRelatedPubkey(pubkey23); tx.AddScriptSign(outpoint2, CfdHashType.P2shP2wsh, new[] { new SignParameter(), sig22, sig23 }, multisigScript); output.WriteLine("tx:\n" + tx.ToHexString()); Assert.Equal("0200000000010201000000000000000000000000000000000000000000000000000000000000000200000000ffffffff0100000000000000000000000000000000000000000000000000000000000000030000002322002064a0e02e723ce71d8f18441a39bedd5cefc9c5411c3045614c34bba1a8fbd94fffffffff0310270000000000001600148b756cbd98f4f55e985f80437a619d47f0732a941027000000000000160014c0a3dd0b7c1b3281be91112e16ce931dbac2a97950c3000000000000160014ad3abd3c325e40e20d89aa054dd980b97494f16c0004004730440220749cbe5080a3ce49c2a89f897be537b2b5449b75c64b57030dea1859b22c183f02200573f5be5170bfe4ca617edec0eb021638dd78b90209bbd8eede8a9e8138a32c01473044022019105df75884ff34111282f32c22986db295596983a87bf0df1d16905b4f9a50022075f8a2c8e3335a4265265b428df185fb045d9614ed1b08929bfa9f3f9d294a72016952210334bd4f1bab7f3e6f6bfc4a4aeaa890b858a9a146c6bd6bc5a3fbc00a12524ca72103ff743075c59596729d74b79694ca99b2c57bed6a77a06871b123b6e0d729823021036759d0dc7623e781de940a9bc9162f69c6ad68cc5be1c748e960ae4613e658e053ae00000000", tx.ToHexString()); }
/// <summary> /// 取消零点偏移 /// </summary> /// <param name="timeout">超时</param> /// <returns></returns> public bool CancelZeroOffset(TimeSpan timeout) { if (this.EasySerialPort == null) { return(false); } try { // SW,00,002\CR\LF : 11个字节 this.EasySerialPort.SerialPort.ReceivedBytesThreshold = 11; ByteData reply = this.EasySerialPort.WriteAndGetReply(this.CmdCancelZeroOffset + ",0" + Environment.NewLine, timeout); if (reply == null) { return(false); } if (string.Equals(reply.ToString().Substring(0, 9), CmdCancelZeroOffset)) { reply = this.EasySerialPort.WriteAndGetReply(this.CmdCancelZeroOffset + ",1" + Environment.NewLine, timeout); if (reply == null) { return(false); } if (string.Equals(reply.ToString().Substring(0, 9), CmdCancelZeroOffset)) { return(true); } } return(false); } catch (Exception) { return(false); } }
// 클라에서 서버로 채팅서버 로그인 정보 보내기 public void Send_CTS_Login() { //uint:웹 유저 ID //string:닉네임 //ushort : 버전 //string : KILL 문구 //byte[2] : 국가코드 ///ushort : 클랜마크 ///byte : 언어코드 User _user = UserDataManager.instance.user; SendBuffer = new ByteData(512, 0); string word = string.Empty; byte[] ctCd = new byte[2]; //유저아이디 SendBuffer.InPutByte(_user.user_Users.UserID); //닉네임 SendBuffer.InPutByte(_user.user_Users.NkNm); //버전 SendBuffer.InPutByte((ushort)DefineKey.ReleaseVersion()); //킬문구 if (_user.User_Words.ContainsKey(USERWORD_TYPE.WRD_KILL)) { word = _user.User_Words[USERWORD_TYPE.WRD_KILL].Words; } else { word = "None"; } SendBuffer.InPutByte(word); //국가코드 Debug.Log("소켓서버 로그인 국가코드 : " + _user.user_Users.CtrCd); ctCd = Encoding.UTF8.GetBytes(_user.user_Users.CtrCd); SendBuffer.InPutByte(ctCd[0]); SendBuffer.InPutByte(ctCd[1]); //클랜마크 if (_user.clan_Clans.ClanID == 0) { SendBuffer.InPutByte((ushort)0); } else { SendBuffer.InPutByte(_user.clan_Clans.ClanMark); } //언어코드 byte langCode = (byte)OptionSetting.instance.usingLangueage; SendBuffer.InPutByte(langCode); Net_Script.Send_Data(NETKIND.CTS_LOGIN, SendBuffer.GetTrimByteData()); }
public void setDressUp(ByteData data) { clothesID = data.readInt(); clothes_strong = data.readInt(); equipID = data.readInt(); wingID = data.readInt(); wing_strong = data.readInt(); }
//클라에서 서버로 맵변경 정보 본내기 public void Send_CTS_map_Change(byte _mapIdx) { SendBuffer = new ByteData(512, 0); SendBuffer.InPutByte(_mapIdx); Net_Script.Send_Data(NETKIND.CTS_MAP_CHANGE, SendBuffer.GetTrimByteData()); }
public void Init_LocationPos(ByteData _Receive_data) { hasMoved = true; Recv_ObtainGameItem_Data(_Receive_data); Tr.position = Rcv_Position; Tr.rotation = Quaternion.Slerp(Tr.rotation, Quaternion.Euler(Rcv_EulerAngles), (Time.deltaTime * 10.0f)); }
//클라에서 서버로 공개방 설정 정보보내기 public void Send_CTS_RoomOpen(bool isClose) { //bool : (true : 비공개, false : 공개) SendBuffer = new ByteData(512, 0); SendBuffer.InPutByte(isClose); Net_Script.Send_Data(NETKIND.CTS_OPEN_ROOM, SendBuffer.GetTrimByteData()); }
void Chk_RecieveProcess() { while (Chk_readBuffer() == true) { RecieveBuffer = Read_ByteBuffer(); Recieved_NetKind = (NETKIND)RecieveBuffer.Getbyte(); switch (Recieved_NetKind) { case NETKIND.NONE: break; case NETKIND.STC_LOGIN: Recieve_STC_Login(); break; case NETKIND.STC_CONNECTION_RETENTION: Recieve_STC_Retention(); break; case NETKIND.STC_ROOM_MAKE: Recieve_STC_RoomMake(); break; case NETKIND.STC_OPEN_ROOM: Recieve_STC_OpenRoom(RecieveBuffer); break; case NETKIND.STC_INVITE_ROOM: Recieve_STC_InviteRoom(RecieveBuffer); break; case NETKIND.STC_READYROOM_INFO: Recieve_STC_RoomInfo(RecieveBuffer); break; case NETKIND.STC_FRIEND_ROOM_JOIN: Recieve_STC_FriendRoomjoin(RecieveBuffer); break; case NETKIND.STC_CHAT_MESSAGE: Recieve_STC_ChatMessage(RecieveBuffer); break; case NETKIND.STC_TOAST_MSG: Recieve_STC_ToastMsg(RecieveBuffer); break; case NETKIND.STC_POPUP_MSG: Recieve_STC_PopupMsg(RecieveBuffer); break; case NETKIND.STC_ERROR_CODE: Recieve_STC_ERROR(RecieveBuffer); break; } } }
//폭발 데이터 받기 public void Grenade_Explosion_Receive_Data(ByteData _Receive_data) { byte _Explosion_State = 0; _Receive_data.OutPutVariable(ref _Explosion_State); _Receive_data.OutPutVariable(ref Explosion_Pos); Explosion_State = (EXPLOSION_STATE)_Explosion_State; }
public void Send_CTS_SET_KILLWORD(string _killword) { SendBuffer = new ByteData(512, 0); SendBuffer.InPutByte(_killword); Net_Script.Send_Data(NETKIND.CTS_SET_KILL_WORDS, SendBuffer.GetTrimByteData()); UserEditor.Getsingleton.EditLog("소켓서버 킬문구 보냄완료"); }
//@pragma('vm:entry-point') static void _dispatchSemanticsAction(int id, int action, ByteData args) { _invoke3 <int, SemanticsAction, ByteData>( (a, b, c) => Window.Instance.onSemanticsAction(a, b, c), Window.Instance._onSemanticsActionZone, id, SemanticsAction.values[action], args); }
//클라에서 서버로 이동할 팀 정보 보내기 public void Send_CTS_TeamMove(byte moveTeamIdx, byte slotIdx) { SendBuffer = new ByteData(512, 0); SendBuffer.InPutByte(moveTeamIdx); SendBuffer.InPutByte(slotIdx); Net_Script.Send_Data(NETKIND.CTS_TEAM_MOVE, SendBuffer.GetTrimByteData()); }
//현재 전체 스코어 데이터 받기 void Recv_Now_Total_Score(ByteData _Receive_data) { if (Game_Script == null) { return; } Game_Script.Recv_Now_Total_Score(_Receive_data); }
//================================================================================================================================================================================ public void Send_Base_Atk(float Damage_Num) { // float : 데미지량 Send_Buffer = new ByteData(128, 0); Send_Buffer.InPutByte(Damage_Num); Data_Send(NETKIND.CTS_SET_ATK_MAINBASE, Send_Buffer.GetTrimByteData()); }
//================================================================================================================================================================================ void Recv_UserKill(ByteData _Receive_data) { if (Game_Script == null) { return; } //캐릭터 죽었을때 데이터 받기 Game_Script.Recv_Kill_Info(_Receive_data); }
void Recv_Base_HP(ByteData _Receive_data) { // float : 최대 체력 // float : Red팀 진지 체력 // float : Blue팀 진지 체력 _Receive_data.OutPutVariable(ref Link_Script.i.Base_OJ_Max_HP); _Receive_data.OutPutVariable(ref Link_Script.i.Base_OJ_Now_HP[0]); _Receive_data.OutPutVariable(ref Link_Script.i.Base_OJ_Now_HP[1]); }
public void TweakTest() { Privkey key = new Privkey("036b13c5a0dd9935fe175b2b9ff86585c231e734b2148149d788a941f1f4f566"); ByteData tweak = new ByteData("98430d10471cf697e2661e31ceb8720750b59a85374290e175799ba5dd06508e"); Assert.Equal("9bae20d5e7fa8fcde07d795d6eb0d78d12e781b9e957122b4d0244e7cefb45f4", key.TweakAdd(tweak).ToHexString()); Assert.Equal("aa71b12accba23b49761a7521e661f07a7e5742ac48cf708b8f9497b3a72a957", key.TweakMul(tweak).ToHexString()); }
public void TestConversion() { bool[] temp = { // Start bit. false, // Data - 00100111, or 39. true, true, true, false, false, true, false, false, // Stop bits. true, true }; List<bool> list = new List<bool>(); list.AddRange(temp); ByteData data = new ByteData(new BinaryData(list)); Assert.AreEqual(1, data.Length, "Only one byte passed."); IEnumerator<byte> ie = data.GetEnumerator(); ie.MoveNext(); Assert.AreEqual(39, ie.Current, "Expected value gained."); Assert.IsFalse(ie.MoveNext(), "Only one value in enumerator."); }
/** * Adds the biff record data to the memory allocated for this File * * @exception IOException * @param record the record to add to the excel data */ public void write(ByteData record) { byte[] bytes = record.getBytes(); data.write(bytes); }
protected override byte Interpolate(byte length, byte t, byte a, byte b) { var aa = new ByteData(a); var bb = new ByteData(b); if (aa.Change == bb.Change) { return (byte)(aa.State ? 128 : 0); } if (((aa.Change + 1) & 7) == bb.Change && bb.Frame != 15) { if (t + bb.Frame >= length) { return (byte)(bb.State ? 128 : 0); } return (byte)(aa.State ? 128 : 0); } //error return a; }
protected override bool CheckInterpolate(byte length, byte a, byte b) { var aa = new ByteData(a); var bb = new ByteData(b); if (aa.Change == bb.Change) { return true; } if (((aa.Change + 1) & 7) == bb.Change && bb.Frame != 15) { return true; } return false; }
public void Fill() { var input = new List<Entry>(); int nextKey = NextKey(); bool key = false; int keyFrame = 15; int keyChange = 0; ByteData data = new ByteData(); for (int i = 0; i < Length; ++i) { if (--nextKey == 0) { key = !key; keyFrame = 0; keyChange = (keyChange + 1) & 7; nextKey = NextKey(); } data.State = key; data.Change = (byte)keyChange; data.Frame = (byte)keyFrame; input.Add(new Entry { A = i, B = data.Data }); keyFrame += 1; if (keyFrame > 15) keyFrame = 15; } Input = input; Source = input; }
public void ProcessChunk(ByteData data, Mesh mesh) { if (lookup == null || lookup.GetLength(0) < data.Length*2 + 3) { lookup = new IntInt[data.Length*2 + 3, data.Length*2 + 3, data.Length*2 + 3]; } lookupVersion++; vertices.Clear(); normals.Clear(); triangles.Clear(); colors.Clear(); counters.Clear(); for (int x = -1; x < data.Length; x++) { for (int y = -1; y < data.Length; y++) { for (int z = -1; z < data.Length; z++) { int configuration = 0; byte target = 1; //for (int i = 0; i < 8; i++) //{ // byte val = data[x + vertexOffset[i, 0], y + vertexOffset[i, 1], z + vertexOffset[i, 2]]; // if (val > target) // { // target = val; // } //} int blend = 1; var color = new Color32(); for (int i = 0; i < 8; i++) { byte val = data[x + vertexOffset[i, 0], y + vertexOffset[i, 1], z + vertexOffset[i, 2]]; if (val <= target) { configuration |= 1 << i; } if (val > target) { color = Color32.Lerp(color, colorMap[val], 1f/blend); blend++; } } if (configuration > 0 && configuration < 255) { ProcessCube((byte) configuration, new Vector3(x, y, z), color, x < 0 || y < 0 || z < 0); } } } } mesh.Clear(); mesh.SetVertices(vertices); if (SMOOTH) { for (int i = 0; i < vertices.Count; i++) { normals.Add(compositeNormals[i].Normal); } } mesh.SetNormals(normals); mesh.SetColors(colors); mesh.SetTriangles(triangles, 0); }