예제 #1
0
        public void Init(SMsgRecvAnswerFriends_SC smsg, FriendBtnType type, Action <int> aciton)
        {
            m_FriendInfo     = smsg;
            m_callBackAction = aciton;
            for (int i = 0; i < ButtonInterface.Length; i++)
            {
                if (i == (int)type)
                {
                    ButtonInterface[i].SetActive(true);
                }
                else
                {
                    ButtonInterface[i].SetActive(false);
                }
            }
            var headRes = CommonDefineManager.Instance.CommonDefine.HeroIcon_MailFriend.FirstOrDefault(P => P.VocationID == smsg.dProfession && P.FashionID == smsg.dbSysActorImageHeadID);;

            if (headRes != null)
            {
                UI_Head.spriteName = headRes.ResName;
            }
            UI_Profession.spriteName = Team.SpriteName.PROFESSION_CHAR + smsg.dProfession.ToString();
            Label_Name.text          = smsg.Name;
            Label_Level.text         = LanguageTextManager.GetString("IDS_I22_38") + smsg.sActorLevel.ToString();
            Label_Combat.text        = smsg.dwFight.ToString();

            Tip_Unline.SetActive(smsg.bOnLine == 0);
        }
예제 #2
0
    public void SetValue(byte index, uint value)
    {
        //var bytes = PackageHelper.StructToBytes<SMsgRecvAnswerFriends_SC>(this);
        var bytes = new byte[63];

        this.szName.CopyTo(bytes, 0);
        PackageHelper.WriteData(this.dwFriendID).CopyTo(bytes, 19);
        PackageHelper.WriteData(this.dbSysActorImageHeadID).CopyTo(bytes, 23);
        PackageHelper.WriteData(this.dProfession).CopyTo(bytes, 27);
        PackageHelper.WriteData(this.sActorLevel).CopyTo(bytes, 31);
        PackageHelper.WriteData(this.dwSex).CopyTo(bytes, 35);
        PackageHelper.WriteData(this.bOnLine).CopyTo(bytes, 39);
        PackageHelper.WriteData(this.dwTeamType).CopyTo(bytes, 43);
        PackageHelper.WriteData(this.dwEctypeLevel).CopyTo(bytes, 47);
        PackageHelper.WriteData(this.dwInBattle).CopyTo(bytes, 51);
        PackageHelper.WriteData(this.dwFight).CopyTo(bytes, 55);
        PackageHelper.WriteData(this.dwButtonIndex).CopyTo(bytes, 59);

        int offset = 19 + index * 4;
        var source = BitConverter.GetBytes(value);

        bytes[offset]     = source[0];
        bytes[offset + 1] = source[1];
        bytes[offset + 2] = source[2];
        bytes[offset + 3] = source[3];

        this = SMsgRecvAnswerFriends_SC.ParsePackage(bytes);

//        var bytes = new byte[Marshal.SizeOf(typeof(SMsgRecvAnswerFriends_SC))];
//
//        this.szName.CopyTo(bytes, 0);
//        PackageHelper.WriteData(this.dwFriendID).CopyTo(bytes, 19);
//        PackageHelper.WriteData(this.dbSysActorImageHeadID).CopyTo(bytes, 19 + 4);
//        PackageHelper.WriteData(this.dProfession).CopyTo(bytes, 19 + 4 + 4);
//        PackageHelper.WriteData(this.sActorLevel).CopyTo(bytes, 19 + 4 + 4 + 4);
//        PackageHelper.WriteData(this.dwSex).CopyTo(bytes, 19 + 4 + 4 + 4 + 4);
//        PackageHelper.WriteData(this.bOnLine).CopyTo(bytes, 19 + 4 + 4 + 4 + 4 + 4);
//        PackageHelper.WriteData(this.dwTeamType).CopyTo(bytes, 19 + 4 + 4 + 4 + 4 + 4 + 4);
//        PackageHelper.WriteData(this.dwEctypeLevel).CopyTo(bytes, 19 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
//
//        int offset = Convert.ToInt32(index) * 4 + 19;
//        var source = BitConverter.GetBytes(value);
//        bytes[offset] = source[0];
//        bytes[offset + 1] = source[1];
//        bytes[offset + 2] = source[2];
//        bytes[offset + 3] = source[3];
//
//        this = SMsgRecvAnswerFriends_SC.ParsePackage(bytes);
    }
예제 #3
0
    public static SMsgAnswerFriends_SC ParsePackage(byte[] dataBuffer)
    {
        SMsgAnswerFriends_SC sMsgAnswerFriends_SC = new SMsgAnswerFriends_SC();
        int of = 0;

        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgAnswerFriends_SC.dwActorID);
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgAnswerFriends_SC.dwFriendActorID);
        byte[] buffer;
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out buffer, Marshal.SizeOf(typeof(SMsgRecvAnswerFriends_SC)));
        sMsgAnswerFriends_SC.sMsgRecvAnswerFriends_SC = SMsgRecvAnswerFriends_SC.ParsePackage(buffer);

        //sMsgAnswerFriends_SC.dwActorID = BitConverter.ToUInt32(dataBuffer, 0);
        //sMsgAnswerFriends_SC.dwFriendActorID = BitConverter.ToUInt32(dataBuffer, 4);
        //int dataLength = 19 + 4 + 4 + 4 + 4 + 4 + 4 + 4;  //等于Mashal.Sizeof(SMsgRecvAnswerFriends_SC);

        return(sMsgAnswerFriends_SC);
    }
예제 #4
0
    public static SMsgGetActorListHead ParsePackage(byte[] dataBuffer)
    {
        SMsgGetActorListHead sMsgGetActorListHead = new SMsgGetActorListHead();

        sMsgGetActorListHead.dwActorID                = BitConverter.ToUInt32(dataBuffer, 0);
        sMsgGetActorListHead.byFriendMaxNum           = dataBuffer[4];
        sMsgGetActorListHead.dwFriendNum              = dataBuffer[5];
        sMsgGetActorListHead.sMsgRecvAnswerFriends_SC = new SMsgRecvAnswerFriends_SC[sMsgGetActorListHead.dwFriendNum];

        int offset = Marshal.SizeOf(typeof(SMsgRecvAnswerFriends_SC));

        //int offset = 19 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
        for (int i = 0; i < sMsgGetActorListHead.dwFriendNum; ++i)
        {
            sMsgGetActorListHead.sMsgRecvAnswerFriends_SC[i] = SMsgRecvAnswerFriends_SC.ParsePackage(dataBuffer.Skip(4 + 1 + 1 + i * offset).Take(offset).ToArray());
        }

        return(sMsgGetActorListHead);
    }
예제 #5
0
    public static SMsgRecvAnswerFriends_SC ParsePackage(byte[] dataBuffer)
    {
        SMsgRecvAnswerFriends_SC sMsgRecvAnswerFriends_SC = new SMsgRecvAnswerFriends_SC();
        int of = 0;

        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgRecvAnswerFriends_SC.szName, 19);
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgRecvAnswerFriends_SC.dwFriendID);
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgRecvAnswerFriends_SC.dbSysActorImageHeadID);
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgRecvAnswerFriends_SC.dProfession);
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgRecvAnswerFriends_SC.sActorLevel);
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgRecvAnswerFriends_SC.dwSex);
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgRecvAnswerFriends_SC.bOnLine);
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgRecvAnswerFriends_SC.dwTeamType);
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgRecvAnswerFriends_SC.dwEctypeLevel);
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgRecvAnswerFriends_SC.dwInBattle);
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgRecvAnswerFriends_SC.dwFight);
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgRecvAnswerFriends_SC.dwButtonIndex);

        return(sMsgRecvAnswerFriends_SC);
    }
예제 #6
0
    //[MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)]
    //public char[] cSendRequestName;			//发送好友请求的玩家的名字

    public static SMsgAdddFriends_SC ParsePackage(byte[] dataBuffer)
    {
        SMsgAdddFriends_SC sMsgAdddFriends_SC = new SMsgAdddFriends_SC();

        int of = 0;

        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgAdddFriends_SC.dSendRequestActorID);
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgAdddFriends_SC.dReceiverActorID);
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out sMsgAdddFriends_SC.tCurTime);
        byte[] buffer;
        of += PackageHelper.ReadData(dataBuffer.Skip(of).ToArray(), out buffer, Marshal.SizeOf(typeof(SMsgRecvAnswerFriends_SC)));
        sMsgAdddFriends_SC.sMsgRecvAnswerFriends_SC = SMsgRecvAnswerFriends_SC.ParsePackage(buffer);

        //sMsgAdddFriends_SC.dSendRequestActorID = BitConverter.ToUInt32(dataBuffer, 0);
        //sMsgAdddFriends_SC.tCurTime = BitConverter.ToUInt64(dataBuffer, 4);
        //int dataLength = 19 + 4 + 4 + 4 + 4 + 4 + 4 + 4;  //等于Mashal.Sizeof(SMsgRecvAnswerFriends_SC);

        //sMsgAdddFriends_SC.cSendRequestName = BitConverter.ToString(dataBuffer, 4, 19).ToCharArray();

        return(sMsgAdddFriends_SC);
    }