Пример #1
0
        public void RoleAppear(Google.Protobuf.IMessage msg)
        {
            if (!(msg is Proto.RoleAppear appear))
            {
                UnityEngine.Debug.LogWarning($"parse RoleAppear error.");
                return;
            }

            foreach (var role in appear.Role)
            {
                var sn = role.Sn;
                if (!_players.ContainsKey(sn))
                {
                    RoleAppear appearObj = new RoleAppear();
                    appearObj.Parse(role);
                    _players.Add(sn, appearObj);
                    appearObj.Load3DObj();

                    UnityEngine.Debug.LogFormat($"sync player sn:{sn} world id:{_ref.GetId()}");
                }
                else
                {
                    _players[sn].Parse(role);
                }
            }
        }
 public void AttachRole(RoleAppear role)
 {
     _role = role;
 }