Example #1
0
 private static void AddItemConfig(ItemDepthConfig tempConfig)
 {
     for (int i = 0; i < _allItemsConfig.Count; i++)
     {
         if (_allItemsConfig[i].target == tempConfig.target)
         {
             _allItemsConfig[i] = tempConfig;
             return;
         }
     }
     _allItemsConfig.Add(tempConfig);
 }
Example #2
0
    private static ItemDepthConfig GetItemConfig(GameObject obj)
    {
        for (int i = 0; i < _allItemsConfig.Count; i++)
        {
            if (_allItemsConfig[i].target == obj)
            {
                return(_allItemsConfig[i]);
            }
        }
        ItemDepthConfig tempconfig = new ItemDepthConfig();

        tempconfig.bIgnor     = false;
        tempconfig.belongTo   = EAtlasLayers.OtherAtlas;
        tempconfig.strContent = "";
        return(tempconfig);
    }
Example #3
0
    void ChangeSpecialType(object param)
    {
        EventMultiArgs  args        = (EventMultiArgs)param;
        ESpecialType    specialType = args.GetArg <ESpecialType>("specialType");
        ItemDepthConfig target      = args.GetArg <ItemDepthConfig>("target");

        target.SetSpecialType(specialType);
        if (specialType != ESpecialType.Auto)
        {
            target.SetIgnor(true);
        }
        else
        {
            target.SetIgnor(false);
        }
        AddItemConfig(target);
    }
Example #4
0
    //打印panel中的一个atlas的title
    void DrawOneTitle(ItemDepthConfig tempConfig)
    {
        float        height   = 32f;
        GameObject   PanelObj = tempConfig.panel;
        EAtlasLayers eLayer   = tempConfig.belongTo;
        string       sTitle   = GetLayerName(tempConfig.belongTo);

        GUILayout.BeginHorizontal();
        GUILayout.Box(sTitle, GUILayout.Width(250f));
        bool bClick = GUILayout.Button("重置选中项depth", "LargeButton", GUILayout.Width(160f), GUILayout.Height(height - 5f));

        if (bClick)
        {
            int layers = 1 << (int)eLayer;

            count_common1 = 0;
            count_common2 = 0;
            count_common3 = 0;
            count_uiatlas = 0;
            EachChildrenDepth(tempConfig.panel, tempConfig.panel, layers, true, true);
        }
        GUILayout.EndHorizontal();
    }
Example #5
0
    //打印panel中的一个atlas的一个sprite

    void DrawOneItem(ref ItemDepthConfig depthConfig)
    {
        float        height       = 25f;
        GameObject   PanelObj     = depthConfig.panel;
        GameObject   obj          = depthConfig.target;
        bool         bSelect      = !depthConfig.bIgnor;
        int          iDepth       = depthConfig.idepth;
        string       sSpecialType = depthConfig.specialType;
        ESpecialType eSpecial     = depthConfig.eSpecial;

        GUILayout.BeginHorizontal();
        GUILayout.Space(30f);
        bool bSelectNow = EditorGUILayout.Toggle("", bSelect, GUILayout.Width(25f));

        if (bSelectNow != bSelect)
        {
            depthConfig.SetIgnor(!bSelectNow);//此数据是复制的,不能直接调
            AddItemConfig(depthConfig);
        }

        bool bPush1 = GUILayout.Button(obj.transform.name, "AS TextArea", GUILayout.Width(120f));
        bool bPush2 = GUILayout.Button(depthConfig.strContent, "AS TextArea", GUILayout.Width(200f));

        if (bPush1 || bPush2)
        {
            GameObject[] objs = new GameObject[1];
            objs[0]           = obj;
            Selection.objects = objs;
        }

        if (eSpecial == ESpecialType.Other)
        {
            string sdepth    = GUILayout.TextArea(iDepth.ToString(), GUILayout.Width(60f));
            int    int_depth = int.Parse(sdepth);
            if (int_depth != depthConfig.idepth)
            {
                depthConfig.SetDepth(int_depth);
                AddItemConfig(depthConfig);
            }
        }
        else
        {
            GUILayout.Box(iDepth.ToString(), GUILayout.Width(60f));
        }

        //特殊处理下拉菜单
        if (GUILayout.Button(GetSpecialTypeName(eSpecial), EditorStyles.layerMaskField, GUILayout.Width(250f), GUILayout.MinHeight(height)))
        {
            bool           isSelect = false;
            GenericMenu    menu     = new GenericMenu();
            EventMultiArgs args     = new EventMultiArgs();
            args.AddArg("target", depthConfig);
            args.AddArg("specialType", ESpecialType.Auto);
            if (sSpecialType == "Auto")
            {
                isSelect = true;
            }
            menu.AddItem(new GUIContent("Auto"), isSelect, ChangeSpecialType, args);
            isSelect = false;
            if (sSpecialType == "Depth-1")
            {
                isSelect = true;
            }
            EventMultiArgs args2 = new EventMultiArgs();
            args2.AddArg("target", depthConfig);
            args2.AddArg("specialType", ESpecialType.Depth0);
            menu.AddItem(new GUIContent("-1:最底"), isSelect, ChangeSpecialType, args2);
            isSelect = false;
            if (sSpecialType == "Depth99")
            {
                isSelect = true;
            }
            EventMultiArgs args3 = new EventMultiArgs();
            args3.AddArg("target", depthConfig);
            args3.AddArg("specialType", ESpecialType.Depth99);
            menu.AddItem(new GUIContent("99:Common_1顶层"), isSelect, ChangeSpecialType, args3);
            isSelect = false;
            if (sSpecialType == "Depth199")
            {
                isSelect = true;
            }
            EventMultiArgs args4 = new EventMultiArgs();
            args4.AddArg("target", depthConfig);
            args4.AddArg("specialType", ESpecialType.Depth199);
            menu.AddItem(new GUIContent("199:界面图集顶层"), isSelect, ChangeSpecialType, args4);
            isSelect = false;
            if (sSpecialType == "Depth299")
            {
                isSelect = true;
            }
            EventMultiArgs args5 = new EventMultiArgs();
            args5.AddArg("target", depthConfig);
            args5.AddArg("specialType", ESpecialType.Depth299);
            menu.AddItem(new GUIContent("299:Common_2顶层"), isSelect, ChangeSpecialType, args5);
            isSelect = false;
            if (sSpecialType == "Depth399")
            {
                isSelect = true;
            }
            EventMultiArgs args6 = new EventMultiArgs();
            args6.AddArg("target", depthConfig);
            args6.AddArg("specialType", ESpecialType.Depth399);
            menu.AddItem(new GUIContent("399:图标图集顶层"), isSelect, ChangeSpecialType, args6);
            isSelect = false;
            if (sSpecialType == "Depth499")
            {
                isSelect = true;
            }
            EventMultiArgs args7 = new EventMultiArgs();
            args7.AddArg("target", depthConfig);
            args7.AddArg("specialType", ESpecialType.Depth499);
            menu.AddItem(new GUIContent("499:Common_3顶层"), isSelect, ChangeSpecialType, args7);
            isSelect = false;
            if (sSpecialType == "Other")
            {
                isSelect = true;
            }
            EventMultiArgs args8 = new EventMultiArgs();
            args8.AddArg("target", depthConfig);
            args8.AddArg("specialType", ESpecialType.Other);
            menu.AddItem(new GUIContent("Other"), isSelect, ChangeSpecialType, args8);
            menu.ShowAsContext();
        }
        GUILayout.Space(30f);
        GUILayout.EndHorizontal();
    }