大连中石油电子沙盘
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.
 
 
 
 

51 lines
2.1 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ReplayHookPipe : ReplaySimpleObject
{
/// <summary>
/// 回放克隆
/// </summary>
/// <param name="json"></param>
public override void CloneObject(string json)
{
var jsonData = JsonUtility.FromJson<RecordWaterReceiver>(json);
var clonedObj = EntitiesManager.Instance.CreateObj(cloneBase.clonePrefab, jsonData.myTransform.getMyPosition(), transform, long.Parse(jsonData.objectName));
clonedObj.name = jsonData.objectName;//名字即ID
SetHookPipe(clonedObj, jsonData);
SetCloneGameObject(clonedObj, json);
if (clonedObj.GetComponent<ObjSelectCtrl>())
{
clonedObj.GetComponent<ObjSelectCtrl>().SetSelect(json);
}
if (clonedObj.GetComponent<ObjDrag>())
{
clonedObj.GetComponent<ObjDrag>().enabled = jsonData.dragable;
}
}
/// <summary>
/// 设置基本属性
/// </summary>
/// <param name="clonedObj"></param>
/// <param name="jsonData"></param>
public void SetHookPipe(GameObject clonedObj, RecordWaterReceiver jsonData)
{
clonedObj.name = jsonData.objectName;
clonedObj.transform.localRotation = jsonData.myTransform.getMyRotation();
clonedObj.transform.localPosition = jsonData.myTransform.getMyPosition();
clonedObj.transform.localScale = jsonData.myTransform.getMyScale();
SelectedObjs.gameObjs.Add(clonedObj);
CloneGameObjInfo objMsg = clonedObj.GetComponent<CloneGameObjInfo>();
objMsg.gameObjType = jsonData.gameObjType;
objMsg.buildNum = jsonData.buildNum;
objMsg.floorNum = jsonData.floorNum;
objMsg.interlayerNum = jsonData.interlayerNum;
clonedObj.GetComponent<WaterReceiver>().hasSupplier = jsonData.hasSupplier;
clonedObj.SetActive(jsonData.isActive);
clonedObj.GetComponent<ToolAttribute>().ReplayTask(jsonData.task);
clonedObj.GetComponent<HookPipeControl>().SetWaterScale(jsonData.waterScale);
}
}