2016-11-19 56 views
0

所以我一直在解決一段時間的代碼。我設法解決了一個問題,但那只是另一個,甚至更大的問題。新顏色的每個實例(從第40行開始)都會彈出一個錯誤:CS0246「無法找到類型或名稱空間名稱Color(是否缺少使用指令或程序集引用?)」我只是在修改遊戲,無非是爲頭髮和眼睛添加更多顏色選項,但這給我帶來了很多麻煩,因爲雖然我有編程經驗,但我沒有使用C#或Unity。我真的很感謝一些幫助。請隨身攜帶,這段代碼非常長。Unity/C#編碼顏色錯誤

if (this.Kidnapped) 
    { 
     this.GanguroCasualTextures = this.GanguroUniformTextures; 
     this.GanguroSocksTextures = this.GanguroUniformTextures; 
     this.OccultCasualTextures = this.OccultUniformTextures; 
     this.OccultSocksTextures = this.OccultUniformTextures; 
     this.FemaleCasualTextures = this.FemaleUniformTextures; 
     this.FemaleSocksTextures = this.FemaleUniformTextures; 
    } 
    if (this.RightShoe != null) 
    { 
     this.RightShoe.active = false; 
     this.LeftShoe.active = false; 
    } 
    this.ColorValue = new Color((float)1, (float)1, (float)1); ///**<<<---Problem starts here** 
    if (this.JSON == null) 
    { 
     this.JSON = this.Student.JSON; 
    } 
    string text; 
    if (!this.Initialized) 
    { 
     this.Accessory = UnityBuiltins.parseInt(this.JSON.StudentAccessories[this.StudentID]); 
     this.Hairstyle = UnityBuiltins.parseInt(this.JSON.StudentHairstyles[this.StudentID]); 
     this.Stockings = this.JSON.StudentStockings[this.StudentID]; 
     this.BreastSize = this.JSON.StudentBreasts[this.StudentID]; 
     this.HairColor = this.JSON.StudentColors[this.StudentID]; 
     this.Club = this.JSON.StudentClubs[this.StudentID]; 
     text = this.JSON.StudentNames[this.StudentID]; 
     this.Initialized = true; 
    } 
    if (text == "Random") 
    { 
     this.Randomize = true; 
     if (!this.Male) 
     { 
      text = string.Empty + this.StudentManager.FirstNames[UnityEngine.Random.Range(0, Extensions.get_length(this.StudentManager.FirstNames))] + " " + this.StudentManager.LastNames[UnityEngine.Random.Range(0, Extensions.get_length(this.StudentManager.LastNames))]; 
      this.JSON.StudentNames[this.StudentID] = text; 
      this.Student.Name = text; 
     } 
     else 
     { 
      text = string.Empty + this.StudentManager.MaleNames[UnityEngine.Random.Range(0, Extensions.get_length(this.StudentManager.MaleNames))] + " " + this.StudentManager.LastNames[UnityEngine.Random.Range(0, Extensions.get_length(this.StudentManager.LastNames))]; 
      this.JSON.StudentNames[this.StudentID] = text; 
      this.Student.Name = text; 
     } 
     if (PlayerPrefs.GetInt("MissionMode") == 1 && PlayerPrefs.GetInt("MissionTarget") == this.StudentID) 
     { 
      this.JSON.StudentNames[this.StudentID] = PlayerPrefs.GetString("MissionTargetName"); 
      this.Student.Name = PlayerPrefs.GetString("MissionTargetName"); 
      text = PlayerPrefs.GetString("MissionTargetName"); 
     } 
    } 
    if (this.Randomize) 
    { 
     this.Teacher = false; 
     this.BreastSize = UnityEngine.Random.Range(0.5f, 2f); 
     this.Accessory = 0; 
     this.Club = 0; 
     if (!this.Male) 
     { 
      this.Hairstyle = UnityEngine.Random.Range(1, Extensions.get_length(this.FemaleHair) - 1); 
     } 
     else 
     { 
      this.SkinColor = UnityEngine.Random.Range(0, Extensions.get_length(this.SkinTextures)); 
      this.Hairstyle = UnityEngine.Random.Range(1, Extensions.get_length(this.MaleHair)); 
     } 
    } 
    if (!this.Male) 
    { 
     this.RightBreast.localScale = new Vector3(this.BreastSize, this.BreastSize, this.BreastSize); 
     this.LeftBreast.localScale = new Vector3(this.BreastSize, this.BreastSize, this.BreastSize); 
     if (this.StudentID == 32 && !this.Kidnapped && Application.loadedLevelName == "PortraitScene") 
     { 
      this.Character.animation.Play("f02_socialCameraPose_00"); 
     } 
    } 
    else 
    { 
     for (int i = 0; i < Extensions.get_length(this.GaloAccessories); i++) 
     { 
      this.GaloAccessories[i].active = false; 
     } 
     if (this.Club == 3) 
     { 
      this.Character.animation["sadFace_00"].layer = 1; 
      this.Character.animation.Play("sadFace_00"); 
      this.Character.animation["sadFace_00"].weight = (float)1; 
     } 
     if (this.StudentID == 13 && PlayerPrefs.GetInt("CustomSuitor") == 1) 
     { 
      if (PlayerPrefs.GetInt("CustomSuitorHair") > 0) 
      { 
       this.Hairstyle = PlayerPrefs.GetInt("CustomSuitorHair"); 
      } 
      if (PlayerPrefs.GetInt("CustomSuitorAccessory") > 0) 
      { 
       this.Accessory = PlayerPrefs.GetInt("CustomSuitorAccessory"); 
       if (this.Accessory == 1) 
       { 
        float x = 1.02f; 
        Vector3 localScale = this.MaleAccessories[1].transform.localScale; 
        float num = localScale.x = x; 
        Vector3 vector = this.MaleAccessories[1].transform.localScale = localScale; 
        float z = 1.062f; 
        Vector3 localScale2 = this.MaleAccessories[1].transform.localScale; 
        float num2 = localScale2.z = z; 
        Vector3 vector2 = this.MaleAccessories[1].transform.localScale = localScale2; 
       } 
      } 
      if (PlayerPrefs.GetInt("CustomSuitorBlonde") > 0) 
      { 
       this.HairColor = "Yellow"; 
      } 
      if (PlayerPrefs.GetInt("CustomSuitorJewelry") > 0) 
      { 
       for (int i = 0; i < Extensions.get_length(this.GaloAccessories); i++) 
       { 
        this.GaloAccessories[i].active = true; 
       } 
      } 
     } 
    } 
    if (this.Club == 100) 
    { 
     this.MyRenderer.sharedMesh = this.TeacherMesh; 
     this.Teacher = true; 
    } 
    else if (this.Club == 101) 
    { 
     if (PlayerPrefs.GetInt("Student_" + this.StudentID + "_Replaced") == 0) 
     { 
      this.Character.animation["f02_smile_00"].layer = 1; 
      this.Character.animation.Play("f02_smile_00"); 
      this.Character.animation["f02_smile_00"].weight = (float)1; 
      this.RightEyeRenderer.gameObject.active = false; 
      this.LeftEyeRenderer.gameObject.active = false; 
     } 
     this.MyRenderer.sharedMesh = this.CoachMesh; 
     this.Teacher = true; 
    } 
    this.ID = 0; 
    while (this.ID < Extensions.get_length(this.FemaleAccessories)) 
    { 
     if (this.FemaleAccessories[this.ID] != null) 
     { 
      this.FemaleAccessories[this.ID].active = false; 
     } 
     this.ID++; 
    } 
    this.ID = 0; 
    while (this.ID < Extensions.get_length(this.MaleAccessories)) 
    { 
     if (this.MaleAccessories[this.ID] != null) 
     { 
      this.MaleAccessories[this.ID].active = false; 
     } 
     this.ID++; 
    } 
    this.ID = 0; 
    while (this.ID < Extensions.get_length(this.ClubAccessories)) 
    { 
     if (this.ClubAccessories[this.ID] != null) 
     { 
      this.ClubAccessories[this.ID].active = false; 
     } 
     this.ID++; 
    } 
    this.ID = 0; 
    while (this.ID < Extensions.get_length(this.TeacherAccessories)) 
    { 
     if (this.TeacherAccessories[this.ID] != null) 
     { 
      this.TeacherAccessories[this.ID].active = false; 
     } 
     this.ID++; 
    } 
    this.ID = 0; 
    while (this.ID < Extensions.get_length(this.TeacherHair)) 
    { 
     if (this.TeacherHair[this.ID] != null) 
     { 
      this.TeacherHair[this.ID].active = false; 
     } 
     this.ID++; 
    } 
    this.ID = 0; 
    while (this.ID < Extensions.get_length(this.FemaleHair)) 
    { 
     if (this.FemaleHair[this.ID] != null) 
     { 
      this.FemaleHair[this.ID].active = false; 
     } 
     this.ID++; 
    } 
    this.ID = 0; 
    while (this.ID < Extensions.get_length(this.MaleHair)) 
    { 
     if (this.MaleHair[this.ID] != null) 
     { 
      this.MaleHair[this.ID].active = false; 
     } 
     this.ID++; 
    } 
    this.ID = 0; 
    while (this.ID < Extensions.get_length(this.FacialHair)) 
    { 
     if (this.FacialHair[this.ID] != null) 
     { 
      this.FacialHair[this.ID].active = false; 
     } 
     this.ID++; 
    } 
    this.ID = 0; 
    while (this.ID < Extensions.get_length(this.Eyewear)) 
    { 
     if (this.Eyewear[this.ID] != null) 
     { 
      this.Eyewear[this.ID].active = false; 
     } 
     this.ID++; 
    } 
    this.ID = 0; 
    while (this.ID < Extensions.get_length(this.RightStockings)) 
    { 
     if (this.RightStockings[this.ID] != null) 
     { 
      this.RightStockings[this.ID].active = false; 
     } 
     if (this.LeftStockings[this.ID] != null) 
     { 
      this.LeftStockings[this.ID].active = false; 
     } 
     this.ID++; 
    } 
    if (this.StudentID == 13 && PlayerPrefs.GetInt("CustomSuitor") == 1 && PlayerPrefs.GetInt("CustomSuitorEyewear") > 0) 
    { 
     this.Eyewear[PlayerPrefs.GetInt("CustomSuitorEyewear")].active = true; 
    } 
    if (this.StudentID == 1 && PlayerPrefs.GetInt("CustomSenpai") == 1) 
    { 
     if (PlayerPrefs.GetInt("SenpaiEyeWear") > 0) 
     { 
      this.Eyewear[PlayerPrefs.GetInt("SenpaiEyeWear")].active = true; 
     } 
     this.FacialHairstyle = PlayerPrefs.GetInt("SenpaiFacialHair"); 
     this.HairColor = PlayerPrefs.GetString("SenpaiHairColor"); 
     this.EyeColor = PlayerPrefs.GetString("SenpaiEyeColor"); 
     this.Hairstyle = PlayerPrefs.GetInt("SenpaiHairStyle"); 
    } 
    if (!this.Male) 
    { 
     if (!this.Teacher) 
     { 
      this.FemaleHair[this.Hairstyle].active = true; 
      this.HairRenderer = this.FemaleHairRenderers[this.Hairstyle]; 
      this.SetFemaleUniform(); 
     } 
     else 
     { 
      this.TeacherHair[this.Hairstyle].active = true; 
      this.HairRenderer = this.TeacherHairRenderers[this.Hairstyle]; 
      if (this.Club == 100) 
      { 
       this.MyRenderer.materials[0].mainTexture = this.TeacherBodyTexture; 
       this.MyRenderer.materials[1].mainTexture = this.DefaultFaceTexture; 
       this.MyRenderer.materials[2].mainTexture = this.TeacherBodyTexture; 
      } 
      else 
      { 
       this.MyRenderer.materials[0].mainTexture = this.CoachFaceTexture; 
       this.MyRenderer.materials[1].mainTexture = this.CoachBodyTexture; 
       this.MyRenderer.materials[2].mainTexture = this.CoachBodyTexture; 
      } 
     } 
    } 
    else 
    { 
     if (this.Hairstyle > 0) 
     { 
      this.MaleHair[this.Hairstyle].active = true; 
      this.HairRenderer = this.MaleHairRenderers[this.Hairstyle]; 
     } 
     if (this.FacialHairstyle > 0) 
     { 
      this.FacialHair[this.FacialHairstyle].active = true; 
      this.FacialHairRenderer = this.FacialHairRenderers[this.FacialHairstyle]; 
     } 
     this.SetMaleUniform(); 
    } 
    if (!this.Male) 
    { 
     if (!this.Teacher) 
     { 
      if (this.FemaleAccessories[this.Accessory] != null) 
      { 
       this.FemaleAccessories[this.Accessory].active = true; 
      } 
     } 
     else if (this.TeacherAccessories[this.Accessory] != null) 
     { 
      this.TeacherAccessories[this.Accessory].active = true; 
     } 
    } 
    else if (this.MaleAccessories[this.Accessory] != null) 
    { 
     this.MaleAccessories[this.Accessory].active = true; 
    } 
    if (this.Club < 11 && this.ClubAccessories[this.Club] != null && PlayerPrefs.GetInt("Club_" + this.Club + "_Closed") == 0 && this.StudentID != 26) 
    { 
     this.ClubAccessories[this.Club].active = true; 
    } 
    if (this.Stockings == "Loose") 
    { 
     this.RightStockings[0].active = true; 
     this.LeftStockings[0].active = true; 
    } 
      if (!this.Randomize) 
    { 
     if (this.HairColor == "White") 
     { 
      this.ColorValue = new Color((float)1, (float)1, (float)1); 
     } 
     else if (this.HairColor == "Black") 
     { 
      this.ColorValue = new Color((float)0, (float) 0, (float) 0); 
     } 
     else if (this.HairColor == "Red") 
     { 
      this.ColorValue = new Color((float)1, (float)0, (float)0); 
     } 
     else if (this.HairColor == "Yellow") 
     { 
      this.ColorValue = new Color((float)1, (float)1, 0.31f); 
     } 
     else if (this.HairColor == "Green") 
     { 
      this.ColorValue = new Color((float)0, (float)1, (float)0); 
     } 
     else if (this.HairColor == "Cyan") 
     { 
      this.ColorValue = new Color((float)0, (float)1, (float)1); 
     } 
     else if (this.HairColor == "Blue") 
     { 
      this.ColorValue = new Color((float)0, (float)0, (float)1); 
     } 
     else if (this.HairColor == "Purple") 
     { 
      this.ColorValue = new Color((float)1, (float)0, (float)1); 
     } 
     else if (this.HairColor == "Orange") 
     { 
      this.ColorValue = new Color((float)1, 0.5f, (float)0); 
     } 
     else if (this.HairColor == "Brown") 
     { 
      this.ColorValue = new Color(0.5f, 0.25f, (float)0); 
     } 
     else if (this.HairColor == "Munakata") 
     { 
      this.ColorValue = new Color(0.992f, 0.988f, 0.976f); 
     } 
     else if (this.HairColor == "Chisa") 
     { 
      this.ColorValue = new Color(0.8f, 0.361f, 0.137f); 
     } 
     else if (this.HairColor == "Juzo") 
     { 
      this.ColorValue = new Color(0.094f, 0.137f, 0.075f); 
     } 
     else if (this.HairColor == "Miaya") 
     { 
      this.ColorValue = new Color(0.353f, 0.604f, 0.855f); 
     } 
     else if (this.HairColor == "Yoi") 
     { 
      this.ColorValue = new Color(0.882f, 0.8f, 0.545f); 
     } 
     else if (this.HairColor == "Ruru") 
     { 
      this.ColorValue = new Color(0.882f, 0.706f, 0.663f); 
     } 
     else if (this.HairColor == "Seiko") 
     { 
      this.ColorValue = new Color(0.835f, 0.847f, 0.851f); 
     } 
     else if (this.HairColor == "Egg") 
     { 
      this.ColorValue = new Color(0.765f, 0.659f, 0.62f); 
     } 
     else if (this.HairColor == "Kiri") 
     { 
      this.ColorValue = new Color(0.878f, 0.847, 0.882f); 
     } 
     else if (this.HairColor == "Toga") 
     { 
      this.ColorValue = new Color(0.976f, 0.945f, 0.871f); 
     } 
     else if (this.HairColor == "Aoi") 
     { 
      this.ColorValue = new Color(0.431f, 0.263f, 0.239f); 
     } 
     else if (this.HairColor == "Fukawa") 
     { 
      this.ColorValue = new Color(0.31f, 0.196f, 0.255f); 
     } 
     else if (this.HairColor == "Maizono") 
     { 
      this.ColorValue = new Color(0.192f, 0.224f, 0.294f); 
     } 
     else if (this.HairColor == "Leon") 
     { 
      this.ColorValue = new Color(0.761f, 0.239f, 0.11f); 
     } 
     else if (this.HairColor == "Junko") 
     { 
      this.ColorValue = new Color(0.98f, 0.922f, 0.886f); 
     } 
     else if (this.HairColor == "Mukuro") 
     { 
      this.ColorValue = new Color(0.145f, 0.125f, 0.11f); 
     } 
     else if (this.HairColor == "Chihiro") 
     { 
      this.ColorValue = new Color(0.051f, 0.29f, 0.592f); 
     } 
     else if (this.HairColor == "Mondo") 
     { 
      this.ColorValue = new Color(0.051f, 0.29f, 0.592f); 
     } 
     else if (this.HairColor == "Ame") 
     { 
      this.ColorValue = new Color(0.133f, (float)0, 0.18f); 
     } 
     else if (this.HairColor == "Celes") 
     { 
      this.ColorValue = new Color(0.094f, 0.09f, 0.09f); 
     } 
     else if (this.HairColor == "Hinata") 
     { 
      this.ColorValue = new Color(0.541f, 0.447f, 0.427f); 
     } 
     else if (this.HairColor == "Koma") 
     { 
      this.ColorValue = new Color(0.973f, 0.953f, 0.949f); 
     } 
     else if (this.HairColor == "Nanami") 
     { 
      this.ColorValue = new Color(0.839f, 0.757f, 0.745f); 
     } 
     else if (this.HairColor == "Zoom") 
     { 
      this.ColorValue = new Color(0.506f, 0.031f, 0.027f); 
     } 
     else if (this.HairColor == "Saionji") 
     { 
      this.ColorValue = new Color(0.988f, 0.918f, 0.745f); 
     } 
     else if (this.HairColor == "Sonia") 
     { 
      this.ColorValue = new Color(0.98f, 0.945f, 0.945f); 
     } 
     else if (this.HairColor == "Souda") 
     { 
      this.ColorValue = new Color(0.9f, 0.247f, 0.541f); 
     } 
     else if (this.HairColor == "Akane") 
     { 
      this.ColorValue = new Color(0.529f, 0.286f, 0.184f); 
     } 
     else if (this.HairColor == "Teru") 
     { 
      this.ColorValue = new Color(0.204f, 0.11f, 0.106f); 
     } 
     else if (this.HairColor == "Mikan") 
     { 
      this.ColorValue = new Color(0.012f, 0.698f, 0.388f); 
     } 
     else if (this.HairColor == "Kuzu") 
     { 
      this.ColorValue = new Color(0.996f, 0.902f, 0.749f); 
     } 
     else if (this.HairColor == "Peko") 
     { 
      this.ColorValue = new Color((float)1, (float)1, (float)1); 
     } 
     else if (this.HairColor == "Nidai") 
     { 
      this.ColorValue = new Color(0.122f, 0.153f, 0.157f); 
     } 
     else if (this.HairColor == "Mita") 
     { 
      this.ColorValue = new Color(0.886f, 0.816f, 0.769f); 
     } 
     else if (this.HairColor == "Noroshi") 
     { 
      this.ColorValue = new Color(0.012f, 0.114f, 0.012f); 
     } 
     else if (this.HairColor == "Kiza") 
     { 
      this.ColorValue = new Color(0.937f, 0.843f, 0.6f); 
     } 
     else if (this.HairColor == "Jin") 
     { 
      this.ColorValue = new Color(0.141f, 0.082f, 0.173f); 
     } 
     else if (this.HairColor == "Amami") 
     { 
      this.ColorValue = new Color(0.761f, 0.792f, 0.631f); 
     } 
     else if (this.HairColor == "Hitler") 
     { 
      this.ColorValue = new Color(0.224f, 0.196f, 0.255f); 
     } 
     else if (this.HairColor == "Kae") 
     { 
      this.ColorValue = new Color(0.933f, 0.855f, 0.78f); 
     } 
     else if (this.HairColor == "Hopebot") 
     { 
      this.ColorValue = new Color(0.965f, 0.961f, 0.922f); 
     } 
     else if (this.HairColor == "Kaito") 
     { 
      this.ColorValue = new Color(0.282f, 0.2f, 0.278f); 
     } 
     else if (this.HairColor == "Angie") 
     { 
      this.ColorValue = new Color(0.961f, 0.961f, 0.945f); 
     } 
     else if (this.HairColor == "Maki") 
     { 
      this.ColorValue = new Color(0.247f, 0.259f, 0.235f); 
     } 
     else if (this.HairColor == "Miu") 
     { 
      this.ColorValue = new Color(0.949f, 0.902f, 0.89f); 
     } 
     else 
     { 
      this.RightEyeRenderer.material.mainTexture = this.HairRenderer.material.mainTexture; 
      this.LeftEyeRenderer.material.mainTexture = this.HairRenderer.material.mainTexture; 
      this.FaceTexture = this.HairRenderer.material.mainTexture; 
      this.CustomHair = true; 
     } 
     if (this.Hairstyle > 0) 
     { 
      this.HairRenderer.material.color = this.ColorValue; 
     } 
    } 
    else 
    { 
     float r = UnityEngine.Random.Range((float)0, 1f); 
     Color color = this.HairRenderer.material.color; 
     float num3 = color.r = r; 
     Color color2 = this.HairRenderer.material.color = color; 
     float g = UnityEngine.Random.Range((float)0, 1f); 
     Color color3 = this.HairRenderer.material.color; 
     float num4 = color3.g = g; 
     Color color4 = this.HairRenderer.material.color = color3; 
     float b = UnityEngine.Random.Range((float)0, 1f); 
     Color color5 = this.HairRenderer.material.color; 
     float num5 = color5.b = b; 
     Color color6 = this.HairRenderer.material.color = color5; 
    } 
    if (!this.Teacher) 
    { 
     if (this.CustomHair) 
     { 
       if (!this.Male) 
      { 
       this.MyRenderer.materials[2].mainTexture = this.FaceTexture; 
      } 
      else if (PlayerPrefs.GetInt("MaleUniform") == 1) 
      { 
       this.MyRenderer.materials[2].mainTexture = this.FaceTexture; 
      } 
      else if (PlayerPrefs.GetInt("MaleUniform") < 4) 
      { 
       this.MyRenderer.materials[1].mainTexture = this.FaceTexture; 
      } 
      else 
      { 
       this.MyRenderer.materials[0].mainTexture = this.FaceTexture; 
      } 
     } 
     else 
     { 
      this.RightEyeRenderer.material.color = this.ColorValue; 
      this.LeftEyeRenderer.material.color = this.ColorValue; 
     } 
    } 
    else if (this.Teacher) 
    { 
     if (PlayerPrefs.GetInt("Student_" + this.StudentID + "_Replaced") == 1) 
     { 
      float @float = PlayerPrefs.GetFloat("Student_" + this.StudentID + "_ColorR"); 
      float float2 = PlayerPrefs.GetFloat("Student_" + this.StudentID + "_ColorG"); 
      float float3 = PlayerPrefs.GetFloat("Student_" + this.StudentID + "_ColorB"); 
      this.HairRenderer.material.color = new Color(@float, float2, float3); 
     } 
     this.RightEyeRenderer.material.color = this.HairRenderer.material.color; 
     this.LeftEyeRenderer.material.color = this.HairRenderer.material.color; 
    } 
    if (this.Male) 
    { 
     if (this.Accessory == 2) 
     { 
      this.RightIrisLight.active = false; 
      this.LeftIrisLight.active = false; 
     } 
     if (Application.loadedLevelName == "PortraitScene") 
     { 
      this.Character.transform.localScale = new Vector3(0.93f, 0.93f, 0.93f); 
     } 
     if (this.FacialHairRenderer != null) 
     { 
      this.FacialHairRenderer.material.color = this.ColorValue; 
      if (Extensions.get_length(this.FacialHairRenderer.materials) > 1) 
      { 
       this.FacialHairRenderer.materials[1].color = this.ColorValue; 
      } 
     } 
    } 
    if (!this.Randomize) 
    { 
     if (this.EyeColor != string.Empty) 
     { 
      if (this.EyeColor == "White") 
      { 
       this.CorrectColor = new Color((float)1, (float)1, (float)1); 
      } 
      else if (this.EyeColor == "Black") 
      { 
       this.CorrectColor = new Color((float)0, (float) 0, (float) 0); 
      } 
      else if (this.EyeColor == "Red") 
      { 
       this.CorrectColor = new Color((float)1, (float)0, (float)0); 
      } 
      else if (this.EyeColor == "Yellow") 
      { 
       this.CorrectColor = new Color((float)1, (float)1, 0.31f); 
      } 
      else if (this.EyeColor == "Green") 
      { 
       this.CorrectColor = new Color((float)0, (float)1, (float)0); 
      } 
      else if (this.EyeColor == "Cyan") 
      { 
       this.CorrectColor = new Color((float)0, (float)1, (float)1); 
      } 
      else if (this.EyeColor == "Blue") 
      { 
       this.CorrectColor = new Color((float)0, (float)0, (float)1); 
      } 
      else if (this.EyeColor == "Purple") 
      { 
       this.CorrectColor = new Color((float)1, (float)0, (float)1); 
      } 
      else if (this.EyeColor == "Orange") 
      { 
       this.CorrectColor = new Color((float)1, 0.5f, (float)0); 
      } 
      else if (this.EyeColor == "Brown") 
      { 
       this.CorrectColor = new Color(0.5f, 0.25f, (float)0); 
      } 
      else if (this.EyeColor == "Munakata") 
      { 
       this.CorrectColor = new Color(0.545f, 0.467f, 0.533f); 
      } 
      else if (this.EyeColor == "Juzo") 
      { 
       this.CorrectColor = new Color(0.827f, 0.137f, 0.518f); 
      } 
      else if (this.EyeColor == "Chisa") 
      { 
       this.CorrectColor = new Color(0.62f, (float)1, 0.42f); 
      } 
      else if (this.EyeColor == "Yoi") 
      { 
       this.CorrectColor = new Color((float)1, (float)0, (float)0); 
      } 
      else if (this.EyeColor == "Ruru") 
      { 
       this.CorrectColor = new Color(0.922f, 0.898f, 0.894f); 
      } 
      else if (this.EyeColor == "Seiko") 
      { 
       this.CorrectColor = new Color(0.624f, 0.537f, 0.631f); 
      } 
      else if (this.EyeColor == "Miaya") 
      { 
       this.CorrectColor = new Color(0.635f, 0.843f, 0.804f); 
      } 
      else if (this.EyeColor == "Egg") 
      { 
       this.CorrectColor = new Color(0.957, 0.937f, 0.875f); 
      } 
      else if (this.EyeColor == "Kiri") 
      { 
       this.CorrectColor = new Color(0.788f, 0.702f, 0.78f); 
      } 
      else if (this.EyeColor == "Toga") 
      { 
       this.CorrectColor = new Color(0.404f, 0.525f, 0.655f); 
      } 
      else if (this.EyeColor == "Aoi") 
      { 
       this.CorrectColor = new Color(0.298f, 0.404f, 0.498f); 
      } 
      else if (this.EyeColor == "Fukawa") 
      { 
       this.CorrectColor = new Color(0.6f, 0.522f, 0.541f); 
      } 
      else if (this.EyeColor == "Maizono") 
      { 
       this.CorrectColor = new Color(0.184f, 0.247f, 0.298f); 
      } 
      else if (this.EyeColor == "Leon") 
      { 
       this.CorrectColor = new Color(0.867f, 0.878f, 0.875f); 
      } 
      else if (this.EyeColor == "Junko") 
      { 
       this.CorrectColor = new Color(0.573, 0.612, 0.635f); 
      } 
      else if (this.EyeColor == "Mukuro") 
      { 
       this.CorrectColor = new Color(0.533f, 0.545f, 0.612f); 
      } 
      else if (this.EyeColor == "Chihiro") 
      { 
       this.CorrectColor = new Color(0.631f, 0.502f, 0.318f); 
      } 
      else if (this.EyeColor == "Mondo") 
      { 
       this.CorrectColor = new Color(0.773f, 0.561f, 0.427f); 
      } 
      else if (this.EyeColor == "Ame") 
      { 
       this.CorrectColor = new Color(0.588f, 0.463f, 0.608f); 
      } 
      else if (this.EyeColor == "Celes") 
      { 
       this.CorrectColor = new Color((float)1, (float)0, (float)0); 
      } 
      else if (this.EyeColor == "Hinata") 
      { 
       this.CorrectColor = new Color(0.741f, 0.753f, 0.675f); 
      } 
      else if (this.EyeColor == "Koma") 
      { 
       this.CorrectColor = new Color(0.722f, 0.718f, 0.702f); 
      } 
      else if (this.EyeColor == "Nanami") 
      { 
       this.CorrectColor = new Color(0.929f, 0.792f, 0.792f); 
      } 
      else if (this.EyeColor == "Zoom") 
      { 
       this.CorrectColor = new Color(0.494f, 0.412f, 0.392f); 
      } 
      else if (this.EyeColor == "Saionji") 
      { 
       this.CorrectColor = new Color(0.957f, 0.804f, 0.447f); 
      } 
      else if (this.EyeColor == "Sonia") 
      { 
       this.CorrectColor = new Color(0.408f, 0.631f, 0.745f); 
      } 
      else if (this.EyeColor == "Souda") 
      { 
       this.CorrectColor = new Color(0.9f, 0.247f, 0.541f); 
      } 
      else if (this.EyeColor == "Akane") 
      { 
       this.CorrectColor = new Color(0.475f, 0.451f, 0.325f); 
      } 
      else if (this.EyeColor == "Nidai") 
      { 
       this.CorrectColor = new Color(0.71f, 0.741f, 0.773f); 
      } 
      else if (this.EyeColor == "Teru") 
      { 
       this.CorrectColor = new Color((float)0, (float)0, (float)0); 
      } 
      else if (this.EyeColor == "Mikan") 
      { 
       this.CorrectColor = new Color(0.671f, 0.549f, 0.576f); 
      } 
      else if (this.EyeColor == "Kuzu") 
      { 
       this.CorrectColor = new Color((float)1, 0.941f, 0.878f); 
      } 
      else if (this.EyeColor == "Peko") 
      { 
       this.CorrectColor = new Color((float)1, (float)0, (float)0); 
      } 
      else if (this.EyeColor == "Noroshi") 
      { 
       this.CorrectColor = new Color(0.078f, 0.604f, 0.263f); 
      } 
      else if (this.EyeColor == "Mita") 
      { 
       this.CorrectColor = new Color(0.631f, 0.502f, 0.318f); 
      } 
      else if (this.EyeColor == "Kiza") 
      { 
       this.CorrectColor = new Color(0.247f, 0.435f, 0.69f); 
      } 
      else if (this.EyeColor == "Jin") 
      { 
       this.CorrectColor = new Color(0.604f, 0.447f, 0.6f); 
      } 
      else if (this.EyeColor == "Amami") 
      { 
       this.CorrectColor = new Color(0.667f, 0.686f, 0.537f); 
      } 
      else if (this.EyeColor == "Hitler") 
      { 
       this.CorrectColor = new Color(0.361f, 0.322f, 0.392f); 
      } 
      else if (this.EyeColor == "Kae") 
      { 
       this.CorrectColor = new Color(0.769f, 0.659f, 0.702f); 
      } 
      else if (this.EyeColor == "Hopebot") 
      { 
       this.CorrectColor = new Color(0.431f, 0.667f, 0.608f); 
      } 
      else if (this.EyeColor == "Kaito") 
      { 
       this.CorrectColor = new Color(0.58f, 0.467f, 0.514f); 
      } 
      else if (this.EyeColor == "Angie") 
      { 
       this.CorrectColor = new Color(0.518f, 0.584f, 0.553f); 
      } 
      else if (this.EyeColor == "Maki") 
      { 
       this.CorrectColor = new Color(0.278f, 0.161f, 0.149f); 
      } 
      else if (this.EyeColor == "Miu") 
      { 
       this.CorrectColor = new Color(0.275f, 0.376f, 0.396f); 
      } 
      this.RightEyeRenderer.material.color = this.CorrectColor; 
      this.LeftEyeRenderer.material.color = this.CorrectColor; 
     } 
    } 
    else 
{ 
    float num6 = UnityEngine.Random.Range((float)0, 1f); 
    float num7 = UnityEngine.Random.Range((float)0, 1f); 
    float num8 = UnityEngine.Random.Range((float)0, 1f); 
    float r2 = num6; 
    Color color7 = this.RightEyeRenderer.material.color; 
    float num9 = color7.r = r2; 
    Color color8 = this.RightEyeRenderer.material.color = color7; 
    float g2 = num7; 
    Color color9 = this.RightEyeRenderer.material.color; 
    float num10 = color9.g = g2; 
    Color color10 = this.RightEyeRenderer.material.color = color9; 
    float b2 = num8; 
    Color color11 = this.RightEyeRenderer.material.color; 
    float num11 = color11.b = b2; 
    Color color12 = this.RightEyeRenderer.material.color = color11; 
    float r3 = num6; 
    Color color13 = this.LeftEyeRenderer.material.color; 
    float num12 = color13.r = r3; 
    Color color14 = this.LeftEyeRenderer.material.color = color13; 
    float g3 = num7; 
    Color color15 = this.LeftEyeRenderer.material.color; 
    float num13 = color15.g = g3; 
    Color color16 = this.LeftEyeRenderer.material.color = color15; 
    float b3 = num8; 
    Color color17 = this.LeftEyeRenderer.material.color; 
    float num14 = color17.b = b3; 
    Color color18 = this.LeftEyeRenderer.material.color = color17; 
} 
    if (this.StudentID == 17) 
    { 
     if (PlayerPrefs.GetInt("Scheme_2_Stage") == 2) 
     { 
      this.FemaleAccessories[3].active = false; 
     } 
    } 
    else if (this.StudentID == 20 && this.transform.position != new Vector3((float)0, (float)0, (float)0)) 
    { 
     this.RightEyeRenderer.material.mainTexture = this.DefaultFaceTexture; 
     this.LeftEyeRenderer.material.mainTexture = this.DefaultFaceTexture; 
     ((RainbowScript)this.RightEyeRenderer.gameObject.GetComponent(typeof(RainbowScript))).enabled = true; 
     ((RainbowScript)this.LeftEyeRenderer.gameObject.GetComponent(typeof(RainbowScript))).enabled = true; 
    } 
    if (this.Student != null && this.Student.AoT) 
    { 
     this.Student.AttackOnTitan(); 
    } 
    this.TaskCheck(); 
    this.TurnOnCheck(); 
+0

你一定錯過了'using'聲明,這將引用該命名空間中哪個「顏色」被定義。 –

+0

如果您使用的是Visual Studio,只需按Ctrl +。 ,,,,你會得到彈出包括namespase爲Color類 –

回答

0

首先添加參照項目System.Drawing中 ,然後用添加

,如:using System.Drawing;

+0

這似乎並不工作,因爲它只是拋出錯誤說繪圖不存在於命名空間系統中。除此之外,我擔心引用任何尚未引用的內容,因爲我只是在修改遊戲。我只是複製並粘貼了一些顏色可變的行,並修改了它們的值,僅此而已。它不應該真的拋出這個錯誤,因爲我在參考文獻中沒有改變任何內容。儘管如此,謝謝。 –

0

你不應該需要一個System.Drawing中因爲團結在UnityEngine -Namespace中定義了它自己的Color

因此,也許看,如果添加此行到文件的頂部工作了,或者至少,改變錯誤:

using UnityEngine;