Пример #1
0
 public override void ParseXml(XmlElement node)
 {
     effectType = node.GetAttribute("effectType").ToEnumEx <EffectType>();
     arise      = node.GetAttribute("arise").ToEnumEx <EffectArise>();
     on         = node.GetAttribute("on").ToEnumEx <EffectOn>();
     asset      = node.GetAttribute("asset");
     delay      = node.GetAttribute("delay").ToFloatEx();
     offset     = node.GetAttribute("offset").ToVector3Ex();
     base.ParseXml(node);
 }
Пример #2
0
    public override void OnDraw(ref Rect r)
    {
        base.OnDraw(ref r);
        UnityEditor.EditorGUILayout.LabelField("EffectType", effectType.ToString());
        r.height += 20;

        if (parent != null)
        {
            if (parent.GetType() == typeof(EntityParamAnimation))
            {
                arise = EffectArise.ParentBegin;
            }
            else if (parent.GetType() == typeof(EntityParamEffectTime))
            {
                arise     = (EffectArise)UnityEditor.EditorGUILayout.EnumPopup("Arise", arise);
                r.height += 20;
                if (arise == EffectArise.ParentTrigger)
                {
                    arise = EffectArise.ParentBegin;
                }
            }
            else
            {
                arise     = (EffectArise)UnityEditor.EditorGUILayout.EnumPopup("Arise", arise);
                r.height += 20;
            }
        }
        else
        {
            arise     = (EffectArise)UnityEditor.EditorGUILayout.EnumPopup("Arise", arise);
            r.height += 20;
        }
        on        = (EffectOn)UnityEditor.EditorGUILayout.EnumPopup("On", on);
        r.height += 20;
        asset     = UnityEditor.EditorGUILayout.TextField("Asset", asset);
        r.height += 20;

        if (mPrefab == null && string.IsNullOrEmpty(asset) == false)
        {
            string path = string.Format("assets/resources/r/spell_fx/{0}", asset);
            mPrefab = UnityEditor.AssetDatabase.LoadAssetAtPath <GameObject>(path);
            if (mPrefab == null)
            {
                path    = string.Format("assets/r/spell_fx/{0}", asset);
                mPrefab = UnityEditor.AssetDatabase.LoadAssetAtPath <GameObject>(path);
            }
        }

        var obj = (GameObject)UnityEditor.EditorGUILayout.ObjectField("Prefab", mPrefab, typeof(UnityEngine.GameObject), false, new GUILayoutOption[0]);

        if (obj != null && obj != mPrefab)
        {
            asset   = obj.name + ".prefab";
            mPrefab = obj;
        }
        r.height += 20;
        delay     = Mathf.Clamp(UnityEditor.EditorGUILayout.FloatField("Delay", delay), 0, float.MaxValue);
        r.height += 20;

        offset    = UnityEditor.EditorGUILayout.Vector3Field("Offset", offset);
        r.height += 30;
    }