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.
524 lines
17 KiB
524 lines
17 KiB
using System; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
|
|
|
|
/// <summary> |
|
/// 信息同步帮助,用来存储本客户端进入场景前 需要同步的 其他客户端的命令操作(键鼠,ui) |
|
/// </summary> |
|
public static class NetworkSyncHelper |
|
{ |
|
public static List<BaseNetworkSyncDate> SyncInfos = new List<BaseNetworkSyncDate>();//需同步的UI操作数据信息 |
|
|
|
|
|
public static void AddSyncData(BaseNetworkSyncDate Item) |
|
{ |
|
if (!SyncInfos.Contains(Item)) |
|
{ |
|
SyncInfos.Add(Item); |
|
} |
|
} |
|
} |
|
|
|
/// <summary> |
|
/// 同步信息基类 |
|
/// </summary> |
|
public class BaseNetworkSyncDate |
|
{ |
|
public long gameObjID;//游戏对象ID |
|
public CloneObjType gameObjType;//游戏对象类型 |
|
public long UserID;//克隆出来的对象归属谁 |
|
public string buildNum;//楼号 |
|
public int floorNum;//层号 |
|
public int interlayerNum;//夹层号,0表示不是夹层,1表示第一个夹层 |
|
public long SendUserID;//发送客户端id |
|
|
|
////后登入同步处理 |
|
//public virtual void LoadFuntion() |
|
//{ |
|
|
|
//} |
|
|
|
} |
|
|
|
/// <summary> |
|
/// 单一克隆物体 |
|
/// </summary> |
|
public class CloneDisasterSyncData : BaseNetworkSyncDate |
|
{ |
|
// public string PrefabsPath; |
|
public Vector3 ClonePosition; |
|
// public ulong parentUID; |
|
public string name; |
|
public long HitObjID; |
|
//public GameObject cloneprefabs; |
|
////后登入同步处理 |
|
//public override void LoadFuntion() |
|
//{ |
|
// base.LoadFuntion(); |
|
// if (EntitiesManager.Instance.GetEntityByID(gameObjID) == null) |
|
// { |
|
// GameObject Prefab = Resources.Load<GameObject>(PrefabsPath); |
|
// Transform parent = EntitiesManager.Instance.GetEntityByID((long)parentUID).transform; |
|
// GameObject clone = EntitiesManager.Instance.CreateObj(Prefab, ClonePosition, parent, gameObjID); |
|
// clone.GetComponent<BaseGameObjInfo>().UserID = UserID; |
|
// clone.GetComponent<BaseGameObjInfo>().gameObjType = gameObjType; |
|
// clone.GetComponent<CloneGameObjInfo>().floorNum = floorNum; |
|
// clone.GetComponent<CloneGameObjInfo>().buildNum = buildNum; |
|
// clone.GetComponent<CloneGameObjInfo>().interlayerNum = interlayerNum; |
|
// } |
|
//} |
|
} |
|
/// <summary> |
|
/// 物体删除同步 |
|
/// </summary> |
|
public class ObjDelectSyncData : BaseNetworkSyncDate |
|
{ |
|
//public override void LoadFuntion() |
|
//{ |
|
// base.LoadFuntion(); |
|
// if (EntitiesManager.Instance.GetEntityByID(gameObjID) != null) |
|
// { |
|
// EntitiesManager.Instance.DeleteObj(EntitiesManager.Instance.GetEntityByID(gameObjID)); |
|
// } |
|
//} |
|
} |
|
/// <summary> |
|
/// 物体旋转同步 |
|
/// </summary> |
|
public class ObjRotateSyncData : BaseNetworkSyncDate |
|
{ |
|
public Vector3 rotate; |
|
public Space space;//world/location |
|
//public override void LoadFuntion() |
|
//{ |
|
// base.LoadFuntion(); |
|
// if (EntitiesManager.Instance.GetEntityByID(gameObjID) != null) |
|
// { |
|
// GameObject rotateobj = EntitiesManager.Instance.GetEntityByID(gameObjID); |
|
// rotateobj.transform.Rotate(rotate.x, rotate.y, rotate.z, space); |
|
// } |
|
//} |
|
} |
|
|
|
/// <summary> |
|
/// 物体拖拽同步 |
|
/// </summary> |
|
public class ObjDragSyncData : BaseNetworkSyncDate |
|
{ |
|
public Vector3 offset; |
|
public Vector3 position;//进入拖动记录的位置,拖动到不能放下的地方,会弹回到此位置 |
|
|
|
//public Space space;//world/location |
|
//public override void LoadFuntion() |
|
//{ |
|
// base.LoadFuntion(); |
|
// if (EntitiesManager.Instance.GetEntityByID(gameObjID) != null) |
|
// { |
|
// GameObject dragobj = EntitiesManager.Instance.GetEntityByID(gameObjID); |
|
// dragobj.transform.position += offset; |
|
// } |
|
//} |
|
} |
|
|
|
/// <summary> |
|
/// 火同步数据(火的初始状态同步) |
|
/// </summary> |
|
public class FireOriginAttributeSyncData:BaseNetworkSyncDate |
|
{ |
|
public OriginFire FireAttribute; |
|
} |
|
/// <summary> |
|
/// 全液面火设置 |
|
/// </summary> |
|
public class FireLiquidScaleSyncData : BaseNetworkSyncDate |
|
{ |
|
public float firescale; |
|
public long oilTankID; |
|
} |
|
/// <summary> |
|
/// 泄露2 |
|
/// </summary> |
|
public class Leak2SyncData : BaseNetworkSyncDate |
|
{ |
|
public int Level; |
|
} |
|
|
|
/// <summary> |
|
/// 风力风向同步 |
|
/// </summary> |
|
public class WindZoneSyncData : BaseNetworkSyncDate |
|
{ |
|
public Quaternion Rotation; |
|
public float windMain; |
|
} |
|
/// <summary> |
|
/// 油罐信息同步 |
|
/// </summary> |
|
public class OilTankInfoSyncData : BaseNetworkSyncDate |
|
{ |
|
// public OilTankMessage oiltankmessage; |
|
public string MatterContainer;//储物 |
|
public float Reserves;//储量 |
|
public float OutShowHeight;//固有高度*储量 |
|
public float Taketime;//承受时间 |
|
public float DurationTime;//持续时间 |
|
public float FlowRate;//泄露流速 |
|
public float BoilProb;//沸溢几率 |
|
public bool HasLeakeSet; |
|
// 是否爆炸 |
|
public bool isExplode = false; |
|
// 是否可以喷溅沸溢 |
|
public bool isBoilOver = false; |
|
// 喷溅范围 |
|
public float PenJianRange = 0; |
|
// 冷却爆炸时间 |
|
public int ExplodeTime = 0; |
|
// 爆炸死亡范围 |
|
public int ExplodeDeadRange = 0; |
|
// 爆炸受伤范围 |
|
public int ExplodeHurtRange = 0; |
|
// 喷溅时间 |
|
public int SplashTime = 0; |
|
// 发生喷溅几率 |
|
public int SplashProbability = 0; |
|
// 沸溢几率 |
|
public int BoilOverTime = 0; |
|
// 发生沸溢几率 |
|
public int BoilOverProbability = 0; |
|
// 喷溅死亡范围 |
|
public int BoilOverDeadRange = 0; |
|
} |
|
|
|
/// <summary> |
|
/// 被困人员被消防员点击等待消防员 |
|
/// </summary> |
|
public class TrappedWaitFiremanSyncData : BaseNetworkSyncDate |
|
{ |
|
public Vector3 Waitposition; |
|
public bool IsWait; |
|
} |
|
|
|
/// <summary> |
|
/// 连接管线同步信息类 |
|
/// </summary> |
|
public class AssociatedLineSyncDate : BaseNetworkSyncDate |
|
{ |
|
//public bool IsResert; |
|
public Vector3 LineBeginPoint; |
|
//public Vector3 LineEndPoint; |
|
public float lenght; |
|
public Vector3 hitpoint; |
|
/// <summary> |
|
/// 点击物体id |
|
/// </summary> |
|
public long hitgameObjId; |
|
//public CloneObjType clonetype; |
|
public long startHitGameObjId; |
|
public long endHitGameObjId; |
|
public long CreatFiremanId; |
|
public string name; |
|
// public ulong parentUID;//克隆父物体 |
|
// public string PrefabsPath; |
|
public float Height; |
|
public Vector3 SizeVec; |
|
private Vector3 startPoint; |
|
private Vector3 endPoint; |
|
#region |
|
//public override void LoadFuntion() |
|
//{ |
|
// base.LoadFuntion(); |
|
// GameObject parentgameobj = null; |
|
// GameObject parent = Resources.Load<GameObject>("LineParent/ParentWaterHoseLine"); |
|
// GameObject Prefab = Resources.Load<GameObject>("ClonePrefabs/Lines/" + gameObjType.ToString()); |
|
// if (EntitiesManager.Instance.GetEntityByID(gameObjID) == null) |
|
// { |
|
// parentgameobj = EntitiesManager.Instance.CreateObj(parent, Vector3.zero, |
|
// EntitiesManager.Instance.GetEntityByID((long)parentUID).transform, gameObjID); |
|
// startPoint = LineBeginPoint; |
|
// } |
|
// else//第三个点及以上,找到前两个点创建的对象,将末位点赋给起点 |
|
// { |
|
// parentgameobj = EntitiesManager.Instance.GetEntityByID(gameObjID); |
|
// startPoint = parentgameobj.GetComponent<ParentLinesMessage>().EndPoint; |
|
// } |
|
// endPoint = hitpoint; |
|
// float distance = Vector3.Distance(startPoint, endPoint);//计算两点的距离 |
|
// Vector3 clonedObjPos = (startPoint + endPoint) / 2; |
|
// // Debug.Log(gameObjID); |
|
// //EntitiesManager.Instance.AddEntity(gameObjID, parentgameobj); |
|
// clonedObjPos = new Vector3(clonedObjPos.x, clonedObjPos.y + Height, clonedObjPos.z); |
|
// GameObject line =GameObject.Instantiate(Prefab, parentgameobj.transform); |
|
|
|
// line.name = "line"; |
|
// line.transform.position = clonedObjPos; |
|
// line.transform.forward = (-(endPoint - startPoint)).normalized;//改变线条的朝向 |
|
// line.transform.localScale = new Vector3(SizeVec.x, SizeVec.y, distance * SizeVec.z);//延长线条,连接两点。 |
|
// line.AddComponent<BoxCollider>(); |
|
// line.GetComponent<CloneGameObjInfo>().gameObjID = parentgameobj.GetComponent<BaseGameObjInfo>().gameObjID; |
|
// parentgameobj.GetComponent<ParentLinesMessage>().LineLenght = lenght; |
|
// parentgameobj.GetComponent<ParentLinesMessage>().StartHitGameObj =startHitGameObj; |
|
// parentgameobj.GetComponent<ParentLinesMessage>().EndHitGameObj = endHitGameObj; |
|
// parentgameobj.GetComponent<ParentLinesMessage>().StartPoint =LineBeginPoint; |
|
// parentgameobj.GetComponent<ParentLinesMessage>().EndPoint = endPoint;//data.LineEndPoint; |
|
// parentgameobj.name = name; |
|
// parentgameobj.GetComponent<CloneGameObjInfo>().gameObjID = gameObjID; |
|
// parentgameobj.GetComponent<CloneGameObjInfo>().gameObjType = gameObjType; |
|
// parentgameobj.GetComponent<CloneGameObjInfo>().UserID = UserID; |
|
// parentgameobj.GetComponent<CloneGameObjInfo>().buildNum =buildNum; |
|
// parentgameobj.GetComponent<CloneGameObjInfo>().floorNum =floorNum; |
|
// parentgameobj.GetComponent<CloneGameObjInfo>().interlayerNum =interlayerNum; |
|
// //ExpendHose(distance, parentgameobj.GetComponent<ParentLinesMessage>().LineLenght); |
|
// SelectedObjs.gameObjs.Add(line); |
|
//} |
|
#endregion |
|
} |
|
|
|
/// <summary> |
|
/// 警戒线 |
|
/// </summary> |
|
public class WarnLineSyncDate : BaseNetworkSyncDate |
|
{ |
|
//public bool IsEnd; |
|
public Vector3 LineBeginPoint; |
|
//public Vector3 LineEndPoint; |
|
public Vector3 hitpoint; |
|
public string name; |
|
// public string PrefabsPath; |
|
// public ulong parentUID;//克隆父物体 |
|
#region |
|
//public override void LoadFuntion() |
|
//{ |
|
// base.LoadFuntion(); |
|
// GameObject parentline = Resources.Load<GameObject>("LineParent/ParentWarnLine"); |
|
// GameObject Prefab = Resources.Load<GameObject>(PrefabsPath + gameObjType.ToString()); |
|
// Transform parent = EntitiesManager.Instance.GetEntityByID((long)parentUID).transform; |
|
// //如果实体管理器找不到该物体,先实体管理器克隆一个 |
|
// if (!EntitiesManager.Instance.GetEntityByID(gameObjID)) |
|
// { |
|
// GameObject parentobj = EntitiesManager.Instance.CreateObj(parentline, Vector3.zero, parent, gameObjID); |
|
// float distance = Vector3.Distance(LineBeginPoint, hitpoint);//计算两点的距离 |
|
|
|
// Vector3 clonedObjPos = (LineBeginPoint + hitpoint) / 2; |
|
|
|
// //EntitiesManager.Instance.AddEntity(gameObjID, parentgameobj); |
|
// clonedObjPos = new Vector3(clonedObjPos.x, clonedObjPos.y + 0.2f, clonedObjPos.z); |
|
// GameObject line = GameObject.Instantiate(Prefab, parentobj.transform); |
|
// line.name = "line"; |
|
// line.transform.position = clonedObjPos; |
|
// line.transform.forward = (-(hitpoint - LineBeginPoint)).normalized;//改变线条的朝向 |
|
// line.transform.localScale = new Vector3(25, 25, distance * 78);//延长线条,连接两点。 |
|
// line.AddComponent<BoxCollider>(); |
|
// line.GetComponent<CloneGameObjInfo>().gameObjID = parentobj.GetComponent<BaseGameObjInfo>().gameObjID; |
|
|
|
// //SelectedObjs.gameObjs.Add(line); |
|
// SelectedObjs.gameObjs.Add(line); |
|
// // startPoint = endPoint; |
|
// parentobj.name = name; |
|
// parentobj.GetComponent<CloneGameObjInfo>().gameObjID = gameObjID; |
|
// parentobj.GetComponent<CloneGameObjInfo>().gameObjType = gameObjType; |
|
// parentobj.GetComponent<CloneGameObjInfo>().UserID = UserID; |
|
// parentobj.GetComponent<CloneGameObjInfo>().buildNum = buildNum; |
|
// parentobj.GetComponent<CloneGameObjInfo>().floorNum = floorNum; |
|
// parentobj.GetComponent<CloneGameObjInfo>().interlayerNum = interlayerNum; |
|
// } |
|
// else |
|
// { |
|
// // GameObject parentobj = EntitiesManager.Instance.GetEntityByID(baseGameobjInfo.gameObjID); |
|
// } |
|
//} |
|
#endregion |
|
} |
|
/// <summary> |
|
/// 铺设水带 |
|
/// </summary> |
|
public class LayerWaterHoseSyncData : BaseNetworkSyncDate |
|
{ |
|
public bool IsBegin; |
|
} |
|
|
|
/// <summary> |
|
/// 消防员工作状态 |
|
/// </summary> |
|
public class FiremanWorktypeChangeSyncData : BaseNetworkSyncDate |
|
{ |
|
public FireManSkills worktype; |
|
//public bool Skill; |
|
//public CloneObjType cloneObjType; |
|
} |
|
/// <summary> |
|
/// 出水 |
|
/// </summary> |
|
public class SpraySyncData : BaseNetworkSyncDate |
|
{ |
|
public SprayParticleType spraytype; |
|
public float size; |
|
public bool IsOn; |
|
} |
|
/// <summary> |
|
/// 寻路 |
|
/// </summary> |
|
public class PathFindSyncData : BaseNetworkSyncDate |
|
{ |
|
public Vector3 TargetPoint; |
|
public Vector3 trappedTargetpoint; |
|
public bool TrappedMeetDangerous; |
|
} |
|
//消防员引导被困人员 |
|
public class TrappedMoveFollowFiremanSyncData : BaseNetworkSyncDate |
|
{ |
|
public bool IsEnd; |
|
public long FiremanID; |
|
public long TrappedID; |
|
public long SaveFiremanUserID; |
|
public long Falldownlock; |
|
} |
|
//被困人员引导 |
|
public class TrappedGuidanceSyncData : BaseNetworkSyncDate |
|
{ |
|
public List<Vector3> Guidlist; |
|
public bool IsEnd; |
|
public long SaveFiremanUserID; |
|
public bool IsSetPoint; |
|
} |
|
//消防员可用管线 |
|
public class WaterHoseNumSyncData : BaseNetworkSyncDate |
|
{ |
|
public int NowRemainWaterHose;//可用管线盘数 |
|
public float WaterHoseLenghtRemain;//可用管线长度 |
|
} |
|
//收起铺设的管线同步 |
|
public class DestroyLayWaterHoseSyncData : BaseNetworkSyncDate |
|
{ |
|
public string hosename; |
|
|
|
} |
|
//车辆水源信息 |
|
public class TruckWaterMessageSyncData : BaseNetworkSyncDate |
|
{ |
|
public bool ConnectFoam; |
|
public bool ConnectWater; |
|
public long ConnectWaterHose;//连接的管线 |
|
public bool IsConncet;//连接还是消除 |
|
} |
|
public class NormalFireFightSyncData : BaseNetworkSyncDate |
|
{ |
|
public float Rateovertime1; |
|
public float Rateovertime2; |
|
} |
|
public class Leak1FireFightSyncData : BaseNetworkSyncDate |
|
{ |
|
public float FireButtomRate; |
|
public float Fire8Rate; |
|
public float Smokerate; |
|
} |
|
public class HaemalSyncData : BaseNetworkSyncDate |
|
{ |
|
public float Haemal; |
|
public bool FallDown; |
|
} |
|
public class TrappedFallDownSyncData : BaseNetworkSyncDate |
|
{ |
|
public MoveState trappedState; |
|
} |
|
public class ReportErroeSyncData : BaseNetworkSyncDate |
|
{ |
|
public string Time;//时间 |
|
public string errorset;//事件 |
|
public string describe;//详情 |
|
} |
|
public class SprayRotateSyncData : BaseNetworkSyncDate |
|
{ |
|
public float Hrotate; |
|
public float Vroatet; |
|
public Vector3 VrotateVec; |
|
public Vector3 HrotateVec; |
|
} |
|
public class TruckNowSkillSyncData: BaseNetworkSyncDate |
|
{ |
|
public TruckSkills NowSkill; |
|
} |
|
|
|
public class SafeAreaSyncData : BaseNetworkSyncDate |
|
{ |
|
public Vector3 ClonePosition; |
|
public string name; |
|
public long HitObjID; |
|
} |
|
/// <summary> |
|
/// 急救或者移动状态同步 |
|
/// </summary> |
|
public class WounderFirstAidOrMoveStateSyncData : BaseNetworkSyncDate |
|
{ |
|
public bool IsBeFristAidOrMove; |
|
} |
|
/// <summary> |
|
/// 移动伤员同步 |
|
/// </summary> |
|
public class WounderMoveSyncData : BaseNetworkSyncDate |
|
{ |
|
public long WounderId; |
|
public long Fireman1Id = 0;//操作的消防员1 |
|
public long Fireman2Id = 0;//操作的消防员2 |
|
public Vector3 WounderPos;//移动的伤员的坐标 |
|
public Vector3 Fireman1Pos;//移动的消防员1坐标 |
|
public Vector3 Fireman2Pos;//移动的消防员2坐标 |
|
public bool IsBegianMove;//是否开始移动 |
|
} |
|
/// <summary> |
|
/// 安全区已经营救的伤员数同步 |
|
/// </summary> |
|
public class SafeAreaWounderNumSyncData : BaseNetworkSyncDate |
|
{ |
|
public int HasSaveNum; |
|
} |
|
public class WounderFristAidSyncData : BaseNetworkSyncDate |
|
{ |
|
public bool IsBeFristAid; |
|
} |
|
public class TrappedMoveStateSyncData : BaseNetworkSyncDate |
|
{ |
|
public MoveState State; |
|
public float Speed; |
|
} |
|
|
|
//水幕水带同步数据类 |
|
public class WaterCurtainHoseSyncData |
|
{ |
|
public WaterCHoseParentSyncData WaterCHoseParentSyncData = new WaterCHoseParentSyncData(); |
|
public WaterCHoseChildSyncData WaterCHoseChildSyncData = new WaterCHoseChildSyncData(); |
|
public long waterSourceObjId = -1;//水幕水带上绑定的水源对象ID |
|
} |
|
|
|
public class WaterCHoseParentSyncData : BaseNetworkSyncDate |
|
{ |
|
public Vector3 ClonePosition; |
|
public string Name; |
|
} |
|
|
|
public class WaterCHoseChildSyncData : BaseNetworkSyncDate |
|
{ |
|
public Vector3 StartPoint; |
|
public Vector3 EndPoint; |
|
public float Height; |
|
} |
|
|
|
/// <summary> |
|
/// 水幕水带的水幕特效克隆的同步数据类 |
|
/// </summary> |
|
public class WaterCurutainSyncData : BaseNetworkSyncDate |
|
{ |
|
public Vector3 ClonePosition; |
|
public string Name; |
|
public long ParentGameObjId;//水幕特效父对象(水幕水带)的对象id |
|
} |
|
|
|
/// <summary> |
|
/// 水幕水带的水幕特效显示隐藏的同步数据类 |
|
/// </summary> |
|
public class WaterCurutainHideOrShowSyncData |
|
{ |
|
public long GameObjId; |
|
public bool isShow;//true表示显示,false表示隐藏 |
|
} |