/// <summary> /// 获取天赋信息 /// </summary> /// <param name="id">tid</param> public async void GetTalentInfos(ulong id) { Debug.Log("------->>>>>发送获取天赋信息" + id); GetTalentInfosResponse getTalentInfosResponse = await GetTalentInfosRPC.GetTalentInfos(id); Debug.Log("------->>>>>接收天赋信息" + getTalentInfosResponse.Success); if (getTalentInfosResponse.Success != null) { m_TalentNodes.Clear(); m_TalentNodes = getTalentInfosResponse.Success.Success_.Nodes; for (int i = 0; i < m_TalentNodes.Count; i++) { if (m_TalentVODic.TryGetValue(m_TalentNodes[i].Tid, out TalentVO talentVO)) { talentVO.Level = (int)m_TalentNodes[i].Level; talentVO.Type = (int)m_TalentNodes[i].Type; talentVO.MaxLevel = (int)m_TalentNodes[i].Maxlevel; SetTalentState(talentVO); } else { Debug.Log("本地没有这个数据"); } } } else { Debug.Log("没有数据"); } GameFacade.Instance.SendNotification(NotificationName.MSG_TALENT_CHANGEINFOS); }
public Method(Method other) : this() { name_ = other.name_; requestTypeUrl_ = other.requestTypeUrl_; requestStreaming_ = other.requestStreaming_; responseTypeUrl_ = other.responseTypeUrl_; responseStreaming_ = other.responseStreaming_; options_ = other.options_.Clone(); syntax_ = other.syntax_; }
public Api(Api other) : this() { name_ = other.name_; methods_ = other.methods_.Clone(); options_ = other.options_.Clone(); version_ = other.version_; SourceContext = other.sourceContext_ != null?other.SourceContext.Clone() : null; mixins_ = other.mixins_.Clone(); syntax_ = other.syntax_; }
public Response(Response other) : this() { unknown1_ = other.unknown1_; unknown2_ = other.unknown2_; apiUrl_ = other.apiUrl_; Unknown6 = other.unknown6_ != null?other.Unknown6.Clone() : null; Auth = other.auth_ != null?other.Auth.Clone() : null; payload_ = other.payload_.Clone(); errorMessage_ = other.errorMessage_; }
public static Vector2 ToVector2(this pbc::RepeatedField <float> src) { if (src.Count != 2) { throw new System.Exception(); } var v = new Vector2(); v.X = src[0]; v.Y = src[1]; return(v); }
/// <summary> /// 发送操作指令 /// </summary> /// <param name="code">指令</param> /// <param name="tid">tid</param> public async void GetTalentOperation(TalentCode code, ulong tid) { Debug.Log(tid + "------->>>>>发送操作天赋指令" + code); TalentOperationResponse getTalentInfosResponse = await TalentOperationRPC.TalentOperation((uint)code, tid); Debug.Log("------->>>>>接收操作天赋" + getTalentInfosResponse.Success); if (code == TalentCode.Reset || code == TalentCode.StopUse) { ResetLevelData((uint)tid); } if (getTalentInfosResponse.Success != null && getTalentInfosResponse.Success.Success_.ErrorCode == 0) { m_TalentNodes.Clear(); m_TalentNodes = getTalentInfosResponse.Success.Success_.Nodes; int errorCode = getTalentInfosResponse.Success.Success_.ErrorCode; DebugErrorCode(errorCode); for (int i = 0; i < m_TalentNodes.Count; i++) { TalentVO talentVO = null; if (m_TalentVODic.TryGetValue(m_TalentNodes[i].Tid, out talentVO)) { talentVO.Level = (int)m_TalentNodes[i].Level; talentVO.Type = (int)m_TalentNodes[i].Type; talentVO.MaxLevel = (int)m_TalentNodes[i].Maxlevel; SetTalentState(talentVO); } else { Debug.Log("本地没有这个数据"); } } } else { Debug.Log("没有数据"); } MsgTalentOperation msgTalentOperation = new MsgTalentOperation(); msgTalentOperation.M_TalentCode = code; msgTalentOperation.Tid = (uint)tid; if (getTalentInfosResponse.Success.Success_.ErrorCode == 0) { GameFacade.Instance.SendNotification(NotificationName.MSG_TALENT_OPERATION, msgTalentOperation); } }
/// <summary> /// Copies all rows in the supplied DataTable to a destination table specified by the DestinationTableName property of the PhoenixBulkCopy object. /// </summary> /// <param name="table"></param> public void WriteToServer(DataTable table) { pbc::RepeatedField <UpdateBatch> updates = new pbc::RepeatedField <UpdateBatch>(); long batchCount = 0; string sql = BuildStatement(); PrepareResponse pResp = _connection.InternalPrepareStatement(sql); foreach (DataRow row in table.Rows) { UpdateBatch anUpdate = new UpdateBatch(); foreach (var val in row.ItemArray) { anUpdate.ParameterValues.Add(PhoenixParameter.AsPhoenixTypedValue(val)); } updates.Add(anUpdate); // If we reached the batch size, then send to server... ? batchCount++; if (batchCount >= this.BatchSize) { // Send to server _connection.InternalExecuteBatch(pResp.Statement.Id, updates); updates.Clear(); // Reset batch counter batchCount = 0; } } // Last batch if (batchCount > 0) { // Send to server _connection.InternalExecuteBatch(pResp.Statement.Id, updates); updates.Clear(); } }
internal ExecuteBatchResponse InternalExecuteBatch(uint statementId, pbc::RepeatedField <UpdateBatch> updates) { Task <ExecuteBatchResponse> tResp = null; try { var t = Task.Factory.StartNew(() => _client.ExecuteBatchRequestAsync(this.ConnectionId, statementId, updates, this.Options)); t.Wait(); // Wait on the internal result also. tResp = t.Result; tResp.Wait(); } catch (Exception ex) { if (OnInternalException(ex)) { throw; } } return(tResp.Result); }
/// <summary> /// This request is used to execute a batch of updates against a PreparedStatement. /// </summary> public async Task <ExecuteBatchResponse> ExecuteBatchRequestAsync(string connectionId, uint statementId, pbc::RepeatedField <UpdateBatch> updates, RequestOptions options) { ExecuteBatchRequest req = new ExecuteBatchRequest { ConnectionId = connectionId, StatementId = statementId, Updates = updates }; WireMessage msg = new WireMessage { Name = Constants.WireMessagePrefix + "ExecuteBatchRequest", WrappedMessage = req.ToByteString() }; using (Response webResponse = await PostRequestAsync(msg.ToByteArray(), options)) { if (webResponse.WebResponse.StatusCode != HttpStatusCode.OK) { WireMessage output = WireMessage.Parser.ParseFrom(webResponse.WebResponse.GetResponseStream()); ErrorResponse res = ErrorResponse.Parser.ParseFrom(output.WrappedMessage); throw new WebException( string.Format( "ExecuteBatchRequestAsync failed! connectionId: {0}, Response code was: {1}, Response body was: {2}", connectionId, webResponse.WebResponse.StatusCode, res.ToString())); } else { WireMessage output = WireMessage.Parser.ParseFrom(webResponse.WebResponse.GetResponseStream()); ExecuteBatchResponse res = ExecuteBatchResponse.Parser.ParseFrom(output.WrappedMessage); return(res); } } }
/// <summary> /// This request is used to fetch the tables available in this database filtered by the provided criteria. /// </summary> public async Task <ResultSetResponse> TablesRequestAsync(string catalog, string schemaPattern, string tableNamePattern, pbc::RepeatedField <string> typeList, bool hasTypeList, string connectionId, RequestOptions options) { TablesRequest req = new TablesRequest { Catalog = catalog, SchemaPattern = schemaPattern, TableNamePattern = tableNamePattern, TypeList = typeList, HasTypeList = hasTypeList, ConnectionId = connectionId }; WireMessage msg = new WireMessage { Name = Constants.WireMessagePrefix + "TablesRequest", WrappedMessage = req.ToByteString() }; using (Response webResponse = await PostRequestAsync(msg.ToByteArray(), options)) { if (webResponse.WebResponse.StatusCode != HttpStatusCode.OK) { WireMessage output = WireMessage.Parser.ParseFrom(webResponse.WebResponse.GetResponseStream()); ErrorResponse res = ErrorResponse.Parser.ParseFrom(output.WrappedMessage); throw new WebException( string.Format( "TablesRequestAsync failed! connectionId: {0}, Response code was: {1}, Response body was: {2}", connectionId, webResponse.WebResponse.StatusCode, res.ToString())); } else { WireMessage output = WireMessage.Parser.ParseFrom(webResponse.WebResponse.GetResponseStream()); ResultSetResponse res = ResultSetResponse.Parser.ParseFrom(output.WrappedMessage); return(res); } } }
/// <summary> /// This request is used to execute a PreparedStatement, optionally with values to bind to the parameters in the Statement. /// </summary> public async Task <ExecuteResponse> ExecuteRequestAsync(StatementHandle statementHandle, pbc::RepeatedField <TypedValue> parameterValues, ulong firstFrameMaxSize, bool hasParameterValues, RequestOptions options) { ExecuteRequest req = new ExecuteRequest { StatementHandle = statementHandle, ParameterValues = parameterValues, FirstFrameMaxSize = firstFrameMaxSize, HasParameterValues = hasParameterValues }; WireMessage msg = new WireMessage { Name = Constants.WireMessagePrefix + "ExecuteRequest", WrappedMessage = req.ToByteString() }; using (Response webResponse = await PostRequestAsync(msg.ToByteArray(), options)) { if (webResponse.WebResponse.StatusCode != HttpStatusCode.OK) { WireMessage output = WireMessage.Parser.ParseFrom(webResponse.WebResponse.GetResponseStream()); ErrorResponse res = ErrorResponse.Parser.ParseFrom(output.WrappedMessage); throw new WebException( string.Format( "ExecuteRequestAsync failed! connectionId: {0}, Response code was: {1}, Response body was: {2}", statementHandle.ConnectionId, webResponse.WebResponse.StatusCode, res.ToString())); } else { WireMessage output = WireMessage.Parser.ParseFrom(webResponse.WebResponse.GetResponseStream()); ExecuteResponse res = ExecuteResponse.Parser.ParseFrom(output.WrappedMessage); return(res); } } }
public void QueryManyRowTest() { var client = new PhoenixClient(_credentials); string connId = GenerateRandomConnId(); RequestOptions options = RequestOptions.GetGatewayDefaultOptions(); // In gateway mode, url format will be https://<cluster dns name>.azurehdinsight.net/hbasephoenix<N>/ // Requests sent to hbasephoenix0/ will be forwarded to PQS on workernode0 options.AlternativeEndpoint = "hbasephoenix0/"; string tableName = "Persons" + connId; OpenConnectionResponse openConnResponse = null; CreateStatementResponse createStatementResponse = null; try { // Opening connection pbc::MapField <string, string> info = new pbc::MapField <string, string>(); openConnResponse = client.OpenConnectionRequestAsync(connId, info, options).Result; // Syncing connection ConnectionProperties connProperties = new ConnectionProperties { HasAutoCommit = true, AutoCommit = false, HasReadOnly = true, ReadOnly = false, TransactionIsolation = 0, Catalog = "", Schema = "", IsDirty = true }; client.ConnectionSyncRequestAsync(connId, connProperties, options).Wait(); createStatementResponse = client.CreateStatementRequestAsync(connId, options).Result; // Running query 1 string sql1 = "CREATE TABLE " + tableName + " (LastName varchar(255) PRIMARY KEY,FirstName varchar(255))"; client.PrepareAndExecuteRequestAsync(connId, sql1, createStatementResponse.StatementId, long.MaxValue, int.MaxValue, options).Wait(); // Commit statement 1 client.CommitRequestAsync(connId, options).Wait(); // Creating statement 2 string sql2 = "UPSERT INTO " + tableName + " VALUES (?,?)"; PrepareResponse prepareResponse = client.PrepareRequestAsync(connId, sql2, long.MaxValue, options).Result; StatementHandle statementHandle = prepareResponse.Statement; // Insert 300 rows for (int i = 0; i < 300; i++) { pbc::RepeatedField <TypedValue> list = new pbc.RepeatedField <TypedValue>(); TypedValue v1 = new TypedValue { StringValue = "d" + i, Type = Rep.String }; TypedValue v2 = new TypedValue { StringValue = "x" + i, Type = Rep.String }; list.Add(v1); list.Add(v2); ExecuteResponse executeResponse = client.ExecuteRequestAsync(statementHandle, list, long.MaxValue, true, options).Result; } // Commit statement 2 client.CommitRequestAsync(connId, options).Wait(); // Running query 3 string sql3 = "select * from " + tableName; ExecuteResponse execResponse3 = client.PrepareAndExecuteRequestAsync(connId, sql3, createStatementResponse.StatementId, long.MaxValue, int.MaxValue, options).Result; pbc::RepeatedField <Row> rows = execResponse3.Results[0].FirstFrame.Rows; for (int i = 0; i < rows.Count; i++) { Row row = rows[i]; Debug.WriteLine(row.Value[0].ScalarValue.StringValue + " " + row.Value[1].ScalarValue.StringValue); } // 100 is hard coded in server side as default firstframe size // In order to get remaining rows, FetchRequestAsync is used Assert.AreEqual(100, rows.Count); // Fetch remaining rows, offset is not used, simply set to 0 // if FetchResponse.Frame.Done = true, that means all the rows fetched FetchResponse fetchResponse = client.FetchRequestAsync(connId, createStatementResponse.StatementId, 0, int.MaxValue, options).Result; Assert.AreEqual(200, fetchResponse.Frame.Rows.Count); Assert.AreEqual(true, fetchResponse.Frame.Done); // Running query 4 string sql4 = "DROP TABLE " + tableName; client.PrepareAndExecuteRequestAsync(connId, sql4, createStatementResponse.StatementId, long.MaxValue, int.MaxValue, options).Wait(); // Commit statement 4 client.CommitRequestAsync(connId, options).Wait(); } catch (Exception ex) { Assert.Fail(ex.Message); } finally { if (createStatementResponse != null) { client.CloseStatementRequestAsync(connId, createStatementResponse.StatementId, options).Wait(); createStatementResponse = null; } if (openConnResponse != null) { client.CloseConnectionRequestAsync(connId, options).Wait(); openConnResponse = null; } } }
public FieldMask(FieldMask other) : this() { paths_ = other.paths_.Clone(); }
public static async void ExecuteProcedure(DataContract dataContract) { string connId = Guid.NewGuid().ToString(); RequestOptions options = RequestOptions.GetGatewayDefaultOptions(); var credentials = new ClusterCredentials(new Uri("jdbc:phoenix:10.16.0.206:/hbase-unsecure"), null, null); var client = new PhoenixClient(credentials); // In gateway mode, PQS requests will be https://<cluster dns name>.azurehdinsight.net/hbasephoenix<N>/ // Requests sent to hbasephoenix0/ will be forwarded to PQS on workernode0 options.AlternativeEndpoint = "hbasephoenix0/"; OpenConnectionResponse openConnResponse = null; StatementHandle statementHandle = null; try { //var info = new pbc::MapField<string, string>(); // Opening connection pbc::MapField <string, string> info = new pbc::MapField <string, string>(); openConnResponse = await client.OpenConnectionRequestAsync(connId, info, options); // Syncing connection ConnectionProperties connProperties = new ConnectionProperties { HasAutoCommit = true, AutoCommit = true, HasReadOnly = true, ReadOnly = false, TransactionIsolation = 0, Catalog = "", Schema = "", IsDirty = true }; await client.ConnectionSyncRequestAsync(connId, connProperties, options); var createStatementResponse = await client.CreateStatementRequestAsync(connId, options); string sql = "SELECT * FROM Customers"; ExecuteResponse executeResponse = await client.PrepareAndExecuteRequestAsync(connId, sql, createStatementResponse.StatementId, long.MaxValue, int.MaxValue, options); pbc::RepeatedField <Row> rows = executeResponse.Results[0].FirstFrame.Rows; // Loop through all of the returned rows and display the first two columns for (int i = 0; i < rows.Count; i++) { Row row = rows[i]; Console.WriteLine(row.Value[0].ScalarValue.StringValue + " " + row.Value[1].ScalarValue.StringValue); } // 100 is hard-coded on the server side as the default firstframe size // FetchRequestAsync is called to get any remaining rows Console.WriteLine(""); Console.WriteLine($"Number of rows: {rows.Count}"); // Fetch remaining rows, offset is not used, simply set to 0 // When FetchResponse.Frame.Done is true, all rows were fetched FetchResponse fetchResponse = await client.FetchRequestAsync(connId, createStatementResponse.StatementId, 0, int.MaxValue, options); Console.WriteLine($"Frame row count: {fetchResponse.Frame.Rows.Count}"); Console.WriteLine($"Fetch response is done: {fetchResponse.Frame.Done}"); Console.WriteLine(""); // Running query 2 string sql2 = "select count(*) from Customers"; ExecuteResponse countResponse = await client.PrepareAndExecuteRequestAsync(connId, sql2, createStatementResponse.StatementId, long.MaxValue, int.MaxValue, options); long count = countResponse.Results[0].FirstFrame.Rows[0].Value[0].ScalarValue.NumberValue; Console.WriteLine($"Total customer records: {count}"); Console.WriteLine(""); // Running query 3 string sql3 = "select StateProvince, count(*) as Number from Customers group by StateProvince order by Number desc"; ExecuteResponse groupByResponse = await client.PrepareAndExecuteRequestAsync(connId, sql3, createStatementResponse.StatementId, long.MaxValue, int.MaxValue, options); pbc::RepeatedField <Row> stateRows = groupByResponse.Results[0].FirstFrame.Rows; for (int i = 0; i < stateRows.Count; i++) { Row row = stateRows[i]; Console.WriteLine(row.Value[0].ScalarValue.StringValue + ": " + row.Value[1].ScalarValue.NumberValue); } } catch (Exception ex) { } finally { if (statementHandle != null) { await client.CloseStatementRequestAsync(connId, statementHandle.Id, options); statementHandle = null; } if (openConnResponse != null) { await client.CloseConnectionRequestAsync(connId, options); openConnResponse = null; } } }
public static VrmProtobuf.VRMCSpringBone ToGltf(this SpringBoneManager self, List <Node> nodes, pbc::RepeatedField <global::VrmProtobuf.Node> protoNodes) { if (self == null) { return(null); } var springBone = new VrmProtobuf.VRMCSpringBone(); // // VRMC_node_collider // foreach (var x in self.Colliders) { var index = nodes.IndexOfThrow(x.Node); var collider = new VrmProtobuf.VRMC_node_collider(); foreach (var y in x.Colliders) { switch (y.ColliderType) { case VrmSpringBoneColliderTypes.Sphere: { var sphere = new VrmProtobuf.Sphere { Radius = y.Radius, }; sphere.Offset.Add(y.Offset.X); sphere.Offset.Add(y.Offset.Y); sphere.Offset.Add(y.Offset.Z); collider.Shapes.Add(new VrmProtobuf.ColliderShape { Sphere = sphere, }); break; } case VrmSpringBoneColliderTypes.Capsule: { var capsule = new VrmProtobuf.Capsule { Radius = y.Radius, }; capsule.Offset.Add(y.Offset.X); capsule.Offset.Add(y.Offset.Y); capsule.Offset.Add(y.Offset.Z); capsule.Tail.Add(y.CapsuleTail.X); capsule.Tail.Add(y.CapsuleTail.Y); capsule.Tail.Add(y.CapsuleTail.Z); collider.Shapes.Add(new VrmProtobuf.ColliderShape { Capsule = capsule, }); } break; default: throw new NotImplementedException(); } } protoNodes[index].Extensions.VRMCNodeCollider = collider; } // // VRMC_springBone // foreach (var x in self.Springs) { var settingIndex = springBone.Settings.Count; springBone.Settings.Add(x.ToGltf(nodes)); foreach (var bone in x.Bones) { var spring = new VrmProtobuf.Spring { Name = x.Comment, HitRadius = x.HitRadius, SpringRoot = nodes.IndexOfThrow(bone), Setting = settingIndex, }; foreach (var y in x.Colliders) { spring.Colliders.Add(nodes.IndexOfThrow(y.Node)); } springBone.Springs.Add(spring); } } return(springBone); }