コード例 #1
0
        protected virtual void ParseEventValue(XmlElement elm, Node node)
        {
            string        evtName = elm.GetAttribute("name");
            EventProperty evtPro  = node.GetEventProperty(evtName);

            if (evtPro == null)
            {
                UnityEngine.Debug.LogError("can not find event:" + evtName);
                return;
            }
            evtPro.strValue = elm.GetAttribute("value");
            evtPro.param.Clear();
            GlobalEventDef evtDef = editor.GetGlobalEventDef(evtPro.strValue);

            if (evtDef == null)
            {
                UnityEngine.Debug.LogError("can not find event def:" + evtPro.strValue);
                return;
            }
            evtDef.Init(evtPro);
            for (int i = 0; i < editor.globalEventDef.Count; ++i)
            {
                if (editor.globalEventDef[i].name == evtPro.strValue)
                {
                    evtPro.selectIdx = i;
                    return;
                }
            }
        }
コード例 #2
0
        protected virtual void ParseEventParam(GlobalEventDef evtDef, XmlElement elm)
        {
            Param param = new Param();

            param.name = elm.GetAttribute("name");
            param.desc = elm.GetAttribute("desc");

            if (elm.HasAttribute("type"))
            {
                param.type = elm.GetAttribute("type");
            }

            evtDef.paramList.Add(param);
        }
コード例 #3
0
        public void Clone(EventProperty src)
        {
            this.name         = src.name;
            this.desc         = src.desc;
            this.strValue     = src.strValue;
            this.editorParams = src.editorParams;
            this.eventDef     = src.eventDef;
            this.selectIdx    = src.selectIdx;

            param.Clear();
            foreach (ParamProperty srcP in src.param)
            {
                ParamProperty thisP = new ParamProperty();
                thisP.Clone(srcP);
                param.Add(thisP);
            }
        }
コード例 #4
0
        public static void Show(Node node)
        {
            if (node == null)
            {
                lastNode = node;
                return;
            }

            if (lastNode != node)
            {
                GUI.FocusControl("-1");
                lastNode = node;
            }

            for (int i = 0; i < node.property.Count; ++i)
            {
                GUI.SetNextControlName(i.ToString());
                ParamProperty pro = node.property[i];
                pro.parmDef.Draw(pro);
            }

            for (int i = 0; i < node.eventProperty.Count; ++i)
            {
                GUI.SetNextControlName(i.ToString());
                EventProperty pro     = node.eventProperty[i];
                int           lastIdx = pro.selectIdx;
                pro.selectIdx = EditorGUILayout.Popup(pro.desc, pro.selectIdx, NodeFlowEditorWindow.instance.globalEventList);
                if (pro.selectIdx != lastIdx)
                {
                    pro.param.Clear();
                    GlobalEventDef eventDef = NodeFlowEditorWindow.instance.globalEventDef[pro.selectIdx];
                    if (eventDef != null)
                    {
                        eventDef.Init(pro);
                    }
                }

                if (pro.eventDef != null)
                {
                    pro.eventDef.Draw(pro);
                }
            }
        }
コード例 #5
0
        protected virtual void ParseEventDef(XmlElement elm)
        {
            GlobalEventDef evtDef = new GlobalEventDef();

            evtDef.name = elm.GetAttribute("name");
            evtDef.desc = elm.GetAttribute("desc");

            if (elm.HasAttribute("type"))
            {
                evtDef.type = elm.GetAttribute("type");
            }

            if (elm.HasAttribute("value"))
            {
                evtDef.value = elm.GetAttribute("value");
            }

            editor.globalEventDef.Add(evtDef);

            if (!elm.HasChildNodes)
            {
                return;
            }

            XmlNode cfgNode = elm.FirstChild;

            while (cfgNode != null)
            {
                XmlElement cfgElm     = cfgNode as XmlElement;
                string     cfgElmName = cfgElm.Name;

                if (cfgElmName.Equals("param"))
                {
                    ParseEventParam(evtDef, cfgElm);
                }
                else
                {
                    UnityEngine.Debug.LogError("can not parse element :" + cfgElmName);
                }

                cfgNode = cfgNode.NextSibling;
            }
        }