public MatchStateSlotMachineBullFight(MatchStateMachine owner)
     : base(owner)
 {
     m_eState = MatchState.State.eSlotMachineBullFight;
     match    = m_match as GameMatch_BullFight;
 }
Exemplo n.º 2
0
    public bool CreateNewMatch(GameMatch.Config config)
    {
        if (mPlayerManager != null)
        {
            mPlayerManager.RemoveAllPlayers();
        }

        if (mCurMatch != null)
        {
            mCurMatch = null;
        }

        //涂鸦数据
        GameMatch.Config.TeamMember mainRole = config.MainRole;
        if (mainRole != null)
        {
            RoleInfo role = MainPlayer.Instance.GetRole2(uint.Parse(mainRole.id));
            if (role != null && role.badge_book_id != 0)
            {
                BadgeBook book = MainPlayer.Instance.badgeSystemInfo.GetBadgeBookByBookId(role.badge_book_id);
                mainRole.badgeBook = book;
            }
            for (int i = 0; i < config.NPCs.Count; ++i)
            {
                GameMatch.Config.TeamMember teamMate = config.NPCs [i];
                if (teamMate != null)
                {
                    RoleInfo roleTeammate = MainPlayer.Instance.GetRole2(uint.Parse(teamMate.id));
                    if (roleTeammate != null && roleTeammate.badge_book_id != 0)
                    {
                        BadgeBook book = MainPlayer.Instance.badgeSystemInfo.GetBadgeBookByBookId(roleTeammate.badge_book_id);
                        teamMate.badgeBook = book;
                    }
                }
            }
        }

        GameMatch match = null;

        switch (config.type)
        {
        case GameMatch.Type.ePVP_1PLUS:
        case GameMatch.Type.ePVP_3On3:
            match = new GameMatch_PVP(config);
            break;

        case GameMatch.Type.e1On1:
        case GameMatch.Type.eCareer1On1:
            match = new GameMatch_1ON1(config);
            break;

        case GameMatch.Type.ePractise:
            match = new GameMatch_Practise(config);
            break;

        case GameMatch.Type.eReady:
            match = new GameMatch_Ready(config);
            break;

        case GameMatch.Type.eFreePractice:
            match = new GameMatch_FreePractice(config);
            break;

        case GameMatch.Type.ePracticeVs:
            match = new GameMatch_PracticeVs(config);
            break;

        case GameMatch.Type.e3On3:
        case GameMatch.Type.eCareer3On3:
            match = new GameMatch_3ON3(config);
            break;

        case GameMatch.Type.eAsynPVP3On3:
            match = new GameMatch_AsynPVP3ON3(config);
            break;

        case GameMatch.Type.e3AIOn3AI:
            match = new GameMatch_3AION3AI(config);
            break;

        case GameMatch.Type.eReboundStorm:
            match = new GameMatch_ReboundStorm(config);
            break;

        case GameMatch.Type.eBlockStorm:
            match = new GameMatch_BlockStorm(config);
            break;

        case GameMatch.Type.eUltimate21:
            match = new GameMatch_Ultimate21(config);
            break;

        case GameMatch.Type.eMassBall:
            match = new GameMatch_MassBall(config);
            break;

        case GameMatch.Type.eGrabZone:
            match = new GameMatch_GrabZone(config);
            break;

        case GameMatch.Type.eGrabPoint:
            match = new GameMatch_GrabPoint(config);
            break;

        case GameMatch.Type.eBullFight:
            match = new GameMatch_BullFight(config);
            break;

        case GameMatch.Type.ePractice1V1:
            match = new GameMatch_Practice1V1(config);
            break;

        case GameMatch.Type.eQualifyingNewerAI:
            match = new GameMatch_QualifyingNewerAI(config);
            break;

        case GameMatch.Type.eLadderAI:
            match = new GameMatch_LadderAI(config);
            break;
        }
        if (match == null)
        {
            Debug.LogError("Unsupported match type is detected when creating a new match.");
            return(false);
        }

        mCurMatch = match;
        mCurMatch.Build();

        return(true);
    }