private void InitCompents(string LS4ECSName0) { Debug.Log("InitCompents"); componentData.Clear(); if (LS4ECSName0 == ecs.LS4ECS_Name) { foreach (var c in ecs.ECSComponentData) { if (componentData.ContainsKey(c.ScriptName)) { Debug.LogError("key already exists : " + c.ScriptName); continue; } componentData.Add(c.ScriptName, c.GetValue()); } } else { LogicSystem4ECSData d = lS4ECSDataDic[LS4ECSName0]; foreach (var item in d.systemList) { ISystem system = allSystem[item]; foreach (var c in system.FilterComponentTypes) { string name = c.FullName; if (componentData.ContainsKey(name)) { continue; } object obj = ReflectionUtils.CreateDefultInstance(c); componentData.Add(name, obj); } } } }
private void EditDataGUI() { if (currentEditLS4ECSData == null) { return; } GUILayout.Space(4); currentEditLS4ECSData.name = EditorDrawGUIUtil.DrawBaseValue("Name:", currentEditLS4ECSData.name).ToString(); if (string.IsNullOrEmpty(currentEditLS4ECSData.name) || (lS4ECSDataDic.ContainsKey(currentEditLS4ECSData.name) && lS4ECSDataDic[currentEditLS4ECSData.name] != currentEditLS4ECSData)) { EditorGUILayout.HelpBox("名字不能为空或重复", MessageType.Error); return; } GUILayout.BeginVertical("box"); foreach (var d in currentEditLS4ECSData.systemList) { GUILayout.Label("\tSystem:" + d); } GUILayout.EndVertical(); GUILayout.BeginHorizontal("box"); GUILayout.BeginVertical("box"); GUILayout.Label("ECS系统:"); foreach (var item in allSystem) { bool contains = false; string name = item.GetType().FullName; if (currentEditLS4ECSData.systemList.Contains(name)) { contains = true; GUI.color = Color.red; } if (GUILayout.Button(name)) { if (contains) { currentEditLS4ECSData.systemList.Remove(name); } else { currentEditLS4ECSData.systemList.Add(name); } currentSelectSys = item; } GUI.color = Color.white; } GUILayout.EndVertical(); GUILayout.BeginVertical("box"); GUILayout.Label("ECS系统:" + (currentSelectSys == null ? "" : currentSelectSys.GetType().FullName)); GUILayout.Label("ECS组件:"); if (currentSelectSys != null) { foreach (var item in currentSelectSys.FilterComponentNames) { GUILayout.Label("\t" + item); } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("完成")) { currentEditLS4ECSData = null; toolbarOption = 0; } }