Ejemplo n.º 1
0
        private void SyncUserToObservers(User infoUser)
        {
            Room room = GetRoom();

            if (null != infoUser && null != room && null != room.GetActiveScene())
            {
                UserInfo userInfo = infoUser.Info;
                if (null != userInfo)
                {
                    Vector3 pos = userInfo.GetMovementStateInfo().GetPosition3D();

                    ArkCrossEngineMessage.Position pos_bd0 = new ArkCrossEngineMessage.Position();
                    pos_bd0.x = pos.X;
                    pos_bd0.z = pos.Z;
                    Msg_CRC_Create bd0 = new Msg_CRC_Create();
                    bd0.role_id        = infoUser.RoleId;
                    bd0.hero_id        = infoUser.HeroId;
                    bd0.camp_id        = infoUser.CampId;
                    bd0.role_level     = infoUser.Level;
                    bd0.is_player_self = false;
                    bd0.position       = pos_bd0;
                    bd0.face_dirction  = (float)userInfo.GetMovementStateInfo().GetFaceDir();
                    for (int index = 0; index < userInfo.GetSkillStateInfo().GetAllSkill().Count; index++)
                    {
                        bd0.skill_levels.Add(userInfo.GetSkillStateInfo().GetSkillInfoByIndex(index).SkillLevel);
                    }
                    bd0.scene_start_time = StartTime;
                    bd0.nickname         = infoUser.Name;
                    NotifyAllObserver(bd0);

                    DataSyncUtility.SyncBuffListToObservers(userInfo, this);

                    Msg_RC_SyncProperty propBuilder = DataSyncUtility.BuildSyncPropertyMessage(userInfo);
                    NotifyAllObserver(propBuilder);

                    Msg_RC_SyncCombatStatisticInfo combatBuilder = DataSyncUtility.BuildSyncCombatStatisticInfo(userInfo);
                    NotifyAllObserver(combatBuilder);

                    LogSys.Log(LOG_TYPE.DEBUG, "send user {0} msg to observers", infoUser.RoleId);
                }
            }
        }