public Promise <ProtoMessage> FirstContactMessage(ProtoContact protoContact) { Debug.Log("Contact received"); // send back a protojoin message with all of our class information (as it currently is) return(new Promise <ProtoMessage>((resolve, reject) => { var protoJoin = new ProtoJoin(); foreach (var ixAndClass in this.ixToClass) { var mapClass = new ProtoMapping() { Key = ixAndClass.Key, Value = ixAndClass.Value.Name }; //mapClass.Key = ixAndClass.Key; //mapClass.Value = ixAndClass.Value; protoJoin.IxToProtos.Add(mapClass); } // respond with the current mapping of all proto objects in the project resolve(new ProtoMessage(protoJoin)); })); }
public Promise <ProtoMessage> AdjustSharedClasses(ProtoJoin protoJoin) { Debug.Log($"Adjusting Protojoin {protoJoin}"); return(new Promise <ProtoMessage>((resolve, reject) => { //got a bunch of mappings var mappings = protoJoin.IxToProtos; //look over the mapping from index to key foreach (var pItem in mappings) { var pType = Type.GetType(pItem.Value); if (!ixToClass.ContainsKey(pItem.Key)) { ixToClass.Add(pItem.Key, pType); classToIx.Add(pType, pItem.Key); } else { Debug.Log($"ignoring proto mapping {pItem}, alread have {ixToClass[pItem.Key]}"); } } //nothing to add to the response resolve(null); })); }