示例#1
0
    private void Awake()
    {
        AudioBackgroundManager.Instance.PlayBackgroundMusic(AudioClips[Random.Range(0, AudioClips.Length)]);

        MatchController.GetInstance().ScoreboardController = this;
        _animator = GetComponent <Animator>();
        if (MatchController.GetInstance().Time < 0)
        {
            {
                _time = maxTime * 60;
                MatchController.GetInstance().TimeString = GenerateTimeString();
            }
        }
        else
        {
            _time = MatchController.GetInstance().Time;
        }

        homeScoreText.text = MatchController.GetInstance().HomeScore.ToString();
        awayScoreText.text = MatchController.GetInstance().AwayScore.ToString();

        splitScreen.SetActive(MatchController.GetInstance().SplitScreen);

        if (_time == 0 && MatchController.GetInstance().HomeScore != MatchController.GetInstance().AwayScore)
        {
            EndMatch();
        }
    }
示例#2
0
 void Update()
 {
     if (MatchController.GetInstance().Playing&& _time != 0)
     {
         UpdateTime();
     }
 }
示例#3
0
 public void ReloadScene()
 {
     _animator.SetBool(IsReplaying, false);
     MatchController.GetInstance().Playing = false;
     MatchController.GetInstance().Time    = _time;
     SceneManager.LoadScene(SceneManager.GetActiveScene().name);
 }
示例#4
0
        public async Task ThrowApplicationException_WhenMatchesIsNull()
        {
            // Arrange
            Mock <IMatchService> matchServiceMock = new Mock <IMatchService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            Mock <IMemoryCache>  memoryCacheMock  = new Mock <IMemoryCache>();

            string validSortOrder  = string.Empty;
            string validFilter     = string.Empty;
            int    validPageNumber = 1;
            int    validPageSize   = 10;

            IPagedList <Match> matches = null;

            matchServiceMock.Setup(mock => mock.FilterMatchesAsync(validSortOrder, validFilter, validPageNumber, validPageSize))
            .Returns(Task.FromResult(matches));

            MatchController SUT = new MatchController(
                matchServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock.Object);

            // Act & Assert
            await Assert.ThrowsExceptionAsync <ApplicationException>(() =>
                                                                     SUT.Download(validSortOrder, validFilter, validPageNumber, validPageSize));
        }
示例#5
0
 public void Goal()
 {
     homeScoreText.text = MatchController.GetInstance().HomeScore.ToString();
     awayScoreText.text = MatchController.GetInstance().AwayScore.ToString();
     _animator.SetBool(IsGoal, true);
     randomText.text = "GOAL";
 }
示例#6
0
        static void Main(string[] args)
        {
            try
            {
                databaseconfigpath = args[0];
                Console.WriteLine("Using databaseconfigfile " + args[0]);
            }
            catch (Exception e)
            {
                Console.WriteLine("No databaseconfigpath was given. Exiting..." + e.Message);
                databaseconfigpath = "";
            }

            try
            {
                portconfigpath = args[1];
                Console.WriteLine("Using portconfigfile " + args[1]);
            }
            catch (Exception e)
            {
                Console.WriteLine("No portconfigpath was given, using default ports. (exception message: " + e.Message + ")");
                portconfigpath = "";
            }

            PortManager.instance();
            Thread.Sleep(1000);
            //Console.WriteLine("here");


            DatabaseController dc = DatabaseController.instance();

            Thread.Sleep(1000);
            LoginController lc = LoginController.instance();

            Thread.Sleep(100);
            MatchController mc = MatchController.instance();

            Thread.Sleep(100);
            MiscController miscc = MiscController.instance();

            Thread.Sleep(100);

            Thread login = new Thread(lc.logincontrol);

            login.Start();

            Thread match = new Thread(mc.handleRequests);

            match.Start();

            Thread misc = new Thread(miscc.handleRequests);

            misc.Start();

            //string res = dc.GetAgeAndGender("theVilandry");
            //Console.WriteLine(res);


            //dc.successfulRegister("admin", "admin".GetHashCode().ToString(), 1, 1);
        }
 private void Awake()
 {
     if (!Instance)
     {
         Instance = this;
     }
 }
    private void Awake()
    {
        if (isHome)
        {
            GameObject go = Instantiate(home, transform);
            go.transform.parent = null;
            go.GetComponent <PlayerController>().isHome = true;
            go.GetComponent <PlayerController>().Init();
        }
        else
        {
            if (MatchController.GetInstance().SplitScreen)
            {
                GameObject go = Instantiate(away, transform);
                go.transform.parent = null;
                go.GetComponent <PlayerController>().isHome = false;
                go.GetComponent <PlayerController>().Init();
            }
            else
            {
                GameObject go = Instantiate(ai, transform);
                go.transform.parent = null;
                go.GetComponent <AIController>().isHome = false;
                go.GetComponent <AIController>().Init();
            }
        }

        Destroy(gameObject);
    }
示例#9
0
        public override void Start()
        {
            gameObj = PopupManager.AddWindow(PopupWindowName.MATCH_POP_UP);
            MatchController matchController = gameObj.GetComponent <MatchController>();

            matchController.beginTime = beginTime;
        }
示例#10
0
    // // Tries to grab necessary components if they haven't been already.
    // // Returns true if all components were verified to be grabbed.
    // private bool TryToGrabComponents()
    // {
    //  if (this.matchDataBroadcaster == null)
    //      this.matchDataBroadcaster = FindObjectOfType<MatchDataBroadcaster>();

    //  if (this.matchController == null)
    //      this.matchController = FindObjectOfType<MatchController>();

    //  if (this.matchDataBroadcaster == null)
    //      return false;
    //  if (this.matchController == null)
    //      return false;

    //  return true;
    // }

    private IEnumerator GrabComponentsCoroutine()
    {
        while (this.matchDataBroadcaster == null)
        {
            this.matchDataBroadcaster = FindObjectOfType <MatchDataBroadcaster>();
            yield return(null);
        }

        while (this.matchController == null)
        {
            this.matchController = FindObjectOfType <MatchController>();
            yield return(null);
        }

        while (this.gridController == null)
        {
            this.gridController = FindObjectOfType <GridController>();
            yield return(null);
        }

        while (this.hudController == null)
        {
            this.hudController = FindObjectOfType <HudController>();
            yield return(null);
        }
    }
示例#11
0
        private LiveBetsBase(IHubConnectionContext <dynamic> clients)
        {
            Clients          = clients;
            _shortMatchCodes = new Dictionary <string, SavedMatch>();
            gameToSave       = new List <Game>();
            //the controller below is for testing please comment it initailisation to save server resources
            myController    = new MyController();
            myApiController = new MatchController();

            _gamesWithLiveScoresAndOdds.Clear();

            cc          = new CustomController();
            BetDatabase = cc.BetDatabase;
            //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Important, please take caution!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
            // firt check if there are some games in the db then populate their MatchNo's in memeory to avoid duplicate ShortCodes
            setInitialGamesFromDb();
            //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
            _liveBetUrls = new List <LiveBetSource>
            {
                new LiveBetSource
                {
                    Name = "Scores",
                    Url  = "http://www.goalserve.com/getfeed/d1aa4f5599064db8b343090338221a49/soccernew/inplay"
                },
                new LiveBetSource
                {
                    Name = "Odds",
                    Url  = "http://www.goalserve.com/getfeed/d1aa4f5599064db8b343090338221a49/lines/soccer-inplay"
                }
            };

            GetchAllGamesFromServiceProvider().Wait();
            _timer = new Timer(UpdateGames, null, _updateInterval, _updateInterval);
        }
示例#12
0
    private void Awake()
    {
        m_match = new Match();

        switch (m_matchControlType)
        {
        case MatchControlType.Local:
        {
            var userInput = new MouseAndKbInput();
            m_matchCtrl = new LocalMatchController(m_match, userInput);
            m_matchView.Init(m_match);
            break;
        }

        case MatchControlType.Client:
        {
            m_match.SetLogic(new ClientMatchLogic(m_match));
            m_matchCtrl = ClientBuilder.Create(m_match, m_matchView);
            break;
        }

        case MatchControlType.Server:
        {
            m_match.SetLogic(new ServerMatchLogic(m_match));
            m_matchCtrl = ServerBuilder.Create(m_match);
            m_matchView.Init(m_match);
            break;
        }
        }
    }
示例#13
0
        public override void updateMe(GameManager gameManager, MouseState MouseState)
        {
            if (!_closed)
            {
                _matchController = gameManager.MatchController;
                if (_matchController.Match != MatchType.DM)
                {
                    if (_matchController.WinningTeam.ID == 1)
                    {
                        _lblList[0].Text      = "BLUE TEAM";
                        _lblList[0].TextColor = Color.Blue;
                    }
                    else if (_matchController.WinningTeam.ID == 2)
                    {
                        _lblList[0].Text      = "RED TEAM";
                        _lblList[0].TextColor = Color.Red;
                    }
                }
                else
                {
                    _lblList[0].Text = ((SpaceMarine)_matchController.NoTeam.GetWinner()).PlayerName;
                }

                if (_listBox.SelectedItem != null)
                {
                    endGame(gameManager);
                    _listBox.SelectedItem = null;
                }

                base.updateMe(gameManager, MouseState);

                _listBox.updateMe(_game.MouseState);
            }
        }
示例#14
0
 public void ToMainMenu()
 {
     MatchController.GetInstance().Time      = -1;
     MatchController.GetInstance().HomeScore = 0;
     MatchController.GetInstance().AwayScore = 0;
     SceneManager.LoadScene(0);
 }
示例#15
0
    private void UpdateMoneyHud()
    {
        this.lastKnownPlayerMoneyStr = matchDataBroadcaster.PlayerMoneyStr;

        if (this.lastKnownUsernameStr != matchDataBroadcaster.UsernameListStr)
        {
            // TODO: Sanitize this!!!
            this.lastKnownUsernameStr = matchDataBroadcaster.UsernameListStr;
            this.usernames            = MatchDataBroadcaster.UnpackStringData(this.lastKnownUsernameStr);
        }

        if (this.lastKnownPlayerMoneyStr != "")
        {
            this.playerMoneyAmounts = MatchController.UnpackPlayerMoneyStr(this.lastKnownPlayerMoneyStr);

            Debug.Log(debugTag + "Player Money String: " + this.lastKnownPlayerMoneyStr);

            for (int i = 0; i < usernames.Count; i++)
            {
                string username;

                if (usernames[i] != null)
                {
                    username = usernames[i];
                }
                else
                {
                    username = "******" + (i + 1);
                }
                this.playerMoneyText[i].text = "<b>" + username + "</b>'s Cash: <b>$" + playerMoneyAmounts[i] + "</b>";
            }
        }
    }
示例#16
0
 public override void OnPlayerLeftRoom(Player otherPlayer)
 {
     if (PhotonNetwork.IsMasterClient && actualScene.buildIndex == 2)
     {
         matchController = FindObjectOfType <MatchController>();
     }
 }
        public async Task CallFindAsync_WhenCalled()
        {
            // Arrange
            Mock <IMatchService> matchServiceMock = new Mock <IMatchService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            Mock <IMemoryCache>  memoryCacheMock  = new Mock <IMemoryCache>();

            string validId = string.Empty;

            Match validMatchResult = new Match();

            matchServiceMock.Setup(mock => mock.FindAsync(validId))
            .Returns(Task.FromResult(validMatchResult));

            MatchController SUT = new MatchController(
                matchServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock.Object);

            // Act
            await SUT.Details(validId);

            // Assert
            matchServiceMock.Verify(mock => mock.FindAsync(validId), Times.Once);
        }
示例#18
0
    private bool teamScores()
    {
        //Si estoy en posición de tiro al arco y meto gol
        if (currentPosition >= 85 && currentBallHolder == myClub && RandomCalculator.evaluateChances(myClubScoreChance() / scoringChanceDividerConstant))
        {
            myClubScore++;

            MatchController.updateMatchScore(myClubScore.ToString() + "-" + enemyClubScore.ToString(), currentBallHolder.getName());
            currentBallHolder = enemyClub;
            currentPosition   = 50;
            return(true);
        }

        //Si el equipo contrario está en posición de tiro al arco y mete gol

        if (currentPosition <= 15 && currentBallHolder == enemyClub && RandomCalculator.evaluateChances(myClubStopChance() / scoringChanceDividerConstant))
        {
            enemyClubScore++;

            MatchController.updateMatchScore(myClubScore.ToString() + "-" + enemyClubScore.ToString(), currentBallHolder.getName());
            currentBallHolder = myClub;
            currentPosition   = 50;
            return(true);
        }
        return(false);
    }
示例#19
0
        public async Task ReturnCorrectViewModel_WhenCalled()
        {
            // Arrange
            Mock <IMatchService> matchServiceMock = new Mock <IMatchService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            Mock <IMemoryCache>  memoryCacheMock  = new Mock <IMemoryCache>();

            string validSortOrder  = string.Empty;
            string validFilter     = string.Empty;
            int    validPageNumber = 1;
            int    validPageSize   = 10;

            IPagedList <ESportStatistics.Data.Models.Match> matches = new PagedList <Match>(new List <Match>().AsQueryable(), validPageNumber, validPageSize);

            matchServiceMock.Setup(mock => mock.FilterMatchesAsync(validSortOrder, validFilter, validPageNumber, validPageSize))
            .Returns(Task.FromResult(matches));

            MatchController SUT = new MatchController(
                matchServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock.Object);

            // Act
            var result = await SUT.Filter(validSortOrder, validFilter, validPageSize, validPageNumber) as PartialViewResult;

            // Assert
            Assert.IsInstanceOfType(result.Model, typeof(TableViewModel <MatchViewModel>));
        }
        public async Task ReturnCorrectViewModel_WhenCalled()
        {
            // Arrange
            Mock <IMatchService> matchServiceMock = new Mock <IMatchService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            Mock <IMemoryCache>  memoryCacheMock  = new Mock <IMemoryCache>();

            string validId = string.Empty;

            Match validMatchResult = new Match();

            matchServiceMock.Setup(mock => mock.FindAsync(validId))
            .Returns(Task.FromResult(validMatchResult));

            MatchController SUT = new MatchController(
                matchServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock.Object);

            // Act
            var result = await SUT.Details(validId) as ViewResult;

            // Assert
            Assert.IsInstanceOfType(result.Model, typeof(MatchDetailsViewModel));
        }
示例#21
0
        public async Task CallFilterMatchesAsync_WhenCalled()
        {
            // Arrange
            Mock <IMatchService> matchServiceMock = new Mock <IMatchService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            Mock <IMemoryCache>  memoryCacheMock  = new Mock <IMemoryCache>();

            string validSortOrder  = string.Empty;
            string validFilter     = string.Empty;
            int    validPageNumber = 1;
            int    validPageSize   = 10;

            IPagedList <ESportStatistics.Data.Models.Match> matches = new PagedList <ESportStatistics.Data.Models.Match>(new List <Match>().AsQueryable(), validPageNumber, validPageSize);

            matchServiceMock.Setup(mock => mock.FilterMatchesAsync(validSortOrder, validFilter, validPageNumber, validPageSize))
            .Returns(Task.FromResult(matches));

            MatchController SUT = new MatchController(
                matchServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock.Object);

            // Act
            await SUT.Filter(validSortOrder, validFilter, validPageSize, validPageNumber);

            // Assert
            matchServiceMock
            .Verify(mock => mock.FilterMatchesAsync(validSortOrder, validFilter, validPageNumber, validPageSize),
                    Times.Once);
        }
示例#22
0
        public async Task ReturnCorrectViewModel_WhenCalled()
        {
            // Arrange
            Mock <IMatchService> matchServiceMock = new Mock <IMatchService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            IMemoryCache         memoryCacheMock  = new MemoryCache(new MemoryCacheOptions());

            string validSortOrder  = string.Empty;
            string validFilter     = string.Empty;
            int    validPageNumber = 1;
            int    validPageSize   = 10;

            IPagedList <Match> matches = new PagedList <Match>(new List <Match>().AsQueryable(), validPageNumber, validPageSize);

            matchServiceMock.Setup(mock => mock.FilterMatchesAsync(validSortOrder, validFilter, validPageNumber, validPageSize))
            .Returns(Task.FromResult(matches));

            MatchController SUT = new MatchController(
                matchServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock);

            // Act
            var result = await SUT.Index() as ViewResult;

            // Assert
            Assert.IsInstanceOfType(result.Model, typeof(MatchIndexViewModel));
        }
示例#23
0
    public void Play()
    {
        AudioBackgroundManager.Instance.PlayUI(audioclips[4]);
        if (_playerInputs.Count == 1)
        {
            int random = Random.Range(0, kits.Count - 1);
            while (random == _homeKitCounter)
            {
                random = Random.Range(0, kits.Count - 1);
            }

            awayMaterial.mainTexture = kits[random];
            _isSplitScreen           = false;
        }
        else
        {
            PlayerPrefs.SetInt("Away Kit", _awayKitCounter);
            _isSplitScreen = true;
        }

        PlayerPrefs.SetInt("Home Kit", _homeKitCounter);

        MatchController.GetInstance().SplitScreen = _isSplitScreen;


        SceneManager.LoadScene(2);
    }
示例#24
0
    private void Start()
    {
        GetBalaIndex();

        GetRigidBody().drag = GetPlayerDeceleration();

        life  = 1;
        score = 0;
        SetCanShoot(true);
        damageable = true;

        matchController = FindObjectOfType <MatchController>();
        //matchController.AddPlayer(this);
        spawnPoint = matchController.GetSpawnPoint(this);

        teamId = 5;

        movementSM = new StateMachine();

        groundedState = new GroundedState(this, movementSM);
        shootingState = new ShootingState(this, movementSM);
        shieldState   = new ShieldState(this, movementSM);
        deadState     = new DeadState(this, movementSM);
        stunState     = new StunState(this, movementSM);
        feederState   = new FeederState(this, movementSM);

        movementSM.Initialize(shootingState);
    }
示例#25
0
        public void UpdateEntityWithMatchEventsTest()
        {
            var matchService = new Mock <IMatchService>();

            matchService.Setup(mock => mock.UpdateEntityMatchEvents(It.IsAny <MatchDTO>()));

            var matchController = new MatchController(matchService.Object);
            var tempMatchDTO    = new MatchDTO
            {
                Id                     = 1,
                HomeTeamId             = 0,
                HomeTeam               = "",
                AwayTeamId             = 0,
                AwayTeam               = "",
                MatchDate              = DateTime.Now,
                HomeTeamFirstHalfScore = 0,
                AwayTeamFirstHalfScore = 0,
                HomeTeamScore          = 0,
                AwayTeamScore          = 0,
                IsFinished             = false,
                MatchEvents            = null
            };

            matchController.UpdateEntityWithMatchEvents(tempMatchDTO, tempMatchDTO.Id);

            matchService.Verify(mock => mock.UpdateEntityMatchEvents(It.IsAny <MatchDTO>()), Times.Once);
        }
示例#26
0
 public void Guess(ActionObject action, IPEndPoint groupEP)
 {
     if (action.Player != MatchController.CurrentPlayer)
     {
         return;
     }
     MatchController.Guess(action.Player, action.Guess);
 }
示例#27
0
 public void PlayCard(ActionObject action, IPEndPoint groupEP)
 {
     if (action.Player != MatchController.CurrentPlayer)
     {
         return;
     }
     MatchController.PlayCard(action.Player, action.Card);
 }
示例#28
0
        public void InvokeControllerMethod(string url)
        {
            var parsedUrl = UrlParser.Parse(url);

            var response = new MatchController().PostPlayDayMatches(parsedUrl["games"], parsedUrl["days"]);

            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
        }
示例#29
0
 public Parser(ConsoleColor consoleColor)
 {
     Calculator      = new Calculator();
     color           = consoleColor;
     matchController = new MatchController();
     userController  = new UserController();
     teamController  = new TeamController();
 }
示例#30
0
 public override void OnStartClient()
 {
     base.OnStartClient();
     gameController  = FindObjectOfType <GameController>();
     matchController = gameController.matchController;
     matchController.OnPlayerStarted(this);
     //this.PostNotification(Started);
 }
    /**************************************************
     * Event Handlers
     **************************************************/
    // Use this for initialization
    protected override void Awake()
    {
        _matchController = global::MatchController.Instance;
        _teamsController = global::TeamsController.Instance;

        base.Awake();
        ToggleKey = KeyCode.Tab;
        ToggleEnabled = true;
    }
示例#32
0
    void Start()
    {
        cardText = gameObject.GetComponentInChildren<Text>();
        cardImage = gameObject.GetComponentInChildren<Image>();
        cardButton = gameObject.GetComponentInChildren<Button>();
        cardButton.onClick.AddListener(() => HandleCardClicked());
        matchController = GameObject.FindObjectOfType<MatchController>();

        defaultCardBackground = cardButton.GetComponent<Image>().sprite;
    }
示例#33
0
 // Update is called once per frame
 void Update()
 {
     if(matchController == null)
     {
         matchController = GameObject.Find("MatchControllerObj").GetComponent<MatchController>();
     }
     /*
     if(isHighlighted)
     {
         renderer.material.color = new Color(1.0f, 0f, 0f, 1.0f);
     }
     else
     {
         renderer.material.color = new Color(1.0f, 1.0f, 1.0f, 0f);
     }
     */
 }
    private void Start()
    {
        if (Network.isServer == true) {
            _matchController = MatchController.Instance;
            _userNetworkPlayers = new List<NetworkPlayer>();
        }

        _userModels = new List<UserModel>();
    }
 public static void Reset()
 {
     _instance = null;
 }
示例#36
0
 public void Init(string unitOwner, int unitID, MatchController matchController)
 {
     this.unitOwner = unitOwner;
     this.unitID = unitID;
     this.matchController = matchController;
 }
示例#37
0
    void Start()
    {
        GameObject pObj_;
        pObj_ = GameObject.FindWithTag("oScene0");
        scene0Script = pObj_.GetComponent<JTSScene0>();

        gameObject.AddComponent("InputInterface");
        //gameObject.AddComponent("DragDropSurfaceTile");
        UnHighlightTile();
        matchController = GameObject.Find("MatchControllerObj").GetComponent<MatchController>();
        isOccupied = false;
    }
 void Start()
 {
     if (Network.isServer) _matchController = MatchController.Instance;
 }
示例#39
0
 void LateUpdate()
 {
     if(matchController == null)
     {
         matchController = GameObject.Find("MatchControllerObj").GetComponent<MatchController>();
     }
     if(scene0Script == null)
     {
         GameObject pObj_;
         pObj_ = GameObject.FindWithTag("oScene0");
         scene0Script = pObj_.GetComponent<JTSScene0>();
     }
 }
示例#40
0
 void Start()
 {
     matchController = GameObject.FindObjectOfType(typeof(MatchController)) as MatchController;
 }