Exemplo n.º 1
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;
        }