private void instantiateButton(SubactionData subDataToSet, int index) { GameObject go = NGUITools.AddChild(gameObject, SubactionCardPrefab); SubactionCard card = go.GetComponent <SubactionCard>(); card.SetAnchors(anchorObject, leftAnchorOffset, rightAnchorOffset); card.SetSubaction(subDataToSet); card.SetEditor(editor); card.RegisterListeners(); card.setIndex(index); children.Add(go); }
public void UpdateOrder() { int index = 0; List <SubactionData> subDataList = new List <SubactionData>(); foreach (Transform child in grid.GetChildList()) { SubactionCard orderPanel = child.GetComponent <SubactionCard>(); orderPanel.setIndex(index); subDataList.Add(orderPanel.subaction); index++; } Debug.Log("Update Order Subactions:"); Debug.Log(subDataList); ChangeSubactionOrderAction legacyAction = ScriptableObject.CreateInstance <ChangeSubactionOrderAction>(); legacyAction.init(subDataList); editor.DoAction(legacyAction); }
private void Awake() { subactionCard = GetComponent <SubactionCard>(); }