using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class screensize
{
 [RuntimeInitializeOnLoadMethod]
 static void OnRuntimeMethodLoad()
 {
  Screen.SetResolution(1280,720,false);
 }
}
public class nekonote : MonoBehaviour
{
 int flg=-1;int count=0;int spacewait=0;int headkaku=0;int headhou=1;int headwait=2;
 int yay=0;int pakekazu=1;int shinkazu=16;int hintonoff=1;
 int lastnum=-1;int total1=0;int total2=0;int keta=0;int nowpake=0;int nowbit=0;int uphand=0;
 int setwakuc=0;int setwakuw=0;
 int score=0;int times1=0;
 int[] monnum=new int[15];int[] bits=new int[16];int[] pbits=new int[4];int[] tennums=new int[5];
 int i;int j;int k;int z;int zx;int zy;int r;int ee;int a;int aa;int aaa;int x;int y;int r1;int r2;int ax;int ay;
 int xx;int yy;int ii;int jj;int kk;int a1;int a2;int a3;
 int e;int e1;int moves;int mousex;int mousey;
 float stimef;float ntimef;float stime2f;float ntime2f;float stime3f;float ntime3f;float stime4f;float ntime4f;
 float xf;float yf;float af;float kakuf;float axf;float ayf;
 string c1;string c2;string c3;string c4;
 string d1;string keyname2="bignyan_mousefix";string[] dts=new string[2];
 int mfx=640;int mfy=360;
 GUIStyle style1;GUIStyle style2;GUIStyle style3;
 GameObject[] obj=new GameObject[2000];
 AudioSource bgm1;AudioSource bgm2;AudioSource bgm3;AudioSource bgm4;

 void Start()
 {
  dataload();
  style1=new GUIStyle();style1.fontSize=40;
  style2=new GUIStyle();style2.fontSize=16;
  style3=new GUIStyle();style3.fontSize=24;style3.normal.textColor=Color.red;
  obj[0]=GameObject.Find("ng-mes"); // 0  ng-mes
  obj[1]=GameObject.Find("nekonote-title"); // 1  title
  for (i=1;i<=3;i++) {obj[i+1]=GameObject.Find("nekonote-t-waku-"+i);} // 2-4  title-waku
  obj[5]=GameObject.Find("ya-r-28x28"); // 5 title-ya
  for (i=1;i<=3;i++) {obj[i+5]=GameObject.Find("nyan-head-"+i);} // 6-8  nyan-head
  for (i=1;i<=2;i++) {obj[i+8]=GameObject.Find("nyan-arm-"+i);} // 9-10  nyan-arm
  for (i=1;i<=8;i++) {obj[i+10]=GameObject.Find("com-"+i);} // 11-18  coms
  for (i=0;i<=7;i++) {obj[i+19]=GameObject.Find("nekonote-button-"+i);} // 19-26  buttons
  for (i=1;i<=2;i++) {obj[i+26]=GameObject.Find("nekonote-setwaku-"+i);} // 27-28  setwaku
  for (i=1;i<=4;i++) {obj[i+28]=GameObject.Find("nekonote-hint-"+i);} // 29-32  hints
  obj[33]=GameObject.Find("nekonote-packet-1"); // 33  packet
  for (i=1;i<=3;i++) {obj[i+33]=GameObject.Find("nekonote-m-packet-"+i);} // 34-36  mini-packet
  for (i=1;i<=5;i++) {obj[i+36]=GameObject.Find("nekonote-fuki-"+i);} // 37-41  fuki 1-5
  for (i=0;i<=4;i++) {obj[i+42]=Object.Instantiate(obj[i+37]) as GameObject;} // 42 - 46  fuki 6-10
  for (i=1;i<=2;i++) {obj[i+46]=GameObject.Find("gameend-mes-"+i);} // 47-48  gameend-mes
  for (i=0;i<=15;i++) {obj[i+50]=GameObject.Find("num-16a-"+i);} // 50-65  num-16a-moto
  for (i=0;i<=15;i++) {obj[i+66]=GameObject.Find("bignum-"+i);} // 66-81  bignum-moto
  for (i=0;i<=1;i++) {obj[i+82]=GameObject.Find("smallnum-"+i);} // 82-83  smallnum-moto
  for (i=1;i<=15;i++) {obj[i+83]=GameObject.Find("nekonote-hintnum-"+i);} // 84-98  hintnum

  for (i=0;i<=15;i++)
  {
   for (j=0;j<=5;j++) {obj[j*16+i+100]=Object.Instantiate(obj[i+50]) as GameObject;} // 100-195  nums-15a-copy
   for (j=0;j<=9;j++) {obj[j*16+i+200]=Object.Instantiate(obj[i+66]) as GameObject;} // 200-359  bignum-copy
  }
  for (i=0;i<=1;i++)
  {
   for (j=0;j<=3;j++) {obj[i*4+j+360]=Object.Instantiate(obj[i+82]) as GameObject;} // 360-367  smallnum-copy
  }
  obj[997]=GameObject.Find("mousefix-1"); // 997  mousefix-black
  obj[998]=GameObject.Find("mousefix-2"); // 998  mousefix-red
  obj[999]=GameObject.Find("mousefix-moji"); // 999  mousefix-button
  obj[1000]=GameObject.Find("button-esc"); // 1000  button-esc
  bgm1=obj[1].GetComponent();bgm2=obj[2].GetComponent();
  bgm3=obj[3].GetComponent();bgm4=obj[4].GetComponent();

  alldel();
  z=0;zx=0;zy=0;objput();
  z=6;zx=0;zy=0;objput();z=9;zx=-50;zy=-50;objput();z=10;zx=50;zy=-50;objput();
  z=12;zx=-300;zy=-100;objput();z=16;zx=248;zy=-100;objput();
  count=500;flg=-1;
 }

 void Update()
 {
  Vector3 mpos=Input.mousePosition;
  xf=mpos.x;yf=mpos.y;
  if (flg>-9) {xf=xf*640/mfx;yf=yf*360/mfy;}
  mousex=(int)xf;mousey=(int)yf;
//  c1="X="+mousex.ToString()+" Y="+mousey.ToString();
  if (flg==-1)
  {
   count=count-1;
   if (Input.GetMouseButtonDown(0)) {count=0;}
   if (Input.GetMouseButtonDown(1)) {count=0;}
   if (Input.GetKeyDown(KeyCode.Space)) {count=0;spacewait=2;}
   if (Input.GetKeyDown(KeyCode.Return)) {count=0;}
   if (count<=0)
   {
    titleput();flg=0;
   }
  }
  if (flg==0)
  {
   if (spacewait>0) {spacewait=spacewait-1;}
   if (Input.GetMouseButtonDown(0) && spacewait<=0)
   {
    if (mousey>=431 && mousey<=454)
    {
     if (mousex>=644 && mousex<=664) {pakekazu=1;}
     if (mousex>=680 && mousex<=700) {pakekazu=2;}
     if (mousex>=716 && mousex<=736) {pakekazu=3;}
     if (mousex>=752 && mousex<=772) {pakekazu=4;}
    }
    if (mousey>=395 && mousey<=421)
    {
     if (mousex>=602 && mousex<=679) {shinkazu=16;}
     if (mousex>=698 && mousex<=775) {shinkazu=10;}
    }
    if (mousey>=363 && mousey<=387)
    {
     if (mousex>=654 && mousex<=700) {hintonoff=1;}
     if (mousex>=725 && mousex<=771) {hintonoff=0;}
    }
    if (mousex>=508 && mousex<=714 && mousey>=265 && mousey<=290) {gamestart();}
   }
   if (spacewait<=0)
   {
    if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.Keypad8))
    {
     yay=yay-1;if (yay<0) {yay=2;}
    }
    if (Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.Keypad2))
    {
     yay=yay+1;if (yay>2) {yay=0;}
    }
    if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.Keypad4))
    {
     if (yay==0)
     {
      pakekazu=pakekazu-1;if (pakekazu<1) {pakekazu=4;}
     }
     if (yay==1)
     {
      if (shinkazu==16) {shinkazu=10;} else {shinkazu=16;}
     }
     if (yay==2)
     {
      if (hintonoff==1) {hintonoff=0;} else {hintonoff=1;}
     }
    }
    if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.Keypad6))
    {
     if (yay==0)
     {
      pakekazu=pakekazu+1;if (pakekazu>4) {pakekazu=1;}
     }
     if (yay==1)
     {
      if (shinkazu==16) {shinkazu=10;} else {shinkazu=16;}
     }
     if (yay==2)
     {
      if (hintonoff==1) {hintonoff=0;} else {hintonoff=1;}
     }
    }
    if (Input.GetKeyDown(KeyCode.Space)) {gamestart();}
    if (Input.GetKeyDown(KeyCode.M))
    {
     alldel();z=997;zx=0;zy=0;objput();z=998;objput();
     flg=-9;spacewait=2;
    }
   }
   if (flg==0)
   {
    z=5;zx=-200;zy=114-yay*47;objput();
    z=2;zx=pakekazu*50-32;zy=116;objput();
    if (shinkazu==16) {zx=0;} else {zx=132;}
    z=3;zy=68;objput();
    z=4;zx=148-hintonoff*98;zy=22;objput();
   }
  }
  if (flg>=1)
  {
   headwait=headwait-1;
   if (headwait<=0)
   {
    headkaku=headkaku+headhou;
    if (headkaku>=20 && headhou>0) {headkaku=20;headhou=-1;}
    if (headkaku<=-20 && headhou<0) {headkaku=-20;headhou=1;}
    for (i=6;i<=8;i++) {obj[i].transform.rotation=Quaternion.identity;obj[i].transform.Rotate(0,0,headkaku);}
    headwait=2;
   }
  }
  if (flg==1)
  {
   if (spacewait>0) {spacewait=spacewait-1;}
// input
   moves=-1;
   if (spacewait<=0)
   {
    if (Input.GetMouseButtonDown(0) && spacewait<=0)
    {
     if (mousex>=1038 && mousex<=1108 && mousey>=290 && mousey<=358) {moves=0;}
     if (mousex>=966 && mousex<=1036 && mousey>=290 && mousey<=358) {moves=1;}
     if (mousex>=1002 && mousex<=1072 && mousey>=361 && mousey<=429) {moves=2;}
     if (mousex>=977 && mousex<=1097 && mousey>=216 && mousey<=284) {moves=3;}
    }
    if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.Keypad6)) {moves=0;}
    if (Input.GetKeyDown(KeyCode.Keypad0) || Input.GetKeyDown(KeyCode.Alpha0)) {moves=0;}
    if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.Keypad4)) {moves=1;}
    if (Input.GetKeyDown(KeyCode.Keypad1) || Input.GetKeyDown(KeyCode.Alpha1)) {moves=1;}
    if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.Keypad8)) {moves=2;}
    if (Input.GetKeyDown(KeyCode.Return)) {moves=3;}
   }
   if (moves==0 && nowbit<=3)
   {
    obj[10].transform.Rotate(180,0,0);z=82;zx=50;zy=50;objput();
    z=27;zx=-2000;zy=0;objput();z=28;objput();
    pbits[nowbit]=0;uphand=0;
    flg=2;count=10;buttonput();
   }
   if (moves==1 && nowbit<=3)
   {
    obj[9].transform.Rotate(180,0,0);z=83;zx=-50;zy=50;objput();
    z=27;zx=-2000;zy=0;objput();z=28;objput();
    pbits[nowbit]=1;uphand=1;
    flg=2;count=10;buttonput();
   }
   if (moves==2 && nowbit>=1)
   {
    nowbit=nowbit-1;
    if (pbits[nowbit]==0)
    {
     z=nowbit+360;zx=-2000;zy=0;objput();
     obj[10].transform.Rotate(180,0,0);uphand=2;
    }
    else
    {
     z=nowbit+364;zx=-2000;zy=0;objput();
     obj[9].transform.Rotate(180,0,0);uphand=3;
    }
    z=27;zx=-2000;zy=0;objput();z=28;objput();
    pbits[nowbit]=0;
    flg=2;count=10;buttonput();
   }
   if (moves==3 && nowbit>=4) {flg=3;count=0;}
   setwakuw=setwakuw-1;
   if (setwakuw<=0)
   {
    if (setwakuc==0) {setwakuc=1;} else {setwakuc=0;}
    if (nowbit<=3)
    {
     z=27;zx=-2000;zy=0;objput();z=28;objput();
     z=setwakuc+27;zx=nowbit*32-47;zy=-174;objput();
    }
    setwakuw=25;
   }
  }
  if (flg>=1 && flg<=4)
  {
// times
   ntime2f=Time.time;
   if (ntime2f-stime2f>=1f)
   {
    times1=times1-1;
    timeput();stime2f=stime2f+1f;
    if (times1<=0) {gameend();}
// bgm-replay
   ntimef=Time.time;
   if (ntimef-stimef>=13f) {bgm1.Play();stimef=stimef+13f;}
   }
  }
  if (flg==2)
  {
   count=count-1;
   if (count<=0)
   {
    if (uphand==0 || uphand==1)
    {
     if (uphand==0)
     {
      obj[10].transform.Rotate(180,0,0);z=82;zx=-2000;zy=0;objput();
      z=nowbit+360;zx=nowbit*32-47;zy=-156;objput();
     }
     else
     {
      obj[9].transform.Rotate(180,0,0);z=83;zx=-2000;zy=0;objput();
      z=nowbit+364;zx=nowbit*32-47;zy=-156;objput();
     }
     z=27;zx=-2000;zy=0;objput();z=28;objput();
     nowbit=nowbit+1;
     if (nowbit<=3)
     {
      z=27;zx=-2000;zy=0;objput();z=28;objput();
      z=setwakuc+27;zx=nowbit*32-47;zy=-174;objput();
     }
    }
    if (uphand==2 || uphand==3)
    {
     obj[12-uphand].transform.Rotate(180,0,0);
     z=27;zx=-2000;zy=0;objput();z=28;objput();
     z=setwakuc+27;zx=nowbit*32-47;zy=-174;objput();
    }
    flg=1;buttonput();
   }
  }
  if (flg==3)
  {
   count=count+5;
   z=33;zx=count;zy=-156;objput();
   for (i=0;i<=3;i++) {z=pbits[i]*4+i+360;zx=i*32+count-47;zy=-156;objput();}
   if (count>=250)
   {
    for (i=0;i<=3;i++) {bits[nowpake*4+i]=pbits[i];pbits[i]=0;}
    z=16;zx=-2000;zy=0;objput();
    for (i=34;i<=36;i++) {z=i;zx=-2000;zy=0;objput();}
    for (i=360;i<=367;i++) {z=i;zx=-2000;zy=0;objput();}
    if (nowpake<3)
    {
     z=15;zx=248;zy=-100;objput();z=33;zx=0;zy=-156;objput();
     nowpake=nowpake+1;
     if (nowpake<3) {z=36-nowpake;zx=-50;zy=-204;objput();}
     nowbit=0;flg=1;buttonput();
    }
    else {hantei();}
   }
  }
  if (flg==4)
  {
   count=count-1;
   if (count<=0) {newmon();}
  }
  if (flg==9)
  {
   ntime2f=Time.time;
   if (ntime2f-stime2f>=0.5f)
   {
    stime2f=stime2f+0.5f;count=count+1;
    z=47;zx=-2000;zy=0;objput();z=48;objput();
    z=count%2+47;zx=330;zy=80;objput();
    if (count>=12) {titleput();}
   }
  }
  if (flg>0)
  {
   if (Input.GetKeyDown(KeyCode.Escape)) {titleput();}
   if (Input.GetMouseButtonDown(0))
   {
    if (mousex>=383 && mousex<=435 && mousey>=182 && mousey<=220) {titleput();}
   }
  }
  if (flg==-9)
  {
   if (spacewait>0) {spacewait=spacewait-1;}
   if (Input.GetMouseButtonDown(0) && spacewait<=0)
   {
    mfx=mousex;mfy=mousey;
    datasave();titleput();
   }
  }
 }

 void gamestart()
 {
  for (i=1;i<=5;i++) {z=i;zx=-2000;zy=0;objput();}
  for (i=6;i<=8;i++) {z=i;zx=-2000;zy=0;objput();}
  for (i=6;i<=10;i++) {obj[i].transform.rotation=Quaternion.identity;}
  z=999;zx=-2000;zy=0;objput();z=1000;zx=-320;zy=-220;objput();
  obj[10].transform.Rotate(0,180,0);
  score=0;scoreput();times1=120;timeput();
  headkaku=0;headhou=1;headwait=2;newmon();
  stimef=Time.time;stime2f=Time.time;
  bgmstop();bgm1.Play();
 }

 void newmon()
 {
  for (i=6;i<=8;i++) {z=i;zx=-2000;zy=0;objput();}
  for (i=11;i<=18;i++) {z=i;zx=-2000;zy=0;objput();}
  for (i=27;i<=28;i++) {z=i;zx=-2000;zy=0;objput();}
  for (i=34;i<=46;i++) {z=i;zx=-2000;zy=0;objput();}
  for (i=84;i<=98;i++) {z=i;zx=-2000;zy=0;objput();}
  for (i=200;i<=367;i++) {z=i;zx=-2000;zy=0;objput();}
  obj[9].transform.rotation=Quaternion.identity;
  obj[10].transform.rotation=Quaternion.identity;obj[10].transform.Rotate(0,180,0);
  for (i=0;i<=14;i++) {monnum[i]=i+1;}
  for (i=0;i<1000;i++)
  {
   r1=Random.Range(0,15);if (r1>14) {r1=0;}
   r2=Random.Range(0,15);if (r2>14) {r2=0;}
   a=monnum[r1];monnum[r1]=monnum[r2];monnum[r2]=a;
  }
  if (monnum[0]==lastnum)
  {
   for (i=0;i<=3;i++) {monnum[i]=monnum[i+1];}
  }
  lastnum=monnum[0];total1=0;
  a=monnum[0];keta=1;
  if (pakekazu>=2) {a=a+monnum[1]*16;}
  if (pakekazu>=3) {a=a+monnum[2]*256;}
  if (pakekazu==4) {a=a+monnum[3]*4096;}
  if (a>=10) {keta=2;}
  if (a>=100) {keta=3;}
  if (a>=1000) {keta=4;}
  if (a>=10000) {keta=5;}
  total1=a;
  if (shinkazu==16) {z=pakekazu+36;} else {z=keta+36;}
  if (hintonoff==1)
  {
   z=pakekazu+28;zx=-500;zy=-88;objput();
   for (i=0;i=2) {z=pakekazu+32;zx=-50;zy=-204;objput();}
  nowpake=4-pakekazu;nowbit=0;
  setwakuc=0;setwakuw=25;z=setwakuc+27;zx=-47;zy=-174;objput();
  flg=1;spacewait=2;buttonput();
 }

 void hantei()
 {
  total2=0;a=32768;
  for (i=0;i<=15;i++)
  {
   total2=total2+bits[i]*a;a=a/2;
  }
  if (shinkazu==16)
  {
   z=pakekazu+41;zx=275;zy=40;objput();
   for (i=0;i=10) {keta=2;}
   if (total2>=100) {keta=3;}
   if (total2>=1000) {keta=4;}
   if (total2>=10000) {keta=5;}
   for (i=0;i<=4;i++) {tennums[i]=0;}
   tennums[4]=total2/10000;
   tennums[3]=(total2%10000)/1000;
   tennums[2]=(total2%1000)/100;
   tennums[1]=(total2%100)/10;
   tennums[0]=total2%10;
   z=keta+41;zx=275;zy=40;objput();
   for (i=0;i=1) {a2=0;}
  if (flg==1 && nowbit>=4) {a3=0;}
  z=a1+19;zx=600;zy=-50;objput();z=a1+20;zx=500;zy=-50;objput();
  z=a2+21;zx=550;zy=50;objput();z=a3+22;zx=550;zy=-150;objput();
 }

 void scoreput()
 {
  if (score<0) {score=0;}
  for (ii=100;ii<=147;ii++) {z=ii;zx=-2000;zy=0;objput();}
  if (shinkazu==10)
  {
   if (score>999) {score=999;}
   zy=200;aa=0;
   a=score/100;if (a>0) {aa=1;z=a+100;zx=410;objput();}
   a=(score%100)/10;if (a>0 || aa>0) {aa=1;z=a+116;zx=428;objput();}
   a=score%10;z=a+132;zx=446;objput();
  }
  else
  {
   if (score>4095) {score=4095;}
   zy=200;aa=0;
   a=score/256;if (a>0) {aa=1;z=a+100;zx=410;objput();}
   a=(score%256)/16;if (a>0 || aa>0) {aa=1;z=a+116;zx=428;objput();}
   a=score%16;z=a+132;zx=446;objput();
  }
 }

 void timeput()
 {
  if (times1<0) {times1=0;}
  for (ii=148;ii<=195;ii++) {z=ii;zx=-2000;zy=0;objput();}
  if (shinkazu==10)
  {
   if (times1>999) {times1=999;}
   zy=170;aa=0;
   a=times1/100;if (a>0) {aa=1;z=a+148;zx=410;objput();}
   a=(times1%100)/10;if (a>0 || aa>0) {aa=1;z=a+164;zx=428;objput();}
   a=times1%10;z=a+180;zx=446;objput();
  }
  else
  {
   if (times1>4095) {times1=4095;}
   zy=170;aa=0;
   a=times1/256;if (a>0) {aa=1;z=a+148;zx=410;objput();}
   a=(times1%256)/16;if (a>0 || aa>0) {aa=1;z=a+164;zx=428;objput();}
   a=times1%16;z=a+180;zx=446;objput();
  }
 }

 void gameend()
 {
  bgmstop();bgm4.Play();
  for (i=6;i<=8;i++) {z=i;zx=-2000;zy=0;objput();}
  for (i=11;i<=18;i++) {z=i;zx=-2000;zy=0;objput();}
  for (i=27;i<=46;i++) {z=i;zx=-2000;zy=0;objput();}
  for (i=82;i<=98;i++) {z=i;zx=-2000;zy=0;objput();}
  for (i=200;i<=367;i++) {z=i;zx=-2000;zy=0;objput();}
  z=6;zx=0;zy=0;objput();
  obj[9].transform.rotation=Quaternion.identity;
  obj[10].transform.rotation=Quaternion.identity;obj[10].transform.Rotate(0,180,0);
  z=12;zx=-300;zy=-100;objput();z=16;zx=248;zy=-100;objput();
  z=47;zx=330;zy=80;objput();
  flg=9;buttonput();stime2f=Time.time;count=0;
 }

 void titleput()
 {
  alldel();bgmstop();flg=0;spacewait=2;yay=0;
  z=999;zx=-280;zy=-234;objput();
  z=6;zx=0;zy=0;objput();z=9;zx=-50;zy=-50;objput();z=10;zx=50;zy=-50;objput();
  z=12;zx=-300;zy=-100;objput();z=16;zx=248;zy=-100;objput();
  z=1;zx=0;zy=0;objput();z=5;zx=-200;zy=114;objput(); // 114-yay*48
  z=2;zx=pakekazu*50-32;zy=116;objput();
  if (shinkazu==16) {zx=0;} else {zx=132;}
  z=3;zy=68;objput();
  z=4;zx=148-hintonoff*98;zy=22;objput();
 }

 void OnGUI()
 {
  GUI.Label (new Rect (300,80,100,30),c1,style1);
  GUI.Label (new Rect (300,160,100,30),c2,style2);
  GUI.Label (new Rect (300,240,100,30),c3,style1);
  GUI.Label (new Rect (300,320,100,30),c4,style3);
 }

 void objput()
 {
  Vector3 pos=obj[z].transform.position;
  pos.x=zx*0.01f;pos.y=zy*0.01f;
  obj[z].transform.position=pos;
 }

 void objput2()
 {
  Vector3 pos=obj[z].transform.position;
  pos.x=xf*0.01f;pos.y=yf*0.01f;
  obj[z].transform.position=pos;
 }
 void bgmstop()
 {
  bgm1.Stop();bgm2.Stop();bgm3.Stop();bgm4.Stop();
 }

 void alldel()
 {
  zx=-2000;zy=0;
  for (i=0;i<=48;i++) {z=i;objput();}
  for (i=50;i<=98;i++) {z=i;objput();}
  for (i=100;i<=195;i++) {z=i;objput();}
  for (i=200;i<=367;i++) {z=i;objput();}
  for (i=997;i<=1000;i++) {z=i;objput();}
  for (i=6;i<=10;i++) {obj[i].transform.rotation=Quaternion.identity;}
  obj[10].transform.Rotate(0,180,0);
 }

 void datasave()
 {
  d1=mfx.ToString()+"/"+mfy.ToString();
  PlayerPrefs.SetString(keyname2,d1);
  PlayerPrefs.Save();
 }

 void dataload()
 {
  d1=PlayerPrefs.GetString(keyname2,"nothing");
  if (d1!="nothing")
  {
   dts=d1.Split('/');
   mfx=int.Parse(dts[0]);mfy=int.Parse(dts[1]);
  }
  else
  {
   mfx=640;mfy=360;
  }
 }
}