void AddMethod(int index) { GameData gd = GameData.Instance; GamePlayingMethodPanelData gpmpd = gd.GamePlayingMethodPanelData; string name = gpmpd.GameIndex + "_" + index; StartCoroutine(gpmpd.ReadPlayingMethond_(name, isGame)); }
/// <summary> /// 处理关闭面板按钮 /// </summary> void HandleCloseBtn() { GameData gd = GameData.Instance; GamePlayingMethodPanelData gpmpd = gd.GamePlayingMethodPanelData; gpmpd.PanelShow = false; UpdateShow(); }
/// <summary> /// 处理查看某种玩法的按钮 /// </summary> /// <param name="index">按钮对应的下标</param> void HandleReadGamePlayingMethod(int index) { GameData gd = GameData.Instance; GamePlayingMethodPanelData gpmpd = gd.GamePlayingMethodPanelData; gpmpd.GameIndex = index; //默认打开基本玩法的基本规则 UIMainView.Instance.GamePlayingMethodPanel.PointIndexBtn(false, 0); }
/// <summary> /// 面板的更新显示 /// </summary> public void UpdateShow(int status) { GameData gd = GameData.Instance; GamePlayingMethodPanelData gpmpd = gd.GamePlayingMethodPanelData; CreatRoomMessagePanelData crmpd = GameData.Instance.CreatRoomMessagePanelData; if (gpmpd.PanelShow) { if (MahjongLobby_AH.GameData.Instance.CreatRoomMessagePanelData != null) { //if (crmpd.CreatRoomType == 1 && SDKManager.Instance.IOSCheckStaus == 0 && SDKManager.Instance.CheckStatus == 0) if (UIMainView.Instance.ParlorShowPanel.ParlorMessagePanel.gameObject.activeSelf == false && SDKManager.Instance.IOSCheckStaus == 0 && SDKManager.Instance.CheckStatus == 0) { SwitchLocation.SetActive(true); BtnParent.GetComponent <GridLayoutGroup>().padding.top = 5; } else { SwitchLocation.SetActive(false); BtnParent.GetComponent <GridLayoutGroup>().padding.top = -50; } } GameData.Instance.isShowQuitPanel = false; gameObject.SetActive(true); SpwanBtn(status); if (SDKManager.Instance.IOSCheckStaus == 1 || SDKManager.Instance.CheckStatus == 1) { for (int i = 0; i < IosHideBtn.Length; i++) { IosHideBtn[i].SetActive(false); } //BtnParent.GetComponent<GridLayoutGroup>().padding.top = -50; } else { for (int i = 0; i < IosHideBtn.Length; i++) { IosHideBtn[i].SetActive(true); } //BtnParent.GetComponent<GridLayoutGroup>().padding.top = 5; } } else { GameData.Instance.isShowQuitPanel = true; gameObject.SetActive(false); } }
/// <summary> /// 产生对应玩法的按钮 /// </summary> public void SpwanBtn(int status) { anhui.MahjongCommonMethod mcm = anhui.MahjongCommonMethod.Instance; GameData gd = GameData.Instance; GamePlayingMethodPanelData gpmpd = gd.GamePlayingMethodPanelData; //SelectAreaPanelData sapd = gd.SelectAreaPanelData; //删除之前的按钮 Button[] btn = BtnParent.transform.GetComponentsInChildren <Button>(); for (int i = 0; i < btn.Length; i++) { Destroy(btn[i].gameObject); } int index_ = 0; List <int> temp = new List <int>(); //Debug.LogError("status:" + status + ",:" + mcm.lsMethodId.Count + "," + GameData.Instance.CreatRoomMessagePanelData.MethodId); if (status == 0) { temp = mcm.lsMethodId; if (GameData.Instance.CreatRoomMessagePanelData.MethodId > 0) { index_ = GameData.Instance.CreatRoomMessagePanelData.MethodId; PointIndexBtn(false, 0); Area.text = anhui.MahjongCommonMethod.Instance._dicDisConfig[gpmpd.CountyId].COUNTY_NAME; } else { temp = new List <int>(); if (SDKManager.Instance.IOSCheckStaus == 1 || SDKManager.Instance.CheckStatus == 1) { temp.Add(2); } else { for (int i = 0; i < mcm._dicPlayNameConfig[gpmpd.CountyId].Count; i++) { temp.Add(mcm._dicPlayNameConfig[gpmpd.CountyId][i].METHOD); } } index_ = mcm._dicPlayNameConfig[gpmpd.CountyId][0].METHOD; Area.text = anhui.MahjongCommonMethod.Instance._dicDisConfig[gpmpd.CountyId].COUNTY_NAME; } //Area.text = MahjongCommonMethod.Instance._dicDisConfig[GameData.Instance.SelectAreaPanelData.iCountyId].COUNTY_NAME; } else { Area.text = anhui.MahjongCommonMethod.Instance._dicDisConfig[gpmpd.CountyId].COUNTY_NAME; string[] id = anhui.MahjongCommonMethod.Instance._dicDisConfig[gpmpd.CountyId].METHOD.Split('_'); for (int k = 0; k < id.Length; k++) { int ID = Convert.ToInt16(id[k]); if (ID != 0) { temp.Add(ID); } } PointIndexBtn(false, 0); } gpmpd.GameIndex = temp[0]; AddMethod(1); for (int i = 0; i < temp.Count; i++) { if (SDKManager.Instance.CheckStatus == 1) { if (i > 1) { break; } } GameObject go = Instantiate(Resources.Load <GameObject>("Lobby/PlayerMethodPanel/Method")); go.name = "Method_" + temp[i]; go.transform.SetParent(BtnParent.transform); go.transform.localScale = Vector3.one; go.transform.localPosition = new Vector3(go.transform.localPosition.x, go.transform.localPosition.y, 0); if (index_ > 0) { if (temp[i] == index_) { go.transform.GetComponent <CityConnectCounty>().status[0].SetActive(true); go.transform.GetComponent <CityConnectCounty>().status[1].SetActive(false); } else { go.transform.GetComponent <CityConnectCounty>().status[1].SetActive(true); go.transform.GetComponent <CityConnectCounty>().status[0].SetActive(false); } } else { if (i == 0) { go.transform.GetComponent <CityConnectCounty>().status[0].SetActive(true); go.transform.GetComponent <CityConnectCounty>().status[1].SetActive(false); } else { go.transform.GetComponent <CityConnectCounty>().status[1].SetActive(true); go.transform.GetComponent <CityConnectCounty>().status[0].SetActive(false); } } if (SDKManager.Instance.CheckStatus == 0) { //Debug.LogError("gpmpd.CountyId:" + gpmpd.CountyId + ".count:" + mcm._dicPlayNameConfig[gpmpd.CountyId].Count); for (int k = 0; k < mcm._dicPlayNameConfig[gpmpd.CountyId].Count; k++) { if (temp[i] == mcm._dicPlayNameConfig[gpmpd.CountyId][k].METHOD) { go.transform.GetComponent <CityConnectCounty>().status[2].GetComponent <Text>().text = mcm._dicPlayNameConfig[gpmpd.CountyId][k].METHOD_NAME; go.transform.GetComponent <CityConnectCounty>().status[3].GetComponent <Text>().text = mcm._dicPlayNameConfig[gpmpd.CountyId][k].METHOD_NAME; } } } else { if (i == 0) { go.transform.GetComponent <CityConnectCounty>().status[2].GetComponent <Text>().text = "推倒胡"; go.transform.GetComponent <CityConnectCounty>().status[3].GetComponent <Text>().text = "推倒胡"; } else { go.transform.GetComponent <CityConnectCounty>().status[2].GetComponent <Text>().text = "推倒胡打锅"; go.transform.GetComponent <CityConnectCounty>().status[3].GetComponent <Text>().text = "推倒胡打锅"; } } AddClickDelegate(go.GetComponent <Button>()); } }
/// <summary> /// 处理点击玩法按钮 /// </summary> void HandlePlayingMehod() { GameData gd = GameData.Instance; GamePlayingMethodPanelData gpmpd = gd.GamePlayingMethodPanelData; CreatRoomMessagePanelData crmpd = gd.CreatRoomMessagePanelData; SelectAreaPanelData sapd = gd.SelectAreaPanelData; ParlorShowPanelData pspd = gd.ParlorShowPanelData; if (crmpd.CreatRoomType == 1) { gpmpd.CountyId = sapd.iCountyId; string[] id = MahjongCommonMethod.Instance._dicDisConfig[gpmpd.CountyId].METHOD.Split('_'); MahjongCommonMethod.Instance.lsMethodId = new List <int>(); for (int i = 0; i < id.Length; i++) { // Debug.LogWarning("处理点击玩法按钮1"); MahjongCommonMethod.Instance.lsMethodId.Add(System.Convert.ToInt32(id[i])); } } else { gpmpd.CountyId = pspd.iCountyId[2]; } if (gpmpd.Status != 1) { GameData.Instance.CreatRoomMessagePanelData.MethodId = System.Convert.ToInt32(MahjongCommonMethod.Instance._dicDisConfig[gpmpd.CountyId].METHOD.Split('_')[0]); string[] id = MahjongCommonMethod.Instance._dicDisConfig[gpmpd.CountyId].METHOD.Split('_'); MahjongCommonMethod.Instance.lsMethodId = new List <int>(); for (int i = 0; i < id.Length; i++) { // Debug.LogWarning("处理点击玩法按钮2"); MahjongCommonMethod.Instance.lsMethodId.Add(System.Convert.ToInt32(id[i])); } } else { gpmpd.Status = 0; } //如果玩家的没有可玩的玩法 if (MahjongCommonMethod.Instance.lsMethodId.Count <= 0) { if (SDKManager.Instance.IOSCheckStaus == 1) { //获取所有城市的信息 MahjongCommonMethod.Instance.GetPlayerMessageData_IE(LobbyContants.MAJONG_PORT_URL_T + SelectAreaPanelData.url_city , null, gpmpd.GetCityMessage, "CityData"); //获取所有县城的信息 MahjongCommonMethod.Instance.GetPlayerMessageData_IE(LobbyContants.MAJONG_PORT_URL_T + SelectAreaPanelData.url_county , null, gpmpd.GetCountyMessage, "CountyData"); } else { //获取所有城市的信息 MahjongCommonMethod.Instance.GetPlayerMessageData_IE(LobbyContants.MAJONG_PORT_URL + SelectAreaPanelData.url_city , null, gpmpd.GetCityMessage, "CityData"); //获取所有县城的信息 MahjongCommonMethod.Instance.GetPlayerMessageData_IE(LobbyContants.MAJONG_PORT_URL + SelectAreaPanelData.url_county , null, gpmpd.GetCountyMessage, "CountyData"); } } else { gpmpd.PanelShow = true; //gpmpd.GameIndex = 1; //默认打开第一个 SystemMgr.Instance.GamePlayingMethodSystem.UpdateShow(0); } }