using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// 信息同步帮助,用来存储本客户端进入场景前 需要同步的 其他客户端的命令操作(键鼠,ui)
///
public static class NetworkSyncHelper
{
public static List SyncInfos = new List();//需同步的UI操作数据信息
public static void AddSyncData(BaseNetworkSyncDate Item)
{
if (!SyncInfos.Contains(Item))
{
SyncInfos.Add(Item);
}
}
}
///
/// 同步信息基类
///
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()
//{
//}
}
///
/// 单一克隆物体
///
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(PrefabsPath);
// Transform parent = EntitiesManager.Instance.GetEntityByID((long)parentUID).transform;
// GameObject clone = EntitiesManager.Instance.CreateObj(Prefab, ClonePosition, parent, gameObjID);
// clone.GetComponent().UserID = UserID;
// clone.GetComponent().gameObjType = gameObjType;
// clone.GetComponent().floorNum = floorNum;
// clone.GetComponent().buildNum = buildNum;
// clone.GetComponent().interlayerNum = interlayerNum;
// }
//}
}
///
/// 物体删除同步
///
public class ObjDelectSyncData : BaseNetworkSyncDate
{
//public override void LoadFuntion()
//{
// base.LoadFuntion();
// if (EntitiesManager.Instance.GetEntityByID(gameObjID) != null)
// {
// EntitiesManager.Instance.DeleteObj(EntitiesManager.Instance.GetEntityByID(gameObjID));
// }
//}
}
///
/// 物体旋转同步
///
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);
// }
//}
}
///
/// 物体拖拽同步
///
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;
// }
//}
}
///
/// 火同步数据(火的初始状态同步)
///
public class FireOriginAttributeSyncData:BaseNetworkSyncDate
{
public OriginFire FireAttribute;
}
///
/// 全液面火设置
///
public class FireLiquidScaleSyncData : BaseNetworkSyncDate
{
public float firescale;
public long oilTankID;
}
///
/// 泄露2
///
public class Leak2SyncData : BaseNetworkSyncDate
{
public int Level;
}
///
/// 风力风向同步
///
public class WindZoneSyncData : BaseNetworkSyncDate
{
public Quaternion Rotation;
public float windMain;
}
///
/// 油罐信息同步
///
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;
}
///
/// 被困人员被消防员点击等待消防员
///
public class TrappedWaitFiremanSyncData : BaseNetworkSyncDate
{
public Vector3 Waitposition;
public bool IsWait;
}
///
/// 连接管线同步信息类
///
public class AssociatedLineSyncDate : BaseNetworkSyncDate
{
//public bool IsResert;
public Vector3 LineBeginPoint;
//public Vector3 LineEndPoint;
public float lenght;
public Vector3 hitpoint;
///
/// 点击物体id
///
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("LineParent/ParentWaterHoseLine");
// GameObject Prefab = Resources.Load("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().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();
// line.GetComponent().gameObjID = parentgameobj.GetComponent().gameObjID;
// parentgameobj.GetComponent().LineLenght = lenght;
// parentgameobj.GetComponent().StartHitGameObj =startHitGameObj;
// parentgameobj.GetComponent().EndHitGameObj = endHitGameObj;
// parentgameobj.GetComponent().StartPoint =LineBeginPoint;
// parentgameobj.GetComponent().EndPoint = endPoint;//data.LineEndPoint;
// parentgameobj.name = name;
// parentgameobj.GetComponent().gameObjID = gameObjID;
// parentgameobj.GetComponent().gameObjType = gameObjType;
// parentgameobj.GetComponent().UserID = UserID;
// parentgameobj.GetComponent().buildNum =buildNum;
// parentgameobj.GetComponent().floorNum =floorNum;
// parentgameobj.GetComponent().interlayerNum =interlayerNum;
// //ExpendHose(distance, parentgameobj.GetComponent().LineLenght);
// SelectedObjs.gameObjs.Add(line);
//}
#endregion
}
///
/// 警戒线
///
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("LineParent/ParentWarnLine");
// GameObject Prefab = Resources.Load(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();
// line.GetComponent().gameObjID = parentobj.GetComponent().gameObjID;
// //SelectedObjs.gameObjs.Add(line);
// SelectedObjs.gameObjs.Add(line);
// // startPoint = endPoint;
// parentobj.name = name;
// parentobj.GetComponent().gameObjID = gameObjID;
// parentobj.GetComponent().gameObjType = gameObjType;
// parentobj.GetComponent().UserID = UserID;
// parentobj.GetComponent().buildNum = buildNum;
// parentobj.GetComponent().floorNum = floorNum;
// parentobj.GetComponent().interlayerNum = interlayerNum;
// }
// else
// {
// // GameObject parentobj = EntitiesManager.Instance.GetEntityByID(baseGameobjInfo.gameObjID);
// }
//}
#endregion
}
///
/// 铺设水带
///
public class LayerWaterHoseSyncData : BaseNetworkSyncDate
{
public bool IsBegin;
}
///
/// 消防员工作状态
///
public class FiremanWorktypeChangeSyncData : BaseNetworkSyncDate
{
public FireManSkills worktype;
//public bool Skill;
//public CloneObjType cloneObjType;
}
///
/// 出水
///
public class SpraySyncData : BaseNetworkSyncDate
{
public SprayParticleType spraytype;
public float size;
public bool IsOn;
}
///
/// 寻路
///
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 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;
}
///
/// 急救或者移动状态同步
///
public class WounderFirstAidOrMoveStateSyncData : BaseNetworkSyncDate
{
public bool IsBeFristAidOrMove;
}
///
/// 移动伤员同步
///
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;//是否开始移动
}
///
/// 安全区已经营救的伤员数同步
///
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;
}
///
/// 水幕水带的水幕特效克隆的同步数据类
///
public class WaterCurutainSyncData : BaseNetworkSyncDate
{
public Vector3 ClonePosition;
public string Name;
public long ParentGameObjId;//水幕特效父对象(水幕水带)的对象id
}
///
/// 水幕水带的水幕特效显示隐藏的同步数据类
///
public class WaterCurutainHideOrShowSyncData
{
public long GameObjId;
public bool isShow;//true表示显示,false表示隐藏
}