static void CheckPlayerZuiGaoFen() { //XkGameCtrl.CheckPlayerActiveNum(); if (XkGameCtrl.PlayerActiveNum <= 0) { return; } if (Time.time - TimeLastMaxScore < 0.5f) { return; } TimeLastMaxScore = Time.time; int maxScore = 0; int indexVal = 0; for (int i = 0; i < 4; i++) { switch (i) { case 0: if (!XkGameCtrl.IsActivePlayerOne) { continue; } break; case 1: if (!XkGameCtrl.IsActivePlayerTwo) { continue; } break; case 2: if (!XkGameCtrl.IsActivePlayerThree) { continue; } break; case 3: if (!XkGameCtrl.IsActivePlayerFour) { continue; } break; } if (XkGameCtrl.PlayerJiFenArray[i] > maxScore) { maxScore = XkGameCtrl.PlayerJiFenArray[i]; indexVal = i; } } //Debug.Log("Unity:"+"CheckPlayerZuiGaoFen -> maxScore "+maxScore+", index "+indexVal); XKPlayerScoreCtrl playerScore = null; switch (indexVal) { case 0: playerScore = _InstanceP1; break; case 1: playerScore = _InstanceP2; break; case 2: playerScore = _InstanceP3; break; case 3: playerScore = _InstanceP4; break; } if (playerScore.ZuiGaoFenObj.activeSelf) { return; } if (_InstanceP1 != null) { _InstanceP1.SetActiveZuiGaoFen(playerScore == _InstanceP1); } if (_InstanceP2 != null) { _InstanceP2.SetActiveZuiGaoFen(playerScore == _InstanceP2); } if (_InstanceP3 != null) { _InstanceP3.SetActiveZuiGaoFen(playerScore == _InstanceP3); } if (_InstanceP4 != null) { _InstanceP4.SetActiveZuiGaoFen(playerScore == _InstanceP4); } }
static void CheckPlayerZuiGaoFen(bool isHuLueTime = false) { //XkGameCtrl.CheckPlayerActiveNum(); if (XkGameCtrl.PlayerActiveNum <= 0) { return; } if (Time.time - TimeLastMaxScore < 0.5f) { return; } TimeLastMaxScore = Time.time; int maxScore = 0; int indexVal = -1; PlayerEnum indexPlayer = PlayerEnum.Null; for (int i = 0; i < 4; i++) { indexPlayer = (PlayerEnum)(i + 1); if (XkGameCtrl.GetIsActivePlayer(indexPlayer) == false) { continue; } if (XkGameCtrl.GetIsDeathPlayer(indexPlayer) == true) { XKPlayerScoreCtrl playerScoreCom = GetInstance(indexPlayer); if (playerScoreCom != null) { playerScoreCom.SetActiveZuiGaoFen(false); } continue; } //switch (i) { //case 0: // if (!XkGameCtrl.IsActivePlayerOne) { // continue; // } // break; //case 1: // if (!XkGameCtrl.IsActivePlayerTwo) { // continue; // } // break; //case 2: // if (!XkGameCtrl.IsActivePlayerThree) { // continue; // } // break; //case 3: // if (!XkGameCtrl.IsActivePlayerFour) { // continue; // } // break; //} if (XkGameCtrl.PlayerJiFenArray[i] > maxScore) { maxScore = XkGameCtrl.PlayerJiFenArray[i]; indexVal = i; } } //Debug.Log("Unity:"+"CheckPlayerZuiGaoFen -> maxScore "+maxScore+", index "+indexVal); if (indexVal == -1) { return; } XKPlayerScoreCtrl playerScore = null; switch (indexVal) { case 0: playerScore = _InstanceP1; break; case 1: playerScore = _InstanceP2; break; case 2: playerScore = _InstanceP3; break; case 3: playerScore = _InstanceP4; break; } if (playerScore.ZuiGaoFenObj.activeSelf) { return; } if (_InstanceP1 != null) { _InstanceP1.SetActiveZuiGaoFen(playerScore == _InstanceP1); } if (_InstanceP2 != null) { _InstanceP2.SetActiveZuiGaoFen(playerScore == _InstanceP2); } if (_InstanceP3 != null) { _InstanceP3.SetActiveZuiGaoFen(playerScore == _InstanceP3); } if (_InstanceP4 != null) { _InstanceP4.SetActiveZuiGaoFen(playerScore == _InstanceP4); } }