public void LoadGameResultUI() { _view = _prefab.GetComponent <UIGameResultView> () ?? _prefab.gameObject.AddComponent <UIGameResultView> (); _view._btnXuanyao = _prefab.Find("Panel/btn_xuanyao").GetComponent <Button> (); _view._btnContinue = _prefab.Find("Panel/btn_jixu").GetComponent <Button> (); _view._scrollDetail = _prefab.Find("Panel/ScrollDetail"); _view._scrollDetail.gameObject.SetActive(false); for (int i = 0; i < GameMessage.TABLE_PLAYER_NUM; i++) { string tempName = "Panel/GameResult/result" + (i + 1); _view._resultItems[i] = _prefab.Find(tempName).GetComponent <UIResultItem> () ?? _prefab.Find(tempName).gameObject.AddComponent <UIResultItem> (); UIResultItem resultItem = _view._resultItems[i]; resultItem._btnResult = _prefab.Find(tempName).GetComponent <Button> (); resultItem._imgBgWin = resultItem._btnResult.transform.Find("img_bgWin"); resultItem._imgBgLose = resultItem._btnResult.transform.Find("img_bgLose"); resultItem._textscore = resultItem._btnResult.transform.Find("text_score").GetComponent <Text> (); resultItem._handCards = resultItem._btnResult.transform.Find("handCards"); resultItem._imgHu = resultItem._btnResult.transform.Find("imghu").GetComponent <Image> (); resultItem._imgWeiting = resultItem._btnResult.transform.Find("imgWeiTing").GetComponent <Image> (); resultItem._imgHuazhu = resultItem._btnResult.transform.Find("imgHuazhu").GetComponent <Image> (); resultItem._textHubs = resultItem._btnResult.transform.Find("text_hubs").GetComponent <Text> (); resultItem._huGroup = resultItem._btnResult.transform.Find("huGroup"); resultItem._imgHeadkuang = resultItem._btnResult.transform.Find("img_headkuang").GetComponent <Image> (); resultItem._imgHeadIcon = resultItem._btnResult.transform.Find("img_headkuang/Image/img_headIcon").GetComponent <Image> (); resultItem._imgBenjia = resultItem._btnResult.transform.Find("img_headkuang/img_benjia").GetComponent <Image> (); resultItem._imgMaxWin = resultItem._btnResult.transform.Find("img_headkuang/img_maxWin").GetComponent <Image> (); resultItem._textName = resultItem._btnResult.transform.Find("img_headkuang/text_name").GetComponent <Text> (); resultItem._btnResult.onClick.RemoveAllListeners(); } _view._resultItems[0]._btnResult.onClick.AddListener(delegate() { UIOperation.Instance.OnClickResult(this, 0); }); _view._resultItems[1]._btnResult.onClick.AddListener(delegate() { UIOperation.Instance.OnClickResult(this, 1); }); _view._resultItems[2]._btnResult.onClick.AddListener(delegate() { UIOperation.Instance.OnClickResult(this, 2); }); _view._resultItems[3]._btnResult.onClick.AddListener(delegate() { UIOperation.Instance.OnClickResult(this, 3); }); for (int i = 0; i < 20; i++) { string tempName = "Panel/ScrollDetail/Viewport/Content/PanelDetail/detail" + (i + 1); _view._dtailtems[i] = _prefab.Find(tempName).GetComponent <UIDetailItem> () ?? _prefab.Find(tempName).gameObject.AddComponent <UIDetailItem> (); UIDetailItem dtailtem = _view._dtailtems[i]; dtailtem.gameObject.SetActive(false); dtailtem._textWinType = dtailtem.transform.Find("text_winType").GetComponent <Text>(); dtailtem._textHuType = dtailtem.transform.Find("text_huType").GetComponent <Text>(); dtailtem._textHuBS = dtailtem.transform.Find("text_huBS").GetComponent <Text>(); dtailtem._textWinScore = dtailtem.transform.Find("text_winScore").GetComponent <Text>(); dtailtem._textWinPenson = dtailtem.transform.Find("text_winPenson").GetComponent <Text>(); } // add combo button event _view._btnContinue.onClick.RemoveAllListeners(); _view._btnXuanyao.onClick.RemoveAllListeners(); _view._btnContinue.onClick.AddListener(delegate() { UIOperation.Instance.OnClickGameContinue(this); }); _view._btnXuanyao.onClick.AddListener(delegate() { UIOperation.Instance.OnClickGameXuanyao(this); }); }
public void InitGameResultUI() { // for (int i = 0; i < GameMessage.TABLE_PLAYER_NUM; i++) { // _view._resultItems [i].gameObject.SetActive (true); // } // return; if (UIOperation.Instance._gameResultDatas == null) { return; } UIGroupCardsController.Instance.Close(); int listCount = UIOperation.Instance._gameResultDatas.Count; int maxWinindex = 0; if (listCount > 0) { for (int i = 1; i < UIOperation.Instance._gameResultDatas.Count; i++) { if (UIOperation.Instance._gameResultDatas [maxWinindex].llScore < UIOperation.Instance._gameResultDatas [i].llScore) { maxWinindex = i; } } } for (int i = 0; i < GameMessage.TABLE_PLAYER_NUM; i++) { _view._resultItems [i].gameObject.SetActive(false); if (i < listCount) { bool isWin = false; bool isHu = false; bool isWeiting = false; bool isHuazhu = false; GameMessage.PlayerMessage playerMsg = UIOperation.Instance._gameResultDatas[i]; isWin = playerMsg.llScore >= 0; isHu = playerMsg.cHu > 0; isWeiting = playerMsg.cNOTING > 0; isHuazhu = playerMsg.cHuaZhu > 0; UIResultItem resultItem = _view._resultItems [i]; resultItem.gameObject.SetActive(true); resultItem._textName.text = playerMsg.iUserID.ToString(); resultItem._textscore.text = playerMsg.llScore.ToString(); resultItem._textHubs.text = "x" + playerMsg.cWinCounts; resultItem._imgBgWin.gameObject.SetActive(isWin); resultItem._imgBgLose.gameObject.SetActive(!isWin); resultItem._imgHu.gameObject.SetActive(isHu); resultItem._imgWeiting.gameObject.SetActive(isWeiting); resultItem._imgHuazhu.gameObject.SetActive(isHuazhu); resultItem._textHubs.gameObject.SetActive(isHu); resultItem._huGroup.gameObject.SetActive(isHu); resultItem._imgBenjia.gameObject.SetActive(i == UIOperation.Instance.SelfIndex); resultItem._imgMaxWin.gameObject.SetActive(i == maxWinindex); //peng kang card for (int n = 0; n < playerMsg.vStructMj.Count; n++) { UIGroupCardsController.Instance.GetPengGroupUI(resultItem._handCards, playerMsg.vStructMj[n].card, playerMsg.vStructMj[n].specialType); } //hand card UIGroupCardsController.Instance.GetHandGroupUI(resultItem._handCards, playerMsg.vhandCards); if (isHu) { //hu card UIGroupCardsController.Instance.GetHuGroupUI(resultItem._huGroup, playerMsg.vHuCards); } } } }