示例#1
0
        public void TestDeclareStageMapWhenButtonNumberIsLargerThanProgressAndAllowedStages()
        {
            StageMapManagerImplementation stageMapImplementor = new StageMapManagerImplementation();
            int x = stageMapImplementor.DeclareStageMapButton(1, 4, 1, 5);

            Assert.AreEqual(0, x);
        }
示例#2
0
    /**Determine which stages are available to the user.
     * @params stageProgress is the progress of the user of a stage, stageCount is the total number of stages available, pageNumber is the current page number of the stage map
     * */
    public void DeclareStageMapButtons(int stageProgress, int stageCount, int pageNumber)
    {
        for (int i = 0; i < stageMapButtons.Length; i++)
        {
            StageMapButtonScript aStageButton = stageMapButtons[i].GetComponent <StageMapButtonScript>();
            int result = stageMapImplementor.DeclareStageMapButton(stageProgress, stageCount, pageNumber, i);
            Debug.Log(result);
            if (result == 1)
            {
                aStageButton.SetStageButton(true);
                int stageLevelForAButton = stageMapImplementor.ComputeStageNumber(pageNumber, noOfStagePerPage, i);

                stageMapButtons[i].GetComponent <Button>().interactable = true;
                aStageButton.SetStageButtonImage(activeSprite2);
                aStageButton.SetStageLevel(stageLevelForAButton);
                aStageButton.SetStageText(stageLevelForAButton.ToString());
            }
            else if (result == 2)
            {
                aStageButton.SetStageButton(false);
                aStageButton.SetStageButtonImage(lockedSprite2);
                aStageButton.SetStageText("");
            }

            else
            {
                aStageButton.SetStageButton(true);
                stageMapButtons[i].GetComponent <Button>().interactable = false;
                aStageButton.SetStageButtonImage(lockedSprite2);
                aStageButton.SetStageText("");
            }
        }
    }