public virtual void UpdateInfo(NodeInfo data, GNodeParts view) { Data = data; viewer = view; viewer.identify = data.UID; Data.Acceleration = Vector3.zero; Data.Velocity = Vector3.zero; viewer.UpdateLabel(data.name); var drag = viewer.mTransform.GetComponent <LeanDrag>(); if (drag == null) { viewer.gameObject.AddComponent <LeanDrag>(); } view.gameObject.AddComponent <LeanMoveToTop>(); }
public RGNode CreateNode(NodeInfo info, Transform center, Transform box, float radius, string parent) { if (info == null) { return(null); } RGNode item = GetNode(info.UID); bool add = false; bool icon = File.Exists(info.avatar); if (item == null) { GNodeParts view = null; if (info.IsVirtual || !icon) { view = ZAssetController.Instance.ActivateAsset <GNodeParts>(box); } else { view = ZAssetController.Instance.ActivateAsset <GNodePersonParts>(box); } item = new RGNode(info, view); var pos = GetRandomPosition(center, radius); item.Data.LastPosition = pos; item.Data.X = pos.x; item.Data.Y = pos.y; item.distPos = new Vector2(pos.x, pos.y); item.mTransform.localPosition = pos; add = true; } AddNode(item, parent, add); if (icon) { ZImageController.Instance.Load(info.UID, info.avatar, OnImageLoad); } return(item); }
public RGNode(NodeInfo info, GNodeParts view) { UpdateInfo(info, view); }