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.
36 lines
1.2 KiB
36 lines
1.2 KiB
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
|
|
public class ReplayInstanceText : ReplaySimpleObject |
|
{ |
|
/// <summary> |
|
/// 回放克隆 |
|
/// </summary> |
|
/// <param name="json"></param> |
|
public override void CloneObject(string json) |
|
{ |
|
var jsonData = JsonUtility.FromJson<RecordInstanceText>(json); |
|
var clonedObj = EntitiesManager.Instance.CreateObj(cloneBase.clonePrefab, jsonData.myTransform.getMyPosition(), transform, long.Parse(jsonData.objectName)); |
|
clonedObj.name = jsonData.objectName;//名字即ID |
|
SetBaseGameObject(clonedObj, jsonData); |
|
SetCloneGameObject(clonedObj, json); |
|
SetInstanceTextData(clonedObj, jsonData); |
|
} |
|
/// <summary> |
|
/// 设置特殊属性 |
|
/// </summary> |
|
/// <param name="obj"></param> |
|
public override void SetCloneGameObject(GameObject obj, string json) |
|
{ |
|
base.SetCloneGameObject(obj, json); |
|
obj.AddComponent<TextControl>(); |
|
} |
|
private void SetInstanceTextData(GameObject obj, RecordInstanceText data) |
|
{ |
|
var set = obj.GetComponent<TextControl>(); |
|
set.SetColor(data.Color); |
|
set.SetScale(data.Scale); |
|
set.SetText(data.InputField); |
|
} |
|
}
|
|
|