예제 #1
0
        // Use this for initialization
        void Start()
        {
            levelCount        = LevelLoader.LevelCount;//从levelloader中得到关卡总数量;
            levelRecordLoader = LevelRecordLoader.GetInstance();
            levelInformation  = new List <LevelInformation>();
            onePageCount      = (uint)buttonCollect.Length;


            //初始化关卡信息
            for (uint i = 0; i < levelCount; i++)
            {
                string         name   = LevelLoader.GetName(i);            //得到名字
                Nullable <int> record = levelRecordLoader.GetMaxRecord(i); //得到record
                levelInformation.Add(new LevelInformation(name, record));
            }

            nextChallengeLevelIndex = GetnextChallengeLevelIndex();
            page = 0;
            Refresh();

            //对按钮的消息进行绑定
            for (int i = 0; i < onePageCount; i++)
            {
                Transform target = buttonCollect[i].transform;
                buttonCollect[i].GetComponent <Button>().onClick.AddListener(
                    () => HandlerNotification(target)
                    );
            }
        }
예제 #2
0
        //加载点击按钮,只有有效范围内的按钮可以点击
        public void LoadClickLevel(uint num)
        {
            uint i = onePageCount * page;

            LevelLoader.Load(num + i);
            LevelRecordLoader.GetInstance().curLevel = num + i;//设置存档进度
        }
예제 #3
0
 //退出游戏
 public static void Quit()
 {
     Debug.Log("退出游戏");
     LevelRecordLoader.GetInstance().SaveLevelRecord();
     LevelRecordLoader.GetInstance().ShowAllLevelRecord();
     Application.Quit();
 }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        LevelRecordLoader temp = LevelRecordLoader.GetInstance();

        temp.ShowAllLevelRecord();

        temp.CompareMaxRecord(1, 3);
        temp.CompareMaxRecord(1, 7);
        temp.CompareMaxRecord(1, 2);
    }
예제 #5
0
 //按照index来加载scene
 public static void Load(uint index)
 {
     //获得真实的关卡序号
     index = index + base_offset;
     if (index >= levelNum)
     {
         Debug.LogError("加载失败,关卡数越界");
         throw new IndexOutOfRangeException("加载失败,关卡数越界");
     }
     else
     {
         SceneManager.LoadScene((int)index);
         LevelRecordLoader.GetInstance().curLevel = index;
         Debug.Log("按index加载成功:");
     }
 }
예제 #6
0
        void FixedUpdate()
        {
            //如果当前有监听对象,且对象不在场景内或者速度过低
            var birdWithinScene = birdWatcher.BirdWithinScene();

            if (birdWithinScene.HasValue && birdWithinScene == false)
            {
                this.Kill(new Existing <Bird>(birdWatcher.BirdUnderWatch));
                this.UnWatch();
            }

            if (this.Fail())
            {
                finalAction.call(
                    () => {
                    this.activeControl.BindsTo(
                        new Existing <Fail>(UIElements.failMenu)
                        );
                    UIElements.failMenu.OpenMenu();
                }
                    );
                return;
            }

            if (this.Win())
            {
                finalAction.call(
                    () => {
                    var curIndex = LevelLoader.GetCurIndex();
                    LevelRecordLoader.GetInstance().CompareMaxRecord(curIndex, UIElements.scorer.GetScore());    //记录当前关卡分数
                    var next_level = LevelLoader.GetNextLevelIndex();
                    LevelRecordLoader.GetInstance().curLevel = next_level.HasValue ? next_level.Value : curIndex;
                    this.activeControl.BindsTo(
                        new Existing <Win>(UIElements.winMenu)
                        );
                    UIElements.winMenu.OpenMenu();
                }
                    );

                //end
                return;
            }
        }
예제 #7
0
        //继续上一次的关卡,调用了另一个界面的函数。因为我把和关卡有关的都放在另一个menu上了。
        public void ContinueLevel()
        {
            var last_level = LevelRecordLoader.GetInstance().curLevel;

            LevelLoader.Load(last_level);
        }