private void ShowRandomName() { XCharacter role = DataDBSCharacter.GetDataById(CurRole.Carrer); if (role == null) { int sex = CurRole.Carrer == 2 || CurRole.Carrer == 3 ? 1 : 0; string randomName = GetRandomName(sex); iptHeroName.value = randomName; } }
private void ShowView() { DRole db = mRoleDBList[mRoleIndex]; XCharacter role = DataDBSCharacter.GetDataById(db.Carrer); DActor actorDB = ReadCfgActor.GetDataById(db.ActorID); btnCreateRole.SetActive(role == null); btnRoll.SetActive(role == null); iptHeroName.gameObject.SetActive(role == null); btnEnterGame.SetActive(role != null); labHeroName.text = role != null?GTTools.Format("Lv.{0} {1}", role.Level, role.Name != null?role.Name : actorDB.Name) : "未创建"; }
private void OnEnterGameClick(GameObject go) { GTAudioManager.Instance.PlayEffectAudio(GTAudioKey.SOUND_UI_CLICK); int carrerID = mRoleDBList[mRoleIndex].Carrer; XCharacter c = DataDBSCharacter.GetDataById(carrerID); if (c == null) { GTItemHelper.ShowTip("你还没有创建这个角色"); return; } GTNetworkSend.Instance.TryRoleLogin(c.GUID); }
private void OnAck_EnterScene(MessageRecv obj) { System.IO.MemoryStream ms = new System.IO.MemoryStream(obj.Data); EnterSceneAck ack = Serializer.Deserialize <EnterSceneAck>(ms); if (GTItemHelper.ShowNetworkError(ack.RetCode) == false) { return; } XCharacter data = DataDBSCharacter.GetDataById(GTGlobal.CurPlayerCarrerID); if (data == null) { GTItemHelper.ShowTip("职业错误"); return; } else { data.Id = ack.ActorID; data.PosX = ack.x; data.PosY = ack.y; data.PosZ = ack.z; data.Face = ack.vx; data.Type = (int)EActorType.PLAYER; data.Camp = ack.Camp; data.CurAttrs.AddRange(GTTools.GetListFromEnumNames <int>(typeof(EAttr))); data.CurAttrs[(int)EAttr.MAXHP - 1] = ack.hpmax; data.CurAttrs[(int)EAttr.MAXMP - 1] = ack.mpmax; data.CurAttrs[(int)EAttr.HP - 1] = ack.hp; data.CurAttrs[(int)EAttr.MP - 1] = ack.mp; data.CurAttrs[(int)EAttr.SPEED - 1] = 600; GTGlobal.Main = data; GTGlobal.CurCopyGUID = ack.CopyGuid; GTSimulateServer.CalcMainPropertys(); GTWorld.Instance.ResetGuide(); GTWorld.Instance.EnterWorld(ack.CopyID); GTEventCenter.FireEvent(GTEventID.TYPE_MAP_ENTERWORLD); } }