// Update is called once per frame void Update() { //Vector3 screenPos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 10); //Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos); //Debug.Log($"sp : {screenPos}"); //Debug.Log($"wp : {worldPos}"); if (this.vineScene != null) { try { // turn vine into our scene of interest renderScene(vineScene); ProtoHello hi = new ProtoHello(); var screenSize = this.vineScene.ImgSize; hi.ProtoMessage = $"delayed screen stuff {screenSize[0]}, {screenSize[1]}"; this.promised.Resolve(new ProtoMessage(hi)); } catch (Exception ex) { this.promised.Reject(ex); } this.promised = null; this.vineScene = null; } }
//// Use this for initialization //void Start() //{ // this.RegisterProtoMessageHandlers(); // //// what a hack, I just want to register a function for this proto // //// maybe there is a better way, but this is the only that can match generic types // //var methodInfo = this.GetType().GetMethod("ReceiveHello"); // ////register our response to hello messages :) // //MasterProtoRouter.Instance.AddResponsePromise(typeof(ProtoHello), this, methodInfo); //} //Handle incoming hellos -- and send a response when we're done public Promise <ProtoMessage> ReceiveHello(ProtoHello hello) { return(new Promise <ProtoMessage>((resolve, reject) => { ProtoHello response = new ProtoHello(); response.ProtoMessage = $"howdy there from c# - you said: {hello.ProtoMessage}"; Debug.Log($"receiving a friendly hello and responding to msg {hello.ProtoMessage} with {response}"); resolve(new ProtoMessage(response)); })); }
void Update() { if (splineToDraw != null) { DrawSpline(splineToDraw); ProtoHello hello = new ProtoHello(); hello.ProtoMessage = "go f**k yourself with this bullshit"; toResolve.Resolve(new ProtoMessage(hello)); splineToDraw = null; toResolve = null; } }
//Handle incoming hellos -- and send a response when we're done public Promise <ProtoMessage> ReceiveHello(ProtoHello hello) { var promise = new Promise <ProtoMessage>(); delay = (float)r.NextDouble() * 4; this.promised = promise; Debug.Log($"receiving a friendly hello and responding in future to msg {hello.ProtoMessage}"); ProtoHello response = new ProtoHello(); response.ProtoMessage = $"delayed {delay}s howdy from c# - you said: {hello.ProtoMessage}"; this.futureMessage = new ProtoMessage(response); return(promise); }