コード例 #1
0
ファイル: CustomTerminal.cs プロジェクト: 2yangk23/MapleShark
 public CustomTerminal(string name, MatchHandler handler, params string[] prefixes)
     : base(name)
 {
     _handler = handler;
       if (prefixes != null)
     Prefixes.AddRange(prefixes);
 }
コード例 #2
0
    public void PlayQuickMatch()
    {
        GoToCharacterSelect();
        SNBNetwork.instance.GetRandomMatch((response) => {
            mainThreadEvents.Enqueue(() => {
                if (response.Count > 0)
                {
                    string oppIp, oppUsername; int oppPort; bool is_hosting;

                    currentMatch = Instantiate(matchHandler);
                    response.GetField(out oppIp, "ip", null);
                    response.GetField(out oppPort, "port", -1);
                    response.GetField(out is_hosting, "is_hosting", false);
                    response.GetField(out oppUsername, "username", null);

                    currentMatch.isServer          = is_hosting;
                    currentMatch.opponentIp        = oppIp;
                    currentMatch.opponentPort      = oppPort;
                    currentMatch.opponent.username = oppUsername;

                    currentMatch.OnOpponentConnect    += OpponentConnected;
                    currentMatch.OnOpponentDisconnect += OpponentDisconnected;
                    currentMatch.OnOpponentReady      += OpponentBecameReady;
                    currentMatch.OnMatchTransition    += MatchCountDown;

                    FlipConnectionMessage();
                    ShowConnectionLoad("Waiting for " + oppUsername);
                }
            });
        });
    }
コード例 #3
0
        private IEnumerator CreateMatch(SharedGroupHandler sharedGroupHandler)
        {
            var isPlayerOne = ApplicationModel.CurrentPlayer.Entity.Id == ApplicationModel.CurrentMatch.playerOneId;

            ApplicationModel.CurrentSharedGroupData.sharedGroupId = $"{ApplicationModel.CurrentMatch.playerOneId}-{ApplicationModel.CurrentMatch.playerTwoId}";

            Debug.Log(ApplicationModel.CurrentSharedGroupData.sharedGroupId);

            if (isPlayerOne)
            {
                yield return(sharedGroupHandler.Create(ApplicationModel.CurrentSharedGroupData.sharedGroupId));
            }
            else
            {
                var matchHandler = new MatchHandler(ApplicationModel.CurrentPlayer, ApplicationModel.CurrentSharedGroupData.sharedGroupId);

                while (string.IsNullOrWhiteSpace(matchHandler.TicTacToeSharedGroupData?.match?.playerTwoId) && LookingForMatch)
                {
                    Debug.Log("Joining to match");
                    yield return(matchHandler.JoinMatch());

                    yield return(new WaitForSeconds(Constants.RETRY_GET_LOBBY_INFO_AFTER_SECONDS));
                }
            }
        }
コード例 #4
0
    private bool shipCanBeMoved()
    {
        bool result          = false;
        bool shipIsAvailable = false;

        if (MatchDatas.getActiveShip() != null)
        {
            foreach (LoadedShip ship in MatchHandler.getAvailableShips())
            {
                if (ship.getPilotId() == MatchDatas.getActiveShip().GetComponent <ShipProperties>().getLoadedShip().getPilotId())
                {
                    shipIsAvailable = true;
                }
            }

            if (shipIsAvailable && isPlayersOwnShip())
            {
                if (
                    MatchDatas.getActiveShip().GetComponent <ShipProperties>().isMovable() &&
                    !MatchDatas.getActiveShip().GetComponent <ShipProperties>().getLoadedShip().isHasBeenActivatedThisRound()
                    )
                {
                    result = true;
                }
            }
        }

        return(result);
    }
コード例 #5
0
        /// <summary>
        /// 条件に合うタスクに対して指令を行う
        /// </summary>
        /// <param name="match">条件式</param>
        /// <param name="order">指令</param>
        public void ParticularOrder(MatchHandler <T> match, OrderHandler <T> order)
        {
            int      no  = 0;
            Task <T> now = null;

            for (Task <T> task = this.top; task != null && this.actCount > 0;)
            {
                // MEMO: 切断されても良い様に最初にノードを更新する
                now  = task;
                task = task.next;

                int ret = match(now.item);
                // 中断
                if (ret < 0)
                {
                    break;
                }
                // HIT
                if (ret > 0)
                {
                    if (!order(now.item, no))
                    {
                        this.Detach(now);
                    }
                }
                ++no;
            }
        }
コード例 #6
0
 public MockOperation(string id, MatchHandler onMatch, bool initialState, params IToken[] tokens)
 {
     Tokens           = tokens;
     Id               = id;
     _onMatch         = onMatch;
     IsInitialStateOn = initialState;
 }
コード例 #7
0
        void MsgRecvCallBack(SocketModel model)
        {
            //一级协议模块分发
            switch (model.type)
            {
            //登录模块
            case TypeProtocol.Login:
                LoginHandler.MessageReceive(model);
                break;

            //用户模块
            case TypeProtocol.User:
                UserHandler.MessageReceive(model);
                break;

            //匹配模块
            case TypeProtocol.Match:
                MatchHandler.MessageReceive(model);
                break;;

            case TypeProtocol.Alive:
                AliveHandler.MessageReceive(model);
                break;;
            }
        }
コード例 #8
0
    void enableMatchMaking()
    {
        MatchHandler mh = GameObject.Find("Logic").GetComponent <MatchHandler>();

        mh.enabled = true;
        mh.RegisterForMatchMaking();
    }
コード例 #9
0
    private int enAwakeSplit = 0;                          // 接続されるリスト
    #endregion


    #region MAIN FUNCTION
    /// <summary>
    /// 初期化
    /// </summary>
    public void Initialize()
    {
        this.pool    = new TaskSystem <Collision>(POOL_MAX);
        this.players = new TaskSystem <Collision>(POOL_PL_MAX);
        this.enemies = new TaskSystem <Collision>(POOL_EN_MAX);

        this.plBullets = new TaskSystem <Collision> [COL_SPLIT];
        this.enBullets = new TaskSystem <Collision> [COL_SPLIT];
        for (int i = 0; i < COL_SPLIT; ++i)
        {
            this.plBullets[i] = new TaskSystem <Collision>(POOL_PBL_MAX);
            this.enBullets[i] = new TaskSystem <Collision>(POOL_EBL_MAX);
        }

        // 味方検査
        this.playerHandler = new OrderHandler <Collision>(this.PlayerOrder);
        // 敵検査
        this.enemyHandler = new OrderHandler <Collision>(this.EnemyOrder);
        // 接触判定
        this.scanHandler = new MatchHandler <Collision>(this.ScanOrder);
        // 接触処理
        this.hitHandler = new OrderHandler <Collision>(this.HitOrder);
        // 回収処理
        this.detachHandler = new OrderHandler <Collision>(this.DetachOrder);

        for (int i = 0; i < POOL_MAX; ++i)
        {
            this.collisions[i] = new Collision();
            this.pool.Attach(this.collisions[i]);
        }

#if DEBUG
        this.InitializeDebug();
#endif
    }
コード例 #10
0
ファイル: CustomTerminal.cs プロジェクト: odasm/Fiesta_Utils
 public CustomTerminal(string name, MatchHandler handler, params string[] prefixes) : base(name)
 {
     _handler = handler;
     if (prefixes != null)
     {
         Prefixes.AddRange(prefixes);
     }
 }
コード例 #11
0
ファイル: CustomTerminal.cs プロジェクト: TheByte/sones
 public CustomTerminal(String name, MatchHandler handler, params string[] prefixes)
     : base(name)
 {
     _handler = handler;
       if (prefixes != null)
     Prefixes.AddRange(prefixes);
       this.EditorInfo = new TokenEditorInfo(TokenType.Unknown, TokenColor.Text, TokenTriggers.None);
 }
コード例 #12
0
 public void PlayTraining()
 {
     GoToCharacterSelect();
     currentMatch                    = Instantiate(matchHandler);
     currentMatch.matchType          = MatchType.Training;
     currentMatch.OnMatchTransition += MatchCountDown;
     // todo: Choose random opponent or implement opponent selection
 }
コード例 #13
0
    void Start()
    {
        matchHandler = FindObjectOfType <MatchHandler>();

        thisCharacter     = Instantiate(matchHandler.characterPrefabs[(int)SNBGlobal.thisUser.character], matchHandler.isServer ? spawnPoints[0].transform : spawnPoints[1].transform);
        opponentCharacter = Instantiate(matchHandler.characterPrefabs[(int)matchHandler.opponent.character], matchHandler.isServer ? spawnPoints[1].transform : spawnPoints[0].transform);
        opponentCharacter.GetComponent <PlayerManagement>().role = PlayerRole.Opponent;
    }
コード例 #14
0
 void Start()
 {
     matchHandler = FindObjectOfType <MatchHandler>();
     board        = FindObjectOfType <Board>();
     isColumnBomb = false;
     isRowBomb    = false;
     isColorBomb  = false;
 }
コード例 #15
0
 void Start()
 {
     soundManager = FindObjectOfType <SoundManager>();
     matchHandler = FindObjectOfType <MatchHandler>();
     scoreManager = FindObjectOfType <ScoreManager>();
     progressBar  = FindObjectOfType <ProgressBarHandler>();
     allGems      = new GameObject[width, height];
     FillBoard();
 }
コード例 #16
0
    private void Start()
    {
        matchHandler = FindObjectOfType <MatchHandler>();

        firstPlayerName.text     = SNBGlobal.thisUser.character.ToString();
        secondPlayerName.text    = matchHandler.opponent.character.ToString();
        firstPlayerImage.sprite  = matchHandler.characterSprites[(int)SNBGlobal.thisUser.character];
        secondPlayerImage.sprite = matchHandler.characterSprites[(int)matchHandler.opponent.character];
    }
コード例 #17
0
ファイル: CustomTerminal.cs プロジェクト: yangbodevp/irony
 public CustomTerminal(string name, MatchHandler handler, params string[] prefixes) : base(name)
 {
     _handler = handler;
     if (prefixes != null)
     {
         Prefixes.AddRange(prefixes);
     }
     this.EditorInfo = new TokenEditorInfo(TokenType.Unknown, TokenColor.Text, TokenTriggers.None);
 }
コード例 #18
0
        private void Home()
        {
            IResult res = new MatchHandler().HandleRequest(new UrlRequest()
            {
                Url = context.PageUrl, HttpContext = context
            });

            res.Strip = this;
            res.View();
        }
コード例 #19
0
 public void CharacterSelectToMain()
 {
     currentScreen = MenuScreens.Main;
     menuAnimator.SetBool("CharacterSelectLoad", false);
     if (currentMatch != null)
     {
         currentMatch.LeaveMatch();
         currentMatch = null;
     }
 }
コード例 #20
0
 ///<summary>Registers a function which should be called upon a matching stdout line given by the specified pattern. MatchHandlers should be registered before the process is started to avoid InvalidOperationException exceptions.</summary>
 public void RegisterMatchHandler(string pattern, MatchHandler handler)
 {
     if (!_matchHandlers.ContainsKey(pattern))
     {
         _matchHandlers.Add(pattern, handler);
     }
     else
     {
         _matchHandlers[pattern] += handler;
     }
 }
コード例 #21
0
ファイル: TimedialogUI.cs プロジェクト: isoundy000/LOLClient
 void Start()
 {
     timeText    = transform.Find("timer").GetComponent <Text>();
     contentText = transform.Find("Image/Text").GetComponent <Text>();
     InvokeRepeating("showtip", 0, 0.4f);
     matchHandler = GameObject.Find("NetWork").GetComponent <MatchHandler>();
     matchHandler.OnLeaveMatch = this.OnHide;//向该模块注册取消匹配返回的处理函数
     transform.Find("btncancel").GetComponent <Button>().onClick.AddListener(delegate()
     {
         //向服务器请求取消匹配
         matchHandler.LeaveMatch();
     });
 }
コード例 #22
0
    void Awake()
    {
        instance = this;

        matchTimerLength = DMMatchSettings.instance.GetMatchTimer();
        matchTimer       = matchTimerLength;

        int curSpawnPoint = 0;

        for (int i = 0; i < DMMatchSettings.instance.GetNumberOfPlayers(); i++)
        {
            Vector2    spawnPos  = initialSpawnContainer.GetChild(curSpawnPoint).position;
            PlayerData newPlayer = Instantiate(playerPrefab, spawnPos, Quaternion.identity).GetComponent <PlayerData>();
            newPlayer.SetPlayerNum(i + 1);

            //Apply player health setting
            newPlayer.maxHealth = DMMatchSettings.instance.GetPlayerHealth();

            //Apply bouncy players setting
            Rigidbody2D       playerRB = newPlayer.GetComponent <Rigidbody2D>();
            PhysicsMaterial2D newMat   = new PhysicsMaterial2D();
            newMat.friction         = 0;
            newMat.bounciness       = (DMMatchSettings.instance.GetBouncyPlayers()) ? 1 : 0;
            playerRB.sharedMaterial = newMat;

            //Apply speed multiplier setting
            PlayerBoost playerBoost = newPlayer.GetComponent <PlayerBoost>();
            playerBoost.boostPower *= DMMatchSettings.instance.GetSpeedMultiplier();

            //Apply drag multiplier setting
            playerRB.drag *= DMMatchSettings.instance.GetDragMultiplier();

            //Apply size multiplier setting
            newPlayer.transform.localScale *= DMMatchSettings.instance.GetSizeMultiplier();

            //Apply knockback multiplier setting
            PlayerMovement playerMovement = newPlayer.GetComponent <PlayerMovement>();
            playerMovement.SetKnockbackMultiplier(DMMatchSettings.instance.GetKnockbackMultiplier());

            //Add the player to the cinemachine
            cmTargetGroup.AddMember(newPlayer.transform, 1, 0);

            curSpawnPoint++;
            if (curSpawnPoint >= initialSpawnContainer.childCount)
            {
                curSpawnPoint = 0;
            }
        }

        DMMatchStats.instance.SetupPlayerStats();
    }
コード例 #23
0
        /// <summary>
        /// 通过清单编码获取所有的分类数据
        /// </summary>
        /// <returns></returns>
        private List <DataRow> Filter(DataRow[] db, MatchHandler match, params string[] fields)
        {
            var rows = new List <DataRow>();

            foreach (DataRow row in db)
            {
                if (match(row))
                {
                    rows.Add(row);
                }
            }

            return(rows);
        }
コード例 #24
0
    private void HandleMatchInProgLeft_One(string[] segments)
    {
        MatchState match = MatchHandler.GetMatchById(segments[2]);

        if (match != null)
        {
            PlayerState playerState = match.GetPlayerStateById(segments[3]);
            if (playerState != null)
            {
                InterEventDispatcher.InvokeDCFromMatchInProgressEvent
                    (new DCFromMatchInProgressEventArgs(match, playerState));
            }
        }
    }
コード例 #25
0
        public void PlayMatchWithOneTeam()
        {
            SetupFootballMatchTests(out List <Team> teams, out FootballMatchFactory matchFactory, out HistoryLeagueStats leagueStats);
            var          potentialOutcomeCalculator = new PoissonPotentialOutcomeCalculator(new PoissonEvaluator(), new PoissonEvaluator());
            var          match        = new MatchHandler(matchFactory, potentialOutcomeCalculator);
            MatchRequest matchRequest = matchFactory.CreateRequest(new List <Team> {
                teams.FirstOrDefault()
            }, leagueStats);
            var result = match.Handle(matchRequest);

            Assert.IsTrue(result.Scores.GetValueOrDefault(teams[0]) == 3);
            Assert.IsTrue(result.winner.TeamName == teams[0].TeamName);
            Assert.IsTrue(result.winRemarks.Name == "WinByDefault");
            Assert.IsTrue(result.GetType() == typeof(MatchResult));
        }
コード例 #26
0
    private Collision ccol = null;                                                            // チェックするコリジョン
    #endregion


    #region MAIN FUNCTION
    /// <summary>
    /// 初期化
    /// </summary>
    public void Initialize()
    {
        // 味方検査
        this.playerHandler = new OrderHandler <Collision>(this.PlayerOrder);
        // 接触判定
        this.scanHandler = new MatchHandler <Collision>(this.ScanOrder);
        // 接触処理
        this.hitHandler = new OrderHandler <Collision>(this.HitOrder);

        for (int i = 0; i < POOL_MAX; ++i)
        {
            this.collisions[i] = new Collision();
            this.pool.Attach(this.collisions[i]);
        }
    }
コード例 #27
0
        public void PlayNormalMatch()
        {
            SetupFootballMatchTests(out List <Team> teams, out FootballMatchFactory matchFactory, out HistoryLeagueStats leagueStats);
            var potentialOutcomeCalculator = new PoissonPotentialOutcomeCalculator(new PoissonEvaluator(), new PoissonEvaluator());

            var          match        = new MatchHandler(matchFactory, potentialOutcomeCalculator);
            MatchRequest matchRequest = matchFactory.CreateRequest(teams, leagueStats);
            var          result       = match.Handle(matchRequest);

            if (result.Scores.GetValueOrDefault(teams[0]) == result.Scores.GetValueOrDefault(teams[1]))
            {
                Assert.IsTrue(result.Scores.GetValueOrDefault(teams[0]) == result.Scores.GetValueOrDefault(teams[1]), "Tie match");
                Assert.IsTrue(result.winner == null, "No winner of the match");
            }
            Assert.IsTrue(result.winRemarks.Name == "NoRemarks");
            Assert.IsTrue(result.GetType() == typeof(MatchResult));
        }
コード例 #28
0
        public ActionResult Match(string username, bool accepted)
        {
            try
            {
                LoginHelper.CheckAccess(Session);
            }
            catch (Exception)
            {
                return(RedirectToAction("Login", "Login"));
            }

            var userProfileHandler = new UserProfileHandler();

            var userProfileId = (int)Session["userProfileId"];
            var userProfile   = userProfileHandler.Get(userProfileId);

            if (!userProfile.CompletedRequest)
            {
                return(RedirectToAction("Index", "Error", new { errorMessage = userProfile.ErrorMessage.Replace(' ', '-') }));
            }

            var userProfileToMatch = userProfileHandler.GetByUsername(username);

            if (!userProfileToMatch.CompletedRequest)
            {
                return(RedirectToAction("Index", "Error", new { errorMessage = userProfileToMatch.ErrorMessage.Replace(' ', '-') }));
            }

            var match = new MatchEntity
            {
                MatchDate          = DateTime.Now,
                MatchUserProfileId = userProfileToMatch.Entity.UserProfileId,
                UserProfileId      = userProfile.Entity.UserProfileId,
                Accepted           = accepted
            };

            var matchResponse = new MatchHandler().Add(match);

            if (!matchResponse.CompletedRequest)
            {
                return(RedirectToAction("Index", "Error", new { errorMessage = matchResponse.ErrorMessage.Replace(' ', '-') }));
            }

            return(RedirectToAction("Index", "Home"));
        }
コード例 #29
0
    private IEnumerator QueryBoardDisplay(SpectatorSyncEventArgs args)
    {
        yield return(new WaitForSeconds(1.0f));

        MatchState match = MatchHandler.GetMatchById(args.MatchId);

        Debug.LogFormat("Match In Progress: {0} | Current Match Not Null: {1}",
                        MatchHandler.CurrentMatch != null ? match.InProgress.ToString() : "NULL", MatchHandler.CurrentMatch != null);

        Debug.LogFormat("Match Identities: {0} | {1}",
                        MatchHandler.CurrentMatch != null ? MatchHandler.CurrentMatch.MatchIdentity : "NULL", match.MatchIdentity);

        if (match.InProgress && MatchHandler.CurrentMatch != null &&
            MatchHandler.CurrentMatch.MatchIdentity == match.MatchIdentity)
        {
            m_TargetGameBoard.gameObject.SetActive(true);
        }
    }
コード例 #30
0
    void Start()
    {
        Ball          = GameObject.FindGameObjectWithTag("Ball");
        BallComponent = Ball.GetComponent <Ball>();

        //TODO: Refactor this
        MatchHandler matchHandler = GameObject.FindGameObjectWithTag("MatchHandler").GetComponent <MatchHandler>();

        if (GetComponent <PlayerInfo>().Team == StaticData.SoccerTeam.BLUE)
        {
            OpponentsGoal = matchHandler.Goal_RED.GetComponent <Goal>();
            OwnGoal       = matchHandler.Goal_BLUE.GetComponent <Goal>();
        }
        else
        {
            OpponentsGoal = matchHandler.Goal_BLUE.GetComponent <Goal>();
            OwnGoal       = matchHandler.Goal_RED.GetComponent <Goal>();
        }
    }
コード例 #31
0
    private void setShipLocation()
    {
        MatchDatas.getActiveShip().GetComponent <ShipProperties>().setMovable(false);
        MatchDatas.getActiveShip().GetComponent <ShipProperties>().getLoadedShip().setHasBeenActivatedThisRound(true);

        bool allShipsActivated = true;

        foreach (LoadedShip ship in MatchHandler.getAvailableShips())
        {
            if (!ship.isHasBeenActivatedThisRound())
            {
                allShipsActivated = false;
            }
        }

        if (allShipsActivated)
        {
            MatchHandler.collectUpcomingAvailableShips(true);
        }
    }
コード例 #32
0
    private static void startActivationPhase()
    {
        MatchHandlerUtil.hideActiveShipHighlighters();
        MatchDatas.setCurrentPhase(MatchDatas.phases.ACTIVATION);
        MatchDatas.setCurrentLevel(0);

        foreach (Player player in MatchDatas.getPlayers())
        {
            foreach (LoadedShip ship in player.getSquadron())
            {
                ship.setHasBeenActivatedThisRound(false);
            }
        }

        MatchHandler.collectUpcomingAvailableShips(true);

        // TODO Active player index is not always right/sufficient!!
        MatchDatas.getPlayers()[MatchDatas.getActivePlayerIndex()].setActiveShip(null);
        MatchDatas.getPlayers()[MatchDatas.getActivePlayerIndex()].setSelectedShip(null);
    }
コード例 #33
0
ファイル: MatchReaction.cs プロジェクト: jyzgo/Match3Demo
    public MatchReaction(MatchHandler curHandler)
    {
        _leftList = curHandler._leftList;
        _rightList = curHandler._rightList;
        _upList = curHandler._upList;
        _downList = curHandler._downList;

        _curCell = curHandler._curCell;
        _leftUpCell = curHandler._leftUpCell;
        _upRightCell = curHandler._upRightCell;
        _rightDownCell = curHandler._rightDownCell;
        _downLeftCell = curHandler._downLeftCell;

        _horCount  = _leftList.Count + _rightList.Count + 1;
        _verCount  = _upList.Count + _downList.Count + 1;

        _IsMatchLeftUp    = curHandler._IsMatchLeftUp;
        _IsMatchRightUp   = curHandler._IsMatchUpRight;
        _IsMatchRightDown = curHandler._IsMatchRightDown;
        _IsMatchLeftDown  = curHandler._IsMatchDownLeft;

        CheckReaction ();
    }
コード例 #34
0
ファイル: SubReactions.cs プロジェクト: jyzgo/Match3Demo
 public HorizonReaction(MatchHandler curHandler)
     : base(curHandler)
 {
 }
コード例 #35
0
ファイル: SubReactions.cs プロジェクト: jyzgo/Match3Demo
 public SquareReaction(MatchHandler curHandler)
     : base(curHandler)
 {
 }
コード例 #36
0
ファイル: SubReactions.cs プロジェクト: jyzgo/Match3Demo
 public VertiElimReaction(MatchHandler curHandler)
     : base(curHandler)
 {
 }
コード例 #37
0
ファイル: SubReactions.cs プロジェクト: jyzgo/Match3Demo
 public DyeReaction(MatchHandler curHandler)
     : base(curHandler)
 {
 }
コード例 #38
0
ファイル: SubReactions.cs プロジェクト: jyzgo/Match3Demo
 public FishReaction(MatchHandler curHandler)
     : base(curHandler)
 {
 }
コード例 #39
0
ファイル: SubReactions.cs プロジェクト: jyzgo/Match3Demo
 public ColorReaction(MatchHandler curHandler)
     : base(curHandler)
 {
 }