Beispiel #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            LevelTime = await _context.LevelTime.FirstOrDefaultAsync(m => m.LevelTimeId == id);

            if (LevelTime == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Beispiel #2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            LevelTime = await _context.LevelTime.FindAsync(id);

            if (LevelTime != null)
            {
                _context.LevelTime.Remove(LevelTime);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #3
0
    // Initializes end screen UI
    private void InitializeUI()
    {
        if (VRMissionModeManager.Instance.nextMissionLevelData == null)
        {
            nextMissionButton.interactable = false;
        }

        if (VRMissionModeManager.Instance.levelData.bHasScore)
        {
            endTimeText.text = "Score: " + VRMissionModeManager.Instance.missionScore.Score.ToString();

            parTimeText.gameObject.SetActive(true);
            parTimeText.text = "Par Time: " + VRMissionModeManager.Instance.levelData.parTime.SGetTimeString();

            timeBonusText.gameObject.SetActive(true);
            timeBonusText.text = "Time Bonus: " + VRMissionModeManager.Instance.TimeBonus.ToString();

            endBestTimeText.text = "Best: " + VRMissionModeManager.Instance.BestScore.ToString();
            endRankText.text     = "Rank: " + VRMissionModeManager.Instance.EndRank;
        }
        else
        {
            endTimeText.text     = "Time: " + LevelTime.SConvertToTimeString(VRMissionModeManager.Instance.missionTimer.CurrentTime);
            endBestTimeText.text = "Best: " + LevelTime.SConvertToTimeString(VRMissionModeManager.Instance.BestTime);
            endRankText.text     = "Rank: " + VRMissionModeManager.Instance.EndRank;
        }

        switch (VRMissionModeManager.Instance.EndRank)
        {
        case "Gold":
            endRankText.color = goldRankColour;
            break;

        case "Silver":
            endRankText.color = silverRankColour;
            break;

        case "Bronze":
            endRankText.color = bronzeRankColour;
            break;

        default:
            endRankText.color = noRankColour;
            break;
        }
    }
Beispiel #4
0
    DebugCommandHandler commandHandler = DebugCommandHandler.Instance;     // Added

    void Update()
    {
        LevelTime instance = LevelTime.Instance;

        if (instance != null)
        {
            float time = instance.GetTime(this._levelTimer);
            if (time != this.oldTime)
            {
                this.oldTime = time;
                // If stopwatch is active, prevent text from being updated by vanilla text
                if (commandHandler.stopwatchCommand != null && !commandHandler.stopwatchCommand.isActive)
                {
                    this._text.text = StringUtility.ConvertToTime(time, this._format);
                }
            }
        }
    }
Beispiel #5
0
    private void readConfig(string line)
    {
        BufferedDataReader parser     = new BufferedDataReader(line, "");
        string             configName = parser.readWord();

        if (configName.Equals("Time"))
        {
            LevelTime lt = world.AddComponent <LevelTime>();
            lt.TimeLeft = parser.readInt();
        }
        else if (configName.StartsWith("Score"))
        {
            world.AddComponent <LevelScore>();
        }
        else
        {
            Debug.LogError("FileToLevelLoader - ERROR : Unknown config " + configName);
        }
    }
Beispiel #6
0
    // Initialization
    protected override void Start()
    {
        iCurrentLevel = 0;

        asLevelTimeStrings  = new string[levelList.aLevelData.Length];
        asLevelScoreStrings = new string[levelList.aLevelData.Length];

        for (int i = 0; i < asLevelTimeStrings.Length; i++)
        {
            float time  = ProfileDataManager.Instance.LoadVRMissionTime(levelList.aLevelData[i].sLevelName);
            int   score = ProfileDataManager.Instance.LoadVRMissionScore(levelList.aLevelData[i].sLevelName);
            asLevelTimeStrings[i]  = time == -1 ? "Best: --:--.--" : "Best: " + LevelTime.SConvertToTimeString(time);
            asLevelScoreStrings[i] = score == -1 ? "Best: -----" : "Best: " + score.ToString();
        }

        InitializeButtons();
        UpdateUI();

        StartCoroutine(SetObjectSelection());
    }
    // Start is called before the first frame update
    void Start()
    {
        countdown             = GameObject.Find("CountdownCanvas").GetComponent <Canvas>();
        countdownAnimator     = countdown.GetComponent <Animator>();
        spacecraftControls    = FindObjectOfType <SpacecraftControls>();
        spacecraftMovement    = FindObjectOfType <SpacecraftMovement>();
        levelTime             = FindObjectOfType <LevelTime>();
        gameMaster            = GameObject.FindGameObjectWithTag("GameMaster").GetComponent <GameMaster>();
        playLevelCountdown    = gameMaster.getPlayCountdown();
        countdownTime         = 4.0f;
        decreaseCountDownTime = countdownTime;
        countdownPlaying      = false;

        if (playLevelCountdown)
        {
            beginCountdown();
        }
        else
        {
            levelTime.startTimer();
        }
    }
Beispiel #8
0
        public void Update(object sender, EventArgs e)
        {
            degrees += 1;
            player.TriggerTicks++;

            if (player.IsLevelCompleted && !isMessageShowed)
            {
                LevelTime.Stop();
                GameTime.Stop();
                Map.UpdateBestTime();
                ShowMessage();
                isMessageShowed = true;
            }

            if (player.Dead)
            {
                Restart();
            }

            if (player.TriggerTicks != 0)
            {
                player.ReactToOrbs(Map, sizeValue);
            }

            if (player.Moving)
            {
                if (LevelTime.Enabled)
                {
                    player.Move(Map, sizeValue);
                }
                else
                {
                    LevelTime.Start();
                }
            }

            UpdateTimeLabel();
            Invalidate();
        }
Beispiel #9
0
 protected override void UpdatePlayer(LevelTime levelTime)
 {
     player.Update(levelTime, arena.Circle, camera, true);
     hitIterator.Update(levelTime);
     bulletMgr.CheckPlayerCollisions(player, true);
 }
 private void Start()
 {
     gameMaster = GameObject.FindGameObjectWithTag("GameMaster").GetComponent <GameMaster>();
     levelTime  = FindObjectOfType <LevelTime>();
 }
Beispiel #11
0
 private void Restart()
 {
     player = new Player(Map.StartPosition, sizeValue);
     LevelTime.Stop();
     Map.ResetTime();
 }
Beispiel #12
0
 public void WipeOutData()
 {
     time          = new LevelTime();
     score         = "";
     currentColors = new RubikCubeFaceColors();
 }
Beispiel #13
0
 void Awake()
 {
     LevelTime.instance = this;
 }
Beispiel #14
0
 protected override void UpdatePosition(LevelTime levelTime, CircleSprite arenaCircle,
                                        ArenaCamera camera, bool confineCursorToScreen)
 {
     positionIterator.Update(levelTime);
 }
Beispiel #15
0
        //public Fixture Fixture { get; set; }

        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }


            //Get template of fixtures for league type
            var fixtureList = new List <FixtureDate>();

            //get current league using session data

            try
            {
                //string tempLeagueString = HttpContext.Session.GetString("SelectedLeague");

                //int CurrentLeagueId = Convert.ToInt32(tempLeagueString);
                League League = _context.League.FirstOrDefault(c => c.LeagueId == SelectedLeagueId);

                if (League.FixturesMade)
                {
                    return(RedirectToPage("./Index"));
                }


                if (League.LeagueType == LeagueType.Long)
                {
                    fixtureList = _context.FixtureDate.Where(fd => fd.LeagueType == LeagueType.Long)
                                  .OrderBy(fd => fd.StartDaysPlus)
                                  .ToList();
                }
                else
                {
                    fixtureList = _context.FixtureDate.Where(fd => fd.LeagueType == LeagueType.Short)
                                  .OrderBy(fd => fd.StartDaysPlus)
                                  .ToList();
                }


                //Get an array of the teams in this league
                var teamList = _context.Team.Where(t => t.LeagueId == League.LeagueId)
                               .OrderBy(t => t.TeamNo)
                               .ToArray();


                //Loop through and make new fixtures
                foreach (FixtureDate fd in fixtureList)
                {
                    Fixture newFixture = new Fixture
                    {
                        League   = League,
                        TeamAId  = teamList[fd.TeamANo - 1].TeamId,
                        TeamBId  = teamList[fd.TeamBNo - 1].TeamId,
                        PlayDate = League.StartDate.AddDays(fd.StartDaysPlus)
                    };
                    _context.Fixture.Add(newFixture);
                    _context.SaveChanges();

                    //An array of team A players
                    var teamA = _context.TeamPlayer.Where(tp => tp.TeamId == newFixture.TeamAId)
                                .OrderBy(tp => tp.Level)
                                .ToArray();

                    //An array of team B players
                    var teamB = _context.TeamPlayer.Where(tp => tp.TeamId == newFixture.TeamBId)
                                .OrderBy(tp => tp.Level)
                                .ToArray();

                    //Loop through how many levels in this league
                    for (int level = 0; level < League.NoOfLevels; level++)
                    {
                        //get the playing time leveltime for this level
                        LevelTime thisLevelTime = _context.LevelTime.FirstOrDefault(lt => lt.Level == level + 1);

                        //Create a new match between opposing players at this level
                        Match newMatch = new Match
                        {
                            FixtureId = newFixture.FixtureId,
                            PlayerAId = teamA[level].PlayerId,
                            PlayerBId = teamB[level].PlayerId,
                            Level     = level + 1,
                            Played    = false,
                        };
                        _context.Match.Add(newMatch);
                        _context.SaveChanges();

                        //Create new MatchSlot and assign this match to it for this scheduled date and time
                        MatchSlot newMatchSlot = new MatchSlot
                        {
                            MatchId     = newMatch.MatchId,
                            BookingSlot = newFixture.PlayDate + thisLevelTime.StartTime
                        };
                        _context.MatchSlot.Add(newMatchSlot);
                        _context.SaveChanges();
                    }
                }

                //Change fistures made to true
                League.FixturesMade = true;
                _context.SaveChanges();

                return(RedirectToPage("./Index"));
            }
            catch
            {
                return(RedirectToPage("./Index"));
            }
        }