예제 #1
0
    public void UpdateField(int Id, int Index, byte[] buff, int start, int len)
    {
        SyncIdE SyncId = (SyncIdE)Id;

        byte[] updateBuffer = new byte[len];
        Array.Copy(buff, start, updateBuffer, 0, len);
        int  iValue = 0;
        long lValue = 0;

        switch (SyncId)
        {
        case SyncIdE.FRIENDLIST:
            if (Index < 0)
            {
                m_Instance.ClearFriendList(); break;
            }
            if (Index >= m_Instance.SizeFriendList())
            {
                int Count = Index - m_Instance.SizeFriendList() + 1;
                for (int i = 0; i < Count; i++)
                {
                    m_Instance.AddFriendList(new FriendFriendObjWraperV1());
                }
            }
            m_Instance.GetFriendList(Index).FromMemoryStream(new MemoryStream(updateBuffer));
            break;

        case SyncIdE.BLACKLIST:
            if (Index < 0)
            {
                m_Instance.ClearBlackList(); break;
            }
            if (Index >= m_Instance.SizeBlackList())
            {
                int Count = Index - m_Instance.SizeBlackList() + 1;
                for (int i = 0; i < Count; i++)
                {
                    m_Instance.AddBlackList(new FriendFriendObjWraperV1());
                }
            }
            m_Instance.GetBlackList(Index).FromMemoryStream(new MemoryStream(updateBuffer));
            break;

        case SyncIdE.CONTACTSLIST:
            if (Index < 0)
            {
                m_Instance.ClearContactsList(); break;
            }
            if (Index >= m_Instance.SizeContactsList())
            {
                int Count = Index - m_Instance.SizeContactsList() + 1;
                for (int i = 0; i < Count; i++)
                {
                    m_Instance.AddContactsList(new FriendFriendObjWraperV1());
                }
            }
            m_Instance.GetContactsList(Index).FromMemoryStream(new MemoryStream(updateBuffer));
            break;

        case SyncIdE.STRANGERFRIENDLIST:
            if (Index < 0)
            {
                m_Instance.ClearStrangerFriendList(); break;
            }
            if (Index >= m_Instance.SizeStrangerFriendList())
            {
                int Count = Index - m_Instance.SizeStrangerFriendList() + 1;
                for (int i = 0; i < Count; i++)
                {
                    m_Instance.AddStrangerFriendList(-1);
                }
            }
            GameAssist.ReadInt64Variant(updateBuffer, 0, out lValue);
            m_Instance.SetStrangerFriendList(Index, lValue);
            break;

        default:
            break;
        }

        try
        {
            if (NotifySyncValueChanged != null)
            {
                NotifySyncValueChanged(Id, Index);
            }
        }
        catch
        {
            Ex.Logger.Log("FriendData.NotifySyncValueChanged catch exception");
        }
        updateBuffer.GetType();
        iValue++;
        lValue++;
    }
예제 #2
0
    public void UpdateField(int Id, int Index, byte[] buff, int start, int len)
    {
        SyncIdE SyncId = (SyncIdE)Id;

        byte[] updateBuffer = new byte[len];
        Array.Copy(buff, start, updateBuffer, 0, len);
        int  iValue = 0;
        long lValue = 0;

        switch (SyncId)
        {
        case SyncIdE.USERNAME:
            m_Instance.UserName = System.Text.Encoding.UTF8.GetString(updateBuffer);
            break;

        case SyncIdE.USERID:
            GameAssist.ReadInt64Variant(updateBuffer, 0, out lValue);
            m_Instance.UserId = lValue;
            break;

        case SyncIdE.PLATNAME:
            m_Instance.PlatName = System.Text.Encoding.UTF8.GetString(updateBuffer);
            break;

        case SyncIdE.ACCOUNTID:
            GameAssist.ReadInt64Variant(updateBuffer, 0, out lValue);
            m_Instance.AccountId = lValue;
            break;

        case SyncIdE.LEVEL:
            GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
            m_Instance.Level = iValue;
            break;

        case SyncIdE.RANK:
            GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
            m_Instance.Rank = iValue;
            break;

        case SyncIdE.FIGHTPOWER:
            GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
            m_Instance.FightPower = iValue;
            break;

        case SyncIdE.SEC:
            GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
            m_Instance.Sec = iValue;
            break;

        case SyncIdE.MILITARY:
            GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
            m_Instance.Military = iValue;
            break;

        default:
            break;
        }

        try
        {
            if (NotifySyncValueChanged != null)
            {
                NotifySyncValueChanged(Id, Index);
            }
        }
        catch
        {
            Debug.Log("PersistAttrData.NotifySyncValueChanged catch exception");
        }
        updateBuffer.GetType();
        iValue++;
        lValue++;
    }
예제 #3
0
    public void UpdateField(int Id, int Index, byte[] buff, int start, int len)
    {
        SyncIdE SyncId = (SyncIdE)Id;

        byte[] updateBuffer = new byte[len];
        Array.Copy(buff, start, updateBuffer, 0, len);
        int  iValue = 0;
        long lValue = 0;

        switch (SyncId)
        {
        case SyncIdE.BAGRECYCLEBIN:
            if (Index < 0)
            {
                m_Instance.ClearBagRecycleBin(); break;
            }
            if (Index >= m_Instance.SizeBagRecycleBin())
            {
                int Count = Index - m_Instance.SizeBagRecycleBin() + 1;
                for (int i = 0; i < Count; i++)
                {
                    m_Instance.AddBagRecycleBin(new BagRecycleGridObjWraper());
                }
            }
            m_Instance.GetBagRecycleBin(Index).FromMemoryStream(new MemoryStream(updateBuffer));
            break;

        case SyncIdE.ROLEATTR:
            if (Index < 0)
            {
                m_Instance.ClearRoleAttr(); break;
            }
            if (Index >= m_Instance.SizeRoleAttr())
            {
                int Count = Index - m_Instance.SizeRoleAttr() + 1;
                for (int i = 0; i < Count; i++)
                {
                    m_Instance.AddRoleAttr(new OnlineDataRoleAttrObjWraperV1());
                }
            }
            m_Instance.GetRoleAttr(Index).FromMemoryStream(new MemoryStream(updateBuffer));
            break;

        case SyncIdE.RECOMMENDFRIENDOFFSET:
            GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
            m_Instance.RecommendFriendOffset = iValue;
            break;

        case SyncIdE.RECOMMENDFRIENDFLUSHTIME:
            GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
            m_Instance.RecommendFriendFlushTime = iValue;
            break;

        case SyncIdE.RECOMMENDFRIENDLASTLIST:
            if (Index < 0)
            {
                m_Instance.ClearRecommendFriendLastList(); break;
            }
            if (Index >= m_Instance.SizeRecommendFriendLastList())
            {
                int Count = Index - m_Instance.SizeRecommendFriendLastList() + 1;
                for (int i = 0; i < Count; i++)
                {
                    m_Instance.AddRecommendFriendLastList(-1);
                }
            }
            GameAssist.ReadInt64Variant(updateBuffer, 0, out lValue);
            m_Instance.SetRecommendFriendLastList(Index, lValue);
            break;

        case SyncIdE.FOLLOWMEUSERID:
            if (Index < 0)
            {
                m_Instance.ClearFollowmeUserId(); break;
            }
            if (Index >= m_Instance.SizeFollowmeUserId())
            {
                int Count = Index - m_Instance.SizeFollowmeUserId() + 1;
                for (int i = 0; i < Count; i++)
                {
                    m_Instance.AddFollowmeUserId(-1);
                }
            }
            GameAssist.ReadInt64Variant(updateBuffer, 0, out lValue);
            m_Instance.SetFollowmeUserId(Index, lValue);
            break;

        case SyncIdE.FOLLOWWHO:
            GameAssist.ReadInt64Variant(updateBuffer, 0, out lValue);
            m_Instance.FollowWho = lValue;
            break;

        case SyncIdE.THIEFOBJID:
            GameAssist.ReadInt64Variant(updateBuffer, 0, out lValue);
            m_Instance.ThiefObjId = lValue;
            break;

        default:
            break;
        }

        try
        {
            if (NotifySyncValueChanged != null)
            {
                NotifySyncValueChanged(Id, Index);
            }
        }
        catch
        {
            Ex.Logger.Log("OnlineDataData.NotifySyncValueChanged catch exception");
        }
        updateBuffer.GetType();
        iValue++;
        lValue++;
    }
예제 #4
0
	public void UpdateField(int Id, int Index, byte[] buff, int start, int len )
	{
		SyncIdE SyncId = (SyncIdE)Id;
		byte[]  updateBuffer = new byte[len];
		Array.Copy(buff, start, updateBuffer, 0, len);
		int  iValue = 0;
		long lValue = 0;

		switch (SyncId)
		{
			case SyncIdE.USERNAME:
				m_Instance.UserName = System.Text.Encoding.UTF8.GetString(updateBuffer);
				break;
			case SyncIdE.USERID:
				GameAssist.ReadInt64Variant(updateBuffer, 0, out lValue);
				m_Instance.UserId = lValue;
				break;
			case SyncIdE.PLATNAME:
				m_Instance.PlatName = System.Text.Encoding.UTF8.GetString(updateBuffer);
				break;
			case SyncIdE.ACCOUNTID:
				GameAssist.ReadInt64Variant(updateBuffer, 0, out lValue);
				m_Instance.AccountId = lValue;
				break;
			case SyncIdE.LEVEL:
				GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
				m_Instance.Level = iValue;
				break;
			case SyncIdE.RANK:
				GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
				m_Instance.Rank = iValue;
				break;
			case SyncIdE.FIGHTPOWER:
				GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
				m_Instance.FightPower = iValue;
				break;
			case SyncIdE.SEC:
				GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
				m_Instance.Sec = iValue;
				break;
			case SyncIdE.PROF:
				GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
				m_Instance.Prof = iValue;
				break;
			case SyncIdE.ONLINESTATE:
				GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
				m_Instance.OnlineState = iValue;
				break;
			case SyncIdE.TEAMID:
				GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
				m_Instance.TeamId = iValue;
				break;
			case SyncIdE.SHOPSCORE:
				GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
				m_Instance.ShopScore = iValue;
				break;
			case SyncIdE.DUNGEONID:
				GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
				m_Instance.DungeonId = iValue;
				break;
			case SyncIdE.SESSIONKEY:
				m_Instance.SessionKey = System.Text.Encoding.UTF8.GetString(updateBuffer);
				break;
			case SyncIdE.GUILDID:
				GameAssist.ReadInt32Variant(updateBuffer, 0, out iValue);
				m_Instance.GuildId = iValue;
				break;

			default:
				break;
		}

		try
		{
			if (NotifySyncValueChanged!=null)
				NotifySyncValueChanged(Id, Index);
		}
		catch
		{
			Ex.Logger.Log("PersistAttrData.NotifySyncValueChanged catch exception");
		}
		updateBuffer.GetType();
		iValue ++;
		lValue ++;
	}