/// <summary> /// 点击确认按钮 /// </summary> public void OkBtn() { RealNameApprovePanelData rnapd = GameData.Instance.RealNameApprovePanelData; SystemMgr.Instance.AudioSystem.PlayAuto(AudioSystem.AudioType.VIEW_CLOSE); anhui.MahjongCommonMethod mcm = anhui.MahjongCommonMethod.Instance; if (names.text.Length <= 1) { mcm.ShowRemindFrame("名字输入错误,请重新输入"); return; } else { names.text = rnapd.Filter(names.text); } if (IdCard.text.Length != 18) { mcm.ShowRemindFrame("身份证号长度错误,请检查后重新输入"); return; } Regex regex = new Regex(@"^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$"); if (!regex.IsMatch(IdCard.text) || System.Convert.ToInt64(IdCard.text) == 111111111111111111) { mcm.ShowRemindFrame("身份证号输入规范错误,请检查后重新输入"); return; } Messenger_anhui <string, string> .Broadcast(MESSAGE_OK, names.text, IdCard.text); }
/// <summary> /// 更新音乐的音量 /// </summary> public void UpdateVolume() { anhui.MahjongCommonMethod gd = anhui.MahjongCommonMethod.Instance; if (OnUpdateVolume != null) { OnUpdateVolume(gd.isMusicShut, gd.MusicVolume); } }
/// <summary> /// 获取推广专员的信息 /// </summary> /// <param name="countId"></param> public void GetTgMessage(int countId) { anhui.MahjongCommonMethod mcm = anhui.MahjongCommonMethod.Instance; AreaName.text = mcm._dicDisConfig[countId].COUNTY_NAME; string url = SDKManager.Instance.IOSCheckStaus == 0 ? LobbyContants.MAJONG_PORT_URL : LobbyContants.MAJONG_PORT_URL_T; Dictionary <string, string> value = new Dictionary <string, string>(); value.Add("County_id", countId.ToString()); anhui.MahjongCommonMethod.Instance.GetPlayerMessageData_IE(url + "communication.x", value, UpdateTgPanel, " ", 5); }
public int iRedId; //麻将馆红包id /// <summary> /// 获取玩家当前红包状态 /// </summary> /// <param name="iparlorId"></param> /// <param name="timer"></param> public void GetParlorRedBagStatus(int iparlorId, int timer) { anhui.MahjongCommonMethod mcm = anhui.MahjongCommonMethod.Instance; int nowTimer = timer; //处理玩家从某个麻将馆进入游戏,检查该玩家是否有红包信息 if (iparlorId != 0) { for (int i = 0; i < mcm.parlorRedBagInfo.Length; i++) { //找到指定的麻将馆 if (mcm.parlorRedBagInfo[i].parlorId == iparlorId) { iRedId = mcm.parlorRedBagInfo[i].rpId; int status = 0; //0表示没有红包 1表示有红包且未开始抢 2表示有红包已经开始抢 3表示开启条件不足 4表示红包已抢完 if (nowTimer < mcm.parlorRedBagInfo[i].endTim) { //红包还未结束 if (mcm.parlorRedBagInfo[i].state == 0) { if (nowTimer < mcm.parlorRedBagInfo[i].beginTim) { status = 1; } else { status = 2; } } //红包不达开启条件 else { status = 0; } ////红包已经抢完 //else if (mcm.parlorRedBagInfo[i].state == 1) //{ // status = 0; //} } else { status = 0; } Debug.LogError("status:" + status); UpdateShow(status, mcm.parlorRedBagInfo[i]); break; } } } }
/// <summary> /// 更新音效的音量 /// </summary> public void UpdateVolume() { anhui.MahjongCommonMethod gd = anhui.MahjongCommonMethod.Instance; bool soundOn = gd.isEfectShut; float soundVolume = gd.EffectValume; if (OnUpdateVolume != null) { OnUpdateVolume(soundOn, (int )soundVolume); } }
/// <summary> /// 更新音乐的音量 /// </summary> public void UpdateVolume() { anhui.MahjongCommonMethod gd = anhui.MahjongCommonMethod.Instance; bool soundOn = gd.isMusicShut; //Debug.LogWarning("执行3"+ soundOn); int musicVolume = gd.MusicVolume; if (OnUpdateVolume != null) { OnUpdateVolume(soundOn, musicVolume); } }
/// <summary> /// 处理设置音效 /// </summary> void HandleSetMusicEffect() { anhui.MahjongCommonMethod uipd = anhui.MahjongCommonMethod.Instance; if (uipd.isEfectShut) { uipd.isEfectShut = false; } else { uipd.isEfectShut = true; } SystemMgr.Instance.UserInfoSystem.UpdateShow(); SystemMgr.Instance.AudioSystem.UpdateVolume(); }
/// <summary> /// 获取已开放县城的信息 /// </summary> /// <param name="json"></param> public void GetCountyMessage(string json, int status) { anhui.MahjongCommonMethod mcm = anhui.MahjongCommonMethod.Instance; SelectAreaPanelData.CountyMessageData data = new SelectAreaPanelData.CountyMessageData(); data = JsonBase.DeserializeFromJson <SelectAreaPanelData.CountyMessageData>(json.ToString()); if (data.CountyData[0].status != 1) { Debug.LogError("获取已开放县城的信息错误,status:" + data.CountyData[0].status); return; } //保存获取的城市信息 for (int i = 0; i < data.CountyData.Count; i++) { for (int j = 0; j < data.CountyData[i].data.Count; j++) { int countyId = System.Convert.ToInt32(data.CountyData[i].data[j].countyId); if (mcm._dicDisConfig.ContainsKey(countyId)) { mcm._dicDisConfig[countyId].VALID = System.Convert.ToInt32(data.CountyData[i].data[j].flag); } } } //为方法id赋值 for (int i = 0; i < mcm._districtConfig.Count; i++) { if (mcm._districtConfig[i].COUNTY_ID == GameData.Instance.SelectAreaPanelData.iCountyId && mcm._districtConfig[i].VALID == 2) { string[] id = mcm._districtConfig[i].METHOD.Split('_'); for (int k = 0; k < id.Length; k++) { int ID = System.Convert.ToInt16(id[k]); if (ID != 0) { Debug.LogWarning("获取已开放县城的信息"); mcm.lsMethodId.Add(ID); } } } } GameData gd = GameData.Instance; GamePlayingMethodPanelData gpmpd = gd.GamePlayingMethodPanelData; gpmpd.PanelShow = true; //gpmpd.GameIndex = 1; //默认打开第一个 SystemMgr.Instance.GamePlayingMethodSystem.UpdateShow(); }
/// <summary> /// 处理设置音乐 /// </summary> void HandleSetMusic() { anhui.MahjongCommonMethod com = anhui.MahjongCommonMethod.Instance; if (com.isMusicShut) { com.isMusicShut = false; } else { com.isMusicShut = true; // MahjongCommonMethod.Instance.EffectValume = 0; } SystemMgr.Instance.UserInfoSystem.UpdateShow(); SystemMgr.Instance.BgmSystem.UpdateVolume(); }
/// <summary> /// 获取已开放城市的信息 /// </summary> /// <param name="json"></param> public void GetCityMessage(string json, int status) { anhui.MahjongCommonMethod mcm = anhui.MahjongCommonMethod.Instance; SelectAreaPanelData.CityMessageData data = new SelectAreaPanelData.CityMessageData(); data = JsonBase.DeserializeFromJson <SelectAreaPanelData.CityMessageData>(json.ToString()); if (data.CityData[0].status != 1) { Debug.LogError("获取网页json数据状态错误,status:" + data.CityData[0].status); return; } //保存获取的城市信息 for (int i = 0; i < data.CityData.Count; i++) { for (int j = 0; j < data.CityData[i].data.Count; j++) { int cityId = System.Convert.ToInt32(data.CityData[i].data[j].cityId); if (mcm._dicCityConfig.ContainsKey(cityId)) { mcm._dicCityConfig[cityId].VALID = System.Convert.ToInt32(data.CityData[i].data[j].flag); } } } }
public void BtnChioce() { CreatRoomMessagePanelData crmpd = GameData.Instance.CreatRoomMessagePanelData; anhui.MahjongCommonMethod mcm = anhui.MahjongCommonMethod.Instance; if (!mcm._dicMethodConfig.ContainsKey(crmpd.MethodId)) { return; } if (SystemMgr.Instance) { SystemMgr.Instance.AudioSystem.PlayAuto(AudioSystem.AudioType.VIEW_CLOSE); } if (MahjongLobby_AH.UIMainView.Instance.CreatRoomMessagePanel != null) { Text label = null; if (gameObject.GetComponent <Toggle>().isOn) { Text[] label2 = UIMainView.Instance.CreatRoomMessagePanel.RuleParent_.GetComponentsInChildren <Text>(); for (int j = 0; j < label2.Length; j++) { if (label2[j].text == "抢庄") { isfatherusOn = label2[j].transform.parent.GetComponent <Toggle>().isOn; color_nor = label2[j].color; label = label2[j]; break; } } } for (int j = 0; j < mcm.methiod.Count; j++) { if (mcm._dicMethodConfig[crmpd.MethodId].METHOD == mcm.methiod[j].id) { if (mcm.methiod[j].num1 == num) { crmpd.iPrice = 0; mcm.WriteInt32toInt4(ref crmpd.roomMessage_[1], crmpd.iPrice, 16); UIMainView.Instance.CreatRoomMessagePanel.QuanBukexuan = true; OnSetSelfPlayState(label, true); } else if (mcm.methiod[j].num2 == num) { crmpd.iPrice = 1; UIMainView.Instance.CreatRoomMessagePanel.QuanBukexuan = true; mcm.WriteInt32toInt4(ref crmpd.roomMessage_[1], crmpd.iPrice, 16); OnSetSelfPlayState(label, true); } else if (mcm.methiod[j].num3 == num) { crmpd.iPrice = 2; UIMainView.Instance.CreatRoomMessagePanel.QuanBukexuan = true; mcm.WriteInt32toInt4(ref crmpd.roomMessage_[1], crmpd.iPrice, 16); OnSetSelfPlayState(label, true); } break; } } // Debug.LogError("MID" + GameData.Instance.CreatRoomMessagePanelData.MethodId); if (GameData.Instance.CreatRoomMessagePanelData.MethodId == 20015) { if (num == 4) { crmpd.iPrice = 3; mcm.WriteInt32toInt4(ref crmpd.roomMessage_[1], crmpd.iPrice, 16); UIMainView.Instance.CreatRoomMessagePanel.QuanBukexuan = false; OnSetSelfPlayState(label, false); } else if (num == 8) { crmpd.iPrice = 4; mcm.WriteInt32toInt4(ref crmpd.roomMessage_[1], crmpd.iPrice, 16); UIMainView.Instance.CreatRoomMessagePanel.QuanBukexuan = false; OnSetSelfPlayState(label, false); } else if (num == 12) { crmpd.iPrice = 5; mcm.WriteInt32toInt4(ref crmpd.roomMessage_[1], crmpd.iPrice, 16); UIMainView.Instance.CreatRoomMessagePanel.QuanBukexuan = false; OnSetSelfPlayState(label, false); } } } else { for (int j = 0; j < mcm.methiod.Count; j++) { if (mcm._dicMethodConfig[crmpd.MethodId].METHOD == mcm.methiod[j].id) { if (mcm.methiod[j].num1 == num) { crmpd.iPrice = 0; mcm.WriteInt32toInt4(ref crmpd.roomMessage_[1], crmpd.iPrice, 16); } else if (mcm.methiod[j].num2 == num) { crmpd.iPrice = 1; mcm.WriteInt32toInt4(ref crmpd.roomMessage_[1], crmpd.iPrice, 16); } else if (mcm.methiod[j].num3 == num) { crmpd.iPrice = 2; mcm.WriteInt32toInt4(ref crmpd.roomMessage_[1], crmpd.iPrice, 16); } break; } } } // Debug.LogError(num); mcm.WriteColumnValue(ref crmpd.roomMessage_, 4, (sbyte)(crmpd.iPrice > 2 ? 1 : 0), 2); crmpd.iRoomCard = pay; UIMainView.Instance.CreatRoomMessagePanel.UpdataToShowForSelectUseGoldCreatRoom(); }
/// <summary> /// 产生玩法数量的预置体 /// </summary> /// <param name="index"></param> void SpwanPayNum(int index) { if (MethodParent.GetComponentsInChildren <Transform>().Length > 1) { return; } int AllCol = 0; // Debug.Log("玩法" + index); anhui.MahjongCommonMethod mcm = anhui.MahjongCommonMethod.Instance; PlayerPlayingPanelData pppd = GameData.Instance.PlayerPlayingPanelData; MahjongLobby_AH.Data.CreatRoomMessagePanelData cd = MahjongLobby_AH.GameData.Instance.CreatRoomMessagePanelData; #region 分数 GameObject fenshu = Instantiate(Method) as GameObject; fenshu.transform.SetParent(MethodParent.transform); fenshu.transform.localPosition = Vector3.zero; fenshu.transform.localRotation = Quaternion.identity; fenshu.transform.localScale = Vector3.one; MainViewGameRulePlayMethod method_fenshu = fenshu.GetComponent <MainViewGameRulePlayMethod>(); method_fenshu.transform.GetChild(1).GetComponent <GridLayoutGroup>().cellSize = new Vector2(66.0f, method_fenshu.transform.GetChild(1).GetComponent <GridLayoutGroup>().cellSize.y); method_fenshu.Name.text = "分数:"; //分数 GameObject method_fenshu_Select = Instantiate(method_fenshu.GameRuleName) as GameObject; method_fenshu_Select.transform.SetParent(method_fenshu.Parent); method_fenshu_Select.transform.localPosition = Vector3.zero; method_fenshu_Select.transform.localRotation = Quaternion.identity; method_fenshu_Select.transform.localScale = Vector3.one; string str_method_fenshu_Select = ""; if (pppd.playingMethodConf.byBillingMode == 1) { str_method_fenshu_Select = pppd.playingMethodConf.byBillingNumber + "圈"; } else if (pppd.playingMethodConf.byBillingMode == 2) { str_method_fenshu_Select = pppd.playingMethodConf.byBillingNumber + "局"; } else if (pppd.playingMethodConf.byBillingMode == 3) { str_method_fenshu_Select = pppd.playingMethodConf.byBillingNumber + "分"; } //Debug.LogError("局"+pppd.playingMethodConf.byBillingNumber); method_fenshu_Select.transform.GetChild(0).gameObject.SetActive(false); method_fenshu_Select.GetComponentsInChildren <Text>()[0].text = str_method_fenshu_Select; //需要的金币 GameObject method_fenshu_Gold = Instantiate(method_fenshu.GameRuleGold) as GameObject; method_fenshu_Gold.transform.SetParent(method_fenshu.Parent); method_fenshu_Gold.transform.localPosition = Vector3.zero; method_fenshu_Gold.transform.localRotation = Quaternion.identity; method_fenshu_Gold.transform.localScale = Vector3.one; method_fenshu_Gold.GetComponentsInChildren <Text>()[0].text = "X" + pppd.playingMethodConf.byBillingPrice.ToString(); AllCol++; #endregion #region 支付方式 GameObject zhifufangshi = Instantiate(Method) as GameObject; zhifufangshi.transform.SetParent(MethodParent.transform); zhifufangshi.transform.localPosition = Vector3.zero; zhifufangshi.transform.localRotation = Quaternion.identity; zhifufangshi.transform.localScale = Vector3.one; MainViewGameRulePlayMethod method_zhifufangshi = zhifufangshi.GetComponent <MainViewGameRulePlayMethod>(); method_zhifufangshi.Name.text = "房费:"; //支付方式 GameObject method_zhifufangshi_Select = Instantiate(method_zhifufangshi.GameRuleName) as GameObject; method_zhifufangshi_Select.transform.SetParent(method_zhifufangshi.Parent); method_zhifufangshi_Select.transform.localPosition = Vector3.zero; method_zhifufangshi_Select.transform.localRotation = Quaternion.identity; method_zhifufangshi_Select.transform.localScale = Vector3.one; method_zhifufangshi_Select.transform.GetChild(0).gameObject.SetActive(false); if (anhui.MahjongCommonMethod.Instance.ReadColumnValue(cd.roomMessage_, 2, 39) <= 1) { method_zhifufangshi_Select.GetComponentsInChildren <Text>()[0].text = "四家支付"; } else if (anhui.MahjongCommonMethod.Instance.ReadColumnValue(cd.roomMessage_, 2, 39) == 2) { method_zhifufangshi_Select.GetComponentsInChildren <Text>()[0].text = "房主支付"; } AllCol++; #endregion #region 玩法 if (mcm._dicMethodCardType.ContainsKey(index)) { int count = 0; int count_jibu = 5; GameObject wanfa = Instantiate(Method) as GameObject; wanfa.transform.SetParent(MethodParent.transform); wanfa.transform.localPosition = Vector3.zero; wanfa.transform.localRotation = Quaternion.identity; wanfa.transform.localScale = Vector3.one; MainViewGameRulePlayMethod method_wanfa = wanfa.GetComponent <MainViewGameRulePlayMethod>(); method_wanfa.transform.GetChild(1).GetComponent <GridLayoutGroup>().padding.left = 8; method_wanfa.Name.text = "玩法:"; AllCol++; for (int i = 0; i < mcm._dicMethodCardType[index].Count; i++) { // Debug.LogWarning("规则:" + mcm._dicmethodToCardType[index][i].RuleId); if (mcm.JudgeIsShow(mcm._dicmethodToCardType[index][i].RuleId)) { string name = mcm._cardType_[mcm._dicmethodToCardType[index][i].RuleId].card_type; // Debug.Log(mcm._cardType_[mcm._dicmethodToCardType[index][i].RuleId].card_type); GameObject method_wanfa_Select = Instantiate(method_wanfa.GameRuleName) as GameObject; method_wanfa_Select.transform.SetParent(method_wanfa.Parent); method_wanfa_Select.transform.localPosition = Vector3.zero; method_wanfa_Select.transform.localRotation = Quaternion.identity; method_wanfa_Select.transform.localScale = Vector3.one; method_wanfa_Select.GetComponentsInChildren <Text>()[0].text = name; count++; if (count == count_jibu) { GameObject wanfa_1 = Instantiate(Method) as GameObject; wanfa_1.transform.SetParent(MethodParent.transform); wanfa_1.transform.localPosition = Vector3.zero; wanfa_1.transform.localRotation = Quaternion.identity; wanfa_1.transform.localScale = Vector3.one; MainViewGameRulePlayMethod method_wanfa_1 = wanfa_1.GetComponent <MainViewGameRulePlayMethod>(); method_wanfa_1.Name.text = ""; AllCol++; count_jibu += 4; } } } } #endregion #region 托管 if (cd.roomMessage_[5] > 0) { GameObject tuoguan = Instantiate(Method) as GameObject; tuoguan.transform.SetParent(MethodParent.transform); tuoguan.transform.localPosition = Vector3.zero; tuoguan.transform.localRotation = Quaternion.identity; tuoguan.transform.localScale = Vector3.one; MainViewGameRulePlayMethod method_tuoguan = tuoguan.GetComponent <MainViewGameRulePlayMethod>(); method_tuoguan.Name.text = "托管:"; //托管 GameObject method_tuoguan_Select = Instantiate(method_tuoguan.GameRuleName) as GameObject; method_tuoguan_Select.transform.SetParent(method_tuoguan.Parent); method_tuoguan_Select.transform.localPosition = Vector3.zero; method_tuoguan_Select.transform.localRotation = Quaternion.identity; method_tuoguan_Select.transform.localScale = Vector3.one; method_tuoguan_Select.transform.GetChild(0).gameObject.SetActive(false); method_tuoguan_Select.GetComponentsInChildren <Text>()[0].text = (cd.roomMessage_[5] * 60) + "秒"; AllCol++; } #endregion if (AllCol >= 4) { int leng = 20; leng = ((AllCol - 4) + 1) * 25; //背景框面板 m_imMoveBGLeft.rectTransform.offsetMin = new Vector2(m_imMoveBGLeft.rectTransform.offsetMin.x, m_imMoveBGLeft.rectTransform.offsetMin.y - leng); m_imMoveBGLeft.transform.localPosition = new Vector3(m_imMoveBGLeft.transform.localPosition.x, 0); m_imMoveBGRight.rectTransform.offsetMin = new Vector2(m_imMoveBGRight.rectTransform.offsetMin.x, m_imMoveBGRight.rectTransform.offsetMin.y - leng); m_imMoveBGRight.transform.localPosition = new Vector3(m_imMoveBGRight.transform.localPosition.x, 0); //其他面板 m_gAllMoveUp.transform.localPosition = new Vector3(m_gAllMoveUp.transform.localPosition.x, leng, m_gAllMoveUp.transform.localPosition.z); m_gAllMoveDown.transform.localPosition = new Vector3(m_gAllMoveUp.transform.localPosition.x, -(leng - leng / 4), m_gAllMoveUp.transform.localPosition.z); } }
/// <summary> /// 产生玩法数量的预置体 /// </summary> /// <param name="MethodId">玩法id</param> void SpwanPayNum(int MethodId) { PlayBackData pbd = MahjongLobby_AH.GameData.Instance.PlayBackData; int ChoiceIndex = -1; anhui.MahjongCommonMethod mcm = anhui.MahjongCommonMethod.Instance; //玩法局或圈的数量 int[] sum = new int[5]; //玩法数量对应支付的房卡数量 int[] pay = new int[5]; //获取对应的游戏局或者圈的数量 if (mcm._dicMethodConfig[MethodId].sum.Contains("|")) { string[] str_0 = mcm._dicMethodConfig[MethodId].sum.Split('|')[0].Split('_'); string[] str_1 = mcm._dicMethodConfig[MethodId].sum.Split('|')[1].Split('_'); for (int i = 0; i < 3; i++) { sum[i] = Convert.ToInt16(str_0[i]); } for (int i = 0; i < 2; i++) { sum[i + 3] = Convert.ToInt16(str_1[i]); } } else { string[] str_0 = mcm._dicMethodConfig[MethodId].sum.Split('_'); for (int i = 0; i < 3; i++) { if (i < str_0.Length) { sum[i] = Convert.ToInt16(str_0[i]); } else { sum[i] = 0; } } sum[3] = 0; sum[4] = 0; } //获取玩家对应的支付数量 if (mcm._dicMethodConfig[MethodId].pay.Contains("|")) { string[] str_0 = mcm._dicMethodConfig[MethodId].pay.Split('|')[0].Split('_'); string[] str_1 = mcm._dicMethodConfig[MethodId].pay.Split('|')[1].Split('_'); for (int i = 0; i < 3; i++) { pay[i] = Convert.ToInt16(str_0[i]); } for (int i = 0; i < 2; i++) { pay[i + 3] = Convert.ToInt16(str_1[i]); } } else { string[] str_0 = mcm._dicMethodConfig[MethodId].pay.Split('_'); for (int i = 0; i < 3; i++) { if (i < str_0.Length) { pay[i] = Convert.ToInt16(str_0[i]); } else { pay[i] = 0; } } pay[3] = 0; pay[4] = 0; } int count = 0; //根据付费数量,判断出玩家的信息 for (int i = 0; i < 5; i++) { if (pbd.playingMethodConf_2.byBillingNumber == sum[i] && pbd.playingMethodConf_2.byBillingPrice == pay[i]) { ChoiceIndex = i; } } //删除自己的之前的房间规则信息 CreatRoomChoiceMethod[] method = PayNumParent.Find("GameNumbers").GetComponentsInChildren <CreatRoomChoiceMethod>(); if (method.Length > 0) { for (int i = 0; i < method.Length; i++) { Destroy(method[i].gameObject); } } //产生对应的玩法数据 for (int i = 0; i < sum.Length; i++) { if (sum[i] == 0) { continue; } GameObject go = Instantiate(Resources.Load <GameObject>("Lobby/PlayerMethodPanel/CreatRoomChoiceMethod")); go.name = "CreatRoomChoiceMethod"; go.transform.SetParent(PayNumParent.Find("GameNumbers")); go.transform.localPosition = new Vector3(go.transform.localPosition.x, go.transform.localPosition.y, 0); go.transform.localScale = Vector3.one; if (i == ChoiceIndex) { go.transform.GetComponent <Toggle>().isOn = true; } else { go.transform.GetComponent <Toggle>().isOn = false; } go.transform.GetComponent <Toggle>().interactable = false; CreatRoomChoiceMethod crcm = go.GetComponent <CreatRoomChoiceMethod>(); crcm.type = pbd.playingMethodConf_2.byBillingMode; crcm.num = sum[i]; crcm.pay = pay[i]; crcm.UpdateShow(); count++; } PayNumParent.GetComponent <LayoutElement>().minHeight = 60f + ((int)(count / 3f + 0.5f) - 1f) * 45; }
/// <summary> /// 产生规则的信息 /// </summary> /// <param name="MethodId"></param> void SpwanMethod(int MethodId) { int num = 0; //表示隐藏多选按钮数量 anhui.MahjongCommonMethod mcm = anhui.MahjongCommonMethod.Instance; //删除规则 for (int i = 0; i < RuleParent.Length; i++) { Toggle[] tog = new Toggle[RuleParent[i].GetComponentsInChildren <Toggle>().Length]; tog = RuleParent[i].GetComponentsInChildren <Toggle>(); if (tog.Length > 0) { for (int k = 0; k < tog.Length; k++) { Destroy(tog[k].gameObject); } } } //该玩法有多个规则可以实现 for (int i = 0; i < mcm._dicMethodCardType[MethodId].Count; i++) { GameObject go = null; //如果该玩法为多选 if (mcm._dicmethodToCardType[MethodId][i].Choice == 2) { num++; go = Instantiate(Resources.Load <GameObject>("Lobby/PlayerMethodPanel/MultiChoiceBtn")); go.name = "MultiChoiceBtn"; } else { go = Instantiate(Resources.Load <GameObject>("Lobby/PlayerMethodPanel/OnlyOneChoice")); go.GetComponent <Toggle>().group = RuleParent[mcm._dicmethodToCardType[MethodId][i].Hierarchy - 1].GetComponent <ToggleGroup>(); go.name = "OnlyOneChoice"; } bool status = JudgeIsShow(mcm._dicmethodToCardType[MethodId][i].RuleId); go.transform.SetParent(RuleParent[mcm._dicmethodToCardType[MethodId][i].Hierarchy - 1].transform); go.transform.localPosition = new Vector3(go.transform.localPosition.x, go.transform.localPosition.y, 0); go.transform.localScale = Vector3.one; go.transform.Find("Label").GetComponent <Text>().text = mcm._dicMethodCardType[MethodId][i].card_type; go.GetComponent <Toggle>().interactable = false; if (status) { go.GetComponent <Toggle>().isOn = true; } } if (num <= 4) { RuleParent[0].GetComponentInParent <LayoutElement>().minHeight = 70f; } else { RuleParent[0].GetComponentInParent <LayoutElement>().minHeight = 120f; } RuleParent_.GetComponent <LayoutElement>().minHeight = 170f + (int)(num / 4f - 0.5f) * 50f; }
/// <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>()); } }