コード例 #1
0
        /// <summary>
        /// 当收到语音消息通知
        /// </summary>
        /// <param name="url"></param>
        /// <param name="time"></param>
        /// <param name="HasRead"></param>
        /// <param name="isSelf"></param>
        /// <param name="szurl">头像地址</param>
        internal void OnReceiveVoice(string url, float time, bool HasRead, bool isSelf, string szurl, byte [] id)
        {
            //  ig2 = _gChildPanel[2].transform.GetChild(0).GetComponent<InfinityGridLayoutGroup>();
            ShortTalkData std = GameData.Instance.ShortTalkData;
            GameObject    obj = Instantiate(Resources.Load <GameObject>("Game/ShortTalk/VoiceMessage"));

            obj.transform.SetParent(_gChildPanel[2].transform.GetChild(0));
            obj.transform.localEulerAngles = Vector3.zero;
            obj.transform.localPosition    = new Vector3(obj.transform.localPosition.x, obj.transform.localPosition.y, 0);
            obj.transform.localScale       = Vector3.one;
            PreVoiceTalkManage pvtm = obj.GetComponent <PreVoiceTalkManage>();

            pvtm._url     = url;
            pvtm._time    = time;
            pvtm._hasRead = HasRead;
            pvtm._isSelf  = isSelf;
            pvtm._headUrl = szurl;
            pvtm._id      = id;
            pvtm.UpdateShow();//更新显示条
            ShortTalkData.VoiceData _pvtm = new ShortTalkData.VoiceData();
            _pvtm._url     = pvtm._url;
            _pvtm._time    = pvtm._time;
            _pvtm._hasRead = pvtm._hasRead;
            _pvtm._isSelf  = pvtm._isSelf;
            _pvtm._headUrl = pvtm._headUrl;
            std.AddVoiceData(_pvtm);
            //  Debug.LogError("count" + std._voiceData.Count);
            //if (std._voiceData.Count>6)
            //{
            //    ig2.SetAmount(std._voiceData.Count);
            //    ig2.updateChildrenCallback = UpdateVoiceCallBack;
            //}
        }
コード例 #2
0
        //InfinityGridLayoutGroup ig3;
        void UpdateVoiceCallBack(int index, Transform trans)
        {
            ShortTalkData      std = GameData.Instance.ShortTalkData;
            PreVoiceTalkManage pvt = trans.GetComponent <PreVoiceTalkManage>();

            pvt._url     = std._voiceData[index]._url;
            pvt._time    = std._voiceData[index]._time;
            pvt._hasRead = std._voiceData[index]._hasRead;
            pvt._isSelf  = std._voiceData[index]._isSelf;
            pvt._headUrl = std._voiceData[index]._headUrl;
            // pvt._url = std._voiceData[index]._url;
            pvt.UpdateShow();
        }