コード例 #1
0
        private void DrawSkillAudio(float width, float height)
        {
            EDLayout.CreateScrollView(ref audioPos, "", width, height, (float wid, float hei) =>
            {
                //音效列表
                for (int i = 0; i < SelSkill.Audios.Count; i++)
                {
                    EDLayout.CreateVertical("GroupBox", wid * 0.9f, 55, (float wid01, float hei01) => {
                        int selIndex    = i;
                        object conValue = SelSkill.Audios[i].Time;
                        EDTypeField.CreateTypeField("音效播放时间:", ref conValue, typeof(double), wid01, 25);
                        SelSkill.Audios[i].Time = double.Parse(conValue.ToString());

                        //音效Id
                        object idValue = SelSkill.Audios[i].AudioId;
                        EDTypeField.CreateTypeField("音效Id:", ref idValue, typeof(int), wid01, 25);
                        SelSkill.Audios[i].AudioId = int.Parse(idValue.ToString());

                        EDButton.CreateBtn("删除音效", wid01, 25, () => {
                            SelSkill.Audios.RemoveAt(selIndex);
                        });
                    });
                }

                EDButton.CreateBtn("添加音效", wid * 0.9f, 25, () => {
                    SelSkill.Audios.Add(new SkillAudioJson());
                });
            });
        }
コード例 #2
0
 private void DrawSkillList(float width, float height)
 {
     EDLayout.CreateScrollView(ref LeftPos, "", width, height, () =>
     {
         for (int i = 0; i < Json.List.Count; i++)
         {
             SkillJson skill = Json.List[i];
             EDButton.CreateBtn(skill.Id, 180, 25, () =>
             {
                 SelSkillChange(skill);
             });
         }
         //添加技能
         EDButton.CreateBtn("新建技能", 180, 30, () =>
         {
             EDPopPanel.PopWindow("输入技能Id>>>>>>", (x) =>
             {
                 if (CheckContainSkill(x))
                 {
                     Debug.LogError("技能Id重复>>>>>>>>>>>>" + x);
                     return;
                 }
                 int skillId    = int.Parse(x);
                 SkillJson json = new SkillJson
                 {
                     Id = skillId,
                 };
                 Json.List.Add(json);
             });
         });
     });
 }
コード例 #3
0
        private void DrawSkillEffect(float width, float height)
        {
            EDLayout.CreateScrollView(ref effectPos, "", width, height, (float wid, float hei) =>
            {
                EDLayout.CreateVertical("GroupBox", wid * 0.9f, 55, (float wid01, float hei01) => {
                    //特效列表
                    for (int i = 0; i < SelSkill.Effects.Count; i++)
                    {
                        int selIndex    = i;
                        object conValue = SelSkill.Effects[i].Time;
                        EDTypeField.CreateTypeField("特效播放时间:", ref conValue, typeof(double), wid01, 25);
                        SelSkill.Effects[i].Time = double.Parse(conValue.ToString());

                        //特效Id
                        object idValue = SelSkill.Effects[i].EffectId;
                        EDTypeField.CreateTypeField("特效Id:", ref idValue, typeof(int), wid01, 25);
                        SelSkill.Effects[i].EffectId = int.Parse(idValue.ToString());

                        //特效位置
                        object value = LCConvert.StrChangeToObject(SelSkill.Effects[i].Pos, typeof(Vector3).FullName);
                        EDTypeField.CreateTypeField("特效位置:", ref value, typeof(Vector3), width, 25);
                        SelSkill.Effects[i].Pos = value.ToString();

                        EDButton.CreateBtn("删除特效", wid01, 25, () => {
                            SelSkill.Effects.RemoveAt(selIndex);
                        });
                    }
                });

                EDButton.CreateBtn("添加特效", wid * 0.9f, 25, () => {
                    SelSkill.Effects.Add(new SkillEffectJson());
                });
            });
        }
コード例 #4
0
        private void RefreshPanel()
        {
            //左侧列表
            EDLayout.CreateVertical("box", position.width, position.height, () =>
            {
                //编辑界面切换
                EDLayout.CreateHorizontal("box", position.width, 40, (() =>
                {
                    EDButton.CreateBtn("决策层", 100, 20, (() => { ShowDec = true; SaveJson(); showNodeEditor.Clear(); }));

                    EDButton.CreateBtn("行为层", 100, 20, (() => { ShowDec = false; SaveJson(); showNodeEditor.Clear(); }));

                    DrawSelNodePremise(position.width - 200, 40);
                }));

                //界面刷新
                EDLayout.CreateHorizontal("box", position.width, position.height - 40, (() =>
                {
                    if (ShowDec)
                    {
                        DrawDecTreeList();
                    }
                    else
                    {
                        DrawBevTreeList();
                    }
                }));
            });

            //右侧节点
            RefreshRightPanel();
        }
コード例 #5
0
        //行为层
        private void DrawBevTreeList()
        {
            //列表
            EDLayout.CreateScrollView(ref leftPos, "box", position.width * 0.3f, position.height, () =>
            {
                EDTypeField.CreateLableField("********世界行为********", "", position.width * 0.3f, 20);
                foreach (string group in MBevTrees.WorldTrees.Keys)
                {
                    NodeDataJson tree = MBevTrees.WorldTrees[group];
                    EDButton.CreateBtn(group, position.width * 0.28f, 25, () =>
                    {
                        SelTreeChange(tree);
                    });
                }

                EDTypeField.CreateLableField("********实体行为********", "", position.width * 0.3f, 20);
                foreach (string group in MBevTrees.EntityTrees.Keys)
                {
                    NodeDataJson tree = MBevTrees.EntityTrees[group];
                    EDButton.CreateBtn(group, position.width * 0.28f, 25, () =>
                    {
                        SelTreeChange(tree);
                    });
                }
            });
        }
コード例 #6
0
        private void DrawSkillData(float width, float height)
        {
            EDLayout.CreateScrollView(ref dataPos, "", width, height, (float wid, float hei) =>
            {
                for (int i = 0; i < SelSkill.Data.Count; i++)
                {
                    EDLayout.CreateVertical("GroupBox", wid * 0.9f, 55, (float wid01, float hei01) =>
                    {
                        int selIndex           = i;
                        SkillDataJson dataJson = SelSkill.Data[i];

                        //时间信息
                        EDLayout.CreateHorizontal("box", wid01, 25, (float wid02, float hei02) =>
                        {
                            //作用时间
                            object timeValue = dataJson.Time;
                            EDTypeField.CreateTypeField("作用时间:", ref timeValue, typeof(double), 220, 25);
                            dataJson.Time = double.Parse(timeValue.ToString());

                            //持续时间
                            object continueTimeValue = dataJson.ContinueTime;
                            EDTypeField.CreateTypeField("持续时间:", ref continueTimeValue, typeof(double), 220, 25);
                            dataJson.ContinueTime = double.Parse(continueTimeValue.ToString());

                            //间隔时间
                            object gapTimeValue = dataJson.GapTime;
                            EDTypeField.CreateTypeField("间隔时间:", ref gapTimeValue, typeof(double), 220, 25);
                            dataJson.GapTime = double.Parse(gapTimeValue.ToString());
                        });

                        //技能枚举
                        EDLayout.CreateHorizontal("box", wid01, 25, (float wid02, float hei02) =>
                        {
                            //技能类型
                            dataJson.Type = (SkillType)EditorGUILayout.EnumPopup("技能类型:", dataJson.Type, GUILayout.Width(220), GUILayout.Height(25));

                            //技能作用类型
                            dataJson.UseType = (SkillUseType)EditorGUILayout.EnumPopup("作用类型:", dataJson.UseType, GUILayout.Width(220), GUILayout.Height(25));

                            //数据类型
                            dataJson.DataType = (SkillDataType)EditorGUILayout.EnumPopup("数据类型:", dataJson.DataType, GUILayout.Width(220), GUILayout.Height(25));
                        });

                        //数据
                        object data = dataJson.Data;
                        EDTypeField.CreateTypeField("数据:", ref data, typeof(String), 220, 20);
                        dataJson.Data = data.ToString();

                        EDButton.CreateBtn("删除数据", wid01, 20, () => {
                            SelSkill.Data.RemoveAt(selIndex);
                        });
                    });
                }

                EDButton.CreateBtn("添加数据", wid * 0.9f, 25, () => {
                    SelSkill.Data.Add(new SkillDataJson());
                });
            });
        }
コード例 #7
0
        private void DrawAnimList(float width, float height)
        {
            if (SelSkill == null)
            {
                return;
            }
            EDLayout.CreateVertical("", width, height, (float wid, float hei) =>
            {
                if (SelSkill.AnimClips.Count != 0)
                {
                    EDLayout.CreateScrollView(ref animPos, "box", wid, hei * 0.7f, (float wid01, float hei01) =>
                    {
                        //动画列表
                        for (int i = 0; i < SelSkill.AnimClips.Count; i++)
                        {
                            int selIndex = i;
                            if (CheckAnimatorHasClip(SelAnim, SelSkill.AnimClips[i].AnimName))
                            {
                                EDLayout.CreateHorizontal("box", 210, 30, (float wid02, float hei02) =>
                                {
                                    EDTypeField.CreateLableField(string.Format("动画名:{0}", SelSkill.AnimClips[i].AnimName), "", wid02 * 0.7f, hei02);
                                    EDButton.CreateBtn("删除动画", wid02 * 0.3f, hei02, () => {
                                        SelSkill.AnimClips.RemoveAt(selIndex);
                                        UpdateAnimClipsTime();
                                    });
                                });
                            }
                            else
                            {
                                SelSkill.AnimClips.RemoveAt(selIndex);
                                UpdateAnimClipsTime();
                            }
                        }
                    });
                }

                //添加动画
                if (RunningClip.Count == 0)
                {
                    return;
                }
                List <string> showClips = new List <string>();
                for (int i = 0; i < RunningClip.Count; i++)
                {
                    showClips.Add(RunningClip[i].name);
                }
                EDButton.CreateBtn("添加动画", 180, 25, () => {
                    EDPopMenu.CreatePopMenu(showClips, (string str) =>
                    {
                        SkillAnimJson animJson = new SkillAnimJson();
                        animJson.AnimName      = str;
                        SelSkill.AnimClips.Add(animJson);
                        UpdateAnimClipsTime();
                    });
                });
            });
        }
コード例 #8
0
 private void OnGUI()
 {
     EDLayout.CreateHorizontal("box", position.width, position.height, (float weight, float height) =>
     {
         DrawSkillList(200, height);
         DrawSkill(770, height);
         DrawAnimList(230, height);
     });
 }
コード例 #9
0
    private void OnGUI()
    {
        EDLayout.CreateScrollView(ref ScPos, "box", position.width, position.height, (width, height) => {
            EDTypeField.CreateLableField("", "------------ UpdateSystem ------------", width, 30);
            ShowSystemList(true, width);

            EDTypeField.CreateLableField("", "------------ FixedSystem ------------", width, 30);
            ShowSystemList(false, width);
        });
    }
コード例 #10
0
 private void OnGUI()
 {
     EDLayout.CreateVertical("box", position.width, position.height, () =>
     {
         //界面刷新
         EDLayout.CreateHorizontal("box", position.width, position.height - 20, (() =>
         {
             DrawEntityJsonList();
         }));
     });
 }
コード例 #11
0
 private void DrawSelNodePremise(float width, float height)
 {
     if (selNode == null)
     {
         return;
     }
     if (selNode.Json.Premise == null)
     {
         return;
     }
     EDLayout.CreateScrollView(ref nodePremisePos, "box", width, height, () =>
     {
         NodePremiseJson premiseJson = selNode.Json.Premise;
         CreatePremiseBtn(premiseJson);
     });
 }
コード例 #12
0
        private void OnGUI()
        {
            EDLayout.CreateHorizontal("box", position.width, position.height, RefreshPanel);

            ProcessNodeEvents(Event.current);

            ProcessEvents(Event.current);

            curMousePos = Event.current.mousePosition;
            // if (GUI.changed)
            // {
            //
            // }

            bgGridRect = new Rect(new Vector2(position.width * 0.25f, 0), new Vector2(position.width * 0.75f, position.height));
            Repaint();
        }
コード例 #13
0
        private void DrawEditorNodeKeyValue()
        {
            EDLayout.CreateScrollView(ref valuePos, "", mRect.width, mRect.height, ((width, height) =>
            {
                //可编辑键值
                for (int j = 0; j < Json.KeyValues.Count; j++)
                {
                    NodeKeyValue keyValue = Json.KeyValues[j];

                    object value = LCConvert.StrChangeToObject(keyValue.Value, keyValue.TypeFullName);
                    Type ty = LCReflect.GetType(keyValue.TypeFullName);
                    EDTypeField.CreateTypeField(keyValue.KeyName + "= ", ref value, ty, width - 10, 20);

                    keyValue.Value = value.ToString();
                }
            }));
        }
コード例 #14
0
        //画节点
        private void RefreshRightPanel()
        {
            if (selTree == null)
            {
                return;
            }

            EDLayout.DrawGrid(20, 0.2f, Color.gray, bgGridRect, ref offset, drag);
            BeginWindows();
            for (int i = 0; i < showNodeEditor.Count; i++)
            {
                showNodeEditor[i].Draw();
            }
            EndWindows();

            DrawConnectLine();
            //RefreshNodeLines();
        }
コード例 #15
0
ファイル: ECSEditorScene.cs プロジェクト: ALunGame/LCECS
        /// <summary>
        /// 渲染实体观察系统列表
        /// </summary>
        private static void DrawEntitySystem(bool isShow, List <string> systems, float width, float height)
        {
            if (isShow == false)
            {
                return;
            }

            EDLayout.CreateScrollView(ref SystemScrollPos, "GroupBox", width, height, () =>
            {
                for (int i = 0; i < systems.Count; i++)
                {
                    string systemName = systems[i];
                    EditorGUILayout.Space();
                    GUI.color = Color.green;
                    //组件名
                    EditorGUILayout.LabelField("观察系统:", systemName, GUILayout.Width(width), GUILayout.Height(20));
                }
            });
        }
コード例 #16
0
        //组件编辑界面
        private void ShowSelComWindow(float width, float height)
        {
            List <EntityComValueJson> values = UpdateSelComEditorValues();

            EDLayout.CreateScrollView(ref ComValuePos, "Box", width, height, () =>
            {
                for (int i = 0; i < values.Count; i++)
                {
                    EntityComValueJson comView = values[i];
                    Type resType = null;
                    resType      = LCReflect.GetType(comView.Type);
                    if (resType == null)
                    {
                        resType = LCReflect.GetType(comView.Type);
                    }
                    object value = LCConvert.StrChangeToObject(comView.Value, resType.FullName);
                    EDTypeField.CreateTypeField(comView.Name + "= ", ref value, resType, width, 40);
                    SetSelComJson(comView.Name, value.ToString());
                }
            });
        }
コード例 #17
0
ファイル: MapSeekWindow.cs プロジェクト: ALunGame/LCECS
        private void OnGUI()
        {
            EDLayout.CreateVertical("box", position.width, position.height, () => {
                SelMap    = (MapData)EditorGUILayout.ObjectField(SelMap, typeof(MapData), true);
                CurPos    = (Vector2Int)EditorGUILayout.Vector2IntField("当前位置", CurPos);
                TargetPos = (Vector2Int)EditorGUILayout.Vector2IntField("目标位置", TargetPos);

                EDButton.CreateBtn("寻路", 100, 50, () => {
                    //Debug.LogWarningFormat("寻路({0},{1} ==> ({2},{3}))",CurPos.x,CurPos.y,TargetPos.x,TargetPos.y);
                    Path = AstarHelp.FindPath(CurPos, TargetPos, SelMap.ObstaclePos);
                    //Debug.LogWarningFormat("找到 {0} 路径点",Path.Count);
                });


                EDButton.CreateBtn("道路寻路", 100, 50, () => {
                    //Debug.LogWarningFormat("道路寻路({0},{1} ==> ({2},{3}))",CurPos.x,CurPos.y,TargetPos.x,TargetPos.y);
                    Path = AstarHelp.FindPath(CurPos, TargetPos, SelMap.ObstaclePos, SelMap.RoadPos);
                    //Debug.LogWarningFormat("找到 {0} 路径点",Path.Count);
                });

                EditorGUILayout.Space();

                if (SelMap != null)
                {
                    for (int y = TempConfig.MapSizeY - 1; y >= 0; y--)
                    {
                        EDLayout.CreateHorizontal("box", BoxSize * TempConfig.MapSizeY, BoxSize, () => {
                            for (int x = 0; x < TempConfig.MapSizeX; x++)
                            {
                                // Color showColor = GetShowTextColor(x,y);
                                // GUI.color=showColor;
                                // string pos=string.Format("{0},{1}",x,y);
                                Texture showImg = GetBoxShowImg(x, y);
                                GUILayout.Box(new GUIContent(showImg), GUILayout.Height(BoxSize), GUILayout.Width(BoxSize));
                            }
                        });
                    }
                }
            });
        }
コード例 #18
0
ファイル: ECSEditorScene.cs プロジェクト: ALunGame/LCECS
        /// <summary>
        /// 渲染实体组件列表
        /// </summary>
        private static void DrawEntityComs(bool isShow, List <EntityComView> comViews, float width, float height)
        {
            if (isShow == false)
            {
                return;
            }
            EDLayout.CreateScrollView(ref ScrollPos, "GroupBox", width, height, () =>
            {
                for (int i = 0; i < comViews.Count; i++)
                {
                    EntityComView comView = comViews[i];
                    EditorGUILayout.Space();
                    GUI.color = Color.green;
                    //组件名
                    EditorGUILayout.LabelField("组件:", comView.ComName, GUILayout.Width(width), GUILayout.Height(20));

                    //可编辑键值
                    for (int j = 0; j < comView.EditorValueList.Count; j++)
                    {
                        GUI.color            = Color.red;
                        ComKeyValueView info = comView.EditorValueList[j];
                        object valueObj      = info.Info.GetValue(info.Com);
                        EDTypeField.CreateTypeField(info.KeyName + "= ", ref valueObj, info.Info.FieldType, width, 20);
                        LCReflect.SetTypeFieldValue(info.Com, info.KeyName, valueObj);
                    }

                    //只读值
                    for (int j = 0; j < comView.ValueList.Count; j++)
                    {
                        GUI.color            = Color.white;
                        ComKeyValueView info = comView.ValueList[j];
                        object valueObj      = info.Info.GetValue(info.Com);
                        EDTypeField.CreateLableField(info.KeyName + "= ", valueObj.ToString(), width, 20);
                    }
                }
            });
        }
コード例 #19
0
        private void DrawReqList()
        {
            EDLayout.CreateScrollView(ref reqPos, "box", position.width, position.height - 20, (() =>
            {
                List <int> showList = GetWeightList();
                for (int i = 0; i < showList.Count; i++)
                {
                    int key = showList[i];
                    string reqName = GetReqIdName(key);

                    WeightJson json = GetReqWeightJson(key);
                    object value = json.Weight;
                    EDTypeField.CreateTypeField(reqName, ref value, typeof(int), position.width, 20);
                    json.Weight = (int)value;

                    EDButton.CreateBtn("强制置换请求权重", 200, 25, (() => { json.Weight = ECSDefinition.REForceSwithWeight; }));

                    EDButton.CreateBtn("请求自身判断置换请求权重", 200, 25, (() => { json.Weight = ECSDefinition.RESwithRuleSelf; }));

                    EDTypeField.CreateLableField("------------------------", "", position.width, 10);
                    EditorGUILayout.Space();
                }
            }));
        }
コード例 #20
0
        private void OnGUI()
        {
            EDLayout.CreateVertical("box", position.width, position.height, () =>
            {
                //编辑界面切换
                EDLayout.CreateHorizontal("box", position.width, 20, (() =>
                {
                    EDButton.CreateBtn("实体请求", 100, 20, (() =>
                    {
                        SaveReqJson();
                        ShowEntityReq = true;
                    }));

                    EDButton.CreateBtn("世界请求", 100, 20, (() =>
                    {
                        SaveReqJson();
                        ShowEntityReq = false;
                    }));
                }));

                //界面刷新
                EDLayout.CreateHorizontal("box", position.width, position.height - 20, (DrawReqList));
            });
        }
コード例 #21
0
        //渲染实体列表
        private void DrawEntityJsonList()
        {
            //实体列表
            EDLayout.CreateScrollView(ref LeftPos, "box", position.width * 0.2f, position.height, (float width, float height) =>
            {
                for (int i = 0; i < MEntityJsonList.List.Count; i++)
                {
                    EntityJson entity = MEntityJsonList.List[i];
                    EDButton.CreateBtn(entity.EntityName, width, 25, () =>
                    {
                        SelEntityChange(entity);
                    });
                }

                //添加实体
                EDButton.CreateBtn("新建实体", width, 30, () =>
                {
                    EDPopPanel.PopWindow("输入实体名>>>>>>", (x) =>
                    {
                        if (CheckContainEntity(x))
                        {
                            Debug.LogError("实体名重复>>>>>>>>>>>>" + x);
                            return;
                        }
                        EntityJson json = new EntityJson();
                        json.EntityName = x;

                        //默认添加Go组件
                        EntityComJson goComJson = new EntityComJson()
                        {
                            ComName = "LCECS.Core.ECS.GameObjectCom",
                        };
                        json.Coms.Add(goComJson);

                        MEntityJsonList.List.Add(json);
                        SelEntityChange(json);
                    });
                });
            });

            //编辑实体
            EDLayout.CreateVertical("box", position.width * 0.4f, position.height, (float width, float height) =>
            {
                if (SelEntity != null)
                {
                    ShowSelEntityWindow(width);
                }
            });

            //实体预览
            EDLayout.CreateVertical("box", position.width * 0.3f, position.height, (float width, float height) =>
            {
                if (EntityEditor != null)
                {
                    EntityEditor.DrawPreview(GUILayoutUtility.GetRect(300, 200));
                }

                //实体编辑
                if (SelCom != null)
                {
                    ShowSelComWindow(width, position.height * 0.5f);
                }
            });
        }
コード例 #22
0
        //实体编辑界面
        private void ShowSelEntityWindow(float width)
        {
            //基础配置只读
            EDTypeField.CreateLableField("实体名:", SelEntity.EntityName, width, 20);

            object tipobj = SelEntity.TipStr;

            EDTypeField.CreateTypeField("描述信息:", ref tipobj, typeof(string), width, 20);
            SelEntity.TipStr = tipobj.ToString();

            //决策分组
            SelEntity.Group = (EntityDecGroup)EditorGUILayout.EnumPopup("实体决策分组", SelEntity.Group);
            EditorGUILayout.Space();

            //预制体路径
            EditorGUILayout.LabelField("选择预制体:");
            GameObject prefab = null;

            prefab = EditorGUILayout.ObjectField(prefab, typeof(GameObject), false) as GameObject;
            if (prefab != null)
            {
                SelEntity.PrefabPath = AssetDatabase.GetAssetPath(prefab);
            }
            EditorGUILayout.LabelField("预制体路径:");
            EditorGUILayout.LabelField(SelEntity.PrefabPath, "", "box");
            EditorGUILayout.Space();

            //组件列表
            EditorGUILayout.LabelField("组件列表:");
            EDLayout.CreateScrollView(ref ComListPos, "box", width, 150, () => {
                for (int i = 0; i < SelEntity.Coms.Count; i++)
                {
                    //按钮名
                    string btnName = SelEntity.Coms[i].ComName;
                    Type comType   = LCReflect.GetType(SelEntity.Coms[i].ComName);
                    if (comType != null)
                    {
                        ComAttribute comAttribute = LCReflect.GetTypeAttr <ComAttribute>(comType);
                        if (comAttribute != null)
                        {
                            btnName = comAttribute.ViewName;
                        }
                    }
                    else
                    {
                        SelEntity.Coms.RemoveAt(i);
                        continue;
                    }

                    EDButton.CreateBtn(btnName, width * 0.8f, 20, () =>
                    {
                        int comIndex = i;
                        EDPopMenu.CreatePopMenu(new List <string>()
                        {
                            "编辑组件", "删除组件"
                        }, (int index) =>
                        {
                            if (index == 0)
                            {
                                SelCom = LCReflect.GetType(SelEntity.Coms[comIndex].ComName);
                            }
                            else if (index == 1)
                            {
                                SelEntity.Coms.RemoveAt(comIndex);
                            }
                        });
                    });
                    EditorGUILayout.Space();
                }
            });

            //添加组件
            EDButton.CreateBtn("添加组件", 200, 50, () =>
            {
                List <Type> comTyps    = LCReflect.GetClassByType <BaseCom>();
                List <string> showList = new List <string>();
                List <Type> showTyps   = new List <Type>();
                for (int j = 0; j < comTyps.Count; j++)
                {
                    if (CheckContainCom(comTyps[j].FullName))
                    {
                        continue;
                    }
                    showTyps.Add(comTyps[j]);
                    ComAttribute comAttribute = LCReflect.GetTypeAttr <ComAttribute>(comTyps[j]);
                    if (comAttribute != null)
                    {
                        if (comAttribute.GroupName == "")
                        {
                            comAttribute.GroupName = "Default";
                        }
                        showList.Add(comAttribute.GroupName + "/" + comAttribute.ViewName);
                    }
                    else
                    {
                        showList.Add(comTyps[j].FullName);
                    }
                }

                EDPopMenu.CreatePopMenu(showList, (int index) =>
                {
                    Type comType = showTyps[index];
                    if (CheckContainCom(comType.FullName))
                    {
                        Debug.LogError("重复的组件>>>>>>>>" + comType.FullName);
                        return;
                    }

                    EntityComJson comJson = new EntityComJson()
                    {
                        ComName = comType.FullName,
                    };
                    SelEntity.Coms.Add(comJson);
                });
            });

            //保存配置
            EDButton.CreateBtn("保存配置", 200, 50, SaveEntityJsonList);

            //删除实体
            EDButton.CreateBtn("删除实体", 200, 30, () =>
            {
                EDDialog.CreateDialog("删除", "确认删除该实体吗?", (() =>
                {
                    MEntityJsonList.List.Remove(SelEntity);
                    SelEntityChange(null);
                }));
            });
        }
コード例 #23
0
        private void DrawSkill(float width, float height)
        {
            if (SelSkill == null)
            {
                return;
            }

            EDLayout.CreateVertical("box", width, height, (float wid, float hei) =>
            {
                //动画
                if (SelAnim != null)
                {
                    AnimPlayTime = EditorGUILayout.Slider("播放动画", AnimPlayTime, 0, GetTotalAnimTime());

                    object playScale = TimePlayScale;
                    EDTypeField.CreateTypeField("播放动画时间倍数:", ref playScale, typeof(string), width, 25);
                    TimePlayScale = float.Parse(playScale.ToString());

                    if (IsPlaying)
                    {
                        GUI.color = Color.red;
                        EDButton.CreateBtn("暂停", width, 50, () =>
                        {
                            IsPlaying = false;
                        });
                    }
                    else
                    {
                        GUI.color = Color.green;
                        EDButton.CreateBtn("播放", width, 50, () =>
                        {
                            IsPlaying = true;
                        });
                    }
                }
                GUI.color = Color.white;
                EDTypeField.CreateLableField("技能Id:" + SelSkill.Id, "", width, 25);
                object value = SelSkill.DecStr;
                EDTypeField.CreateTypeField("技能描述:", ref value, typeof(string), width, 25);
                SelSkill.DecStr = value.ToString();

                object triggerValue = SelSkill.TriggerTime;
                EDTypeField.CreateTypeField("技能触发时间:", ref triggerValue, typeof(double), width, 25);
                SelSkill.TriggerTime = double.Parse(triggerValue.ToString());

                EDButton.CreateBtn("删除技能", 200, 50, () =>
                {
                    Json.List.Remove(SelSkill);
                    SelSkill = null;
                });

                ShowInfo = EditorGUILayout.Foldout(ShowInfo, "技能信息");
                if (ShowInfo)
                {
                    DrawSkillInfo(width, height * 0.3f);
                }
                GUILayout.Space(10);

                ShowData = EditorGUILayout.Foldout(ShowData, "技能数据");
                if (ShowData)
                {
                    DrawSkillData(width, height * 0.3f);
                }
                GUILayout.Space(10);

                ShowAudio = EditorGUILayout.Foldout(ShowAudio, "技能音效");
                if (ShowAudio)
                {
                    DrawSkillAudio(width, height * 0.3f);
                }
                GUILayout.Space(10);

                ShowEffect = EditorGUILayout.Foldout(ShowEffect, "技能特效");
                if (ShowEffect)
                {
                    DrawSkillEffect(width, height * 0.3f);
                }
                GUILayout.Space(10);
            });
        }