private void 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.eTour) { TourExitReq req = new TourExitReq(); req.session_id = curMatch.m_config.session_id; GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.TourExitReqID); LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", curMatch.leagueType); } else { LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", curMatch.leagueType); } curMatch.m_stateMachine.m_curState.OnExit(); GameSystem.Instance.mClient.pause = false; }
static int IntToEnum(IntPtr L) { int arg0 = (int)LuaDLL.lua_tonumber(L, 1); GameMatch.LeagueType o = (GameMatch.LeagueType)arg0; LuaScriptMgr.Push(L, o); return(1); }
public Dictionary <string, AttrReduceItem> GetItems(GameMatch.LeagueType leagueType, uint sectionID, uint level, PositionType position) { return((from e in config where e.leagueType == leagueType && e.sectionID == sectionID && e.levelRange.Key <= level && level <= e.levelRange.Value && e.position == position select e.items).FirstOrDefault()); }
static int CreateNewMatch(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(Client), typeof(GameMatch.Config))) { Client obj = (Client)LuaScriptMgr.GetNetObjectSelf(L, 1, "Client"); GameMatch.Config arg0 = (GameMatch.Config)LuaScriptMgr.GetLuaObject(L, 2); bool o = obj.CreateNewMatch(arg0); LuaScriptMgr.Push(L, o); return(1); } else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(Client), typeof(GameMatch.Type))) { Client obj = (Client)LuaScriptMgr.GetNetObjectSelf(L, 1, "Client"); GameMatch.Type arg0 = (GameMatch.Type)LuaScriptMgr.GetLuaObject(L, 2); bool o = obj.CreateNewMatch(arg0); LuaScriptMgr.Push(L, o); return(1); } else if (count == 4) { Client obj = (Client)LuaScriptMgr.GetNetObjectSelf(L, 1, "Client"); string arg0 = LuaScriptMgr.GetLuaString(L, 2); ulong arg1 = (ulong)LuaScriptMgr.GetNumber(L, 3); GameMatch.Type arg2 = (GameMatch.Type)LuaScriptMgr.GetNetObject(L, 4, typeof(GameMatch.Type)); bool o = obj.CreateNewMatch(arg0, arg1, arg2); LuaScriptMgr.Push(L, o); return(1); } else if (count == 7) { Client obj = (Client)LuaScriptMgr.GetNetObjectSelf(L, 1, "Client"); uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 2); ulong arg1 = (ulong)LuaScriptMgr.GetNumber(L, 3); bool arg2 = LuaScriptMgr.GetBoolean(L, 4); GameMatch.LeagueType arg3 = (GameMatch.LeagueType)LuaScriptMgr.GetNetObject(L, 5, typeof(GameMatch.LeagueType)); List <uint> arg4 = (List <uint>)LuaScriptMgr.GetNetObject(L, 6, typeof(List <uint>)); List <uint> arg5 = (List <uint>)LuaScriptMgr.GetNetObject(L, 7, typeof(List <uint>)); obj.CreateNewMatch(arg0, arg1, arg2, arg3, arg4, arg5); return(0); } else { LuaDLL.luaL_error(L, "invalid arguments to method: Client.CreateNewMatch"); } return(0); }
public bool ValidateFailedAtSection(string arg) { Transform tm = basePanel.FindChild("UIMatchResult(Clone)"); if (tm != null && NGUITools.GetActive(tm.gameObject)) { LuaComponent luaCom = tm.GetComponent <LuaComponent>(); if (!(bool)luaCom.table["isWin"]) { GameMatch.LeagueType leagueType = (GameMatch.LeagueType)luaCom.table["leagueType"]; if (leagueType == GameMatch.LeagueType.eCareer) { uint sectionID = (uint)(double)(LuaScriptMgr.Instance.GetLuaTable("_G")["CurSectionID"]); if (sectionID == uint.Parse(arg)) { return(true); Debug.Log("Validate failed at section, true, section ID:" + sectionID); } else { Debug.Log("Validate failed at section, false, cur section ID:" + sectionID); } } else { Debug.Log("Validate failed at section, false, match is not career."); } } else { Debug.Log("Validate failed at section, false, match win."); } } else { Debug.Log("Validate failed at section, false, UI not visible"); } return(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; }
void Awake() { m_match = GameSystem.Instance.mClient.mCurMatch; leftNameLabel = transform.FindChild("LeftName").GetComponent <UILabel>(); rightNameLabel = transform.FindChild("RightName").GetComponent <UILabel>(); bg = transform.FindChild("Bg").GetComponent <UISprite>(); leftScoreNode = transform.FindChild("LeftScore"); rightScoreNode = transform.FindChild("RightScore"); timerNode = transform.FindChild("TimerNode"); GameObject prefab = ResourceLoadManager.Instance.LoadPrefab("Prefab/GUI/TimerBoard") as GameObject; timerBoard = CommonFunction.InstantiateObject(prefab, timerNode).GetComponent <TimerBoard>(); timerBoard.backgroundVisible = false; prefab = ResourceLoadManager.Instance.LoadPrefab("Prefab/GUI/ScoreBoard") as GameObject; leftScoreBoard = CommonFunction.InstantiateObject(prefab, leftScoreNode).GetComponent <ScoreBoard_new>(); leftScoreBoard.isLeft = true; rightScoreBoard = CommonFunction.InstantiateObject(prefab, rightScoreNode).GetComponent <ScoreBoard_new>(); rightScoreBoard.isLeft = false; mCounter24 = GameUtils.FindChildRecursive(transform, "TimeCounter24").GetComponent <UTimeCounter24>(); m_match.m_count24Time = m_match.MAX_COUNT24_TIME; mCounter24.gameObject.SetActive(false); mCenterAnchor = GameUtils.FindChildRecursive(transform, "Anchor_Center"); mTopAnchor = GameUtils.FindChildRecursive(transform, "Anchor_Top"); leftBall = transform.FindChild("LeftBall").gameObject; rightBall = transform.FindChild("RightBall").gameObject; m_leftNode = transform.Find("LeftNode"); m_rightNode = transform.Find("RightNode"); prefab = ResourceLoadManager.Instance.LoadPrefab("Prefab/GUI/msg/Foul_24") as GameObject; m_goFoulMsg = GameObject.Instantiate(prefab) as GameObject; m_goFoulMsg.transform.parent = mCenterAnchor; m_goFoulMsg.SetActive(false); prefab = ResourceLoadManager.Instance.LoadPrefab("Prefab/GUI/msg/Msg_CheckBall") as GameObject; m_goCheckBallMsg = GameObject.Instantiate(prefab) as GameObject; m_goCheckBallMsg.transform.parent = mCenterAnchor; m_goCheckBallMsg.SetActive(false); prefab = ResourceLoadManager.Instance.LoadPrefab("Prefab/GUI/ButtonPause") as GameObject; Transform buttonParent = transform.FindChild("ButtonPause"); goExit = CommonFunction.InstantiateObject(prefab, buttonParent); UIEventListener.Get(goExit).onClick = OnExit; goShortMsgFolder = transform.FindChild("ButtonArrow").gameObject; goShortMsgFolder.AddComponent <TweenRotation>(); UIEventListener.Get(goShortMsgFolder).onClick = OnClickMsg; goCustomMsg = transform.FindChild("LeftButton/ButtonTalk").gameObject; UIEventListener.Get(goCustomMsg).onClick = OnClickMsg; goMsg1 = transform.FindChild("LeftButton/ButtonMark/Icon").gameObject; UIEventListener.Get(goMsg1.transform.parent.gameObject).onClick = OnClickMsg; goMsg2 = transform.FindChild("LeftButton/ButtonExchange/Icon").gameObject; UIEventListener.Get(goMsg2.transform.parent.gameObject).onClick = OnClickMsg; GameObject goGrid = transform.FindChild("LeftButton/Grid").gameObject; uiGridCustomMsgs = goGrid.GetComponent <UIGrid>(); GameObject sampleBtn = uiGridCustomMsgs.GetChild(0).gameObject; GameObject goBtnItem = GameObject.Instantiate(sampleBtn) as GameObject; m_btnCustomItem = goBtnItem.GetComponent <UIButton>(); goBtnItem.SetActive(false); sampleBtn.SetActive(false); m_msgHomeBlobs = transform.FindChild("HomeBlobs").GetComponent <UIMatchMessageBlob>(); m_msgAwayBlobs = transform.FindChild("AwayBlobs").GetComponent <UIMatchMessageBlob>(); m_sprWifi = transform.FindChild("RightButton/ButtonWifi/Icon").GetComponent <UISprite>(); m_labWifi = transform.FindChild("RightButton/ButtonWifi/Num").GetComponent <UILabel>(); m_curMatchMsgCond = 0; m_bShowCustomMsg = false; m_bShowAll = true; GameMatch.LeagueType leagueType = m_match.GetConfig().leagueType; if (leagueType == GameMatch.LeagueType.eRegular1V1 || leagueType == GameMatch.LeagueType.ePVP || leagueType == GameMatch.LeagueType.eQualifyingNew || leagueType == GameMatch.LeagueType.eQualifyingNewer || leagueType == GameMatch.LeagueType.eQualifyingNewerAI || leagueType == GameMatch.LeagueType.eLadderAI ) { m_pingTime = new GameUtils.Timer4View(2f, OnPing); } else { m_bShowAll = false; goShortMsgFolder.SetActive(false); transform.FindChild("RightButton").gameObject.SetActive(false); } m_matchScoreEffect = gameObject.AddComponent <UIMatchScoreEffect>(); OnPing(); }
public void CreateNewMatch(uint gameModeID, ulong sessionID, bool needPlayPlot, GameMatch.LeagueType leagueType, List <uint> teammates = null, List <uint> npcList = null) { GameMode gameMode = GameSystem.Instance.GameModeConfig.GetGameMode(gameModeID); if (teammates.Count < 1 && (gameMode.matchType == GameMatch.Type.e3On3 || gameMode.matchType == GameMatch.Type.eAsynPVP3On3 || gameMode.matchType == GameMatch.Type.ePractice1V1)) { return; } GameMatch.Config config = new GameMatch.Config(); config.leagueType = leagueType; config.type = gameMode.matchType; //config.type = GameMatch.Type.e3AIOn3AI; config.sceneId = uint.Parse(gameMode.scene); config.MatchTime = new IM.Number((int)gameMode.time); config.session_id = sessionID; config.gameModeID = gameModeID; config.needPlayPlot = needPlayPlot; config.level = gameMode.level; int pos = 1; config.MainRole = new GameMatch.Config.TeamMember(); config.MainRole.id = teammates[0].ToString(); config.MainRole.pos = pos++; config.MainRole.team = Team.Side.eHome; if (teammates != null) { foreach (uint id in teammates) { if (id.ToString() != config.MainRole.id) { GameMatch.Config.TeamMember mem_npc = new GameMatch.Config.TeamMember(); mem_npc.id = id.ToString(); mem_npc.pos = pos++; mem_npc.team = Team.Side.eHome; config.NPCs.Add(mem_npc); } } } List <uint> npcs = new List <uint>(); if (npcList != null) { npcs = npcList; } else { if (gameMode.mappedNPC.ContainsKey(MainPlayer.Instance.Captain.m_position)) { npcs.Add(gameMode.mappedNPC[MainPlayer.Instance.Captain.m_position]); } foreach (List <uint> candidates in gameMode.unmappedNPC) { if (candidates != null && candidates.Count > 0) { uint id = 0; do { id = candidates[UnityEngine.Random.Range(0, candidates.Count - 1)]; } while (npcs.Contains(id)); npcs.Add(id); } } } foreach (uint ID in npcs) { GameMatch.Config.TeamMember mem_npc = new GameMatch.Config.TeamMember(); mem_npc.id = ID.ToString(); mem_npc.pos = pos++; mem_npc.team = Team.Side.eAway; config.NPCs.Add(mem_npc); } CreateNewMatch(config); }