Exemplo n.º 1
0
        static void Prefix(ActorFace __instance, int actorId, ref int age)
        {
            if (Main.settings.allYoung && Main.settings.allAge >= 0 && age >= Main.settings.allAge)
            {
                age = Main.settings.allAge;
            }

            if (Main.settings.villageYoung && Main.settings.villageAge >= 0 && age >= Main.settings.villageAge)
            {
                if (int.Parse(DateFile.instance.GetActorDate(actorId, 19, false)) == 16)
                {
                    age = Main.settings.villageAge;
                }
            }

            Dictionary <int, string> dic = null;

            if (DateFile.instance.actorsDate.TryGetValue(actorId, out dic))
            {
                if (dic.Keys.Contains <int>(1000010) && int.Parse(dic[1000010]) <= age)
                {
                    age = int.Parse(dic[1000010]);
                }
            }
        }
Exemplo n.º 2
0
        private void Awake()
        {
            rText  = (RectTransform)transform.Find("Text");
            shadow = rText.GetComponent <Shadow>();
            text   = rText.GetComponent <Text>();
            rtf    = (RectTransform)transform;
            tImage = transform.Find("image");
#if !TAIWU_GAME
            GameObject go = GameObject.Instantiate(Tools.GetActorFaceSample());
            actorFace = go.GetComponent <ActorFace>();


            RectTransform tf = (RectTransform)go.transform;
            tf.SetParent(tImage, false);
            tf.localScale       = Vector3.one * 0.15f;
            tf.anchoredPosition = new Vector2(-5, -50);
#endif
        }
Exemplo n.º 3
0
        private void Awake()
        {
            text   = transform.Find("Name").GetComponent <Text>();
            shadow = text.GetComponent <Shadow>();
            //tImage = transform.Find("image");
            //gImage = tImage.gameObject;
#if !TAIWU_GAME
            GameObject go = GameObject.Instantiate(Tools.GetActorFaceSample());
            actorFace = go.GetComponent <ActorFace>();

            RectTransform tf = (RectTransform)go.transform;
            tf.SetParent(transform, false);
            tf.localScale       = Vector3.one * 0.45f;
            tf.anchoredPosition = new Vector2(0, -80);
#endif
            Button btn = gameObject.GetComponent <Button>();
            btn.onClick.AddListener(OnClickChair);
        }
Exemplo n.º 4
0
        private void Awake()
        {
            Button btn = GetComponent <Button>();

            btn.onClick.AddListener(OnClickChair);

            //tImage = transform.Find("image");
            //gImage = tImage.gameObject;
#if !TAIWU_GAME
            GameObject go = GameObject.Instantiate(Tools.GetActorFaceSample());
            actorFace = go.GetComponent <ActorFace>();
            Tools.UpdateFace(last_image, actorFace, 0, 0, 0, new int[] { 3102 }, new int[] { 3102 }, 0, true);

            RectTransform tf = (RectTransform)go.transform;
            tf.SetParent(transform, false);
            tf.localScale       = Vector3.one * 0.25f;
            tf.anchoredPosition = new Vector2(0, -14);
#endif
        }
Exemplo n.º 5
0
            public static bool Prefix(int actorId, ActorFace __instance)
            {
                int SpecialclotheIndex = 0;
                int itemid             = int.Parse(DateFile.instance.GetActorDate(actorId, 305, true));

                //Debug.Log(itemid.ToString());//进入游戏的主界面也会用到这个函数,此时游戏数据未加载所以itemid为0,淦哦,用这一点来屏蔽主界面时候的补丁运行
                if (itemid != 0)
                {
                    SpecialclotheIndex = int.Parse(DateFile.instance.GetItemDate(itemid, 34, true, -1));//902
                    if (SpecialclotheIndex > 100)

                    {
                        __instance.ageImage.gameObject.SetActive(false);
                        __instance.nose.gameObject.SetActive(false);
                        __instance.faceOther.gameObject.SetActive(false);
                        __instance.eye.gameObject.SetActive(false);
                        __instance.eyePupil.gameObject.SetActive(false);
                        __instance.eyebrows.gameObject.SetActive(false);
                        __instance.mouth.gameObject.SetActive(false);
                        __instance.beard.gameObject.SetActive(false);
                        __instance.hair1.gameObject.SetActive(false);
                        __instance.hair2.gameObject.SetActive(false);
                        __instance.hairOther.gameObject.SetActive(false);
                        __instance.clothes.gameObject.SetActive(false);
                        __instance.clothesColor.gameObject.SetActive(false);
                        __instance.body.gameObject.SetActive(true);
                        bool flag2 = __instance.smallSize;
                        if (flag2)
                        {
                            var temp = LoadSprite(SpecialclotheIndex.ToString() + ".png", true);
                            if (temp == null)
                            {
                                temp = LoadSprite(SpecialclotheIndex.ToString() + ".png", false);
                            }
                            if (temp == null)
                            {
                                return(true);
                            }
                            __instance.body.sprite = temp;
                        }
                        else
                        {
                            var temp = LoadSprite(SpecialclotheIndex.ToString() + ".png", false);
                            if (temp == null)
                            {
                                return(true);
                            }
                            __instance.body.sprite = temp;
                        }
                        __instance.body.color = new Color(1f, 1f, 1f, 1f);
                        //int id = DateFile.instance.MianActorID();
                        //int itemid = int.Parse(DateFile.instance.GetActorDate(id, 305, true));
                        //Debug.Log(@"it's id is "+itemid.ToString());//+" "+DateFile.instance.GetItemDate(itemid, 999, true, -1)
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                else
                {
                    return(true);
                }
            }
Exemplo n.º 6
0
 public static void UpdateFace(int[] last_image, ActorFace actorFace, int age, int gender, int actorGenderChange, int[] faceDate, int[] faceColor, int clotheIndex, bool life = true)
 {
     if (!CheckImageChange(last_image, faceDate.Length, age, gender, actorGenderChange, faceDate, faceColor, clotheIndex))
     {
         return;
     }
     if (faceDate.Length == 1)
     {
         actorFace.ageImage.gameObject.SetActive(value: false);
         actorFace.nose.gameObject.SetActive(value: false);
         actorFace.faceOther.gameObject.SetActive(value: false);
         actorFace.eye.gameObject.SetActive(value: false);
         actorFace.eyePupil.gameObject.SetActive(value: false);
         actorFace.eyebrows.gameObject.SetActive(value: false);
         actorFace.mouth.gameObject.SetActive(value: false);
         actorFace.beard.gameObject.SetActive(value: false);
         actorFace.hair1.gameObject.SetActive(value: false);
         actorFace.hair2.gameObject.SetActive(value: false);
         actorFace.hairOther.gameObject.SetActive(value: false);
         actorFace.clothes.gameObject.SetActive(value: false);
         actorFace.clothesColor.gameObject.SetActive(value: false);
         actorFace.body.gameObject.SetActive(value: true);
         if (actorFace.smallSize)
         {
             actorFace.body.sprite = Resources.Load <Sprite>("Graphics/ActorFaceSmall/NPCFace/NPCFace_" + faceDate[0].ToString());
         }
         else
         {
             actorFace.body.sprite = Resources.Load <Sprite>("Graphics/ActorFace/NPCFace/NPCFace_" + faceDate[0].ToString());
         }
         actorFace.body.color = new Color(1f, 1f, 1f, 1f);
     }
     else
     {
         bool flag = life || false || false;
         if (!flag)
         {
             actorFace.ageImage.gameObject.SetActive(value: false);
             actorFace.nose.gameObject.SetActive(value: false);
             actorFace.faceOther.gameObject.SetActive(value: false);
             actorFace.eye.gameObject.SetActive(value: false);
             actorFace.eyePupil.gameObject.SetActive(value: false);
             actorFace.eyebrows.gameObject.SetActive(value: false);
             actorFace.mouth.gameObject.SetActive(value: false);
             actorFace.beard.gameObject.SetActive(value: false);
             actorFace.hair1.gameObject.SetActive(value: false);
             actorFace.hair2.gameObject.SetActive(value: false);
             actorFace.hairOther.gameObject.SetActive(value: false);
             actorFace.clothes.gameObject.SetActive(value: false);
             actorFace.clothesColor.gameObject.SetActive(value: false);
             actorFace.body.gameObject.SetActive(value: true);
             if (actorFace.smallSize)
             {
                 actorFace.body.sprite = Resources.Load <Sprite>("Graphics/ActorFaceSmall/NPCFace/NPCFace_Dead");
             }
             else
             {
                 actorFace.body.sprite = Resources.Load <Sprite>("Graphics/ActorFace/NPCFace/NPCFace_Dead");
             }
             actorFace.body.color = new Color(1f, 1f, 1f, 1f);
         }
         else
         {
             int num  = (actorGenderChange == 0) ? (gender - 1) : ((gender == 1) ? 1 : 0);
             int key  = Mathf.Min(faceDate[0], DateFile.instance.ParseInt(GetSprites.instance.actorFaceDate[num][98]) - 1);
             int key2 = Mathf.Min(faceDate[0], DateFile.instance.ParseInt(GetSprites.instance.actorFaceDate[num][99]) - 1);
             actorFace.ageImage.gameObject.SetActive(flag);
             actorFace.body.gameObject.SetActive(value: true);
             actorFace.nose.gameObject.SetActive(flag);
             actorFace.faceOther.gameObject.SetActive(flag);
             actorFace.eye.gameObject.SetActive(flag);
             actorFace.eyePupil.gameObject.SetActive(flag);
             actorFace.eyebrows.gameObject.SetActive(flag);
             actorFace.mouth.gameObject.SetActive(flag);
             actorFace.beard.gameObject.SetActive(gender == 1 && num == 0 && age >= 20);
             actorFace.hair1.gameObject.SetActive(flag || (!flag && faceDate[7] == 15));
             actorFace.hair2.gameObject.SetActive(flag || (!flag && faceDate[7] == 15));
             actorFace.hairOther.gameObject.SetActive(flag || (!flag && faceDate[7] == 15));
             actorFace.clothes.gameObject.SetActive(value: true);
             actorFace.clothesColor.gameObject.SetActive(value: true);
             if (age <= 14)
             {
                 Dictionary <int, Dictionary <int, Sprite[]> > dictionary = actorFace.smallSize ? GetSprites.instance.childFaceSmall : GetSprites.instance.childFace;
                 if (age <= 3)
                 {
                     actorFace.body.sprite         = dictionary[num][key][2];
                     actorFace.nose.sprite         = dictionary[num][key][0];
                     actorFace.eyePupil.sprite     = dictionary[num][key][1];
                     actorFace.clothesColor.sprite = dictionary[num][key][3];
                     actorFace.body.color          = new Color(1f, 1f, 1f);
                     actorFace.nose.color          = DateFile.instance.faceColor[0][faceColor[0]];
                     actorFace.eyePupil.color      = new Color(1f, 1f, 1f);
                     actorFace.clothesColor.color  = DateFile.instance.faceColor[7][faceColor[7]];
                     actorFace.faceOther.gameObject.SetActive(value: false);
                     actorFace.eye.gameObject.SetActive(value: false);
                     actorFace.eyebrows.gameObject.SetActive(value: false);
                     actorFace.mouth.gameObject.SetActive(value: false);
                     actorFace.beard.gameObject.SetActive(value: false);
                     actorFace.hair1.gameObject.SetActive(value: false);
                     actorFace.hair2.gameObject.SetActive(value: false);
                     actorFace.hairOther.gameObject.SetActive(value: false);
                     actorFace.clothes.gameObject.SetActive(value: false);
                 }
                 else
                 {
                     actorFace.body.sprite         = dictionary[num][key][4];
                     actorFace.nose.sprite         = dictionary[num][key][5];
                     actorFace.eye.sprite          = dictionary[num][key][6];
                     actorFace.eyePupil.sprite     = dictionary[num][key][7];
                     actorFace.hair1.sprite        = dictionary[num][key][9];
                     actorFace.clothesColor.sprite = dictionary[num][key][8];
                     actorFace.body.color          = new Color(1f, 1f, 1f);
                     actorFace.nose.color          = DateFile.instance.faceColor[0][faceColor[0]];
                     actorFace.eyePupil.color      = DateFile.instance.faceColor[2][faceColor[2]];
                     actorFace.hair1.color         = DateFile.instance.faceColor[6][faceColor[6]];
                     actorFace.clothesColor.color  = DateFile.instance.faceColor[7][faceColor[7]];
                     actorFace.faceOther.gameObject.SetActive(value: false);
                     actorFace.eyebrows.gameObject.SetActive(value: false);
                     actorFace.mouth.gameObject.SetActive(value: false);
                     actorFace.beard.gameObject.SetActive(value: false);
                     actorFace.hair2.gameObject.SetActive(value: false);
                     actorFace.hairOther.gameObject.SetActive(value: false);
                     actorFace.clothes.gameObject.SetActive(value: false);
                 }
             }
             else
             {
                 Dictionary <int, Dictionary <int, List <Sprite[]> > > dictionary2 = actorFace.smallSize ? GetSprites.instance.actorFaceSmall : GetSprites.instance.actorFace;
                 if (age >= 60)
                 {
                     actorFace.ageImage.sprite = dictionary2[num][key2][0][2];
                 }
                 else if (age >= 40)
                 {
                     actorFace.ageImage.sprite = dictionary2[num][key2][0][1];
                 }
                 else
                 {
                     actorFace.ageImage.sprite = dictionary2[num][key2][0][0];
                 }
                 actorFace.body.sprite      = dictionary2[num][key2][1][(!flag) ? 1 : 0];
                 actorFace.nose.sprite      = dictionary2[num][key2][2][faceDate[1]];
                 actorFace.faceOther.sprite = dictionary2[num][key2][3][faceDate[2]];
                 actorFace.eye.sprite       = dictionary2[num][key2][4][faceDate[3]];
                 actorFace.eyePupil.sprite  = dictionary2[num][key2][5][faceDate[3]];
                 actorFace.eyebrows.sprite  = dictionary2[num][key2][6][faceDate[4]];
                 actorFace.mouth.sprite     = dictionary2[num][key2][7][faceDate[5]];
                 if (actorFace.beard.gameObject.activeSelf)
                 {
                     actorFace.beard.sprite = dictionary2[0][key2][8][faceDate[6]];
                 }
                 actorFace.hair1.sprite     = dictionary2[num][key2][9][faceDate[7]];
                 actorFace.hair2.sprite     = dictionary2[num][key2][12][faceDate[7]];
                 actorFace.hairOther.sprite = dictionary2[num][key2][13][faceDate[7]];
                 if (clotheIndex != -1)
                 {
                     actorFace.clothes.sprite      = dictionary2[num][key2][10][clotheIndex];
                     actorFace.clothesColor.sprite = dictionary2[num][key2][11][clotheIndex];
                 }
                 else
                 {
                     actorFace.clothes.sprite      = dictionary2[num][key2][10][0];
                     actorFace.clothesColor.sprite = dictionary2[num][key2][11][0];
                 }
                 actorFace.body.color     = (flag ? DateFile.instance.faceColor[0][faceColor[0]] : new Color(1f, 1f, 1f, 1f));
                 actorFace.nose.color     = DateFile.instance.faceColor[0][faceColor[0]];
                 actorFace.eyebrows.color = DateFile.instance.faceColor[1][faceColor[1]];
                 actorFace.eyePupil.color = DateFile.instance.faceColor[2][faceColor[2]];
                 actorFace.mouth.color    = DateFile.instance.faceColor[3][faceColor[3]];
                 if (age >= 70)
                 {
                     Color color = new Color(0.921568632f, 0.9490196f, 0.9647059f);
                     if (actorFace.beard.gameObject.activeSelf)
                     {
                         actorFace.beard.color = color;
                     }
                     actorFace.hair1.color = color;
                     actorFace.hair2.color = color;
                 }
                 else
                 {
                     if (actorFace.beard.gameObject.activeSelf)
                     {
                         actorFace.beard.color = DateFile.instance.faceColor[4][faceColor[4]];
                     }
                     actorFace.hair1.color = DateFile.instance.faceColor[6][faceColor[6]];
                     actorFace.hair2.color = DateFile.instance.faceColor[6][faceColor[6]];
                 }
                 actorFace.faceOther.color    = DateFile.instance.faceColor[5][faceColor[5]];
                 actorFace.clothesColor.color = DateFile.instance.faceColor[7][faceColor[7]];
                 actorFace.hairOther.color    = DateFile.instance.faceColor[7][faceColor[7]];
             }
         }
     }
 }