Example #1
0
    public IEnumerator loadskinE(string url)
    {
        while (!hasspawn)
        {
            yield return(null);
        }
        bool flag   = true;
        bool unload = false;

        if ((int)FengGameManagerMKII.Settings[63] == 1)
        {
            flag = false;
        }
        try
        {
            Renderer[] componentsInChildren = GetComponentsInChildren <Renderer>();
            foreach (Renderer renderer31 in componentsInChildren)
            {
                if (renderer31.name.Contains("hair"))
                {
                    if (!FengGameManagerMKII.LinkHash[2].ContainsKey(url))
                    {
                        WWW link = Guardian.Utilities.GameHelper.CreateWWW(url);
                        if (link != null)
                        {
                            yield return(link);

                            Texture2D tex = RCextensions.LoadImage(link, flag, 1000000);
                            link.Dispose();
                            if (!FengGameManagerMKII.LinkHash[2].ContainsKey(url))
                            {
                                unload = true;
                                renderer31.material.mainTexture = tex;
                                FengGameManagerMKII.LinkHash[2].Add(url, renderer31.material);
                                renderer31.material = (Material)FengGameManagerMKII.LinkHash[2][url];
                            }
                            else
                            {
                                renderer31.material = (Material)FengGameManagerMKII.LinkHash[2][url];
                            }
                        }
                    }
                    else
                    {
                        renderer31.material = (Material)FengGameManagerMKII.LinkHash[2][url];
                    }
                }
            }
        }
        finally
        {
        }
        if (unload)
        {
            FengGameManagerMKII.Instance.UnloadAssets();
        }
    }
Example #2
0
    public IEnumerator CoLoadSkin(string url)
    {
        while (!hasspawn)
        {
            yield return(null);
        }

        bool flag   = true;
        bool unload = false;

        if ((int)FengGameManagerMKII.Settings[63] == 1)
        {
            flag = false;
        }

        try
        {
            foreach (Renderer renderer31 in GetComponentsInChildren <Renderer>())
            {
                if (renderer31.name.Contains("hair"))
                {
                    if (!FengGameManagerMKII.LinkHash[2].ContainsKey(url))
                    {
                        WWW link = Guardian.AntiAbuse.Validators.SkinChecker.CreateWWW(url);
                        if (link != null)
                        {
                            yield return(link);

                            // Old limit: 1MB
                            Texture2D tex = RCextensions.LoadImage(link, flag, 2000000);
                            link.Dispose();
                            if (!FengGameManagerMKII.LinkHash[2].ContainsKey(url))
                            {
                                unload = true;
                                renderer31.material.mainTexture = tex;
                                FengGameManagerMKII.LinkHash[2].Add(url, renderer31.material);
                            }
                            renderer31.material = (Material)FengGameManagerMKII.LinkHash[2][url];
                        }
                    }
                    else
                    {
                        renderer31.material = (Material)FengGameManagerMKII.LinkHash[2][url];
                    }
                }
            }
        }
        finally { }

        if (unload)
        {
            FengGameManagerMKII.Instance.UnloadAssets();
        }
    }
Example #3
0
    public IEnumerator CoLoadSkin(int hairIndex, int eyeIndex, string hairLink)
    {
        bool unload = false;

        Object.Destroy(part_hair);
        this.hair = CostumeHair.MaleHairs[hairIndex];
        hairType  = hairIndex;
        if (this.hair.hair.Length > 0)
        {
            GameObject obj2 = (GameObject)Object.Instantiate(Resources.Load("Character/" + this.hair.hair));
            obj2.transform.parent     = hair_go_ref.transform.parent;
            obj2.transform.position   = hair_go_ref.transform.position;
            obj2.transform.rotation   = hair_go_ref.transform.rotation;
            obj2.transform.localScale = hair_go_ref.transform.localScale;
            obj2.renderer.material    = CharacterMaterials.materials[this.hair.texture];
            bool flag = true;
            if ((int)FengGameManagerMKII.Settings[63] == 1)
            {
                flag = false;
            }
            if (hairLink.EndsWith(".jpg") || hairLink.EndsWith(".png") || hairLink.EndsWith(".jpeg"))
            {
                if (!FengGameManagerMKII.LinkHash[0].ContainsKey(hairLink))
                {
                    WWW link = Guardian.AntiAbuse.Validators.SkinChecker.CreateWWW(hairLink);
                    if (link != null)
                    {
                        yield return(link);

                        // Old limit: 200KB
                        Texture2D tex = RCextensions.LoadImage(link, flag, 300000);
                        link.Dispose();
                        if (!FengGameManagerMKII.LinkHash[0].ContainsKey(hairLink))
                        {
                            unload = true;
                            obj2.renderer.material.mainTexture = tex;
                            FengGameManagerMKII.LinkHash[0].Add(hairLink, obj2.renderer.material);
                        }
                        obj2.renderer.material = (Material)FengGameManagerMKII.LinkHash[0][hairLink];
                    }
                }
                else
                {
                    obj2.renderer.material = (Material)FengGameManagerMKII.LinkHash[0][hairLink];
                }
            }
            else if (hairLink.ToLower() == "transparent")
            {
                obj2.renderer.enabled = false;
            }
            part_hair = obj2;
        }
        if (eyeIndex >= 0)
        {
            SetEyeTexture(this.eye, eyeIndex);
        }
        if (unload)
        {
            FengGameManagerMKII.Instance.UnloadAssets();
        }
    }
Example #4
0
    public IEnumerator loadskinE(int hair, int eye, string hairlink)
    {
        bool unload = false;

        Object.Destroy(part_hair);
        this.hair = CostumeHair.hairsM[hair];
        hairType  = hair;
        if (this.hair.hair != string.Empty)
        {
            GameObject obj2 = (GameObject)Object.Instantiate(Resources.Load("Character/" + this.hair.hair));
            obj2.transform.parent     = hair_go_ref.transform.parent;
            obj2.transform.position   = hair_go_ref.transform.position;
            obj2.transform.rotation   = hair_go_ref.transform.rotation;
            obj2.transform.localScale = hair_go_ref.transform.localScale;
            obj2.renderer.material    = CharacterMaterials.materials[this.hair.texture];
            bool flag = true;
            if ((int)FengGameManagerMKII.Settings[63] == 1)
            {
                flag = false;
            }
            if (hairlink.EndsWith(".jpg") || hairlink.EndsWith(".png") || hairlink.EndsWith(".jpeg"))
            {
                if (!FengGameManagerMKII.LinkHash[0].ContainsKey(hairlink))
                {
                    WWW link = Guardian.Utilities.GameHelper.CreateWWW(hairlink);
                    if (link != null)
                    {
                        yield return(link);

                        Texture2D tex = RCextensions.LoadImage(link, flag, 200000);
                        link.Dispose();
                        if (!FengGameManagerMKII.LinkHash[0].ContainsKey(hairlink))
                        {
                            unload = true;
                            obj2.renderer.material.mainTexture = tex;
                            FengGameManagerMKII.LinkHash[0].Add(hairlink, obj2.renderer.material);
                            obj2.renderer.material = (Material)FengGameManagerMKII.LinkHash[0][hairlink];
                        }
                        else
                        {
                            obj2.renderer.material = (Material)FengGameManagerMKII.LinkHash[0][hairlink];
                        }
                    }
                }
                else
                {
                    obj2.renderer.material = (Material)FengGameManagerMKII.LinkHash[0][hairlink];
                }
            }
            else if (hairlink.ToLower() == "transparent")
            {
                obj2.renderer.enabled = false;
            }
            part_hair = obj2;
        }
        if (eye >= 0)
        {
            setFacialTexture(this.eye, eye);
        }
        if (unload)
        {
            FengGameManagerMKII.Instance.UnloadAssets();
        }
    }