微件:GGLScratchGame:修订间差异

来自Limbo Wiki Mirror
Gaoice留言 | 贡献
无编辑摘要
标签(旧)WikiEditor
Gaoice留言 | 贡献
无编辑摘要
标签(旧)WikiEditor
第2行: 第2行:


   <!-- 初始化遮罩 -->
   <!-- 初始化遮罩 -->
   <div class="ggl-mask" id="ggl-start-mask">
   <div class="ggl-mask" id="ggl-mask">
     <button class="ggl-start-btn">点击开始</button>
     <button class="ggl-start-btn">开始抽奖</button>
   </div>
   </div>


   <!-- 顶部信息 -->
   <!-- 顶部 -->
   <div class="ggl-top">
   <div class="ggl-top">
     <div class="ggl-rule">
     <div class="ggl-rule">刮开奖券 · 每张需点完 30 格才能扫描</div>
      刮开奖券 · 每张需点完 30 格才能扫描
     <div class="ggl-left">剩余彩票:<span id="ggl-left"></span> 张</div>
    </div>
     <div class="ggl-left">
      剩余彩票:<span id="ggl-ticket-left">11</span> 张
    </div>
   </div>
   </div>


   <!-- 彩票主体 -->
   <!-- 彩票 -->
   <div class="ggl-ticket">
   <div class="ggl-ticket">


     <img class="ggl-bg"
     <img class="ggl-bg"
       src="https://wm.gaoice.run/images/b/b6/%E5%9B%BE%E7%89%871.png"
       src="https://wm.gaoice.run/images/b/b6/%E5%9B%BE%E7%89%871.png">
      alt="lottery">


    <!-- 刮奖区域 -->
     <div class="ggl-scratch-area">
     <div class="ggl-scratch-area">
       <div class="ggl-grid"></div>
       <div class="ggl-grid"></div>
     </div>
     </div>


    <!-- 吉祥物 & 气泡 -->
     <div class="ggl-mascot"></div>
     <div class="ggl-mascot">(^▽^)</div>
     <div class="ggl-bubble"></div>
     <div class="ggl-bubble">准备开始。</div>


    <!-- 底部控制 -->
     <div class="ggl-controls">
     <div class="ggl-controls">
       <button id="ggl-scan">扫描结果</button>
       <button id="ggl-scan">扫描结果</button>
     </div>
     </div>
   </div>
   </div>
</div>
</div>


<style>
<style>
/* ===== 根容器 ===== */
.ggl-root { width:375px;margin:auto;font-family:sans-serif;position:relative }
.ggl-root {
.ggl-mask{position:absolute;inset:0;background:#000d;z-index:20;display:flex;align-items:center;justify-content:center}
  width: 375px;
.ggl-start-btn{padding:12px 20px;font-size:16px}
  margin: 0 auto;
  font-family: sans-serif;
  position: relative;
}
 
/* ===== 初始化遮罩 ===== */
.ggl-mask {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ggl-start-btn {
  font-size: 16px;
  padding: 12px 20px;
}


/* ===== 顶部 ===== */
.ggl-top{text-align:center;font-size:14px;margin-bottom:6px}
.ggl-top {
.ggl-ticket{position:relative;aspect-ratio:1075/1911}
  text-align: center;
.ggl-bg{width:100%;display:block}
  font-size: 14px;
  margin-bottom: 6px;
}
.ggl-rule {
  margin-bottom: 4px;
}


/* ===== 彩票 ===== */
.ggl-scratch-area{position:absolute;left:10%;top:35%;width:80%;height:53%}
.ggl-ticket {
.ggl-grid{width:100%;height:100%;display:grid;grid-template-columns:repeat(5,1fr);grid-template-rows:repeat(6,1fr);gap:6px}
  position: relative;
  width: 100%;
  aspect-ratio: 1075 / 1911;
}
.ggl-bg {
  width: 100%;
  display: block;
}
 
/* ===== 刮奖区 ===== */
.ggl-scratch-area {
  position: absolute;
  left: 10%;
  top: 35%;
  width: 80%;
  height: 53%;
}
.ggl-grid {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 6px;
}


/* ===== 单格 ===== */
.ggl-cell{position:relative;overflow:hidden}
.ggl-cell {
.ggl-cell img,.ggl-cover{position:absolute;inset:0;width:100%;height:100%}
  position: relative;
.ggl-cover{background:url("https://wm.gaoice.run/images/thumb/5/5a/%E5%88%AE%E5%BC%80%E5%89%8D.png/180px-%E5%88%AE%E5%BC%80%E5%89%8D.png") center/cover;cursor:pointer}
  overflow: hidden;
.ggl-reward{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:bold;pointer-events:none}
}
.ggl-cell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.ggl-reward {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  pointer-events: none;
}
.ggl-cover {
  position: absolute;
  inset: 0;
  background: url("https://wm.gaoice.run/images/thumb/5/5a/%E5%88%AE%E5%BC%80%E5%89%8D.png/180px-%E5%88%AE%E5%BC%80%E5%89%8D.png") center/cover;
  cursor: pointer;
}


/* ===== 吉祥物 & 气泡 ===== */
.ggl-mascot{position:absolute;left:6%;bottom:14%;font-size:20px;color:#000}
.ggl-mascot {
.ggl-bubble{position:absolute;left:6%;bottom:20%;width:60%;background:#fff;padding:6px;font-size:13px}
  position: absolute;
  left: 6%;
  top: 105%
  bottom: 14%;
  font-size: 20px;
  color: #000;
}
.ggl-bubble {
  position: absolute;
  left: 6%;
  bottom: 20%;
  top: 100%
  width: 60%;
  background: rgba(255,255,255,.9);
  padding: 6px;
  font-size: 13px;
}


/* ===== 控制 ===== */
.ggl-controls{position:absolute;right:6%;bottom:10%}
.ggl-controls {
#ggl-scan{opacity:.3}
  position: absolute;
#ggl-scan.active{opacity:1}
  right: 6%;
  bottom: 10%;
}
#ggl-scan {
  opacity: .3;
  top: 105%
}
#ggl-scan.active {
  opacity: 1;
}
</style>
</style>


<script>
<script>
(function () {
(function(){
 
  const grid = document.querySelector('.ggl-grid');
  const bubble = document.querySelector('.ggl-bubble');
  const mascot = document.querySelector('.ggl-mascot');
  const scanBtn = document.getElementById('ggl-scan');
  const ticketLeft = document.getElementById('ggl-ticket-left');
  const mask = document.getElementById('ggl-start-mask');


  const TICKETS = [
const grid = document.querySelector('.ggl-grid');
    { mascot:'(^▽^)', text:'欢迎,开始吧。', rewards:['DATA'] },
const bubble = document.querySelector('.ggl-bubble');
    { mascot:'(ノ◕ヮ◕)ノ', text:'可以连字哦。', rewards:['DATA','DATA','DATA','DATA'] },
const mascot = document.querySelector('.ggl-mascot');
    { mascot:'(・∀・)', text:'中了刮刮乐!', rewards:['DATA'] },
const scanBtn = document.getElementById('ggl-scan');
    { mascot:'(・_・)', text:'什么都没有。', rewards:[] },
const leftEl = document.getElementById('ggl-left');
    { mascot:'(;゚Д゚)', text:'不太对劲。', rewards:['DATA'] },
const mask = document.getElementById('ggl-mask');
    { mascot:'', text:'……', rewards:[] },
    { mascot:'...', text:'▒▓░▒▓', rewards:['DATA'] },
    { mascot:'', text:'哦 嗯 嘿 哈', rewards:['DATA','DATA'] },
    { mascot:'', text:'你是谁?', rewards:Array(30).fill('DATA') },
    { mascot:'', text:'停下来。', rewards:[], lock:true },
    { mascot:'平安喜乐', text:'你知道的太多了。', end:true }
  ];


   let ticketIndex = 0;
/* ====== 剧情彩票定义 ====== */
   let revealed = 0;
/*
 
index: 第几张(0开始)
   function updateTop() {
left: 你希望显示的剩余张数
     ticketLeft.textContent = TICKETS.length - ticketIndex;
rewards: { 格子索引: 内容 }
*/
const TICKETS = [
   {
    left: 3,
    mascot: '',
    bubble: '第一张,只中了 DATA。',
    rewards: { 12:'DATA' }
  },
  {
    left: 2,
    mascot: '(ノ◕ヮ◕)ノ',
    bubble: '连着刮出了四个字!',
    rewards: { 1:'连',2:'着',3:'四',4:'个' }
  },
  {
    left: 3,
    mascot: '(^▽^)',
    bubble: '中了刮刮乐!DATA 2MB',
    rewards: { 8:'DATA',14:'🎟' }
  },
   {
    left: 3,
    mascot: '(・_・)',
    bubble: '什么都没有。',
    rewards: {}
  },
   {
    left: 2,
    mascot: '(;゚Д゚)',
    bubble: '好像哪里不对。',
    rewards: { 22:'DATA' }
  },
  {
     left: 1,
    mascot: '',
    bubble: '什么都没有。',
    rewards: {}
  },
  {
    left: 1,
    mascot: '...',
    bubble: '▒▓░▒▓▒▓',
    rewards: { 6:'🎟' }
  },
  {
    left: 2,
    mascot: '',
    bubble: '哦 嗯 嘿 哈',
    rewards: { 3:'DATA',18:'DATA' }
  },
  {
    left: 1,
    mascot: '',
    bubble: '你是谁?',
    rewards: Object.fromEntries([...Array(30).keys()].map(i=>[i,'DATA']))
  },
  {
    left: 1,
    mascot: '',
    bubble: '停下来。',
    lock:true,
    rewards: {}
  },
  {
    left: 0,
    mascot: '平安喜乐',
    bubble: '你知道的太多了。',
    rewards: {}
   }
   }
];


  function buildTicket() {
let index = 0;
    grid.innerHTML = '';
let revealed = 0;
    revealed = 0;
    scanBtn.classList.remove('active');


    const t = TICKETS[ticketIndex];
function build(){
    mascot.textContent = t.mascot || '';
  const t = TICKETS[index];
    bubble.textContent = t.text || '';
  grid.innerHTML='';
  revealed=0;
  scanBtn.classList.remove('active');


    const rewardMap = Array(30).fill('');
  leftEl.textContent = t.left;
    (t.rewards||[]).forEach((r,i)=>rewardMap[i]=r);
  mascot.textContent = t.mascot||'';
  bubble.textContent = t.bubble||'';


    for (let i=0;i<30;i++) {
  for(let i=0;i<30;i++){
      const cell = document.createElement('div');
    const cell=document.createElement('div');
      cell.className = 'ggl-cell';
    cell.className='ggl-cell';
      cell.innerHTML = `
    cell.innerHTML=`
        <img src="https://wm.gaoice.run/images/thumb/4/4a/%E5%88%AE%E5%BC%80%E5%90%8E.jpg/180px-%E5%88%AE%E5%BC%80%E5%90%8E.jpg">
      <img src="https://wm.gaoice.run/images/thumb/4/4a/%E5%88%AE%E5%BC%80%E5%90%8E.jpg/180px-%E5%88%AE%E5%BC%80%E5%90%8E.jpg">
        <div class="ggl-reward">${rewardMap[i]}</div>
      <div class="ggl-reward">${t.rewards?.[i]||''}</div>
        <div class="ggl-cover"></div>
      <div class="ggl-cover"></div>
      `;
    `;
      const cover = cell.querySelector('.ggl-cover');
    const cover=cell.querySelector('.ggl-cover');
      if (!t.lock) {
    if(!t.lock){
        cover.onclick = () => {
      cover.onclick=()=>{
          if (cell.dataset.done) return;
        if(cell.dataset.done)return;
          cell.dataset.done = 1;
        cell.dataset.done=1;
          cover.style.display = 'none';
        cover.style.display='none';
          revealed++;
        revealed++;
          if (revealed === 30) scanBtn.classList.add('active');
        if(revealed===30)scanBtn.classList.add('active');
        };
       };
       }
      grid.appendChild(cell);
     }
     }
    grid.appendChild(cell);
   }
   }
}


  scanBtn.onclick = () => {
scanBtn.onclick=()=>{
    if (!scanBtn.classList.contains('active')) return;
  if(!scanBtn.classList.contains('active'))return;
    ticketIndex++;
  index++;
    updateTop();
  if(index>=TICKETS.length)return;
    if (TICKETS[ticketIndex]?.end) {
  if(index===10){
      document.body.style.filter='invert(1)';
    document.body.style.filter='invert(1)';
      setTimeout(()=>location.href='/index.php?title=六世恶言之一',1200);
    setTimeout(()=>location.href='/index.php?title=六世恶言之一',1200);
    } else {
  }else{
      buildTicket();
    build();
    }
  }
  };
};


  mask.onclick = () => {
mask.onclick=()=>{
    mask.remove();
  mask.remove();
    updateTop();
  build();
    buildTicket();
};
  };


})();
})();
</script>
</script>

2026年2月1日 (日) 19:49的版本

   <button class="ggl-start-btn">开始抽奖</button>
刮开奖券 · 每张需点完 30 格才能扫描
剩余彩票:
   <img class="ggl-bg"
     src="%E5%9B%BE%E7%89%871.png">
     <button id="ggl-scan">扫描结果</button>

<style> .ggl-root { width:375px;margin:auto;font-family:sans-serif;position:relative } .ggl-mask{position:absolute;inset:0;background:#000d;z-index:20;display:flex;align-items:center;justify-content:center} .ggl-start-btn{padding:12px 20px;font-size:16px}

.ggl-top{text-align:center;font-size:14px;margin-bottom:6px} .ggl-ticket{position:relative;aspect-ratio:1075/1911} .ggl-bg{width:100%;display:block}

.ggl-scratch-area{position:absolute;left:10%;top:35%;width:80%;height:53%} .ggl-grid{width:100%;height:100%;display:grid;grid-template-columns:repeat(5,1fr);grid-template-rows:repeat(6,1fr);gap:6px}

.ggl-cell{position:relative;overflow:hidden} .ggl-cell img,.ggl-cover{position:absolute;inset:0;width:100%;height:100%} .ggl-cover{background:url("180px-%E5%88%AE%E5%BC%80%E5%89%8D.png") center/cover;cursor:pointer} .ggl-reward{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:bold;pointer-events:none}

.ggl-mascot{position:absolute;left:6%;bottom:14%;font-size:20px;color:#000} .ggl-bubble{position:absolute;left:6%;bottom:20%;width:60%;background:#fff;padding:6px;font-size:13px}

.ggl-controls{position:absolute;right:6%;bottom:10%}

  1. ggl-scan{opacity:.3}
  2. ggl-scan.active{opacity:1}

</style>

<script> (function(){

const grid = document.querySelector('.ggl-grid'); const bubble = document.querySelector('.ggl-bubble'); const mascot = document.querySelector('.ggl-mascot'); const scanBtn = document.getElementById('ggl-scan'); const leftEl = document.getElementById('ggl-left'); const mask = document.getElementById('ggl-mask');

/* ====== 剧情彩票定义 ====== */ /*

index: 第几张(0开始)
left: 你希望显示的剩余张数
rewards: { 格子索引: 内容 }
  • /

const TICKETS = [

 {
   left: 3,
   mascot: ,
   bubble: '第一张,只中了 DATA。',
   rewards: { 12:'DATA' }
 },
 {
   left: 2,
   mascot: '(ノ◕ヮ◕)ノ',
   bubble: '连着刮出了四个字!',
   rewards: { 1:'连',2:'着',3:'四',4:'个' }
 },
 {
   left: 3,
   mascot: '(^▽^)',
   bubble: '中了刮刮乐!DATA 2MB',
   rewards: { 8:'DATA',14:'🎟' }
 },
 {
   left: 3,
   mascot: '(・_・)',
   bubble: '什么都没有。',
   rewards: {}
 },
 {
   left: 2,
   mascot: '(;゚Д゚)',
   bubble: '好像哪里不对。',
   rewards: { 22:'DATA' }
 },
 {
   left: 1,
   mascot: ,
   bubble: '什么都没有。',
   rewards: {}
 },
 {
   left: 1,
   mascot: '...',
   bubble: '▒▓░▒▓▒▓',
   rewards: { 6:'🎟' }
 },
 {
   left: 2,
   mascot: ,
   bubble: '哦 嗯 嘿 哈',
   rewards: { 3:'DATA',18:'DATA' }
 },
 {
   left: 1,
   mascot: ,
   bubble: '你是谁?',
   rewards: Object.fromEntries([...Array(30).keys()].map(i=>[i,'DATA']))
 },
 {
   left: 1,
   mascot: ,
   bubble: '停下来。',
   lock:true,
   rewards: {}
 },
 {
   left: 0,
   mascot: '平安喜乐',
   bubble: '你知道的太多了。',
   rewards: {}
 }

];

let index = 0; let revealed = 0;

function build(){

 const t = TICKETS[index];
 grid.innerHTML=;
 revealed=0;
 scanBtn.classList.remove('active');
 leftEl.textContent = t.left;
 mascot.textContent = t.mascot||;
 bubble.textContent = t.bubble||;
 for(let i=0;i<30;i++){
   const cell=document.createElement('div');
   cell.className='ggl-cell';
   cell.innerHTML=`
     <img src="180px-%E5%88%AE%E5%BC%80%E5%90%8E.jpg">
${t.rewards?.[i]||}
   `;
   const cover=cell.querySelector('.ggl-cover');
   if(!t.lock){
     cover.onclick=()=>{
       if(cell.dataset.done)return;
       cell.dataset.done=1;
       cover.style.display='none';
       revealed++;
       if(revealed===30)scanBtn.classList.add('active');
     };
   }
   grid.appendChild(cell);
 }

}

scanBtn.onclick=()=>{

 if(!scanBtn.classList.contains('active'))return;
 index++;
 if(index>=TICKETS.length)return;
 if(index===10){
   document.body.style.filter='invert(1)';
   setTimeout(()=>location.href='/index.php?title=六世恶言之一',1200);
 }else{
   build();
 }

};

mask.onclick=()=>{

 mask.remove();
 build();

};

})(); </script>