public BeginCanvasCommand(FxCanvasObject obj, Exporter exporter) { ObjectType = CommandTypeBeginCanvas; //------------------------- width = obj.width; height = obj.height; clearColor = obj.backgroundColor; _canvasObject = exporter.GetObject(obj) as CanvasObject; }
static int SortByNodeOrder(FxCanvasObject a, FxCanvasObject b) { var ta = a.nodeOrder; var tb = b.nodeOrder; if (ta > tb) { return(-1); } else { return(1); } return(0); }
public static void OnConnectNodes() { FxCanvasSlot slot = null; FxCanvasObject node = null; foreach (var gameObject in Selection.gameObjects) { var slotobj = gameObject.GetComponentInChildren <FxCanvasSlot>(); if (slotobj != null && slotobj.canvas == null) { slot = slotobj; break; } } if (slot == null) { return; } List <FxCanvasObject> cs = new List <FxCanvasObject>(); var pc = slot.gameObject.GetComponentsInChildren <FxCanvasObject>(); foreach (var p in pc) { cs.Add(p); } pc = slot.gameObject.GetComponentsInParent <FxCanvasObject>(); foreach (var p in pc) { cs.Add(p); } //--------- foreach (var gameObject in Selection.gameObjects) { //----------node------------- var nodeobj = gameObject.GetComponentInChildren <FxCanvasObject>(); if (nodeobj != null && cs.IndexOf(nodeobj) < 0) { node = nodeobj; break; } nodeobj = gameObject.GetComponentInParent <FxCanvasObject>(); if (nodeobj != null && cs.IndexOf(nodeobj) < 0) { node = nodeobj; break; } } Debug.Log("node:" + node + ",slot:" + slot); if (slot == null || node == null) { Debug.LogWarning("选择的内容中找不到能够链接的对象!!"); } else { slot.canvas = node; } }
private void DrawCanvasUI(FxCanvasObject gameObject) { Camera camera = gameObject.GetComponent <Camera>(); DrawCameraBound(camera, gameObject.bounds_color); }