Example #1
0
        /// <summary>
        /// ReserveNetIdで確保したNetIDでidentityを登録する
        /// このメソッド単体でSpawn処理は行わないので、それぞれのclientでIdentityを生成した後で実行すること
        /// </summary>
        public static void RegisterIdentity(RecordableIdentity identity, ushort netId, ushort author)
        {
            if (identity == null)
            {
                return;
            }

            while (identity.netId >= Instance.m_identityList.Count)
            {
                Instance.m_identityList.Add(null);
            }
            Instance.m_identityList[identity.netId] = identity;
            identity.m_netId = netId;
            identity.SetAuthor(author);
            identity.SyncComplete();
        }
 internal void RequestChangeAuthorInGroup(RecordableIdentity identity, ushort author)
 {
     if (identity == null)
     {
         Debug.LogError($"identity={identity} is null");
         return;
     }
     if (!m_identityList.Contains(identity))
     {
         Debug.LogError($"identity={identity} is not found in group");
         return;
     }
     if (GamePacketManager.IsLeader)
     {
         identity.SetAuthor(author);
     }
     else
     {
         SendPacketChangeAuthor(identity.netId, author);
     }
 }