function DrowViewBGInit(view,x,y)
 for j=1,y do
  for i=1,x do
   view.addcontrol(new.image("btn_bg_"..i.."_"..j));
  end
 end
 for j=1,y do
  for i=1,x do
   view.addcontrol(new.image("btn_bg2_"..i.."_"..j));
  end
 end
end
function DrowViewBG(view,start,x,y)
 view.sizex = 74 * x;
 view.sizey = 54 * y;
 view.pxpos = 74 * x;
 view.pypos = 54 * y;

 for j=1,y do
  for i=1,x do
   local tt = 0;
   local gg = 0;
   local tv;
   if i == 1 and j == 1 then
    tv = start;   
   elseif i == x and j == 1 then
    tv = start + 2; 
   elseif x > 1 and j == 1 then
    tv = start + 1;

   elseif i == 1 and j > 1 then
    tv = start + 3;
   elseif i > 1 and j > 1 then
    tv = -1;
   else 

   end

   if i == x and j > 1 then
     tv = start + 5;  
     tt = 69;
   end 

   if i == 1 and j == y then
     tv = start + 6;  

   end 

   if i > 1 and j == y and i ~= x then
     tv = start + 7;  
     gg = 46;

   elseif i == x and j == y then
     tv = start + 8;   
     tt = 0;
   end             
   if tv ~= -1 then
    local object = view.find("btn_bg_"..i.."_"..j);
    object.enable = 1;
    object.xpos = (74 * (i - 1)) + tt;
    object.ypos = (54 * (j - 1)) + gg;
    object.imageID = tv;   
   end
   local object = view.find("btn_bg2_"..i.."_"..j);
   object.enable = 1;
   object.xpos = (74 * (i - 1)) ;
   object.ypos = (54 * (j - 1)) ;
   object.imageID = start + 4;

  end

 end

end
ks = 0;
o_time = os.time();
ls_this_bg1 = 0;
ls_this_bg2 = 0;
ls_this_bg3 = 0;
ls_this_bg4 = 0;

ls_this_y1 = 0;
ls_this_y2 = 0;
ls_this_y3 = 0;
ls_this_y4 = 0;
function daoju_init(view)

 if view.vid ~= 24 then 
  return;
 end
 if view.IsInit then


  DrowViewBGInit(view,8,6);
  --view.addcontrol(new.image("btn_bg"));


  view.settop();
  view.addcontrol(new.image("btn_整理"));
  view.addcontrol(new.image("close"));
  view.addcontrol(new.image("btn_Test")); 

  for i=1,6 do
   for j=1,4 do
    view.addcontrol(new.image("btn_dd_"..i.."_"..j));
   end
  end
  return;
 end
 this.clear(view);
 DrowViewBG(view,245310,8,6)


 for i=1,6 do
   for j=1,4 do
    local dd = view.find("btn_dd_"..i.."_"..j);
    dd.enable = 1;   
    dd.xpos = 0 + 230  + 50 * i;
    dd.ypos = 0 + 20  + 50 * j;; 
    dd.imageID = math.random(480011,480046);
    dd.callbackfunc = 
        function(object,event) 
         if event == Cevent.mouseover then
          this.tip ("点我砸蛋哦!");
         end
         if event == Cevent.click then

          if dd.imageID >= 27603 and dd.imageID <= 27626 then
           for i=1,6 do
            for j=1,4 do
             local view = object.mainview;
             local dd = view.find("btn_dd_"..i.."_"..j);
             dd.imageID = math.random(480011,480046);
            end
           end
           return;
          end  
          for i=1,6 do
           for j=1,4 do
            local view = object.mainview;
            local dd = view.find("btn_dd_"..i.."_"..j);
            dd.imageID = math.random(27603,27626);
           end
          end
          Audio.Bell(60,320)
          Cli.SysMessage("恭喜中大奖啦!!",4,3);
         end

        end
   end
 end


 local image = view.find("close");
 image.enable = 1;   
 image.xpos = view.sizex - 20;
 image.ypos = 15;
 image.sizex = 11;
 image.sizey = 11; 
 image.func = FCC_viewclose;


 local image = view.find("btn_Test");
 image.enable = 1;
 image.xpos = 470;
 image.ypos = 280;
 image.sizex = 18;
 image.sizey = 20;

 image.callbackfunc = 
  function(object,event) 

     -- 绘制底图

     local view = object.mainview;
     --DrowViewBG(view,245310,8,7)
     this.spImage(view.xpos + 140,view.ypos + 150,239502)


     this.spComBox(view.xpos + 20,view.ypos +20,view.xpos + 260,view.ypos + 300,7,0)
     this.spComBox(view.xpos + 270,view.ypos +20,view.xpos + 570,view.ypos + 300,7,0)
     this.spText(view.xpos + 30,view.ypos +30,3,"$4你准备好了吗?")
     this.spText(view.xpos + 40,view.ypos +60,11,"$c砸$d蛋$e蛋$f小$g活$h动")
     this.spText(view.xpos + 22,view.ypos +250,3,"$4每转一次消耗$62$4张")
     this.spImage(view.xpos + 180,view.ypos + 255,27491)



     local image = object;  
     -- 鼠标进入事件
     if event == Cevent.mouseover then
      --image.imageID = 244313;

      --Image.TestButtonPro(view,object,24,4,"$3开始小老鼠转盘")

      --this.spComBox(200,250,500,500,247,0)
      --this.tip ("整理道具哟!");

     else
      --Image.TestButtonPro(view,object,24,4,"$5开始小老鼠转盘")
      --image.imageID = 244311; 
     end   
     -- 鼠标单击事件
     if event == Cevent.click then 
      ks = 1;
      o_time = os.time()
      ls_this_bg1 = math.random(26551,26554)
      ls_this_bg2 = math.random(26551,26554)
      ls_this_bg3 = math.random(26551,26554)
      ls_this_bg4 = math.random(26551,26554)

      ls_this_y1 = 0
      ls_this_y2 = 0
      ls_this_y3 = 0
      ls_this_y4 = 0

      view.find("yanhuashow0").xpos = 9999;
      view.find("yanhuashow1").xpos = 9999;
      view.find("yanhuashow2").xpos = 9999;
      view.find("yanhuashow3").xpos = 9999;
      --Cli.TalkTo("/r");  
     end
     -- 鼠标单击结束事件
     if event == Cevent.clickover then      
      --image.imageID = 244312; 
     end 

  end
end
文档更新时间: 2019-07-30 12:55   作者:admin