网演高层钦州
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

49 lines
2.0 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using AX.Network.Protocols;
using UnityEngine;
using AX.Serialization;
using AX.NetworkSystem;
public class KICK_SOMEONE_SYNC : NetworkMessageBehaviour
{
protected override void Execute(BinaryMessage message)
{
var kickuser = message.Body.Deserialize<KeyValuePair<long, long>>();
if (CurrentUserInfo.room.Id == kickuser.Key)
{
//如果是被踢出的人,返回大厅
if (CurrentUserInfo.mySelf.Id == kickuser.Value)
{
//准备状态下的用户被踢出时需要初始化准备状态,避免再进入房间直接就是准备状态
UserData user = CurrentUserInfo.room.FindUserById(CurrentUserInfo.mySelf.Id);
user.IsReady = false;
EntitiesManager.Instance.Reset();//跳转场景时要清空实体管理器中的对象
NetworkManager.Default.SendAsync("LOBBY_ENTER_SYNC", user);
}
if (GetComponent<MainPanel>())
{
RoleItem[] roleitem = GetComponentsInChildren<RoleItem>();
for (int i = 0; i < roleitem.Length; i++)
{
if (CurrentUserInfo.mySelf.Id != kickuser.Value)
{
UserData remove = CurrentUserInfo.room.FindUserById(kickuser.Value);
CurrentUserInfo.room.UserList.Remove(remove);
if (roleitem[i].userData.UserInfo.Id == kickuser.Value)
{
Destroy(roleitem[i].gameObject);
}
GetComponent<MainPanel>().hideuselessPanel(CurrentUserInfo.room.UserList);
//刷新房间信息
//FindObjectOfType<RoomInfoPanel>().SetRoomInfo();
transform.parent.Find("RoomInfoPanel").GetComponent<RoomInfoPanel>().SetRoomInfo();
}
}
}
}
}
}