YuuHuu 发表于 2025-11-29 20:13:01

技能图标素材1000个

除封面图标以外还有冒险岛所有技能图标

三姐 发表于 2025-12-2 19:00:48

楼主加油,期待你继续发布好内容! {:6_224:}

wssfr 发表于 2026-2-12 16:54:48

666

666666666666666666666666

小侠hhh 发表于 2026-3-4 11:15:15

真是难得给力的好帖子啊~ {:6_205:} {:7_328:}

574656549 发表于 2026-3-9 18:13:16


      const fileInput = document.getElementById('fileInput');
      const mainImg = document.getElementById('main-img');
      const imgContainer = document.getElementById('img-container');
      const viewport = document.getElementById('viewport');
      const selectionBox = document.getElementById('selection-box');
      const displayId = document.getElementById('display-id');
      const searchInput = document.getElementById('search-id');
      const btnSearch = document.getElementById('btn-search');
      const fileInfo = document.getElementById('file-info');
      const previewBox = document.getElementById('preview-box');
      const toast = document.getElementById('toast');
      const dropOverlay = document.getElementById('drop-overlay');

      const ICON_SIZE = 32;
      const COLS = 16;

      let isImageLoaded = false;
      let currentFileIdentifier = ""; // 用于记录当前文件(文件名+大小)

      // --- 核心:处理图片加载逻辑 ---
      function loadIconImage(file) {
            if (!file || !file.type.startsWith('image/')) return;

            // 相同文件检查
            const identifier = `${file.name}-${file.size}-${file.lastModified}`;
            if (identifier === currentFileIdentifier) {
                console.log("检测到相同文件,跳过加载。");
                return;
            }

            const reader = new FileReader();
            reader.onload = function(event) {
                const src = event.target.result;
                mainImg.src = src;
                mainImg.onload = function() {
                  isImageLoaded = true;
                  currentFileIdentifier = identifier;
                  fileInfo.textContent = `文件: ${file.name.substring(0,15)}... | ${this.naturalHeight}px`;
                  previewBox.style.backgroundImage = `url(${src})`;

                  // 重置选框
                  selectionBox.style.display = 'none';
                  displayId.textContent = "--";
                }
            };
            reader.readAsDataURL(file);
      }

      // --- 拖拽功能实现 ---
      window.addEventListener('dragover', (e) => {
            e.preventDefault(); // 必须阻止默认行为才能触发 drop
            dropOverlay.style.display = 'flex';
      });

      window.addEventListener('dragleave', (e) => {
            // 只有当离开 body 时才隐藏覆盖层
            if (e.relatedTarget === null) {
                dropOverlay.style.display = 'none';
            }
      });

      window.addEventListener('drop', (e) => {
            e.preventDefault();
            dropOverlay.style.display = 'none';

            const files = e.dataTransfer.files;
            if (files.length > 0) {
                loadIconImage(files);
            }
      });

      // 原有的文件选择按钮点击事件
      fileInput.addEventListener('change', (e) => {
            loadIconImage(e.target.files);
      });

      // --- 其余业务逻辑 (ID计算, 定位等) ---
      function highlightIcon(id, scroll = false) {
            if (!isImageLoaded) return;
            displayId.textContent = id;
            searchInput.value = id;
            const row = Math.floor(id / COLS);
            const col = id % COLS;
            const x = col * ICON_SIZE;
            const y = row * ICON_SIZE;

            selectionBox.style.display = 'block';
            selectionBox.style.left = x + 'px';
            selectionBox.style.top = y + 'px';
            previewBox.style.backgroundPosition = `-${x}px -${y}px`;

            if (scroll) {
                viewport.scrollTo({
                  top: y - (viewport.clientHeight / 2) + (ICON_SIZE / 2),
                  behavior: 'smooth'
                });
            }
            copyToClipboard(id);
      }

      imgContainer.addEventListener('mousedown', (e) => {
            if (!isImageLoaded) return;
            const rect = imgContainer.getBoundingClientRect();
            const x = e.clientX - rect.left;
            const y = e.clientY - rect.top;
            const col = Math.floor(x / ICON_SIZE);
            const row = Math.floor(y / ICON_SIZE);
            if (col < COLS) {
                const id = (row * COLS) + col;
                highlightIcon(id, false);
            }
      });

      function handleSearch() {
            const id = parseInt(searchInput.value);
            if (!isNaN(id) && id >= 0) highlightIcon(id, true);
      }

      btnSearch.addEventListener('click', handleSearch);
      searchInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') handleSearch(); });

      function copyToClipboard(text) {
            navigator.clipboard.writeText(text).then(() => {
                toast.style.opacity = 1;
                setTimeout(() => { toast.style.opacity = 0; }, 1000);
            });
      }


humble 发表于 2026-5-24 11:39:25

不错不错!就是喜欢这种花花绿绿的图标!

windflag 发表于 2026-5-30 22:07:40

这么强!???

Nemo 发表于 2026-6-2 11:24:01

这个可以

1098177100 发表于 2026-6-7 04:23:36

强,非常需要这个,使我的RPG旋转

RPG暴走的鹌鹑 发表于 2026-6-16 23:44:12

新手瞻仰大佬!
页: [1] 2
查看完整版本: 技能图标素材1000个