ImgNoGoodWindow
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace Daemo
{
class ImgNoGoodWindow : EditorWindow
{
[MenuItem("Tools/UI RES/Assets Img No Good %#W")]
private static void ShowWindow()
{
ImgNoGoodWindow cw = (ImgNoGoodWindow)EditorWindow.GetWindow(typeof(ImgNoGoodWindow));
cw.minSize = new Vector2(500, 500);
}
private List<Texture2D> noGoodImages = new List<Texture2D>();
private List<Texture2D> goodImages = new List<Texture2D>();
private List<Texture2D> packImages = new List<Texture2D>();
private Vector2 scrollPos;
private Texture2D img = null;
private string[] btns = new string[] { "不规范图片组", "规范图片组","Pack图片组" };
private int selectIndex = 0;
public void Awake()
{
this.UpdateMsg();
}
private void UpdateMsg()
{
noGoodImages = EDCheckPrefabRef.GetNoGoodImgs();
noGoodImages.Sort(CompareSize);
goodImages = EDCheckPrefabRef.goodImgs;
goodImages.Sort(CompareSize);
packImages = EDCheckPrefabRef.packImgs;
packImages.Sort(CompareSize);
}
private int CompareSize(Texture2D t1, Texture2D t2) {
int t1Size = t1.width * t1.height;
int t2Size = t2.width * t2.height;
if (t1Size > t2Size)
{
return -1;
}
else if (t1Size == t2Size) {
return 0;
}
else
{
return 1;
}
}
private void OnGUI()
{
GUIContent title = new GUIContent();
title.text = "ImgNoGood";
this.titleContent = title;
GUILayout.Space(10);
if (GUILayout.Button("更新"))
{
this.UpdateMsg();
}
GUILayout.Space(10);
GUILayout.Label("功能说明:以下"+ noGoodImages.Count + "张图片尺寸不符合2的N次幂;"+goodImages.Count+ "张图片尺寸符合2的N次幂"+ packImages.Count+ "张Pack图片");
selectIndex = GUILayout.SelectionGrid(selectIndex, btns,3,GUILayout.MinWidth(100));
scrollPos =
EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(500), GUILayout.Height(400));
List<Texture2D> showList = selectIndex == 0 ? noGoodImages : (selectIndex==1?goodImages:packImages);
for (int i = 0; i < showList.Count; i++)
{
EditorGUILayout.BeginHorizontal();
GUILayout.Label(showList[i].name + ":" + showList[i].width + "*" + showList[i].height + ":");
img = showList[i];
img = (Texture2D)EditorGUILayout.ObjectField(img, typeof(Texture2D), false, GUILayout.MinWidth(200f));
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndScrollView();
}
}
}
ImgNoGoodWindow的更多相关文章
随机推荐
- JustOj 1386: 众数的数量
题目链接:http://oj.jxust.edu.cn/problem.php?id=1386 题目描述 qwn和Q伟N最近沉迷于Battle of Balls,天天翘课玩游戏.因为Q伟N太坑了,所以 ...
- 栈的压入和弹出序列(剑指Offer)
输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈序列对应的一 ...
- Google翻译实现
https://blog.csdn.net/yingshukun/article/details/53470424 Google翻译实现
- 微信企业号OAuth2.0验证接口来获取成员的身份信息
<?php $appid = "请输入您企业的appid"; $secret = "请输入您企业的secreat"; if (!isset($_GET[' ...
- Introduction to the Standard Directory Layout
Having a common directory layout would allow for users familiar with one Maven project to immediatel ...
- springmvc StringHttpMessageConverter 中文乱码的几种解决办法(亲测)
昨天,将一个原来使用JSR 311作为restful实现的测试系统改成了使用spring mvc,最后测试的时候发现输出的json字符串为乱码,从日志可以看出使用的是StringHttpMessage ...
- QML使用的内置对象
QML从ECMAScript继承而来,所以支持这个ECMAScript.经常在QML工程中看到Math.Data.....等方法,但是在Qt手册里搜索不到,这是因为这些方法不是QtQuick的,而是E ...
- java利用poi生成excel文件后下载本地
1.该功能需要poi的jar包,链接: http://pan.baidu.com/s/1migAtNq 密码: 38fx. 2.首先新建一个实体类,用以存放单个数据 public class Test ...
- Selenium android driver
selenium android « s « Jar File Download http://www.java2s.com/Code/Jar/s/selenium-android.htm How t ...
- Actions对Element的一些操作解析
针对Chrome浏览器: 在自动化测试的编写中如果报出Element is not visible to click at xxxx point时,我会使用: new Actions(WebDrive ...