/// <summary> /// 发送消息 /// </summary> /// <param name="msg"></param> public void SendMessage(string toUser, string msg) { Jid to = new Jid(BuildJid(toUser)); //to.Resource = "mobile"; Jid from = new Jid(BuildJid(UserName)); BodyBase[] bodies = new BodyBase[1]; bodies[0] = new TextBody { type = "txt", msg = msg }; /* * 发消息: * {"from":"weigang75","to":"march3","bodies":[{"type":"txt","msg":"?"}],"ext":{}};*/ MsgData data = new MsgData() { from = UserName, to = toUser, bodies = bodies, ext = new { } }; string msgjson = JsonConvert.SerializeObject(data); Message msgNode = new Message(to, from, msgjson); msgNode.GenerateId(); //msgNode.Thread = string.Concat("MSG_", (new Random()).Next(20000, 30000)); msgNode.Type = MessageType.chat; Send(msgNode); }
public Func(BodyBase BodyBase = default, @string Kind = default, @string Suffix = default, int ArgLen = default) { this.m_BodyBaseRef = new ptr <BodyBase>(BodyBase); this.Kind = Kind; this.Suffix = Suffix; this.ArgLen = ArgLen; }
public Stream Build(HeaderBase header, BodyBase body) { var formattedHeader = _headerBuilder.Build(header); var formattedBody = _bodyBuilder.Build(body); var finalContent = _merger.Merge(formattedHeader, formattedBody); return(finalContent); }
public RuleRewrite(BodyBase BodyBase = default, @string Match = default, @string Cond = default, @string Result = default, @string Check = default, long Alloc = default, @string Loc = default, long CommuteDepth = default, bool Typed = default) { this.m_BodyBaseRef = new ptr <BodyBase>(BodyBase); this.Match = Match; this.Cond = Cond; this.Result = Result; this.Check = Check; this.Alloc = Alloc; this.Loc = Loc; this.CommuteDepth = CommuteDepth; this.Typed = Typed; }
// Use this for initialization void Start() { if (species == null) { Debug.LogWarning("CreatureBase added with no species set. Creating new species..."); species = new CreatureSpecies(); species.CreateNewSpecies(); } // Attach body parts as children GameObject body = NewChild("body"); BodyBase bodyBase = body.AddComponent <BodyBase>(); bodyBase.Init(); PGAnimationController animator = gameObject.AddComponent <PGAnimationController>(); animator.Init(ref species, bodyBase.legBase); }
/// <summary> /// 发送文件 /// </summary> /// <param name="toUser">发给谁</param> /// <param name="postedfile">已经上传的文件返回信息</param> public void SendFile(string toUser, PostedFileResp postedfile) { Jid to = new Jid(BuildJid(toUser)); Jid from = new Jid(BuildJid(UserName)); BodyBase[] bodies = new BodyBase[postedfile.entities.Length]; // 构建发送文件的 message 消息 for (int i = 0; i < postedfile.entities.Length; i++) { PostFileEntity entity = postedfile.entities[i]; // 文件类型 img audio string otype = SdkUtils.GetFileType(entity.filename); // 文件的url string ourl = postedfile.uri + "/" + entity.uuid; string osecret = entity.share_secret; string ofilename = entity.filename; /* * 传图片 * ReceivedData: * <message xmlns='jabber:client' from='easemob-demo#[email protected]/webim' * to='easemob-demo#[email protected]' id='124420481838219668' type='chat'> * <body> * {"from":"weigang75","to":"march3","bodies": * [{"type":"img","url":"https://a1.easemob.com/easemob-demo/chatdemoui/chatfiles/cd6f8050-81f7-11e5-a16a-05187e341cb0", * "secret":"zW-AWoH3EeWmJevV5n4Fpkxnnu3e5okMLIhENE0QHaZbvqg5", * "filename":"原生+自定义.jpg", * "thumb":"https://a1.easemob.com/easemob-demo/chatdemoui/chatfiles/cd6f8050-81f7-11e5-a16a-05187e341cb0", * "thumb_secret":"","size":{"width":952,"height":671}}],"ext":{}}</body></message> * * 传语音 * ReceivedData: * <message xmlns='jabber:client' from='easemob-demo#[email protected]/webim' * to='easemob-demo#[email protected]' id='124421298246910356' type='chat'> * <body> * {"from":"weigang75","to":"march3","bodies": * [{"type":"audio", * "url":"https://a1.easemob.com/easemob-demo/chatdemoui/chatfiles/3ec2bb50-81f8-11e5-8e7c-1fa6315dec2d", * "secret":"PsK7WoH4EeWwmIkeyVsexnkK-Rmqu2X_N2qqK9FQYmUkko8W", * "filename":"环信通讯 - 副本.mp3", * "length":3}],"ext":{}}</body></message> * */ // 如果是文件,需要多一些字段 thumb、thumb_secret、size if ("img".Equals(otype)) { bodies[i] = new ImageBody { type = otype, url = ourl, secret = osecret, filename = ofilename, thumb = ourl, thumb_secret = "", size = new ImageSize { width = entity.imageSize.Width, height = entity.imageSize.Height } }; } else if ("audio".Equals(otype)) { bodies[i] = new AudioBody { type = otype, url = ourl, secret = osecret, filename = ofilename }; } else { bodies[i] = new FileBody { type = otype, url = ourl, secret = osecret, filename = ofilename }; } } MsgData data = new MsgData() { from = UserName, to = toUser, bodies = bodies, ext = new { } }; WSMessage msgNode = new WSMessage(to, from); msgNode.Type = MessageType.chat; msgNode.SetBodyData(data); Send(msgNode); }
protected void Init() { m_body = GetComponent <BodyBase>(); m_job = GetComponent <JobBase>(); }
public Case(BodyBase BodyBase = default, ast.Expr Expr = default) { this.m_BodyBaseRef = new ptr <BodyBase>(BodyBase); this.Expr = Expr; }
public File(BodyBase BodyBase = default, arch Arch = default, @string Suffix = default) { this.m_BodyBaseRef = new ptr <BodyBase>(BodyBase); this.Arch = Arch; this.Suffix = Suffix; }
protected void Init() { m_brain = GetComponent <BrainBase>(); m_body = GetComponent <BodyBase>(); }