private SendMessage ( RoomMessageDefine id, object msg ) : void | ||
id | RoomMessageDefine | |
msg | object | |
리턴 | void |
private void OnHightlightPrompt(int userId, string dict, object[] args) { Msg_RC_HighlightPrompt builder = new Msg_RC_HighlightPrompt(); builder.dict_id = dict; foreach (object arg in args) { builder.argument.Add(arg.ToString()); } if (userId > 0) { EntityInfo info = EntityManager.GetEntityInfo(userId); if (null != info) { User user = info.CustomData as User; if (null != user) { user.SendMessage(RoomMessageDefine.Msg_RC_HighlightPrompt, builder); } } } else { NotifyAllUser(RoomMessageDefine.Msg_RC_HighlightPrompt, builder); } }
private void SyncSceneObjectsToUser(User user) { if (null != user) { EntityInfo userInfo = user.Info; RoomUserManager roomUserMgr = GetRoomUserManager(); if (null != userInfo && null != roomUserMgr && null != roomUserMgr.ActiveScene) { for (LinkedListNode <EntityInfo> linkNode = EntityManager.Entities.FirstNode; null != linkNode; linkNode = linkNode.Next) { EntityInfo npc = linkNode.Value; if (null != npc) { Msg_RC_CreateNpc bder = DataSyncUtility.BuildCreateNpcMessage(npc); user.SendMessage(RoomMessageDefine.Msg_RC_CreateNpc, bder); Msg_RC_SyncProperty msg = DataSyncUtility.BuildSyncPropertyMessage(npc); user.SendMessage(RoomMessageDefine.Msg_RC_SyncProperty, msg); } } } } }
public void SyncForNewUser(User user) { if (null != user) { EntityInfo userInfo = user.Info; RoomUserManager roomUserMgr = GetRoomUserManager(); if (null != userInfo && null != roomUserMgr && null != roomUserMgr.ActiveScene) { //发阵营给自己 Msg_RC_CampChanged msg = new Msg_RC_CampChanged(); msg.obj_id = 0; msg.camp_id = user.LobbyUserData.Camp; user.SendMessage(RoomMessageDefine.Msg_RC_CampChanged, msg); //同步场景数据给自己 SyncSceneObjectsToUser(user); SyncUserObjectToOtherUsers(user); } } }
internal void SyncForNewUser(User user) { if (null != user) { EntityInfo userInfo = user.Info; Room room = GetRoom(); if (null != userInfo && null != room && null != room.ActiveScene) { //发阵营给自己 Msg_RC_CampChanged msg = new Msg_RC_CampChanged(); msg.obj_id = 0; msg.camp_id = user.LobbyUserData.Camp; user.SendMessage(RoomMessageDefine.Msg_RC_CampChanged, msg); //同步场景数据给自己 SyncSceneObjectsToUser(user); SyncUserObjectToOtherUsers(user); } } }
private void SyncSceneObjectsToUser(User user) { if (null != user) { EntityInfo userInfo = user.Info; Room room = GetRoom(); if (null != userInfo && null != room && null != room.ActiveScene) { for (LinkedListNode<EntityInfo> linkNode = EntityManager.Entities.FirstValue; null != linkNode; linkNode = linkNode.Next) { EntityInfo npc = linkNode.Value; if (null != npc) { Msg_RC_CreateNpc bder = DataSyncUtility.BuildCreateNpcMessage(npc); user.SendMessage(RoomMessageDefine.Msg_RC_CreateNpc, bder); Msg_RC_SyncProperty msg = DataSyncUtility.BuildSyncPropertyMessage(npc); user.SendMessage(RoomMessageDefine.Msg_RC_SyncProperty, msg); } } } } }