海淀天下城电子沙盘单机版
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.

66 lines
2.1 KiB

4 years ago
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FireManReplay : ReplaySimpleObject
{
public GameObject nullobject;
public Transform p_Drawline;
public override void Start()
{
base.Start();
nullobject = Resources.Load("Prefab/nullobject") as GameObject;
p_Drawline = GameObject.Find("P_DrawLine").transform;
}
/// <summary>
/// 设置特殊属性
/// </summary>
/// <param name="obj"></param>
public override void SetCloneGameObject(GameObject obj, string json)
{
//ClearpDraw();
// CreatLineParent(obj);
// Debug.Log(obj.name);
if (!obj.GetComponent<ObjSelectCtrl>())
obj.AddComponent<ObjSelectCtrl>();
if (!obj.GetComponent<Bag>())
obj.AddComponent<Bag>();
if (obj.GetComponent<XiaoFangYuanDrawLine>())
{
obj.GetComponent<XiaoFangYuanDrawLine>().DelectAllLine();
}
SelectedObjs.characters.Add(obj);
var jsonData = JsonUtility.FromJson<PowerRecordObjectBase>(json);
var PowerAttribute = obj.GetComponent<PowerAttribute>();
PowerAttribute.Task = jsonData.Task;
PowerAttribute.Affiliation = jsonData.Affiliation;
PowerAttribute.Number = jsonData.Number;
PowerAttribute.TypeName = jsonData.TypeName;
var RecordDiverseDatas = GetComponents<IReplayDiverseData>();
foreach (IReplayDiverseData item in RecordDiverseDatas)
{
item.ReplayDiverseData(jsonData.SpecialData, obj);
}
}
public void CreatLineParent(GameObject game)
{
if (!GameObject.Find("drawline-" + game.name))
{
GameObject pline = Instantiate(nullobject, p_Drawline);
pline.name = "drawline-" + game.name;
pline.transform.parent = p_Drawline;
}
}
public void ClearpDraw()
{
if (p_Drawline.childCount>0)
{
for (int i = 0; i < p_Drawline.childCount; i++)
{
Destroy(p_Drawline.GetChild(i).gameObject);
}
}
}
}