public static CharacterDB.Character ReserveCharacter(string characterID) { CharacterDB.Character character = CharacterDB.FindCharacter(characterID); if (character == null) { character = new CharacterDB.Character(characterID); CharacterDB.mCharacters.Add(character); } return(character); }
public static GameObject ComposeCharacter(string characterID, string jobID) { CharacterDB.Character character = CharacterDB.FindCharacter(characterID); if (character == null) { Debug.LogError((object)("Character '" + characterID + "' not found.")); return((GameObject)null); } for (int index = 0; index < character.Jobs.Count; ++index) { if (!(character.Jobs[index].JobID == jobID)) { ; } } Debug.LogError((object)("Character '" + characterID + "'can't be '" + jobID + "'.")); return((GameObject)null); }
public bool LoadAddModels(int job_index) { if (this.mNumLoadRequests > 0) { return(false); } CharacterDB.Character character = CharacterDB.FindCharacter(this.mCharacterID); if (character == null) { Debug.LogError((object)("Unknown character '" + this.mCharacterID + "'")); return(false); } if (job_index < 0 || job_index >= character.Jobs.Count) { return(false); } this.StartCoroutine(this.AsyncSetup(character, job_index)); return(true); }
protected override void Start() { base.Start(); this.mCharacterDataLists.Clear(); this.mUnitObjectLists.Clear(); this.mCharacterSettingsLists.Clear(); this.mFaceAnimationLists.Clear(); CharacterDB.Character character = CharacterDB.FindCharacter(this.mCharacterID); if (character == null) { Debug.LogError((object)("Unknown character '" + this.mCharacterID + "'")); this.SetLoadError(); } else { this.mJobResourceID = !string.IsNullOrEmpty(this.mJobID) ? MonoSingleton <GameManager> .Instance.GetJobParam(this.mJobID).model : "none"; string str = (string)null; if (this.mUnitData != null && this.mUnitData.Jobs != null) { ArtifactParam selectedSkin = this.mUnitData.GetSelectedSkin(Array.FindIndex <JobData>(this.mUnitData.Jobs, (Predicate <JobData>)(j => j.Param.iname == this.mJobID))); str = selectedSkin == null ? (string)null : selectedSkin.asset; } if (string.IsNullOrEmpty(str)) { str = this.mJobResourceID; } int jobIndex = -1; for (int index = 0; index < character.Jobs.Count; ++index) { if (character.Jobs[index].JobID == str) { jobIndex = index; break; } } if (jobIndex < 0) { jobIndex = 0; } this.StartCoroutine(this.AsyncSetup(character, jobIndex)); } }
public static CharacterDB.Job FindCharacter(string characterID, string jobResourceID) { CharacterDB.Character character = CharacterDB.FindCharacter(characterID); if (character == null) { return((CharacterDB.Job)null); } if (string.IsNullOrEmpty(jobResourceID)) { jobResourceID = "none"; } for (int index = 0; index < character.Jobs.Count; ++index) { if (character.Jobs[index].JobID == jobResourceID) { return(character.Jobs[index]); } } return(character.Jobs[0]); }
public void LoadImmediately(string characterID, ESex sex, string jobID) { CharacterDB.Character character = CharacterDB.FindCharacter(characterID); if (character != null) { int index = character.IndexOfJob(jobID); if (string.IsNullOrEmpty(jobID) || index >= 0) { CharacterDB.Job job = character.Jobs[index]; if (!string.IsNullOrEmpty(job.BodyName)) { this.Body = (GameObject)Resources.Load <GameObject>("CH/BODY/" + job.BodyName); if (Object.op_Equality((Object)this.Body, (Object)null)) { Debug.LogError((object)("Failed to load " + job.BodyName)); } else { if (!string.IsNullOrEmpty(job.BodyTextureName)) { this.BodyTexture = (Texture2D)Resources.Load <Texture2D>("CH/BODYTEX/" + job.BodyTextureName); if (Object.op_Equality((Object)this.BodyTexture, (Object)null)) { Debug.LogError((object)("Failed to load " + job.BodyTextureName)); goto label_24; } } if (!string.IsNullOrEmpty(job.BodyAttachmentName)) { this.BodyAttachment = (GameObject)Resources.Load <GameObject>("CH/BODYOPT/" + job.BodyAttachmentName); if (Object.op_Equality((Object)this.BodyAttachment, (Object)null)) { Debug.LogError((object)("Failed to load " + job.BodyAttachmentName)); goto label_24; } } if (!string.IsNullOrEmpty(job.HeadName)) { this.Head = (GameObject)Resources.Load <GameObject>("CH/HEAD/" + job.HeadName); if (Object.op_Equality((Object)this.Head, (Object)null)) { Debug.LogError((object)("Failed to load " + job.HeadName)); goto label_24; } } if (!string.IsNullOrEmpty(job.HairName)) { this.Hair = (GameObject)Resources.Load <GameObject>("CH/HAIR/" + job.HairName); if (Object.op_Equality((Object)this.Hair, (Object)null)) { Debug.LogError((object)("Failed to load " + job.HairName)); goto label_24; } } if (!string.IsNullOrEmpty(job.HeadAttachmentName)) { this.HeadAttachment = (GameObject)Resources.Load <GameObject>("CH/HEADOPT/" + job.HeadAttachmentName); if (Object.op_Equality((Object)this.HeadAttachment, (Object)null)) { Debug.LogError((object)("Failed to load " + job.HeadAttachmentName)); goto label_24; } } this.HairColor0 = job.HairColor0; this.HairColor1 = job.HairColor1; return; } } } else { this.Body = (GameObject)Resources.Load <GameObject>("Units/" + sex.ToPrefix() + characterID); if (Object.op_Inequality((Object)this.Body, (Object)null)) { return; } Debug.LogError((object)("Failed to load " + sex.ToPrefix() + characterID)); } } label_24: this.Body = (GameObject)Resources.Load <GameObject>("Units/NULL"); this.BodyAttachment = (GameObject)null; this.BodyTexture = (Texture2D)null; this.Head = (GameObject)null; this.HeadAttachment = (GameObject)null; this.Hair = (GameObject)null; }