Exemple #1
0
    protected virtual void DrawList(SerializedProperty list, GNewUI.AimEventType evt_type)
    {
        ++EditorGUI.indentLevel;
        showList[(int)evt_type] = EditorGUILayout.Foldout(showList[(int)evt_type], evt_type.ToString() + (evt_type != AimEventType.AnimTransition ? " Events" : "s"));

        if (showList[(int)evt_type])
        {
            EditorGUILayout.BeginVertical("AS TextArea", GUILayout.MinHeight(10f));
            //GUILayout.Label(new GUIContent(evt_type.ToString() + " Events"));

            for (int i = 0; i < list.arraySize; ++i)
            {
                SerializedProperty spi = list.GetArrayElementAtIndex(i);
                if (spi != null)
                {
                    if (DrawItem(i, spi, evt_type))
                    {
                        list.DeleteArrayElementAtIndex(i);
                        break;
                    }
                    GUILayout.Space(2);
                }
            }

            //Add Button
            {
                GUILayout.Space(5);

                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(5);

                if (GUILayout.Button("+", GUILayout.Width(20)))
                {
                    _UIAnim.AddEventBlock(evt_type);
                    return;
                }
                GUILayout.Label(_ct_add);
                GUILayout.EndHorizontal();
                GUILayout.Space(5);
            }
            EditorGUILayout.EndVertical();
        }
        EditorGUI.indentLevel -= 1;
    }
Exemple #2
0
    void CheckItem(int idx, EventBlock item, GNewUI.AimEventType evt_type, ref System.Text.StringBuilder err_msg)
    {
        if (string.IsNullOrEmpty(item.Name))
        {
            err_msg.AppendFormat("A setting with no name appears in {0} [{1}] ", evt_type.ToString(), idx.ToString());
        }
        else if (_UIAnim.IsEventBlockExisted(item.Name, idx, evt_type))
        {
            err_msg.AppendFormat("Name {0} duplicated, in {1} [{2}] \n", item.Name, evt_type.ToString(), idx.ToString());
        }

        if (evt_type == AimEventType.Anim)
        {
            AnimEventBlock aeb = item as AnimEventBlock;
            if (aeb != null)
            {
                if (string.IsNullOrEmpty(aeb.AnimName))
                {
                    err_msg.AppendFormat("Anim Name not set in {0} : {1} \n", evt_type.ToString(), aeb.Name);
                }
                if (aeb.Anim == null)
                {
                    err_msg.AppendFormat("Animation not set in {0} : {1} \n", evt_type.ToString(), aeb.Name);
                }
            }
        }
        if (evt_type == AimEventType.Sound)
        {
            SoundEventBlock seb = item as SoundEventBlock;
            if (seb != null)
            {
                if (string.IsNullOrEmpty(seb.SndPath))
                {
                    err_msg.AppendFormat("Sound Path not set in {0} : {1} \n", evt_type.ToString(), seb.Name);
                }
                if (seb.Node == null)
                {
                    err_msg.AppendFormat("Sound Node not set in {0} : {1} \n", evt_type.ToString(), seb.Name);
                }
            }
        }
        else if (evt_type == AimEventType.Fx)
        {
            FxEventBlock fb = item as FxEventBlock;
            if (fb != null)
            {
                if (string.IsNullOrEmpty(fb.FxPath))
                {
                    err_msg.AppendFormat("Fx Path not set in {0} : {1} \n", evt_type.ToString(), fb.Name);
                }
                if (fb.Hook == null)
                {
                    err_msg.AppendFormat("Fx Hook not set in {0} : {1} \n", evt_type.ToString(), fb.Name);
                }
            }
        }
        else if (evt_type == AimEventType.AnimTransition)
        {
            AnimTransition at = item as AnimTransition;
            if (at.Froms.Length != at.CrossFadeTimes.Length)
            {
                err_msg.AppendFormat("AnimTransition data error ->{0} \n", item.Name);
            }
            if (at != null)
            {
                for (int i = 0; i < at.Froms.Length; i++)
                {
                    if (string.IsNullOrEmpty(at.Froms[i]))
                    {
                        err_msg.AppendFormat("Incomplete AnimTransition appears ? ->{0} \n", item.Name);
                        continue;
                    }

                    for (int k = i + 1; k < at.Froms.Length; k++)
                    {
                        if (at.Froms[k] == at.Froms[i])
                        {
                            err_msg.AppendFormat("AnimTransition {0}->{1} duplicated \n", at.Froms[k], item.Name);
                            break;
                        }
                    }
                }
            }
        }
    }