Ejemplo n.º 1
0
    public void SetPath(GameObject[] gos, ref string[] paths)
    {
        if (gos == null || gos.Length <= 0)
        {
            return;
        }

        paths = new string[gos.Length];

        for (int i = 0; i < gos.Length; i++)
        {
            paths[i] = ControlTools.GetGameObjectPath(gos[i]);
        }
    }
Ejemplo n.º 2
0
    private void DrawBoomUI()
    {
        List <UnsMachineLogic.MachineLogicInfomation.MachineExplode.MachineExplodeMessage> infoMessages = new List <UnsMachineLogic.MachineLogicInfomation.MachineExplode.MachineExplodeMessage>(info.ExplodeInfo.InfoMessage);


        GUILayout.BeginVertical(EditorWindowStyle.levelStyle);

        GUILayout.BeginHorizontal();
        MachineStateUI(str_PropertyName + ".ExplodeInfo.InfoOther", "初始操作", info.ExplodeInfo.InfoOther);
        PropertyField(str_PropertyName + ".ExplodeInfo", "c_animations", "初始动画");
        SetPath(GetGameObject(info.ExplodeInfo.c_animations), ref info.ExplodeInfo.Animations);
        GUILayout.EndHorizontal();

        GUILayout.Box("", EditorWindowStyle.boxLineStyle, GUILayout.Width(fl_LargeBtnWidth), GUILayout.Height(1));

        if (GUILayout.Button("添加爆炸点击操作", EditorWindowStyle.btnStyle, GUILayout.Width(fl_LargeBtnWidth)))
        {
            infoMessages.Add(new UnsMachineLogic.MachineLogicInfomation.MachineExplode.MachineExplodeMessage());

            bl_InfoMessage.Add(false);

            List <CameraPosition> pos = new List <CameraPosition>(cc.logic.AnglePos.ExplodeInfoPos);
            pos.Add(new CameraPosition());
            cc.logic.AnglePos.ExplodeInfoPos = pos.ToArray();
        }

        for (int i = 0; i < infoMessages.Count; i++)
        {
            GUILayout.BeginVertical(EditorWindowStyle.btnFoldoutStyle);

            GUILayout.BeginHorizontal();
            bl_InfoMessage[i] = EditorGUILayout.Foldout(bl_InfoMessage[i], "爆炸信息 " + (i + 1));

            if (GUILayout.Button("-", EditorWindowStyle.btnStyle, GUILayout.Width(fl_normalBtnWidth)))
            {
                infoMessages.RemoveAt(i);
                bl_InfoMessage.RemoveAt(i);

                List <CameraPosition> pos = new List <CameraPosition>(cc.logic.AnglePos.ExplodeInfoPos);
                pos.RemoveAt(i);
                cc.logic.AnglePos.ExplodeInfoPos = pos.ToArray();

                break;
            }
            GUILayout.EndHorizontal();

            if (bl_InfoMessage[i])
            {
                GUILayout.BeginVertical(EditorWindowStyle.levelStyle);

                infoMessages[i].c_go_Collider = EditorGUILayout.ObjectField("碰撞体", infoMessages[i].c_go_Collider, typeof(GameObject), true) as GameObject;
                infoMessages[i].c_go_Model    = EditorGUILayout.ObjectField("模型", infoMessages[i].c_go_Model, typeof(GameObject), true) as GameObject;

                infoMessages[i].Collider = ControlTools.GetGameObjectPath(infoMessages[i].c_go_Collider);
                infoMessages[i].Model    = ControlTools.GetGameObjectPath(infoMessages[i].c_go_Model);

                GUILayout.EndVertical();
            }

            GUILayout.EndVertical();
        }

        GUILayout.EndVertical();
        info.ExplodeInfo.InfoMessage = infoMessages.ToArray();
    }
Ejemplo n.º 3
0
    public override void OnGUI()
    {
        Resize();
        List <UnsMachineLogic.MachineLogicMatch.MachineLogicMatchPlan> plans = new List <UnsMachineLogic.MachineLogicMatch.MachineLogicMatchPlan>(info.Plan);

        GUILayout.BeginVertical(EditorWindowStyle.levelStyle);
        GUILayout.Label("默认设置");

        GUILayout.BeginHorizontal();
        PropertyField(str_PropertyName + ".Other", "c_gos_Transparent", "透明模型");
        SetPath(info.Other.c_gos_Transparent, ref info.Other.Transparent);

        PropertyField(str_PropertyName + ".Other", "c_gos_Entity", "实体模型");
        SetPath(info.Other.c_gos_Entity, ref info.Other.Entity);
        GUILayout.EndHorizontal();

        GUILayout.Box("", EditorWindowStyle.boxLineStyle, GUILayout.Width(fl_LargeBtnWidth), GUILayout.Height(1));

        if (GUILayout.Button("添加选配项", EditorWindowStyle.btnStyle, GUILayout.Width(fl_LargeBtnWidth)))
        {
            plans.Add(new UnsMachineLogic.MachineLogicMatch.MachineLogicMatchPlan());
            bl_PlanStates.Add(false);
            bl_PartStates.Add(new List <bool>());

            List <CameraPosition> pos = new List <CameraPosition>(cc.logic.AnglePos.MatchInfoPos);
            pos.Add(new CameraPosition());
            cc.logic.AnglePos.MatchInfoPos = pos.ToArray();
        }

        for (int i = 0; i < plans.Count; i++)
        {
            GUILayout.BeginVertical(EditorWindowStyle.btnFoldoutStyle);

            GUILayout.BeginHorizontal();
            bl_PlanStates[i] = EditorGUILayout.Foldout(bl_PlanStates[i], "选配项 " + (i + 1));

            if (GUILayout.Button("-", EditorWindowStyle.btnStyle, GUILayout.Width(fl_normalBtnWidth)))
            {
                plans.RemoveAt(i);
                bl_PlanStates.RemoveAt(i);
                bl_PartStates.RemoveAt(i);

                List <CameraPosition> pos = new List <CameraPosition>(cc.logic.AnglePos.MatchInfoPos);
                pos.RemoveAt(i);
                cc.logic.AnglePos.MatchInfoPos = pos.ToArray();

                break;
            }
            GUILayout.EndHorizontal();

            if (bl_PlanStates[i])
            {
                GUILayout.BeginVertical(EditorWindowStyle.levelStyle);

                plans[i].c_go_Transparent = EditorGUILayout.ObjectField("透明模型", plans[i].c_go_Transparent, typeof(GameObject), true, GUILayout.Width(400)) as GameObject;
                plans[i].Transparent      = ControlTools.GetGameObjectPath(plans[i].c_go_Transparent);

                List <UnsMachineLogic.MachineLogicMatch.MachineLogicMatchPlan.MachineLoMatPlPartEntity> partList = new List <UnsMachineLogic.MachineLogicMatch.MachineLogicMatchPlan.MachineLoMatPlPartEntity>();
                if (plans[i].Parts != null)
                {
                    partList.AddRange(plans[i].Parts);
                }

                GUILayout.Box("", EditorWindowStyle.boxLineStyle, GUILayout.Width(fl_LargeBtnWidth), GUILayout.Height(1));
                if (GUILayout.Button("添加选配", EditorWindowStyle.btnStyle, GUILayout.Width(fl_LargeBtnWidth)))
                {
                    partList.Add(new UnsMachineLogic.MachineLogicMatch.MachineLogicMatchPlan.MachineLoMatPlPartEntity());
                    bl_PartStates[i].Add(false);
                }

                for (int j = 0; j < partList.Count; j++)
                {
                    GUILayout.BeginVertical(EditorWindowStyle.btnFoldoutStyle);

                    GUILayout.BeginHorizontal();
                    bl_PartStates[i][j] = EditorGUILayout.Foldout(bl_PartStates[i][j], "选配 " + (j + 1));
                    if (GUILayout.Button("-", EditorWindowStyle.btnStyle, GUILayout.Width(fl_normalBtnWidth)))
                    {
                        partList.RemoveAt(j);
                        bl_PartStates[i].RemoveAt(j);
                        break;
                    }
                    GUILayout.EndHorizontal();
                    if (bl_PartStates[i][j])
                    {
                        GUILayout.BeginVertical(EditorWindowStyle.levelStyle);
                        SerializedObject   obj       = new SerializedObject(base.cc);
                        SerializedProperty property1 = obj.FindProperty("logic");
                        property1 = property1.FindPropertyRelative(str_PropertyName + ".Plan");
                        property1 = property1.GetArrayElementAtIndex(i);
                        property1 = property1.FindPropertyRelative("Parts");
                        property1 = property1.GetArrayElementAtIndex(j);
                        property1 = property1.FindPropertyRelative("c_gos_Entity");
                        //PropertyField(new string[] { str_PropertyName + ".Plan", "Parts" }, new int[] { i, j }, "gos_Entity", "选配模型");
                        //SerializedObject obj = new SerializedObject(logic);
                        //SerializedProperty property1 = obj.FindProperty(str_PropertyName + ".Plan");
                        //property1= property1.GetArrayElementAtIndex(i);
                        //property1 = property1.FindPropertyRelative("Parts");
                        //property1 = property1.GetArrayElementAtIndex(j);
                        //property1 = property1.FindPropertyRelative("gos_Entity");

                        EditorGUILayout.PropertyField(property1.FindPropertyRelative("Array.size"));
                        for (int k = 0; k < property1.arraySize; k++)
                        {
                            EditorGUILayout.PropertyField(property1.GetArrayElementAtIndex(k));
                        }
                        obj.ApplyModifiedProperties();

                        SetPath(partList[j].c_gos_Entity, ref partList[j].Entity);
                        GUILayout.EndVertical();
                    }


                    GUILayout.EndVertical();
                }

                plans[i].Parts = partList.ToArray();


                GUILayout.EndVertical();
            }

            GUILayout.EndVertical();
        }


        GUILayout.EndVertical();

        info.Plan = plans.ToArray();

        EndResize();
    }
Ejemplo n.º 4
0
    private void DrawAnimationMainUI(int index)
    {
        UnsMachineLogic.MachineLogicMainInfo.AnimationMain anim = animList[index];

        GUILayout.BeginHorizontal();
        bl_AnimToggle[index] = EditorGUILayout.Foldout(bl_AnimToggle[index], "动画 " + index);
        if (GUILayout.Button("-", EditorWindowStyle.btnStyle, GUILayout.Width(120)))
        {
            animList.Remove(anim);
            bl_AnimToggle.RemoveAt(index);

            return;
        }

        GUILayout.EndHorizontal();

        if (bl_AnimToggle[index])
        {
            GUILayout.BeginHorizontal(EditorWindowStyle.levelStyle);
            anim.c_go_Collider =
                EditorGUILayout.ObjectField("动画碰撞体", anim.c_go_Collider, typeof(GameObject), true, GUILayout.Width(350)) as GameObject;
            anim.Collider = ControlTools.GetGameObjectPath(anim.c_go_Collider);

            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            if (anim.c_animations == null)
            {
                anim.c_animations = new Animation[0];
            }
            if (anim.Anims == null)
            {
                anim.Anims = new string[0];
            }

            if (GUILayout.Button("动画", EditorWindowStyle.btnStyle, GUILayout.Width(120)))
            {
                List <Animation> anims = new List <Animation>(anim.c_animations);
                anims.Add(new Animation());
                anim.c_animations = anims.ToArray();

                List <string> animPaths = new List <string>(anim.Anims);
                animPaths.Add("");
                anim.Anims = animPaths.ToArray();

                animStateList.Add(false);
            }
            GUILayout.EndHorizontal();

            for (int i = 0; i < anim.c_animations.Length; i++)
            {
                GUILayout.BeginHorizontal();
                anim.c_animations[i] = EditorGUILayout.ObjectField("动画 " + i, anim.c_animations[i], typeof(Animation), true) as Animation;
                anim.Anims[i]        = anim.c_animations[i] == null ? "" : ControlTools.GetGameObjectPath(anim.c_animations[i].gameObject);

                if (GUILayout.Button("-", EditorWindowStyle.btnStyle, GUILayout.Width(60)))
                {
                    List <Animation> anims = new List <Animation>(anim.c_animations);
                    anims.RemoveAt(i);
                    anim.c_animations = anims.ToArray();


                    List <string> animPaths = new List <string>(anim.Anims);
                    animPaths.RemoveAt(i);
                    anim.Anims = animPaths.ToArray();

                    animStateList.RemoveAt(i);
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();

            GUILayout.EndHorizontal();
        }
    }