Ejemplo n.º 1
0
        private void listViewProgress_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.listViewProgress.SelectedItems.Count == 0)
            {
                return;
            }
            Progress pro = new Progress();

            listProgress = ProgressController.getAllProgress();
            foreach (Progress item in listProgress)
            {
                if (item.idProject.ToString() == this.listViewProgress.SelectedItems[0].SubItems[1].Text)
                {
                    pro = item;
                }
            }
            if (pro.finished == true)
            {
                this.radFinished.Checked = true;
            }
            else
            {
                this.radNotFinished.Checked = true;
            }
            this.lbProjectName.Text = pro.Name.ToString();
            timeDown = pro.finishTime - DateTime.Now;
            this.timedown.Start();
        }
Ejemplo n.º 2
0
        public async Task AcceptanceTest()
        {
            // arrange
            var progressQuery = new ProgressQueryViewModel
            {
                PlayerId      = "Ross",
                PlayerLevel   = 4,
                ChipAmountBet = 600
            };

            var questRepositoryMock = new Mock <IQuestRepository>();

            questRepositoryMock
            .Setup(qr => qr.GetQuestAsync())
            .ReturnsAsync(new QuestConfiguration
            {
                RateFromBet                = 0.1m,
                LevelBonusRate             = 0.2m,
                TotalPointNeededToComplete = 1000,
                Milestones = new List <Milestone>
                {
                    new Milestone {
                        PointsNeededToComplete = 250, MilestoneIndex = 0, ChipAwarded = 100
                    },
                    new Milestone {
                        PointsNeededToComplete = 500, MilestoneIndex = 1, ChipAwarded = 150
                    },
                    new Milestone {
                        PointsNeededToComplete = 750, MilestoneIndex = 2, ChipAwarded = 200
                    },
                }
            });

            var playerScoringRepositoryMock = new Mock <IPlayerScoringRepository>();

            playerScoringRepositoryMock
            .Setup(psr => psr.GetPlayerScoringAsync(It.IsAny <string>()))
            .ReturnsAsync((string playerId) => new PlayerScoring {
                PlayerId = playerId, CompletedMilestoneIndices = new List <int> {
                }, Score = 0
            });
            playerScoringRepositoryMock
            .Setup(psr => psr.UpsertPlayerScoringAsync(It.IsAny <string>(), It.IsAny <decimal>(), It.IsAny <IEnumerable <int> >()))
            .Returns(Task.FromResult(0));

            var controller = new ProgressController(questRepositoryMock.Object, playerScoringRepositoryMock.Object);

            // act
            var actionResult = await controller.GetProgressAsync(progressQuery) as OkObjectResult;

            // assert
            Assert.NotNull(actionResult);
            Assert.Equal(200, actionResult.StatusCode);
            ProgressViewModel value = actionResult.Value as ProgressViewModel;

            Assert.NotNull(value);

            Assert.Equal(60.8m, value.QuestPointsEarned);
            Assert.Equal(6.08m, value.TotalQuestPercentCompleted);
        }
Ejemplo n.º 3
0
    void SaveProgress()
    {
        PlayerProgress currLevelProgress = new PlayerProgress(
            levelMode,
            levelNo,
            starPercent,
            timePassed,
            wrongTries,
            nextNumber,
            true,
            false
            );

        ProgressController.SaveProgress(currLevelProgress);

        // If there is no level or we could not get one star, do not unlock next level.
        if (levelNo == levels.Count || starPercent < starPercents[0])
        {
            UICont.DisableNextButton();
            return;
        }

        // We have a next level, so unlock it.
        PlayerProgress nextLevelProgress = ProgressController.GetProgress(levelMode, levelNo + 1);

        nextLevelProgress.locked = false;

        ProgressController.SaveProgress(nextLevelProgress);
    }
Ejemplo n.º 4
0
    private void Awake()
    {
        //singleton initialization
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(instance);
        }

        DontDestroyOnLoad(instance);

        //set null current player on game awaked
        AppController.instance.currentPlayer         = null;
        AppController.instance.allPlayerProgressData = null;

        //save file path
        Debug.Log(Application.persistentDataPath);

        //holding camera values
        cameraHeight = Camera.main.orthographicSize;
        cameraWidth  = cameraHeight * Camera.main.aspect;

        //sets active screen to welcome
        SetState(ApplicationStates.StartMenu);

        //load game data from JSON
        AppController.instance.dataController = new DataController();
        AppController.instance.dataController.LoadGameData();

        //tries to load saved game data if any exists from previous session(s)
        ProgressController.LoadLastSession();
    }
Ejemplo n.º 5
0
    void Start()
    {
        if (progressController == null)
        {
            progressController = GetComponent <ProgressController>();
        }
        unlockedLevels = Mathf.Max(unlockedLevels, progressController.GetProgress().completedLevels + 1);
        for (var i = 0; i < transform.childCount; i++)
        {
            var levelButton  = transform.GetChild(i);
            var levelNumber  = levelButton.GetComponent <LevelNumber>().LevelNum;
            var buttonStatus = levelButton.GetComponent <LevelButtonStatusController>();

            if (levelNumber < unlockedLevels)
            {
                buttonStatus.SetButtonState(LevelButtonState.Unlocked);
            }
            else if (levelNumber == unlockedLevels)
            {
                buttonStatus.SetButtonState(LevelButtonState.Hidden);
            }
            else if (levelNumber > unlockedLevels)
            {
                buttonStatus.SetButtonState(LevelButtonState.Locked);
            }
        }
    }
Ejemplo n.º 6
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Progress progress = new Progress();

            progress.STT          = ProgressController.getIDfromDB().ToString();
            progress.P_ID         = int.Parse(txtProjectID.Text.Trim());
            progress.S_ID         = txtStudentID.Text.Trim();
            progress.ProgressName = txtProjectContent.Text.Trim();
            progress.Note         = txtNote.Text.Trim();
            progress.LinkSource   = txtLink.Text.Trim();

            if (ProgressController.addProgress(progress) == false)
            {
                MessageBox.Show("Error in adding a new progress!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show("Add success!!!", "Note", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            BindingSource source = new BindingSource();

            source.DataSource           = StudentController.listProgressOfStudent(_p_id, _s_id);
            this.dgvProgress.DataSource = source;
        }
        public void ProgressReturnNotFoundWhenQuestConfigNotFound()
        {
            // Arrange
            var configuration = new ConfigurationBuilder()
                                .SetBasePath(Directory.GetCurrentDirectory())
                                .AddJsonFile("config.json")
                                .Build();

            _config             = Options.Create(configuration.Get <QuestConfiguration>());
            _config.Value.Quest = null;

            var controller = new ProgressController(_fakePlayerRepository, _config);

            var bet = new PlayerBet
            {
                PlayerId      = "P01",
                PlayerLevel   = 2,
                ChipAmountBet = 10
            };

            //Act
            var result = controller.Progress(bet);

            //Assert
            var notFoundObjectResult = Assert.IsType <NotFoundObjectResult>(result);

            Assert.Null(notFoundObjectResult.Value);
        }
        private void frmProjectDetail_Load(object sender, EventArgs e)
        {
            txtName.Text      = this.project.name;
            txtSubject.Text   = this.project.subject.ToString();
            txtDateStart.Text = this.project.dateStart.ToString();
            if (project.source != null)
            {
                txtDateEnd.Text = this.project.dateEnd.ToString();
            }

            List <Progress> listProgress = ProgressController.getAllProgress();
            Progress        pro          = new Progress();

            foreach (Progress item in listProgress)
            {
                if (item.idProject == project.idProject)
                {
                    pro = item;
                    break;
                }
            }
            if (pro.finished == true)
            {
                txtDateSubmit.Text = pro.submitTime.ToString();
            }
            else
            {
                txtDateSubmit.Text = "";
            }
            //list student
            string sStudent = "";

            foreach (Student st in project.listStudent)
            {
                sStudent += st.name.ToString() + "\n";
            }
            rbStudent.Text = sStudent;

            // Hiển thị list Instructor của Project
            // Dùng database chuyển qua 1 string để hiển thị trong 1 ô
            string sInstructor = "";

            foreach (Instructor gv in project.listInstructor)
            {
                sInstructor += gv.name.ToString() + "\n";
            }
            rbInstructor.Text = sInstructor;

            txtIdProject.Text = this.project.idProject;
            if (this.project.mark != 0)
            {
                txtMark.Text = this.project.mark.ToString();
            }
            else
            {
                txtMark.Text = "";
            }
            txtSubmitLink.Text = this.project.source;
            //txtDateSubmit.Text = this.project.report.ToString();
        }
Ejemplo n.º 9
0
        public void DisplayProgress()
        {
            this.listViewProgress.Items.Clear();
            int             STT          = 1;
            List <Progress> listProgress = ProgressController.getAllProgress();

            foreach (Progress item in listProgress)
            {
                ListViewItem progress = new ListViewItem(STT.ToString());
                progress.SubItems.Add(new ListViewItem.ListViewSubItem(progress, item.idProject.ToString()));
                progress.SubItems.Add(new ListViewItem.ListViewSubItem(progress, item.Name.ToString()));


                Project p        = ProjectController.GetProject(item.idProject);
                string  sStudent = "";
                foreach (Student st in p.listStudent)
                {
                    sStudent += st.name.ToString() + "\n";
                }
                progress.SubItems.Add(new ListViewItem.ListViewSubItem(progress, sStudent));

                progress.SubItems.Add(new ListViewItem.ListViewSubItem(progress, item.dateStart.ToShortDateString()));  //Ngày bắt đầu
                progress.SubItems.Add(new ListViewItem.ListViewSubItem(progress, item.finishTime.ToShortDateString())); //Ngày kết thúc
                if (item.finished == true)
                {
                    progress.SubItems.Add(new ListViewItem.ListViewSubItem(progress, item.submitTime.ToString()));//Ngày nộp
                }
                else
                {
                    progress.SubItems.Add(new ListViewItem.ListViewSubItem(progress, ""));//Ngày nộp
                }
                listViewProgress.Items.Add(progress);
                STT++;
            }
        }
Ejemplo n.º 10
0
        public void ProgressReturnPlayerProgressWhenBetIsValid()
        {
            // Arrange
            var configuration = new ConfigurationBuilder()
                                .SetBasePath(Directory.GetCurrentDirectory())
                                .AddJsonFile("config.json")
                                .Build();

            _config = Options.Create(configuration.Get <QuestConfiguration>());

            var controller = new ProgressController(_fakePlayerRepository, _config);

            var bet = new PlayerBet
            {
                PlayerId      = "P01",
                PlayerLevel   = 2,
                ChipAmountBet = 10
            };

            var player         = _fakePlayerRepository.GetPlayer(bet.PlayerId);
            var expectedResult = CalculateProgress(_config.Value, player, bet);

            //Act
            var result = controller.Progress(bet);

            //Assert
            var okObjectResult = Assert.IsType <OkObjectResult>(result);
            var model          = Assert.IsType <PlayerProgress>(okObjectResult.Value);

            Assert.Equal(expectedResult.TotalQuestPercentCompleted, model.TotalQuestPercentCompleted);
            Assert.True(expectedResult.MilestonesCompleted.All(shouldItem => model.MilestonesCompleted.Any(isItem => isItem.MilestoneIndex == shouldItem.MilestoneIndex && isItem.ChipsAwarded == shouldItem.ChipsAwarded)));
            Assert.Equal(expectedResult.QuestPointsEarned, model.QuestPointsEarned);
        }
Ejemplo n.º 11
0
    //matching game ends in seconds
    private IEnumerator End(int inSec)
    {
        yield return(new WaitForSeconds(inSec));

        ProgressController.SaveProgress();
        AppController.instance.SetState(AppEnums.ApplicationStates.StoryMap);
    }
Ejemplo n.º 12
0
    private void ApplyProgress()
    {
        stay = true;

        AppController.instance.currentPlayer.SetGoDest();

        AppController.instance.currentPlayer.CalculateProgressPercentage();

        textMeshProProgressBar.text = "%" + AppController.instance.currentPlayer.ProgressPercentage /* + " Finished ("
                                                                                                     + AppController.instance.currentPlayer.LearnedItems.Count.ToString() + " of "
                                                                                                     + AppController.instance.dataController.allItemData.Length.ToString() + " words have learned)"*/;

        progressBarFiller.localScale = new Vector3(AppController.instance.currentPlayer.ProgressPercentage, 1, 1);

        ProgressController.SaveProgress();

        if (AppController.instance.currentPlayer.ProgressPercentage >= 100)
        {
            gameFinishedPanel.SetActive(true);
        }
        else
        {
            gameFinishedPanel.SetActive(false);
        }
    }
Ejemplo n.º 13
0
 public void CheckForTimeout()
 {
     var span = DateTime.Now - GameStarted;
     if (span.Hours >= 24)
     {
         controller = new ProgressController();
     }
 }
Ejemplo n.º 14
0
 public void OnPlayAgainClicked()
 {
     ProgressController.SaveProgress();
     ProgressController.CreateNewPlayer();
     gameFinishedPanel.SetActive(false);
     AppController.instance.SetState(ApplicationStates.StartMenu);
     Debug.Log("Restart : Old Character saved as finished, new character created to play from begin.");
 }
Ejemplo n.º 15
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Progress pro = new Progress();
            // Dùng form frmProject chứ năng thêm
            frmAddProject add = new frmAddProject();

            add.ShowDialog();

            //Nếu cancel (project.a=idProject == null) thì return
            if (add.project.idProject == null)
            {
                return;
            }

            //gán giá trị cho progress
            pro.idProject   = add.project.idProject;
            pro.Name        = add.project.name;
            pro.listStudent = null;
            pro.dateStart   = add.project.dateStart.Value;
            pro.finishTime  = add.project.dateEnd.Value;
            pro.mark        = 0;
            pro.submitTime  = DateTime.Now.Date;
            pro.finished    = false;

            //add progress
            ProgressController.AddProgress(pro);
            //add project
            ProjectController.AddProject(add.project);

            // Hiển thị lên listview
            ListViewItem proj = new ListViewItem(STT.ToString());

            proj.SubItems.Add(new ListViewItem.ListViewSubItem(proj, add.project.idProject.ToString()));
            proj.SubItems.Add(new ListViewItem.ListViewSubItem(proj, add.project.name.ToString()));

            // listStudent
            string sStudent = "";

            foreach (Student st in add.project.listStudent)
            {
                sStudent += st.name.ToString() + " ";
            }
            proj.SubItems.Add(new ListViewItem.ListViewSubItem(proj, sStudent));

            // listInstructor
            string sInstructor = "";

            foreach (Instructor gv in add.project.listInstructor)
            {
                sInstructor += gv.name.ToString() + " ";
            }
            proj.SubItems.Add(new ListViewItem.ListViewSubItem(proj, sInstructor));
            proj.SubItems.Add(new ListViewItem.ListViewSubItem(proj, add.project.subject.ToString()));
            proj.SubItems.Add(new ListViewItem.ListViewSubItem(proj, add.project.course.ToString()));

            this.lstProject.Items.Add(proj);
            STT++;
        }
Ejemplo n.º 16
0
        public void Finds_lecture_nodes()
        {
            using var scope = _factory.Services.CreateScope();
            var controller = new ProgressController(_factory.Services.GetRequiredService <IMapper>(),
                                                    scope.ServiceProvider.GetRequiredService <IProgressService>());

            var node = ((OkObjectResult)controller.GetLectureNodes(1).Result).Value as List <KnowledgeNodeProgressDTO>;

            node.Count.ShouldBe(4);
        }
Ejemplo n.º 17
0
 void Start()
 {
     Time.timeScale    = 1f;
     gameController    = GameObject.Find("GameController").GetComponent <GameController>();
     this.progess      = GameObject.Find("progressZeppelin").GetComponent <ProgressController>();
     this.levelConfig  = this.GetComponent <LevelInterface>();
     this.timer        = levelConfig.getLevelTime();
     this.initialTimer = levelConfig.getLevelTime();
     this.incidents    = levelConfig.getIncidents();
 }
Ejemplo n.º 18
0
        public TaskLoaderView(CancellationTokenSource cancellation)
        {
            InitializeComponent();

            _controller   = new ProgressController(this);
            _cancellation = cancellation;

            TaskProgressBar.Minimum = 0;
            TaskProgressBar.Maximum = 100;
        }
Ejemplo n.º 19
0
    public void OnYesDeleteButtonClicked()
    {
        if (ProgressController.DeleteCurrentCharacter())
        {
            clickedPlayer = null;
        }

        deleteApplyPanel.SetActive(false);
        LoadPlayerList();
    }
Ejemplo n.º 20
0
        public void No_lecture_nodes()
        {
            using var scope = _factory.Services.CreateScope();
            var controller = new ProgressController(_factory.Services.GetRequiredService <IMapper>(),
                                                    scope.ServiceProvider.GetRequiredService <IProgressService>());

            var code = ((NotFoundObjectResult)controller.GetLectureNodes(111).Result).StatusCode;

            code.ShouldBe(404);
        }
Ejemplo n.º 21
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 22
0
    public void OnCreateButtonClicked()
    {
        ProgressController.CreateNewPlayer();

        LoadPlayerList();

        if (GameObject.FindGameObjectWithTag("PlayerListScrollBar") != null)
        {
            GameObject.FindGameObjectWithTag("PlayerListScrollBar").GetComponent <Scrollbar>().value = 0f;
        }
    }
        public async Task DownloadProgressReturnsEmptyResult()
        {
            var mockRepo = new Mock <IHostingEnvironment>();

            mockRepo.Setup(repo => repo.WebRootPath).Returns("");
            var controller = new ProgressController(mockRepo.Object, null);

            var result = await controller.DownloadProgress();

            Assert.IsType <EmptyResult>(result);
        }
        public async Task ViewProgressViewDataFileExist()
        {
            var mockRepo = new Mock <IHostingEnvironment>();

            mockRepo.Setup(repo => repo.WebRootPath).Returns("");
            var controller = new ProgressController(mockRepo.Object, null);

            var result = controller.ViewProgress() as ViewResult;

            Assert.False((bool)(result?.ViewData["FileExist"]));
        }
Ejemplo n.º 25
0
 public void Init()
 {
     courseData = Utilits.CreateCourse();
     courseData.SetUpLinks();
     userId                = "1";
     user                  = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, userId) }));
     courseProgressData    = courseData.CreateProgress(userId);
     courseProgressData.Id = $"{userId}{courseData.Id}";
     courseProgressData.SetUpLinks();
     controller = CreateProgressController();
 }
Ejemplo n.º 26
0
 protected override void OperateImpl(OperatingContext Context, CancellationToken CancellationToken)
 {
     using (var pc = new ProgressController(Progress))
     {
         pc.SetDescription("Подключение по USB...");
         using (UsbConnection connection = Context.Usb.Connect(_usbConnectionTimeout, CancellationToken))
         {
             pc.SetDescription(string.Format("Отправка {0} по USB {{0:P0}}", _dataName), Progress);
             connection.Write(_data, _address, Progress, CancellationToken);
         }
     }
 }
Ejemplo n.º 27
0
    // Start is called before the first frame update
    void Start()
    {
        var settings = GameplaySettings.Settings;
        var mainGame = GameObject.Find("MainGame");

        GameplaySettings.MainCamera = GameObject.Find("MainCamera");
        GameplaySettings.PointsText = GameObject.Find("PointsText");
        GameplaySettings.StarsText  = GameObject.Find("StarsText");
        Globals.GenerateLevel(mainGame.transform, GameplaySettings.MainCamera);

        ProgressController.PaintHUD();
    }
Ejemplo n.º 28
0
    // Start is called before the first frame update
    void Awake()
    {
        // set singleton
        Instance = this;
        Instantiate(Player);

        // ref other scripts
        gm = GameObject.Find("Grid Maker").GetComponent <GridMaker>();
        progressController = GameObject.Find("Progress Arrow").GetComponent <ProgressController>();
        st          = GameObject.Find("Species Tracker").GetComponent <SpeciesTracker>();
        audioSource = GetComponent <AudioSource>();
    }
Ejemplo n.º 29
0
        public void DeleteProgressWhenNoProgressIsStarted()
        {
            _contextMock = new Mock <IDbContext>();

            _participant = new Participant {
                Id = 1, Email = "", Scores = null, UserSetting = null, Progress = null
            };
            _controller = new ProgressController(_contextMock.Object, _participant);
            SetupControllerForTests(_controller);

            var request = _controller.Delete();
        }
Ejemplo n.º 30
0
        private void myProgressToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IUserController     _userController     = new UserController(_formsFactory, _repositoryFactory);
            IProgressController _progressController = new ProgressController(_formsFactory, _repositoryFactory);
            var progressForm = new frmUserProgressWindow(_userController, _progressController, _repositoryFactory);

            this.Close();
            th = new Thread(delegate() {
                RunOnNextForm(progressForm);
            });
            th.SetApartmentState(ApartmentState.STA);
            th.Start();
        }
Ejemplo n.º 31
0
 private void OnApplicationQuit()
 {
     if (currentPlayer != null)
     {
         allPlayerProgressData.lastSessionPlayerId = currentPlayer.PlayerID;
         Debug.Log("Saved - Last Session Id : " + allPlayerProgressData.lastSessionPlayerId);
         ProgressController.SaveProgress();
     }
     else
     {
         Debug.Log("No currentPlayer Found and progress not saved.");
     }
 }
Ejemplo n.º 32
0
    // Start is called before the first frame update
    void Awake()
    {
        // set singleton
        Instance = this;
        Instantiate(Player);

        // ref other scripts
        gm = GameObject.Find("Grid Maker").GetComponent <GridMaker>();
        progressController = GameObject.Find("Progress Arrow").GetComponent <ProgressController>();
        st            = GameObject.Find("Species Tracker").GetComponent <SpeciesTracker>();
        hd            = GetComponent <HintDetection>();
        audioSource   = GetComponent <AudioSource>();
        originalScale = backButton.transform.localScale.x;
    }
Ejemplo n.º 33
0
    //called before Start! Important for order!
    void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(gameObject);
            return;
        }
        else
        {
            _instance = this;
        }
        DontDestroyOnLoad(gameObject);

        //Load level progress!
        if (PlayerPrefs.HasKey("Progress_Beta"))
        {
            CompletionProgress = PlayerPrefs.GetInt("Progress_Beta");
        }
    }
Ejemplo n.º 34
0
 public DoubleTapBonus()
 {
     controller = new ProgressController();
 }