Ejemplo n.º 1
0
    /// <summary>
    /// 绘制Group
    /// </summary>
    /// <param name="world"></param>
    private void ShowGroupsGUI(WorldBase world)
    {
        ECSGroupManager            groupManager = world.group;
        Dictionary <int, ECSGroup> AllGroupDic  = groupManager.AllGroupDic;
        List <ECSGroup>            groups       = new List <ECSGroup>(AllGroupDic.Values);

        List <string> names = new List <string>();

        foreach (var item in groups)
        {
            names.Add(item.Key.ToString());
        }
        selectInt1 = ShowLeftPartWindow("Group ID", names, selectInt1);
        if (selectInt1 != -1)
        {
            ShowRightPartWindow(() =>
            {
                if (groups.Count == 0)
                {
                    return;
                }
                if (selectInt1 >= groups.Count)
                {
                    selectInt1 = groups.Count - 1;
                }
                ECSGroup ecsGroup = groups[selectInt1];
                DrawECSGroup(ecsGroup, groupManager.GroupToEntityDic[ecsGroup]);
            });
        }
    }
Ejemplo n.º 2
0
 void InitGroup()
 {
     group = new ECSGroupManager(this);
     OnEntityComponentAdded   += group.OnEntityComponentChange;
     OnEntityComponentRemoved += group.OnEntityComponentChange;
     //OnEntityComponentChange += (entity, compName, previousComponent, newComponent) =>
     //{
     //    group.OnEntityComponentChange(entity, compName, newComponent);
     //};
 }