示例#1
0
 protected void CloneData(ICharacterActionData action_data, CharacterAction_EffectBase new_effect)
 {
     new_effect.m_ActionData           = action_data;
     new_effect.time                   = this.time;
     new_effect.particle_system_prefab = this.particle_system_prefab;
     new_effect.particle_position      = this.particle_position;
     new_effect.particle_scale         = this.particle_scale;
     if (action_data == null)
     {
         new_effect.sound_list = this.sound_list.ToArray();
     }
     else
     {
         new_effect.sound_list = this.sound_list;
     }
     new_effect.sound_tick  = this.sound_tick;
     new_effect.sound_count = this.sound_count;
     new_effect.sound_loop  = this.sound_loop;
 }
示例#2
0
    virtual public void OnInspectorItem(int index, CharacterAction_EffectBase selected)
    {
        EditorGUILayout.BeginVertical();

        EditorGUILayout.BeginHorizontal();
        EditorGUIUtility.labelWidth = 40f;
        selected.IsEnable           = EditorGUILayout.Toggle(selected.IsEnable, GUILayout.Width(20f));
        selected.time = EditorGUILayout.FloatField("Time", selected.time, GUILayout.Width(100f));
        EditorGUIUtility.labelWidth     = 50f;
        selected.particle_system_prefab = EditorGUILayout.ObjectField("Particle", selected.particle_system_prefab, typeof(HFX_ParticleSystem), false) as HFX_ParticleSystem;
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();
        selected.particle_position  = EditorGUILayout.Vector3Field("Pos", selected.particle_position);
        selected.particle_scale     = EditorGUILayout.Vector3Field("Scale", selected.particle_scale);
        EditorGUIUtility.labelWidth = 0f;
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUIUtility.labelWidth = 40f;
        if (selected.sound_list == null || selected.sound_list.Length == 0)
        {
            selected.sound_list    = new SoundInfo[1];
            selected.sound_list[0] = new SoundInfo();
        }

        if (GUILayout.Button("+", GUILayout.Width(22f)))
        {
            Array.Resize(ref selected.sound_list, selected.sound_list.Length + 1);
            selected.sound_list[selected.sound_list.Length - 1] = new SoundInfo();
        }

        EditorGUIUtility.labelWidth  = 40f;
        selected.sound_list[0].sound = EditorGUILayout.ObjectField("Sound", selected.sound_list[0].sound, typeof(AudioClip), false) as AudioClip;
        selected.sound_list[0].time  = EditorGUILayout.FloatField("Time", selected.sound_list[0].time, GUILayout.Width(90f));
        selected.sound_count         = 1;
        selected.sound_tick          = 0;
//        selected.sound_count = EditorGUILayout.IntField("Count", selected.sound_count, GUILayout.Width(90f));
//        selected.sound_tick = EditorGUILayout.FloatField("Tick", selected.sound_tick, GUILayout.Width(90f));
        selected.sound_loop = EditorGUILayout.Toggle("Loop", selected.sound_loop, GUILayout.Width(90f));

        EditorGUILayout.EndHorizontal();
//        EditorGUILayout.EndVertical();

        int remove_index = -1;

        if (selected.sound_list != null && selected.sound_list.Length > 1)
        {
            for (int i = 1; i < selected.sound_list.Length; ++i)
            {
                SoundInfo info = selected.sound_list[i];

                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("-", GUILayout.Width(22f)))
                {
                    remove_index = i;
                }

                info.sound = EditorGUILayout.ObjectField("Sound", info.sound, typeof(AudioClip), false) as AudioClip;
                info.time  = EditorGUILayout.FloatField("Time", info.time, GUILayout.Width(70f));
                EditorGUILayout.EndHorizontal();
            }
        }
        if (remove_index != -1)
        {
            List <SoundInfo> temp_list = new List <SoundInfo>(selected.sound_list);
            temp_list.RemoveAt(remove_index);
            selected.sound_list = temp_list.ToArray();
        }

        EditorGUIUtility.labelWidth = 0f;
        EditorGUILayout.EndVertical();
    }