void Awake() { mutualExclusion = false; Layer = GUIZLayer.NORMALWINDOW; if (btnReturn != null) { UIEventListener.Get(btnReturn).onClick = delegate { GameCenter.instance.GoPassWord(); } } ; if (btnName != null) { UIEventListener.Get(btnName).onClick = delegate { UpdateNameValue(); } } ; } // protected List<string> nameList = new List<string>(); // int index = 0; void UpdateNameValue() { int profCount = ConfigMng.Instance.ProfNameCount(curProf); int nameCount = ConfigMng.Instance.GetNameRefTable().Count; if (profCount <= 0 || nameCount <= 0) { Debug.LogError("NameConfig配表数据不对,职业" + curProf + "的名字或者性配表长度为0,去找左文祥"); return; } //System.Random profRan = new System.Random(); int profId = R.Next(1, profCount); //System.Random nameRan = new System.Random(); int nameId = R.Next(1, nameCount); NameRef nameRef = ConfigMng.Instance.GetNameRef(nameId); string name = nameRef != null ? nameRef.Firstname : string.Empty; nameRef = ConfigMng.Instance.GetNameRef(profId); name += (nameRef != null && nameRef.names.Count >= curProf) ? nameRef.names[curProf - 1] : string.Empty; // index++; // if(nameList.Contains(name)) // { // Debug.Log("随机到重复名字:"+name+",index:"+(index)+",nameId:"+nameId+",profId:"+profId); // }else // { // nameList.Add(name); // } input.value = name; } void ShowPlayerDes(GameObject games) { curProf = (int)UIEventListener.Get(games).parameter; ShowPreviewSingle(curProf); UpdateNameValue(); } void ShowPreviewSingle(int _prof) { PlayerBaseInfo info = new PlayerBaseInfo(_prof, _prof, true); if (info == null) { return; } CharacterCreateStage state = GameCenter.curGameStage as CharacterCreateStage; if (state != null) { state.CurSelectRole = info; } if (btnCreate != null) { UIEventListener.Get(btnCreate).parameter = info; UIEventListener.Get(btnCreate).onClick = Create; } } void Create(GameObject _go) { if (_go == null) { return; } PlayerBaseInfo info = UIEventListener.Get(_go).parameter as PlayerBaseInfo; if (!GameCenter.loginMng.FontHasAllCharacter(input.label.bitmapFont, input.value) || GameCenter.loginMng.CheckName(input.value)) { GameCenter.messageMng.AddClientMsg(490); return; } GameCenter.loginMng.C2S_ReqCreateChar(info.Prof, input.value); } void ShowPlayers() { for (int i = 0; i < players.Length; i++) { if (players[i] != null) { UIEventListener.Get(players[i]).onClick = ShowPlayerDes; UIEventListener.Get(players[i]).parameter = i + 1; } } }
public void S2C_OnGetPlayerInfoList(Pt _info) { pt_usr_list_a102 pt_usr_list_A102Info = _info as pt_usr_list_a102; loginPlayerDic.Clear(); if (pt_usr_list_A102Info != null) { bool noTargetPlayer = true; uint lastPlayerID = 0; for (int i = 0, max = pt_usr_list_A102Info.usr_list.Count; i < max; i++) { create_usr_info item = pt_usr_list_A102Info.usr_list[i]; PlayerBaseInfo info = new PlayerBaseInfo(item); loginPlayerDic[info.ServerInstanceID] = info; Debug.Log("item.raw_server_id:" + item.raw_server_id + ",loginServerID:" + loginServerID); if (GameCenter.instance.isPlatform) { if (item.raw_server_id.ToString() == loginServerID) { CurSelectPlayerID = (uint)info.ServerInstanceID; noTargetPlayer = false; } } lastPlayerID = (uint)info.ServerInstanceID; } if (noTargetPlayer) { CurSelectPlayerID = lastPlayerID; //容错,没找到目标角色时,取最后一个 } } if (loginPlayerDic.Count > 0)//如果角色数量大于0,则跳转至选择角色状态,否则跳转至创角状态 by吴江 { if (GameCenter.instance.IsReConnecteding) { if (CurSelectPlayerID > 0) { C2S_AskQueue(CurSelectPlayerID); } else { CharacterSelectStage stage = GameCenter.curGameStage as CharacterSelectStage; if (stage != null) { stage.GoToWait(); } else { CharacterCreateStage charaStage = GameCenter.curGameStage as CharacterCreateStage; if (charaStage != null) { charaStage.GoToWait(); } } } return; } else { if (CurSelectPlayerID > 0) { C2S_AskQueue(CurSelectPlayerID); } } } else { if (GameCenter.instance.IsReConnecteding) { CharacterCreateStage stage = GameCenter.curGameStage as CharacterCreateStage; if (stage != null) { stage.GoToWait(); } } else { GameCenter.instance.GoCreatChar(); } } }