public ChapterData()
    {
        Debug.Log("ChapterData:" + this.ToString());

        //		DATABLOCK d = DATABLOCK.NONE;
        //		while (true) {
        //			Debug.Log("DATA:"+d);
        //			if(d == DATABLOCK.END)
        //				break;
        //			d++;
        //		}


        version     = 4;
        ID          = 0;
        GameType    = GAMETYPE.NOSELECTED;
        Name        = "Chapter Name";
        Description = "Chapter Description";

        IconName    = "";
        IconTexture = null;

        LevelList        = new List <LevelData>();
        currentLevelData = null;

        //SaveDataInFile ();
        //LoadDataFromFile ();
    }
Пример #2
0
 public void StartSingleplayer()
 {
     gameType = GAMETYPE.SINGLEPLAYER;
     gameTypeScreen.SetActive(false);
     worldScreen.SetActive(true);
     WorldGenerator.FetchWorlds();
     SetupWorldList();
 }
Пример #3
0
 public void HostInternetGame()
 {
     gameType = GAMETYPE.INTERNET;
     internetGameScreen.SetActive(false);
     worldScreen.SetActive(true);
     WorldGenerator.FetchWorlds();
     SetupWorldList();
 }
Пример #4
0
    public void LoadLevelResults()
    {
        mLevelResults = new Dictionary <ChapterLevel, LevelResult>();

        if (!File.Exists(Application.persistentDataPath + "//.BubbleRockLevelResult"))
        {
            return;
        }

        BinaryReader Reader = new BinaryReader(File.OpenRead(Application.persistentDataPath + "//.BubbleRockLevelResult"));

        string title = Reader.ReadString();

        if (title != "BubbleRockLevelResult")
        {
            Debug.Log("Bad title");
            return;
        }
        int version = Reader.ReadInt32();

        if (version != 2)
        {
            Debug.Log("Bad version");
            return;
        }


        while (true)
        {
            string name = Reader.ReadString();
            if (name == "End")
            {
                break;
            }
            if (name != "LR")
            {
                Debug.Log("Bad data? LevelResult");
                return;
            }
            GAMETYPE gametype = (GAMETYPE)Reader.ReadInt32();
            int      chapter  = Reader.ReadInt32();
            int      level    = Reader.ReadInt32();
            Debug.Log("GAMETYPE: " + gametype + " Chapter: " + chapter + " Level: " + level);

            ChapterLevel mChapterLevel = new ChapterLevel(gametype, chapter, level);

            BinaryFormatter bf           = new BinaryFormatter();
            LevelResult     mLevelResult = (LevelResult)bf.Deserialize(Reader.BaseStream);
            mLevelResults.Add(mChapterLevel, mLevelResult);
        }

        Reader.Close();
    }
 private void Clear()
 {
     version     = 4;
     ID          = 0;
     GameType    = GAMETYPE.NOSELECTED;
     Name        = "Chapter Name";
     Description = "Chapter Description";
     IconName    = "";
     IconTexture = null;
     LevelList.Clear();
     currentLevelData = null;
 }
Пример #6
0
    /// <summary>
    /// 開始遊戲
    /// </summary>
    public void StartGame(int[] r, int[] l, int odds)
    {
        GAMETYPE Type = MainManage.Main.Auto ? GAMETYPE.AUTO : GAMETYPE.NORMAL;

        MainManage.Main.Lines_Obj.CloseLine();

        switch (Type)
        {
        case GAMETYPE.NORMAL:
        {
            for (int i = 0; i < AllReel.Length; i++)
            {
                AllReel[i].ChangeAwards(new int[3] {
                        r[i * 3], r[i * 3 + 1], r[i * 3 + 2]
                    });
                AllReel[i].StartGame_Normal(0, 0.2f, i * 0.05f);
            }
        }
        break;

        case GAMETYPE.AUTO:
        {
            for (int i = 0; i < AllReel.Length; i++)
            {
                AllReel[i].ChangeAwards(new int[3] {
                        r[i * 3], r[i * 3 + 1], r[i * 3 + 2]
                    });
                AllReel[i].StartGame_Auto(0, 0.2f, i * 0.05f);
            }
        }
        break;

        case GAMETYPE.NORMALQUICK:
        {
        }
        break;

        case GAMETYPE.AUTOQUICK:
        {
        }
        break;
        }

        StartCoroutine(OverGame(l, odds));
    }
Пример #7
0
 public void playMulti()
 {
     gameType = GAMETYPE.MULTI;
     PlayerPrefs.SetString("GAMETYPE", "MULTI");
     SceneManager.LoadScene(1);
 }
Пример #8
0
 public void playSingle()
 {
     gameType = GAMETYPE.SINGLE;
     PlayerPrefs.SetString("GAMETYPE", "SINGLE");
     SceneManager.LoadScene(1);
 }
Пример #9
0
 public ChapterLevel(int chapter, int level)
 {
     mGameType = GAMETYPE.NOSELECTED;
     iChapter  = chapter;
     iLevel    = level;
 }
Пример #10
0
 public ChapterLevel(GAMETYPE gametype, int chapter, int level)
 {
     mGameType = gametype;
     iChapter  = chapter;
     iLevel    = level;
 }
    private bool ReadBlock(BinaryReader _BinaryReader)
    {
        DATABLOCK block = (DATABLOCK)_BinaryReader.ReadByte();

        switch (block)
        {
        case DATABLOCK.VERSION:
                        #if DEBUGSAVE
            Debug.Log("ReadBlock: VERSION");
                        #endif
            version = _BinaryReader.ReadInt32();
                        #if DEBUGSAVE
            Debug.Log("Version " + version);
                        #endif
            if (version < 4)
            {
                Debug.LogError("OLDVERSION");
                return(false);
            }
            return(true);

        case DATABLOCK.CHAPTER:
                        #if DEBUGSAVE
            Debug.Log("ReadBlock: CHAPTER");
                        #endif

            ID          = _BinaryReader.ReadInt32();
            GameType    = (GAMETYPE)_BinaryReader.ReadByte();
            Name        = _BinaryReader.ReadString();
            Description = _BinaryReader.ReadString();

            return(true);

        case DATABLOCK.LEVEL:
                        #if DEBUGSAVE
            Debug.Log("ReadBlock: LEVEL");
                        #endif
            currentLevelData = new LevelData();
            LevelList.Add(currentLevelData);
            while (ReadBlock(_BinaryReader))
            {
                continue;
            }

            return(true);

        case DATABLOCK.CELL_BALL:
                        #if DEBUGSAVE
            Debug.Log("ReadBlock: CELL_BALL");
                        #endif
            if (currentLevelData == null)
            {
                Debug.LogError("ReadBlock: CELL_BALL NO LEVEL");
                return(false);
            }

            LevelData.CellBall ball = new LevelData.CellBall();

            ball.position.Set(
                _BinaryReader.ReadSingle(),
                _BinaryReader.ReadSingle(),
                0.0f);

            ball.type   = (BALLTYPE)_BinaryReader.ReadByte();
            ball.basic  = _BinaryReader.ReadBoolean();
            ball.frozen = _BinaryReader.ReadBoolean();
            ball.armor  = _BinaryReader.ReadInt32();

            currentLevelData.CellBallList.Add(ball);

            return(true);

        case DATABLOCK.BALLCOLORLINE:
                        #if DEBUGSAVE
            Debug.Log("ReadBlock: BALLCOLORLINE");
                        #endif

            BALLTYPE bt = (BALLTYPE)_BinaryReader.ReadByte();
            while (bt != BALLTYPE.LASTONE)
            {
                currentLevelData.BallsColorLine.Add(bt);
                bt = (BALLTYPE)_BinaryReader.ReadByte();
            }
            return(true);

        case DATABLOCK.LEVELEND:
                        #if DEBUGSAVE
            Debug.Log("ReadBlock: LEVELEND");
                        #endif
            return(false);

        case DATABLOCK.END:
                        #if DEBUGSAVE
            Debug.Log("ReadBlock: END");
                        #endif
            return(false);

        default:
                        #if DEBUGSAVE
            Debug.LogError("ReadBlock: NO DATA");
                        #endif
            return(false);
        }
    }