/// <summary> /// 处理点击关闭选择县的按钮 /// </summary> void HandleBtnCountyPanelClose() { SelectAreaPanelData sapd = GameData.Instance.SelectAreaPanelData; sapd.isShowCityPanel = true; UpdateShow(); }
/// <summary> /// 处理点击确认创建馆 /// </summary> void HandleBtnSureCreatParlor() { GameData gd = GameData.Instance; //如果玩家不满足开馆条件,直接拦截 if ((gd.PlayerNodeDef.iCoin) <= 0 && gd.PlayerNodeDef.byCreateParlorCert == 0) { UIMgr.GetInstance().GetUIMessageView().Show("您的金币数量不足,无法开馆"); return; } //发送创建麻将馆之前,初始化面板数据 if (UIMainView.Instance.ParlorShowPanel.ParlorName.text.Length < 2) { UIMgr.GetInstance().GetUIMessageView().Show("您的麻将馆名字长度不足"); return; } SelectAreaPanelData sapd = GameData.Instance.SelectAreaPanelData; Network.Message.NetMsg.ClientCreateParlorReq msg = new Network.Message.NetMsg.ClientCreateParlorReq(); msg.iUserId = gd.PlayerNodeDef.iUserId; msg.iCityId = sapd.iCityId; msg.iCountyId = sapd.iCountyId; msg.cParlorName = UIMainView.Instance.ParlorShowPanel.ParlorName.text; Network.NetworkMgr.Instance.LobbyServer.SendCreateParlorReq(msg); }
/// <summary> /// 更新选择区域的面板 /// </summary> public void UpdateShow() { SelectAreaPanelData sapd = GameData.Instance.SelectAreaPanelData; if (sapd.isPanelShow) { gameObject.SetActive(true); OpenNeed(); _gPanelBg.GetComponent <RectTransform>().sizeDelta = new Vector2(0, 0); _gPanelBg.transform.localScale = new Vector3(1, 1, 1); //修改选择地区的关闭按钮状态 if (sapd.iOpenStatus == 1) { BtnClose.gameObject.SetActive(false); } else { BtnClose.gameObject.SetActive(true); } } else { gameObject.SetActive(false); } }
/// <summary> /// 改变地区 /// </summary> public void ChangeArea() { SelectAreaPanelData sapd = GameData.Instance.SelectAreaPanelData; sapd.iOpenStatus = 7; sapd.pos_index = 5; sapd.isPanelShow = true; SystemMgr.Instance.SelectAreaSystem.UpdateShow(); }
/// <summary> /// 修改玩家改变选择区域 /// </summary> void HandleBtnChangeAreaSetting(int type) { SystemMgr.Instance.AudioSystem.PlayAuto(AudioSystem.AudioType.VIEW_CLOSE); SelectAreaPanelData sapd = GameData.Instance.SelectAreaPanelData; sapd.iOpenStatus = type; sapd.isPanelShow = true; SystemMgr.Instance.SelectAreaSystem.UpdateShow(); }
/// <summary> /// 处理点击二次确认申请开馆 /// </summary> void HandleBtnSecondSureCreatParlor() { ParlorShowPanelData pspd = GameData.Instance.ParlorShowPanelData; SelectAreaPanelData sapd = GameData.Instance.SelectAreaPanelData; pspd.isShowSecondSure = false; pspd.isShowWriteParlorName = true; UpdateShow(); }
/// <summary> /// 处理点击切换城市按钮 /// </summary> void HandleSwitchCity() { //打开选择城市面板 SelectAreaPanelData sapd = GameData.Instance.SelectAreaPanelData; sapd.iOpenStatus = 2; sapd.pos_index = 2; sapd.isPanelShow = true; SystemMgr.Instance.SelectAreaSystem.UpdateShow(); }
public void PlayCloseVoice() { SystemMgr.Instance.AudioSystem.PlayAuto(AudioSystem.AudioType.VIEW_CLOSE); SelectAreaPanelData sapd = GameData.Instance.SelectAreaPanelData; ScaleAreaPanel(); for (int i = 0; i < countyMap_go.Length; i++) { countyMap_go[i].SetActive(false); } }
/// <summary> /// 处理选择城市按钮 /// </summary> void HandleBtnSelectCity(GameObject city) { SelectAreaPanelData sapd = GameData.Instance.SelectAreaPanelData; if (city == null) { Debug.LogError("预置体为空"); return; } int index = Convert.ToInt16(city.name.Split('_')[1]); sapd.iCityId = index; Debug.LogError("index:" + index + ",name:" + city.name); //激活对应的县的预置体 GameObject go = city.GetComponent <CityConnectCounty>().County; go.SetActive(true); sapd.isShowCityPanel = false; UpdateShow(); }
void ScaleAreaPanel() { SelectAreaPanelData sd = GameData.Instance.SelectAreaPanelData; DOTweenAnimation DoTwAnim = _gPanelBg.GetComponent <DOTweenAnimation>(); Tweener dt = DoTwAnim.tween as Tweener; Debug.Log(sd.pos_index + "__" + _pos[sd.pos_index].localPosition); dt.ChangeEndValue(_pos[sd.pos_index].localPosition); CloseNeed(); DoTwAnim.DORestartById("1"); // Debug.Log("动画前原来:" + _gPanelBg.transform.localScale); DoTwAnim.DORestartById("2"); //dt.Restart(); DoTwAnim.tween.OnComplete(() => { //DoTwAnim.DORestartById("3"); // Debug.LogWarning("缩放完成"); Ok(); }); }
public GameObject proviceText; //显示省份的文字 public void Awake() { sapd = GameData.Instance.SelectAreaPanelData; speed = fSpeed; if (GameData.Instance.SelectAreaPanelData == null) { return; } if (!sapd.IsGetCityMessage) { if (SDKManager.Instance.IOSCheckStaus == 1) { //获取所有城市的信息 anhui.MahjongCommonMethod.Instance.GetPlayerMessageData_IE(LobbyContants.MAJONG_PORT_URL_T + SelectAreaPanelData.url_city , null, sapd.GetCityMessage, "CityData"); //获取所有县城的信息 anhui.MahjongCommonMethod.Instance.GetPlayerMessageData_IE(LobbyContants.MAJONG_PORT_URL_T + SelectAreaPanelData.url_county , null, sapd.GetCountyMessage, "CountyData"); sapd.IsGetCityMessage = true; } else { //获取所有城市的信息 anhui.MahjongCommonMethod.Instance.GetPlayerMessageData_IE(LobbyContants.MAJONG_PORT_URL + SelectAreaPanelData.url_city , null, sapd.GetCityMessage, "CityData"); //获取所有县城的信息 anhui.MahjongCommonMethod.Instance.GetPlayerMessageData_IE(LobbyContants.MAJONG_PORT_URL + SelectAreaPanelData.url_county , null, sapd.GetCountyMessage, "CountyData"); sapd.IsGetCityMessage = true; } } else { ChangeScale(); } }
/// <summary> /// 点击创建房间按钮 /// </summary> void HandleOpenRoomBtn() { SelectAreaPanelData sapd = GameData.Instance.SelectAreaPanelData; //对应县区选择玩法 anhui.MahjongCommonMethod.Instance.lsMethodId = new List <int>(); string[] id = anhui.MahjongCommonMethod.Instance._dicDisConfig[sapd.iCountyId].METHOD.Split('_'); for (int k = 0; k < id.Length; k++) { int ID = Convert.ToInt16(id[k]); if (ID != 0) { Debug.LogWarning("点击创建房间按钮"); anhui.MahjongCommonMethod.Instance.lsMethodId.Add(ID); } } GameData gd = GameData.Instance; CreatRoomMessagePanelData srmpd = gd.CreatRoomMessagePanelData; //打开创建房间面板 srmpd.CreatRoomType = 2; srmpd.PanelShow = true; SystemMgr.Instance.CreatRoomMessageSystem.UpdateShow(); }
/// <summary> /// 获取指定的更新物体 /// </summary> IEnumerator GetPointObject() { yield return(new WaitForSeconds(0.2f)); ParlorShowPanelData pspd = GameData.Instance.ParlorShowPanelData; SelectAreaPanelData sapd = GameData.Instance.SelectAreaPanelData; if (status == 1) { int CityCount = transform.GetComponentsInChildren <UI_Control_ScrollFlow_Item>().Length; UI_Control_ScrollFlow_Item[] cityItem = new UI_Control_ScrollFlow_Item[CityCount]; cityItem = transform.GetComponentsInChildren <UI_Control_ScrollFlow_Item>(); for (int i = 0; i < CityCount; i++) { float y = cityItem[i].sv; if (0.9 < y && y < 1) { pspd.temp_cc[0] = cityItem[i].iCityId; pspd.iCityId[pspd.iStatus_AreaSeeting - 1] = cityItem[i].iCityId; Debug.LogError("城市id:" + cityItem[i].iCityId); break; } } //更新玩家对应的县的玩家 UI_Control_ScrollFlow_Item[] temp = CountyMessage.transform.GetComponentsInChildren <UI_Control_ScrollFlow_Item>(); int count = 0; if (pspd.dicCountyMessage.ContainsKey(sapd.iCityId)) { count = pspd.dicCountyMessage[sapd.iCityId].Count; } CountyMessage.GetComponent <UI_Control_ScrollFlow>().Items.Clear(); if (temp.Length > count) { for (int i = 0; i < temp.Length; i++) { if (i < count) { //更新该预置体的界面信息 temp[i].GetComponent <Text>().text = pspd.dicCountyMessage[sapd.iCityId][i].countyName; temp[i].iCountyId = Convert.ToInt32(pspd.dicCountyMessage[sapd.iCityId][i].countyId); CountyMessage.GetComponent <UI_Control_ScrollFlow>().Items.Add(temp[i]); temp[i].Init_Num(); temp[i].Init(this); temp[i].Drag(StartValue + i * AddValue); if (temp[i].v - 0.5 < 0.05f) { CountyMessage.GetComponent <UI_Control_ScrollFlow>().Current = temp[i]; } } else { if (temp[i] != null) { Destroy(temp[i].gameObject); } } } } else { for (int i = 0; i < count; i++) { UI_Control_ScrollFlow_Item item = null; if (i < temp.Length) { item = temp[i].GetComponent <UI_Control_ScrollFlow_Item>(); item.Init_Num(); } else { GameObject go = Instantiate(Resources.Load <GameObject>("Lobby/County")); go.transform.localScale = Vector3.one; go.transform.localEulerAngles = Vector3.zero; go.transform.SetParent(CountyMessage.GetComponent <UI_Control_ScrollFlow>().Rect.transform); item = go.GetComponent <UI_Control_ScrollFlow_Item>(); } //更新该预置体的界面信息 item.GetComponent <Text>().text = pspd.dicCountyMessage[sapd.iCityId][i].countyName; item.iCountyId = Convert.ToInt32(pspd.dicCountyMessage[sapd.iCityId][i].countyId); CountyMessage.GetComponent <UI_Control_ScrollFlow>().Items.Add(item); item.Init(this); item.Drag(StartValue + i * AddValue); if (item.v - 0.5 < 0.05f) { CountyMessage.GetComponent <UI_Control_ScrollFlow>().Current = item; } } } CountyMessage.GetComponent <UI_Control_ScrollFlow>().Init(); CountyMessage.GetComponent <UI_Control_ScrollFlow>().Refresh(1); } if (status == 2) { int CountyCount = transform.GetComponentsInChildren <UI_Control_ScrollFlow_Item>().Length; UI_Control_ScrollFlow_Item[] countyItem = transform.GetComponentsInChildren <UI_Control_ScrollFlow_Item>(); for (int i = 0; i < CountyCount; i++) { float y = countyItem[i].sv; if (0.95f < y && y < 1.05f) { pspd.temp_cc[1] = countyItem[i].iCountyId; Debug.LogError("县城id:" + countyItem[i].iCountyId + ",名字:" + countyItem[i].GetComponent <Text>().text + ",位置:" + countyItem[i].transform.localPosition.y); break; } } } }
/// <summary> /// 处理点击确定按钮 /// </summary> void HandleBtnOk() { GameData gd = GameData.Instance; CreatRoomMessagePanelData crmpd = gd.CreatRoomMessagePanelData; InsteadOpenRoomPanelData iorpd = gd.InsteadOpenRoomPanelData; SelectAreaPanelData sapd = GameData.Instance.SelectAreaPanelData; crmpd.PanelShow = false; NetMsg.ClientOpenRoomReq msg = new NetMsg.ClientOpenRoomReq(); msg.iUserId = GameData.Instance.PlayerNodeDef.iUserId; msg.cGameId = (byte)anhui.MahjongCommonMethod.Instance._dicMethodConfig[crmpd.MethodId].gameid; msg.iPlayingMethod = crmpd.MethodId; msg.iCompliment = crmpd.iCompliment; msg.iDisconnectRate = crmpd.iDisconnectRate; msg.iDiscardTime = crmpd.iDiscardTime; msg.iRoomCard = crmpd.iRoomCard; // Debug.LogError("房卡;"+crmpd.iRoomCard); msg.cOpenRoomMode = (byte)crmpd.CreatRoomType; msg.byColorFlag = (byte)crmpd.iColorFlag; msg.caParam = crmpd.roomMessage_; msg.iCountyId = sapd.iCountyId; if (msg.cOpenRoomMode > 1) { msg.iParlorId = GameData.Instance.ParlorShowPanelData.iParlorId; } else { anhui.MahjongCommonMethod.Instance.iParlorId = 0; } // Debug.Log("出牌参数0:" + msg.caParam[0].ToString("X8") + "_" + msg.caParam[2].ToString("X8") + "/n" + "出牌参数1:" + msg.caParam[1].ToString("X8") + "_" + msg.caParam[3].ToString("X8")); // Debug.Log("玩法id:" + msg.iPlayingMethod + ",游戏编号:" + msg.cGameId // + ",开放模式:" + msg.cOpenRoomMode + ",馆主id:" + msg.iParlorId + "县ID:" + msg.iCountyId); //保存玩家的本次创建房间的详细信息 // string willSaveRoomRule = ""; // for (int i = 0; i < msg.caParam.Length; i++) // { // if (i == 0) // { // willSaveRoomRule += msg.caParam[i]; // } // else // { // willSaveRoomRule += ("," + msg.caParam[i]); // } // } // PlayerPrefs.DeleteKey("OpenRoomMsgg"); PlayerPrefs.SetInt("iPlayingMethod", msg.iPlayingMethod); // PlayerPrefs.SetInt("iCountyId", msg.iCountyId); // 开房所属县id // PlayerPrefs.SetString("OpenRoomMsgg", willSaveRoomRule); //如果玩家赞的数量或者断线率或者出牌速度小于房间设置,不让创建房间 if (gd.PlayerNodeDef.iPlayCardAcc > 0 && (gd.PlayerNodeDef.iPlayCardTimeAcc / gd.PlayerNodeDef.iPlayCardAcc) > msg.iDiscardTime && msg.iDiscardTime > 0) { UIMgr.GetInstance().GetUIMessageView().Show("您的出牌速度不满足,自己设置的开房条件"); return; } if (gd.PlayerNodeDef.iGameNumAcc > 0 && ((gd.PlayerNodeDef.iDisconnectAcc / (float)gd.PlayerNodeDef.iGameNumAcc) * 100f) > msg.iDisconnectRate && msg.iDisconnectRate > 0) { UIMgr.GetInstance().GetUIMessageView().Show("您的断线率不满足,自己设置的开房条件"); return; } if (gd.PlayerNodeDef.iCompliment < msg.iCompliment && msg.iCompliment > 0) { UIMgr.GetInstance().GetUIMessageView().Show("您的赞的数量不满足,自己设置的开房条件"); return; } //处理玩家选择的房间信息是否符合要求 NetworkMgr.Instance.LobbyServer.SendOpenRoomReq(msg); //iorpd.PanelShow = false; iorpd.isClickInsteadOpenRoom = false; iorpd.isFirstSpwanInsteadRecord = true; SystemMgr.Instance.InsteadOpenRoomSystem.UpdateShow(); UpdateShow(); }
/// <summary> /// 点击创建房间按钮 /// </summary> void HandleCreatRoom(int createroom) { SelectAreaPanelData sapd = GameData.Instance.SelectAreaPanelData; //对应县区选择玩法 MahjongCommonMethod.Instance.lsMethodId = new List <int>(); GameData gd = GameData.Instance; CreatRoomMessagePanelData crmpd = gd.CreatRoomMessagePanelData; int countId = 0; if (createroom == 1) { countId = sapd.iCountyId; } else { countId = GameData.Instance.ParlorShowPanelData.iCountyId[2]; } string[] id = MahjongCommonMethod.Instance._dicDisConfig[countId].METHOD.Split('_'); for (int k = 0; k < id.Length; k++) { int ID = System.Convert.ToInt16(id[k]); if (ID != 0) { MahjongCommonMethod.Instance.lsMethodId.Add(ID); } } crmpd.CreatRoomType = createroom; crmpd.PanelShow = true; UIMainView.Instance.CreatRoomMessagePanel.m_CreateRoomSource = createroom; //if (PlayerPrefs.HasKey("OpenRoomMsgg")) //{ // //获取玩家上次创建房间的默认参数 // string message = PlayerPrefs.GetString("OpenRoomMsgg"); // if (PlayerPrefs.HasKey("iPlayingMethod")) // { // crmpd.iParamMethid = PlayerPrefs.GetInt("iPlayingMethod"); // } // string[] msgs = message.Split(','); // if (crmpd.iParamMethid > 0) // { // for (int i = 0; i < msgs.Length; i++) // { // crmpd.roomMessage_[i] = Convert.ToUInt32(msgs[i]); // } // } // Debug.LogWarningFormat("{0}:{1}\n{2}:{3}\n{4}:{5}", crmpd.roomMessage_[0].ToString("X8"), // crmpd.roomMessage_[1].ToString("X8"), crmpd.roomMessage_[2].ToString("X8"), crmpd.roomMessage_[3].ToString("X8"), // crmpd.roomMessage_[4].ToString("X8"), crmpd.roomMessage_[5].ToString("X8") // ); //} ////////////////////////////////////////////////////////////////////// if (UIMainView.Instance.CreatRoomMessagePanel.m_showNew[0] != null) { if (!PlayerPrefs.HasKey("CreatRoomShowNew" + GameData.Instance.PlayerNodeDef.iUserId)) { PlayerPrefs.SetInt("CreatRoomShowNew" + GameData.Instance.PlayerNodeDef.iUserId, 0); } int CreatRoomShowNew_num = PlayerPrefs.GetInt("CreatRoomShowNew" + GameData.Instance.PlayerNodeDef.iUserId); if (CreatRoomShowNew_num <= 3) { UIMainView.Instance.CreatRoomMessagePanel.m_showNew[0].SetActive(true); CreatRoomShowNew_num++; PlayerPrefs.SetInt("CreatRoomShowNew" + GameData.Instance.PlayerNodeDef.iUserId, CreatRoomShowNew_num); } else { MonoBehaviour.Destroy(UIMainView.Instance.CreatRoomMessagePanel.m_showNew[0]); PlayerPrefs.DeleteKey("CreatRoomShowNew" + GameData.Instance.PlayerNodeDef.iUserId); } } ////////////////////////////////////////////////////////////////////// SystemMgr.Instance.CreatRoomMessageSystem.UpdateShow(); UIMainView.Instance.CreatRoomMessagePanel.UpdateShowMethod(GameData.Instance.CreatRoomMessagePanelData.MethodId); }
/// <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); } }