private void ParseBTXml() { XElement xml = UIWindow_BTViewPanel.LoadAIConfig(); IEnumerable <XElement> behaviorTrees = xml.Elements(BTDataKey.BEHAVIOUR_TREE_ROOT); if (null == behaviorTrees) { return; } foreach (XElement element in behaviorTrees) { int iID = 0; int.TryParse(element.Attribute(BTDataKey.BEHAVIOUR_TREE_ID).Value, out iID); string desc = element.Attribute("desc").Value; GameObject objElem = GameObject.Instantiate(m_ChildTemplate); objElem.SetActive(true); ComponentTool.Attach(m_SelectRoot, objElem.transform); AIPlanElement elem = objElem.GetComponent <AIPlanElement>(); elem.Init(iID, desc, OnClickSelect); m_ElemList.Add(elem); } m_Grid.Reposition(); }
public void OnClickSelect(GameObject sender) { m_SelectPanel.SetActive(false); gameObject.SetActive(false); AIPlanElement elem = sender.transform.parent.gameObject.GetComponent <AIPlanElement>(); m_OnCreateRootCallback(elem.m_iId); }