protected override void _OnCounterDone() { base._OnCounterDone(); if (m_match.m_config.type == GameMatch.Type.ePVP_1PLUS) { GameMatch_PVP match_pvp = m_match as GameMatch_PVP; UBasketball ball = m_match.mCurScene.mBall; Player ballOwner = ball.m_owner; if (ballOwner != null) { match_pvp.SwitchMainrole(ballOwner.m_defenseTarget); match_pvp.SwitchMainrole(ballOwner); m_match.m_cam.Positioning(true); } } foreach (Player player in GameSystem.Instance.mClient.mPlayerManager) { player.m_InfoVisualizer.SetActive(true); } Color yellow = new Color(1f, 252f / 255, 10f / 255, 1); m_match.mainRole.ShowIndicator(yellow, true); m_match.AssumeDefenseTarget(); }
public override void OnEnter(MatchState lastState) { base.OnEnter(lastState); Debug.Log("PVP Begin"); if (m_match.m_bOverTime && m_match.m_uiMatch == null) { m_match.m_gameMathCountEnable = false; m_match.CreateUI(); } if (m_match.m_config.type == GameMatch.Type.ePVP_1PLUS) { GameMatch_PVP match_pvp = m_match as GameMatch_PVP; UBasketball ball = m_match.mCurScene.mBall; Player ballOwner = ball.m_owner; if (ballOwner != null) { match_pvp.SwitchMainrole(ballOwner.m_defenseTarget); match_pvp.SwitchMainrole(ballOwner); m_match.m_cam.Positioning(true); } } foreach (Player player in GameSystem.Instance.mClient.mPlayerManager) { player.m_InfoVisualizer.SetActive(true); } Color yellow = new Color(1f, 252f / 255, 10f / 255, 1); m_match.mainRole.ShowIndicator(yellow, true); }
public override void GameUpdate(IM.Number fDeltaTime) { base.GameUpdate(fDeltaTime); UBasketball ball = m_match.mCurScene.mBall; if (ball == null) { return; } GameMatch_PVP pvpMatch = m_match as GameMatch_PVP; if (m_match.m_config.type == GameMatch.Type.ePVP_3On3) { } else { if (ball.m_ballState == BallState.eUseBall_Pass) { Player interceptor = ball.m_interceptor; if (interceptor == null) { Player owner = ball.m_catcher; pvpMatch.SwitchMainrole(owner); } else { pvpMatch.SwitchMainrole(interceptor); pvpMatch.SwitchMainrole(interceptor.m_defenseTarget); } } else if (ball.m_ballState == BallState.eUseBall) { pvpMatch.SwitchMainrole(ball.m_owner); } } //处理掉线托管的玩家 GameMatch_PVP match = m_match as GameMatch_PVP; foreach (uint acc_id in match.droppedAccount) { Player mainRole = match.GetMainRole(acc_id); if (mainRole != null) { mainRole.operMode = Player.OperMode.AI; mainRole.m_aiMgr.IsPvp = true; mainRole.m_takingOver = true; Debug.Log(string.Format("PVP player taking over, {0} {1}", mainRole.m_team.m_side, mainRole.m_id)); } } match.droppedAccount.Clear(); }
void OnHandleMatchBeginTimer() { Debug.Log("match begin."); NetworkConn conn = GameSystem.Instance.mNetworkManager.m_gameConn; if (conn == null || conn is VirtualNetworkConn || m_matchBeginPack == null) { return; } GameSystem.Instance.mNetworkManager.m_gameMsgHandler.UnregisterHandler(MsgID.MatchBeginID, HandleMatchBegin); //conn.m_handler.UnregisterHandler(MsgID.PVPLoadCompleteRespID, HandleLoadComplete); MatchBegin resp = Serializer.Deserialize <MatchBegin>(new MemoryStream(m_matchBeginPack.buffer)); if (resp == null) { Debug.LogError("no pvp loading complete resp"); return; } //close ui foreach (KeyValuePair <uint, List <LuaComponent> > items in mapPlayerIdLoadingState) { items.Value.Clear(); } mapPlayerIdLoadingState.Clear(); GameSystem.Instance.mClient.pause = false; GameMatch_PVP match = GameSystem.Instance.mClient.mCurMatch as GameMatch_PVP; match.OnInitPlayer(); if (MainPlayer.Instance.inPvpJoining) { GameMsgSender.SendGameBegin(); m_delayDestroy = true; } else { match.m_stateMachine.SetState(MatchState.State.eOpening); Object.Destroy(gameObject); } }
private IEnumerator _LoadCharacters(PlayerManager pm, GameMatch match) { yield return(new WaitForSeconds(1.5f)); if (pvp) { GameMatch_PVP match_pvp = match as GameMatch_PVP; match_pvp.LoadPlayers(); GameMsgSender.SendPVPLoadProgress(30); } else { foreach (Player player in pm) { GameSystem.Instance.mClient.mCurMatch.CreateTeamMember(player); } _RefreshUIPercFunc(30); } m_curLoadingStep = LoadingStep.eLoadedPlayers; Debug.Log("Load character."); }
public void EnterGame() { if (respInfo == null) { Debug.LogError("Enter game failed with empty info"); return; } MainPlayer.Instance.AccountID = respInfo.acc_id; MainPlayer.Instance.CreateStep = respInfo.create_step; MainPlayer.Instance.SetBaseInfo(respInfo.info); Debug.Log("EnterGame, create_step:" + respInfo.create_step); Debug.Log("EnterGame, loadedLevel:" + Application.loadedLevel); if (Application.loadedLevelName == GlobalConst.SCENE_STARTUP) // scene startup { GameSystem.Instance.mClient.Reset(); if (respInfo.create_step == 1) //进入基础操作练习 { PractiseData practise = GameSystem.Instance.PractiseConfig.GetConfig(20001); GameSystem.Instance.mClient.CreateMatch(practise, 0ul); GameMatch_Practise match = GameSystem.Instance.mClient.mCurMatch as GameMatch_Practise; match.onBehaviourCreated = () => { PractiseBehaviourGuide behaviour = match.practise_behaviour as PractiseBehaviourGuide; behaviour.onOver = () => { CreateStepIn req = new CreateStepIn(); req.acc_id = respInfo.acc_id; GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.CreateStepInID); }; }; } else { MainPlayer.Instance.HpRestoreTime = DateTime.Now + new TimeSpan(0, 0, (int)respInfo.hp_restore_remain); //老玩家,进入大厅界面 LuaTable tScene = LuaScriptMgr.Instance.GetLuaTable("Scene"); tScene.Set("targetUI", "UIHall"); tScene.Set("subID", null); tScene.Set("params", null); SceneManager.Instance.ChangeScene(GlobalConst.SCENE_HALL); } } else { GameMatch curMatch = GameSystem.Instance.mClient.mCurMatch; if (curMatch == null) { GameSystem.Instance.mClient.Reset(); } else // In match, resend EnterGameReq { Debug.Log("EnterGame, Curr league type:" + curMatch.GetConfig().leagueType); if (curMatch.GetConfig().leagueType == GameMatch.LeagueType.eQualifying) { GameSystem.Instance.mClient.Reset(); LuaTable tScene = LuaScriptMgr.Instance.GetLuaTable("Scene"); tScene.Set("targetUI", "UIQualifying"); tScene.Set("subID", null); tScene.Set("params", null); SceneManager.Instance.ChangeScene(GlobalConst.SCENE_MATCH); } else if (curMatch.GetConfig().leagueType == GameMatch.LeagueType.ePVP) { LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { "UIHall", null, null }); } else if (curMatch.GetConfig().leagueType == GameMatch.LeagueType.eQualifyingNewer) { LuaTable tQualifyingNewer = LuaScriptMgr.Instance.GetLuaTable("QualifyingNewer"); tQualifyingNewer.Set("inBackToLadder", false); tQualifyingNewer.Set("isJoinLadder", false); tQualifyingNewer.Set("isWinShowIncStarAnim", false); LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { "UIHall", null, null }); } else if (curMatch.leagueType == GameMatch.LeagueType.eRegular1V1 || curMatch.leagueType == GameMatch.LeagueType.eQualifyingNew || curMatch.leagueType == GameMatch.LeagueType.ePractise1vs1) { MatchStateOver over = curMatch.m_stateMachine.m_curState as MatchStateOver; if (over == null) { GameSystem.Instance.mClient.Reset(); if (curMatch.leagueType == GameMatch.LeagueType.eRegular1V1) { SceneManager.Instance.ChangeScene(GlobalConst.SCENE_HALL); } else if (curMatch.leagueType == GameMatch.LeagueType.eQualifyingNew) { LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { "UIHall", null, null }); } } else { if (curMatch.m_stateMachine.m_curState.m_eState != MatchState.State.eOver || (over != null && !over.matchResultSent) ) { Debug.Log("Resend cached EnterGameReq from new"); MatchType type = GameMatch_PVP.ToMatchType(curMatch.leagueType, curMatch.m_config.type); if (curMatch.leagueType == GameMatch.LeagueType.ePractise1vs1) { EnterGameReq req = new EnterGameReq(); req.acc_id = MainPlayer.Instance.AccountID; req.type = type; req.game_mode = fogs.proto.msg.GameMode.GM_Practice1On1; req.practice_pve = new BeginPracticePve(); req.practice_pve.id = 1; req.practice_pve.fight_list = new FightRoleInfo(); req.practice_pve.fight_list.game_mode = fogs.proto.msg.GameMode.GM_Practice1On1; FightRole fr = new FightRole(); fr.role_id = curMatch.mainRole.m_id; fr.status = FightStatus.FS_MAIN; req.practice_pve.fight_list.fighters.Add(fr); over.SendEnterGamePractise1vs1(req); } else { over.SendEnterGame(type); } } } } else if (PlatNetwork.Instance.cachedEnterGameReq != null) { if (curMatch.m_stateMachine.m_curState.m_eState != MatchState.State.eOver || !(curMatch.m_stateMachine.m_curState as MatchStateOver).matchResultSent) { Debug.Log("Resend cached EnterGameReq"); LuaHelper.SendPlatMsgFromLua((uint)MsgID.EnterGameReqID, PlatNetwork.Instance.cachedEnterGameReq); } } } } if (respInfo.create_step >= GameSystem.Instance.CommonConfig.GetUInt("gMaxCreateStep")) { // after renaming step( the last step), mark as login. MainPlayer.Instance.AddCreateNewRoleLog(true); } else { MainPlayer.Instance.AddCreateNewRoleLog(false); } }
private void ExitMatch() { PlatNetwork.Instance.onReconnected -= ExitMatch; GameMatch curMatch = GameSystem.Instance.mClient.mCurMatch; GameMatch.LeagueType type = curMatch.leagueType; if (type == GameMatch.LeagueType.eCareer) { EndSectionMatch career = new EndSectionMatch(); career.session_id = curMatch.m_config.session_id; ExitGameReq req = new ExitGameReq(); req.acc_id = MainPlayer.Instance.AccountID; req.type = MatchType.MT_CAREER; req.exit_type = ExitMatchType.EMT_OPTION; req.career = career; GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID); GameSystem.Instance.mClient.mUIManager.curLeagueType = curMatch.leagueType; } else if (type == GameMatch.LeagueType.ePractise1vs1) { EndPracticePve endPracticePve = new EndPracticePve(); endPracticePve.session_id = curMatch.m_config.session_id; endPracticePve.main_role_side = 0; //Ö÷¶ÓOr¿Í¶Ó endPracticePve.score_home = (uint)curMatch.m_homeScore; //Ö÷¶ÓµÃ·Ö endPracticePve.score_away = (uint)curMatch.m_awayScore; //¿Í¶ÓµÃ·Ö ExitGameReq req = new ExitGameReq(); req.acc_id = MainPlayer.Instance.AccountID; req.type = MatchType.MT_PRACTICE_1V1; req.exit_type = ExitMatchType.EMT_OPTION; req.practice_pve = endPracticePve; GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID); GameSystem.Instance.mClient.mUIManager.curLeagueType = curMatch.leagueType; } else if (type == GameMatch.LeagueType.eQualifying) { QualifyingEndReq qualifying = new QualifyingEndReq(); qualifying.session_id = curMatch.m_config.session_id; qualifying.type = MatchType.MT_QUALIFYING; ExitGameReq req = new ExitGameReq(); req.acc_id = MainPlayer.Instance.AccountID; req.type = MatchType.MT_QUALIFYING; req.exit_type = ExitMatchType.EMT_OPTION; req.qualifying = qualifying; GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID); GameSystem.Instance.mClient.mUIManager.curLeagueType = curMatch.leagueType; } else if (type == GameMatch.LeagueType.eTour) { //TourExitReq req = new TourExitReq(); //req.session_id = curMatch.m_config.session_id; TourEndReq tour = new TourEndReq(); tour.session_id = curMatch.m_config.session_id; ExitGameReq req = new ExitGameReq(); req.acc_id = MainPlayer.Instance.AccountID; req.type = MatchType.MT_TOUR; req.exit_type = ExitMatchType.EMT_OPTION; req.tour = tour; GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID); MainPlayer.Instance.TourFailTimes++; LuaInterface.LuaTable table = LuaScriptMgr.Instance.lua.NewTable(); table.Set("uiBack", (object)"UICompetition"); LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { curMatch.leagueType, null, table }); } else if (type == GameMatch.LeagueType.ePVP) { ExitGameReq req = new ExitGameReq(); req.acc_id = MainPlayer.Instance.AccountID; req.type = GameMatch_PVP.ToMatchType(curMatch.leagueType, curMatch.m_config.type); req.exit_type = ExitMatchType.EMT_OPTION; if (GameSystem.Instance.mNetworkManager.m_gameConn != null) { Debug.Log("send exit game req"); GameSystem.Instance.mNetworkManager.m_gameConn.SendPack(0, req, MsgID.ExitGameReqID); } GameSystem.Instance.mClient.mUIManager.curLeagueType = curMatch.leagueType; LuaInterface.LuaTable table = LuaScriptMgr.Instance.lua.NewTable(); if (req.type == MatchType.MT_PVP_1V1_PLUS) { if (GameSystem.Instance.mNetworkManager.m_gameConn == null) { table.Set("uiBack", (object)"UIPVPEntrance"); LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { "UI1V1Plus", null, table }); } } else if (req.type == MatchType.MT_PVP_3V3) { table.Set("nextShowUI", (object)"UIPVPEntrance"); LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { "UIChallenge", null, table }); } } else if (type == GameMatch.LeagueType.eRegular1V1) { ExitGameReq req = new ExitGameReq(); req.acc_id = MainPlayer.Instance.AccountID; req.type = MatchType.MT_REGULAR_RACE; req.exit_type = ExitMatchType.EMT_OPTION; req.regular = new PVPEndRegularReq(); req.regular.session_id = curMatch.m_config.session_id; if (curMatch.GetMatchType() == GameMatch.Type.ePVP_1PLUS) { if (GameSystem.Instance.mNetworkManager.m_gameConn != null) { Debug.Log("send exit game req to game server"); GameSystem.Instance.mNetworkManager.m_gameConn.SendPack(0, req, MsgID.ExitGameReqID); } } else if (curMatch.GetMatchType() == GameMatch.Type.eAsynPVP3On3) { req.regular.rival_score = (curMatch as GameMatch_AsynPVP3ON3).GetRivalScore(); GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID); } else { Debug.Log("send exit game req to plat server"); GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID); } } else if (type == GameMatch.LeagueType.eQualifyingNew) { ExitGameReq req = new ExitGameReq(); req.acc_id = MainPlayer.Instance.AccountID; req.type = MatchType.MT_QUALIFYING_NEW; req.exit_type = ExitMatchType.EMT_OPTION; req.qualifying_new = new PVPEndQualifyingReq(); req.qualifying_new.session_id = curMatch.m_config.session_id; if (curMatch.GetMatchType() == GameMatch.Type.ePVP_1PLUS) { if (GameSystem.Instance.mNetworkManager.m_gameConn != null) { Debug.Log("send exit game req to game server"); GameSystem.Instance.mNetworkManager.m_gameConn.SendPack(0, req, MsgID.ExitGameReqID); } } else if (curMatch.GetMatchType() == GameMatch.Type.eAsynPVP3On3) { req.qualifying_new.rival_score = (curMatch as GameMatch_AsynPVP3ON3).GetRivalScore(); GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID); } else { Debug.Log("send exit game req to plat server"); GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID); } } else if (type == GameMatch.LeagueType.ePractise) { EndPractice practice = new EndPractice(); practice.session_id = curMatch.m_config.session_id; ExitGameReq req = new ExitGameReq(); req.acc_id = MainPlayer.Instance.AccountID; req.type = MatchType.MT_PRACTICE; req.exit_type = ExitMatchType.EMT_OPTION; req.practice = practice; GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID); } else if (type == GameMatch.LeagueType.eBullFight) { LuaInterface.LuaTable table = LuaScriptMgr.Instance.lua.NewTable(); table.Set("uiBack", (object)"UICompetition"); LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { curMatch.leagueType, null, table }); } else { LuaInterface.LuaTable table = LuaScriptMgr.Instance.lua.NewTable(); table.Set("uiBack", (object)"UICompetition"); LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { curMatch.leagueType, null, table }); } curMatch.m_stateMachine.m_curState.OnExit(); GameSystem.Instance.mClient.pause = false; }
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); }
public bool CreateNewMatch(string configName, ulong session_id = 0ul, GameMatch.Type matchType = GameMatch.Type.eNone) { if (mPlayerManager != null) { mPlayerManager.RemoveAllPlayers(); } if (mCurMatch != null) { mCurMatch = null; } GameMatch.Config config = new GameMatch.Config(); GameSystem.Instance.gameMatchConfig.LoadMatchConfig(ref config, GameMatch.Type.eNone); GameSystem.Instance.gameMatchConfig.LoadMatchConfig(ref config, matchType); config.session_id = session_id; if (config.MainRole == null) { config.MainRole = new GameMatch.Config.TeamMember(); config.MainRole.id = (MainPlayer.Instance.CaptainID).ToString(); } GameMatch match = null; switch (config.type) { case GameMatch.Type.e1On1: match = new GameMatch_1ON1(config); break; case GameMatch.Type.eReady: object o = LuaScriptMgr.Instance.GetLuaTable("_G")["TestScene"]; if (o != null) { config.sceneId = (uint)(double)o; } match = new GameMatch_Ready(config); break; case GameMatch.Type.eFreePractice: match = new GameMatch_FreePractice(config); break; case GameMatch.Type.e3On3: match = new GameMatch_3ON3(config); break; case GameMatch.Type.eGuide: GameMatch_Guide.SetConfig(ref config); match = new GameMatch_Guide(config); break; case GameMatch.Type.ePVP_1PLUS: case GameMatch.Type.ePVP_3On3: //match = new GameMatch_PVP(config); match = new GameMatch_PVP(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); }
public void Refresh(bool bOnlyPic) { int id = Random.Range(1, 26); string str = "STR_LOADING_TIPS_" + id; Tip.text = CommonFunction.GetConstString(str); TipSimple.text = CommonFunction.GetConstString(str); LblNarrowTip.text = TipSimple.text; LblMultiBaseTip.text = TipSimple.text; if (bOnlyPic) { GetComponent <Animator>().enabled = false; NGUITools.SetActiveChildren(Window, false); ResourceLoadManager.Instance.LoadAloneImage(GameSystem.Instance.CommonConfig.GetString("gPracticeBg"), _OnLoadTexFinish); if (GameSystem.Instance.isNewPlayer) { BGSimple.gameObject.SetActive(false); TipSimple.gameObject.SetActive(false); } } else { TipSimple.gameObject.SetActive(false); BGSimple.gameObject.SetActive(false); GameMatch curMatch = GameSystem.Instance.mClient.mCurMatch; Title.spriteName = curMatch.LeagueTypeToSpriteName(); Title.MakePixelPerfect(); Debug.Log("Refresh team"); if (pvp) { if (myName != null && rivalName != null) { MyTeamName.text = myName; RivalTeamName.text = rivalName; } RefreshMyTeam_PVP(); RefreshRivalTeam_PVP(); GameMatch_PVP match_pvp = curMatch as GameMatch_PVP; if (curMatch.leagueType == GameMatch.LeagueType.eQualifyingNewer || curMatch.leagueType == GameMatch.LeagueType.ePVP ) { MyTeamName.text = CommonFunction.GetConstString("STR_HOME"); RivalTeamName.text = CommonFunction.GetConstString("STR_PEER"); } } else { if (curMatch.leagueType == GameMatch.LeagueType.eRegular1V1 && curMatch.GetMatchType() == GameMatch.Type.eCareer3On3) { MyTeamName.text = MainPlayer.Instance.Name; RivalTeamName.text = (string)(LuaScriptMgr.Instance.GetLuaTable("Regular1V1Handler")["npcRivalName"]); } else if (curMatch.leagueType == GameMatch.LeagueType.eQualifyingNew && curMatch.GetMatchType() == GameMatch.Type.eCareer3On3) { MyTeamName.text = MainPlayer.Instance.Name; RivalTeamName.text = (string)(LuaScriptMgr.Instance.GetLuaTable("UIQualifyingNew")["npcRivalName"]); } RefreshMyTeam(); RefreshRivalTeam(); } SetTeamMatesName(); SetRivalName(); SetTeamMatesScore(); SetRivalScore(); LoadScene(); } }
void Update() { for (int i = updatePreclist.Count - 1; i >= 0; i--) { UpdatePrec up = updatePreclist[i]; up.curTime += Time.deltaTime; if (up.curTime > updatePreclist[i].targetTime) { up.PrecValue--; up.curTime = 0.0f; up.loadingItem.percentage++; LuaComponent loadingItem = up.loadingItem.transform.GetComponent <LuaComponent>(); if (loadingItem.table != null) { loadingItem.table.Set("loadingState", CommonFunction.GetConstString("STR_LOADING") + up.loadingItem.percentage + "%"); } } if (up.PrecValue == 0) { if (m_curLoadingCmd != null) { if (up.loadingItem.ri != null) { if (up.loadingItem.ri.acc_id == MainPlayer.Instance.AccountID) { m_curLoadingCmd.m_bDone = true; } } else { m_curLoadingCmd.m_bDone = true; } } updatePreclist.RemoveAt(i); } } _InitGameMsgHandler(); //loading queue process if (m_curLoadingCmd == null && m_loadingQueue.Count != 0) { m_curLoadingCmd = m_loadingQueue.Dequeue(); m_curLoadingCmd.Execute(); } if (m_curLoadingCmd != null && m_curLoadingCmd.m_bDone) { if (m_curLoadingCmd.m_bFinalCmd) { m_curLoadingStep = LoadingStep.eLoadingComplete; } m_curLoadingCmd = null; } if (m_curLoadingStep == LoadingStep.eInit) { return; } if (m_wait != null) { m_wait.Update(Time.deltaTime); } GameMatch_PVP match = GameSystem.Instance.mClient.mCurMatch as GameMatch_PVP; if (match == null) { if (m_curLoadingStep == LoadingStep.eLoadingComplete) { if (onComplete != null) { onComplete(); } Object.Destroy(gameObject); } } else { if (m_curLoadingStep == LoadingStep.eLoadedScene && match.m_bPlayerDataReady && !m_pvpLoadPlayer) { LoadCharacter(GameSystem.Instance.mClient.mPlayerManager, match); m_pvpLoadPlayer = true; } if (m_curLoadingStep == LoadingStep.eLoadedPlayers && !m_pvpLoadUI) { LoadUI(match); m_pvpLoadUI = true; } if (m_curLoadingStep == LoadingStep.eLoadingComplete && !m_pvpLoadComplete) { if (onComplete != null) { onComplete(); } m_pvpLoadComplete = true; GameMsgSender.SendLoadingComplete(match.GetMatchType()); } if (m_curLoadingStep == LoadingStep.eLoadingComplete && disConnected) { disConnected = false; ShowOffLine(); } if (m_delayDestroy && !MainPlayer.Instance.inPvpJoining) { // if( m_delayLoadLua != null) // { // m_delayLoadLua.ForEach((LuaComponent item) => // { // item.table.Set("loadingState", CommonFunction.GetConstString("STR_LOAD_COMPLETE")); // item.table.Set("loadDone", true); // }); // } Object.Destroy(gameObject); } } }