private void instantiateButton(string imageDef, int index) { GameObject go = NGUITools.AddChild(gameObject, spriteFileButtonPrefab); SubimageOrderPanel button = go.GetComponent <SubimageOrderPanel>(); button.rig = this; button.SetSubimage(imageDef); button.setIndex(index); button.sprite.leftAnchor.target = anchorObject; button.sprite.leftAnchor.relative = 0; button.sprite.leftAnchor.absolute = leftAnchorOffset; button.sprite.rightAnchor.target = anchorObject; button.sprite.rightAnchor.relative = 1; button.sprite.rightAnchor.absolute = rightAnchorOffset; children.Add(go); }
public void UpdateOrder() { int index = 0; List <string> subimages = new List <string>(); foreach (Transform child in grid.GetChildList()) { SubimageOrderPanel orderPanel = child.GetComponent <SubimageOrderPanel>(); orderPanel.setIndex(index); subimages.Add(orderPanel.subimageName); index++; } Debug.Log("Update Order Subimages:"); Debug.Log(subimages); ChangeSubimageOrderAction legacyAction = ScriptableObject.CreateInstance <ChangeSubimageOrderAction>(); legacyAction.init(subimages); editor.DoAction(legacyAction); }