Esempio n. 1
0
 public void Init()
 {
     this.battleMapIndex = 0;
     this.isFrontRow     = false;
     this.debugStartType = 2;
     this.isLevitate     = false;
     this.isTrance       = new Boolean[4];
     for (Int32 i = 0; i < (Int32)this.isTrance.Length; i++)
     {
         this.isTrance[i] = false;
     }
     this.isFade                  = false;
     this.selectCharPosID         = 0;
     this.selectPlayerCount       = 4;
     this.isDebug                 = false;
     this.isRandomEncounter       = false;
     this.isTutorial              = false;
     battle.isAlreadyShowTutorial = false;
     this.FF9Battle               = new FF9StateBattleSystem();
     this.FF9Battle.status_data   = FF9BattleDB.status_data;
     this.FF9Battle.aa_data       = FF9BattleDB.CharacterActions;
     this.FF9Battle.add_status    = FF9BattleDB.StatusSets;
     this.fadeShader              = ShadersLoader.Find("PSX/BattleMap_Abr_1");
     this.battleShader            = ShadersLoader.Find("PSX/BattleMap_StatusEffect");
     this.shadowShader            = ShadersLoader.Find("PSX/BattleMap_Abr_2");
     this.detailTexture           = Resources.Load <Texture2D>("EmbeddedAsset/BattleMap/detailTexture");
 }
Esempio n. 2
0
    public void InitFadeTexture()
    {
        GameObject addTexture = GameObject.Find("UI Root/Submenu Container/Event Fader Panel/Fading Texture Add");

        if (addTexture != null)
        {
            this.eventFadeTextureAdd             = addTexture.GetComponent <UITexture>();
            this.eventFadeTextureAdd.mainTexture = Texture2D.whiteTexture;
            this.eventFadeTextureAdd.material    = new Material(ShadersLoader.Find("PSX/Fade_Abr_1 1"));

            if (Configuration.Graphics.WidescreenSupport)
            {
                eventFadeTextureAdd.width = eventFadeTextureAdd.height * Screen.width / Screen.height;
            }
        }
        GameObject subTexture = GameObject.Find("UI Root/Submenu Container/Event Fader Panel/Fading Texture Sub");

        if (subTexture != null)
        {
            this.eventFadeTextureSub             = subTexture.GetComponent <UITexture>();
            this.eventFadeTextureSub.mainTexture = Texture2D.whiteTexture;
            this.eventFadeTextureSub.material    = new Material(ShadersLoader.Find("PSX/Fade_Abr_2 1"));

            if (Configuration.Graphics.WidescreenSupport)
            {
                eventFadeTextureSub.width = eventFadeTextureSub.height * Screen.width / Screen.height;
            }
        }
    }
Esempio n. 3
0
    public void PostProcess(RenderTexture src, RenderTexture dest)
    {
        Int32 index1 = 0;
        Int32 index2 = 1;

        if (_isUpdate)
        {
            _isUpdate = false;

            Material mat1 = new Material(ShadersLoader.Find("SFX_RUSH_SUB"));
            mat1.SetVector("_Param", new Vector4(_rot, _scale, _subCol, 0.0f));
            Graphics.Blit(_texture[index1], _texture[index2], mat1);

            Material mat2 = new Material(ShadersLoader.Find("SFX_RUSH_ADD"));
            mat2.SetVector("_Center", new Vector4(_px, _py, 0.0f, 0.0f));
            mat2.SetVector("_Param", new Vector4(_rot, _scale, _addCol, 0.0f));
            Graphics.Blit(_texture[index1], _texture[index2], mat2);
            Graphics.Blit(_texture[index2], _texture[index1]);

            if ((_rushSeq & 1) != 0)
            {
                _px += _px >= 0.5 ? -0.009375f : 0.009375f;
            }

            if ((_rushSeq & 2) != 0)
            {
                _py += _py >= 0.5 ? -0.01339286f : 0.01339286f;
            }

            if (!_isRandomEncounter)
            {
                Single num = (Single)Math.Sin(_rushSeq * 14.0 * Math.PI / 180.0);
                _px += num * (0.5f - _px);
                _py += num * (0.5f - _py);
            }

            if (!_isRandomEncounter && _rushSeq >= 16)
            {
                _addCol -= _addColDec;
                if (_addCol < 0.0)
                {
                    _addCol = 0.0f;
                }
            }

            if (_rushSeq >= 1)
            {
                _subCol += _subColDec;
                if (_subCol > 1.0)
                {
                    _subCol = 1f;
                }
            }

            _rot   += _rotInc;
            _scale += _scaleAdd;
        }

        Graphics.Blit(_texture[index1], dest);
    }
Esempio n. 4
0
 public void Init()
 {
     this.spsBin       = null;
     this.prev         = (WorldSPS)null;
     this.next         = (WorldSPS)null;
     this.type         = 0;
     this.no           = -1;
     this.size         = 0;
     this.frame        = 0;
     this.prm0         = 0;
     this.prm1         = 0;
     this.arate        = 0;
     this.pos          = Vector3.zero;
     this.scale        = 4096;
     this.rot          = Vector3.zero;
     this.rotArg       = Vector3.zero;
     this.posOffset    = Vector3.zero;
     this.depthOffset  = 0;
     this.spsIndex     = -1;
     this.spsTransform = (Transform)null;
     this.meshRenderer = (MeshRenderer)null;
     this.meshFilter   = (MeshFilter)null;
     this.works        = new WorldSPS.WorldSPSWork();
     this.spsPrims     = new List <WorldSPS.WorldSPSPrim>();
     this._vertices    = new List <Vector3>();
     this._colors      = new List <Color>();
     this._uv          = new List <Vector2>();
     this._indices     = new List <Int32>();
     this.materials    = new Material[5];
     this.materials[0] = new Material(ShadersLoader.Find("WorldMap/SPS_Abr_0"));
     this.materials[1] = new Material(ShadersLoader.Find("WorldMap/SPS_Abr_1"));
     this.materials[2] = new Material(ShadersLoader.Find("WorldMap/SPS_Abr_2"));
     this.materials[3] = new Material(ShadersLoader.Find("WorldMap/SPS_Abr_3"));
     this.materials[4] = new Material(ShadersLoader.Find("WorldMap/SPS_Abr_None"));
 }
Esempio n. 5
0
 public static void Init()
 {
     SFXMesh.shaders    = new Shader[6];
     SFXMesh.shaders[0] = ShadersLoader.Find("SFX_OPA_GT");
     SFXMesh.shaders[1] = ShadersLoader.Find("SFX_ADD_GT");
     SFXMesh.shaders[2] = ShadersLoader.Find("SFX_SUB_GT");
     SFXMesh.shaders[3] = ShadersLoader.Find("SFX_OPA_G");
     SFXMesh.shaders[4] = ShadersLoader.Find("SFX_ADD_G");
     SFXMesh.shaders[5] = ShadersLoader.Find("SFX_SUB_G");
     SFXMesh.gPos       = new Vector3[SFXMesh.POS_MAX];
     for (Int32 i = 0; i < (Int32)SFXMesh.gPos.Length; i++)
     {
         SFXMesh.gPos[i] = default(Vector3);
     }
     SFXMesh.gTex = new Vector2[SFXMesh.TEX_MAX];
     for (Int32 j = 0; j < (Int32)SFXMesh.gTex.Length; j++)
     {
         SFXMesh.gTex[j] = default(Vector2);
     }
     SFXMesh.gCol = new Color32[SFXMesh.COL_MAX];
     for (Int32 k = 0; k < (Int32)SFXMesh.gCol.Length; k++)
     {
         SFXMesh.gCol[k] = default(Color32);
     }
     SFXMesh.colorData     = new Color[3];
     SFXMesh.colorData[0]  = new Color(1f, 1f, 1f, 1f);
     SFXMesh.colorData[1]  = new Color(1.5f, 1.5f, 1.5f, 1f);
     SFXMesh.colorData[2]  = new Color(2f, 2f, 2f, 1f);
     SFXMesh.dummyMaterial = new Material(SFXMesh.shaders[4]);
 }
Esempio n. 6
0
    public void InitRain()
    {
        this.maxRain  = 222;
        this.rainList = new FieldRainRenderer.Rain[this.maxRain];
        for (Int32 i = 0; i < this.maxRain; i++)
        {
            this.rainList[i] = new FieldRainRenderer.Rain();
        }
        this.numRain  = 0;
        this.strength = 0;
        this.speed    = 0;
        this.over     = 0;
        this.gen      = 0;
        this.offset   = new Vector2(-FieldMap.HalfFieldWidth, 0f);
        this.factor   = 1f;
        this.mat      = new Material(ShadersLoader.Find("SPS/SPSRain"));
        String b = "FBG_N32_IFUG_MAP568_IU_SDV_0";

        this.isIifaTreeMap = false;
        this.posOffset     = Vector3.zero;
        if (FF9StateSystem.Field.SceneName == b)
        {
            this.isIifaTreeMap = true;
            this.posOffset     = new Vector3(1000f, 0f, 1000f);
        }
    }
Esempio n. 7
0
 private void Awake()
 {
     this.randSeed       = -1;
     this.maxRain        = 31;
     this.nf_BbgRainFlag = (Int32)FF9StateSystem.Common.FF9.btl_rain;
     if (this.nf_BbgRainFlag > this.maxRain)
     {
         this.nf_BbgRainFlag = this.maxRain;
     }
     this.mat = ShadersLoader.CreateShaderMaterial("SPS/SPSRain");
 }
Esempio n. 8
0
    private void CreateShadowMesh()
    {
        List <Vector3> list  = new List <Vector3>();
        List <Color>   list2 = new List <Color>();
        List <Vector2> list3 = new List <Vector2>();
        List <Int32>   list4 = new List <Int32>();

        list.Add(new Vector3(-1f, 0f, -1f));
        list.Add(new Vector3(1f, 0f, -1f));
        list.Add(new Vector3(1f, 0f, 1f));
        list.Add(new Vector3(-1f, 0f, 1f));
        Color item = new Color(1f, 1f, 1f, 0.6f);

        list2.Add(item);
        list2.Add(item);
        list2.Add(item);
        list2.Add(item);
        list3.Add(new Vector2(0f, 0f));
        list3.Add(new Vector2(1f, 0f));
        list3.Add(new Vector2(1f, 1f));
        list3.Add(new Vector2(0f, 1f));
        list4.Add(2);
        list4.Add(1);
        list4.Add(0);
        list4.Add(3);
        list4.Add(2);
        list4.Add(0);
        Mesh mesh = new Mesh();

        mesh.vertices  = list.ToArray();
        mesh.colors    = list2.ToArray();
        mesh.uv        = list3.ToArray();
        mesh.triangles = list4.ToArray();
        this.shadowObj = new GameObject(base.gameObject.name + "_Shadow");
        this.shadowObj.transform.parent = PersistenSingleton <EventEngine> .Instance.fieldmap.transform;
        MeshRenderer meshRenderer = this.shadowObj.AddComponent <MeshRenderer>();
        MeshFilter   meshFilter   = this.shadowObj.AddComponent <MeshFilter>();

        meshFilter.mesh = mesh;
        Shader   shader   = ShadersLoader.Find("PSX/FieldMapActorShadow");
        Material material = new Material(shader);

        this.shadowTex          = AssetManager.Load <Texture2D>("CommonAsset/Common/shadow_plate", false);
        material.mainTexture    = this.shadowTex;
        meshRenderer.material   = material;
        this.shadowTran         = this.shadowObj.transform;
        this.shadowMeshRenderer = meshRenderer;
        this.shadowMeshRenderer.material.color = Color.black;
        this.shadowTran.position   = this.GetShadowCurrentPos() + new Vector3(0f, this.shadowHeightOffset * 1f, 0f);
        this.shadowTran.localScale = this.shadowScale;
    }
Esempio n. 9
0
 public override void HonoAwake()
 {
     base.HonoAwake();
     this.MBGInitialized = 1;
     this.mbgCamera      = this.cameraObject.GetComponent <Camera>();
     this.process        = this.cameraObject.GetComponent <MovieMaterialProcessor>();
     this.movieMaterial  = MovieMaterial.New(this.process);
     this.moviePlane.GetComponent <Renderer>().material = this.movieMaterial.Material;
     this.moviePlane.transform.localScale = Vector3.Scale(new Vector3(32f, 1f, 22.4f), MovieMaterial.ScaleVector);
     this.mbgCamera.depth           = -4096f;
     this.movieMaterial.FastForward = (MovieMaterial.FastForwardMode)((!FF9StateSystem.Settings.IsFastForward) ? MovieMaterial.FastForwardMode.Normal : MovieMaterial.FastForwardMode.HighSpeed);
     this.shader = ShadersLoader.Find("PSX/FieldMapActorMBGMask");
     this.SetFastForward(HonoBehaviorSystem.Instance.IsFastForwardModeActive());
     this.isFastForwardOnBeforePlayingMBG = false;
     this.played = false;
 }
Esempio n. 10
0
 public void InitRain()
 {
     this.maxRain  = 222;
     this.rainList = new WorldRainRenderer.Rain[this.maxRain];
     for (Int32 i = 0; i < this.maxRain; i++)
     {
         this.rainList[i] = new WorldRainRenderer.Rain();
     }
     this.numRain  = 0;
     this.strength = 0;
     this.speed    = 0;
     this.over     = 0;
     this.gen      = 0;
     this.offset   = new Vector3(0f, -3474f, 0f);
     this.factor   = 1f;
     this.mat      = new Material(ShadersLoader.Find("SPS/SPSRain"));
 }
Esempio n. 11
0
 public void Init()
 {
     this.attr         = 1;
     this.arate        = 15;
     this.fade         = 128;
     this.refNo        = -1;
     this.charNo       = -1;
     this.boneNo       = 0;
     this.lastFrame    = -1;
     this.curFrame     = 0;
     this.frameCount   = 0;
     this.frameRate    = 16;
     this.pos          = Vector3.zero;
     this.scale        = 4096;
     this.rot          = Vector3.zero;
     this.rotArg       = Vector3.zero;
     this.zOffset      = 0;
     this.posOffset    = Vector3.zero;
     this.depthOffset  = 0;
     this.spsIndex     = -1;
     this.spsTransform = (Transform)null;
     this.meshRenderer = (MeshRenderer)null;
     this.meshFilter   = (MeshFilter)null;
     this.spsBin       = null;
     this.works        = new FieldSPS.FieldSPSWork();
     this.spsPrims     = new List <FieldSPS.FieldSPSPrim>();
     this.spsActor     = (FieldSPSActor)null;
     this._vertices    = new List <Vector3>();
     this._colors      = new List <Color>();
     this._uv          = new List <Vector2>();
     this._indices     = new List <Int32>();
     this.materials    = new Material[5];
     this.materials[0] = new Material(ShadersLoader.Find("PSX/FieldSPS_Abr_0"));
     this.materials[1] = new Material(ShadersLoader.Find("PSX/FieldSPS_Abr_1"));
     this.materials[2] = new Material(ShadersLoader.Find("PSX/FieldSPS_Abr_2"));
     this.materials[3] = new Material(ShadersLoader.Find("PSX/FieldSPS_Abr_3"));
     this.materials[4] = new Material(ShadersLoader.Find("PSX/FieldSPS_Abr_None"));
     this.charTran     = (Transform)null;
     this.boneTran     = (Transform)null;
 }
Esempio n. 12
0
 public static void SetMaterailShader(GameObject go, String shaderName)
 {
     MeshRenderer[] componentsInChildren = go.GetComponentsInChildren <MeshRenderer>();
     for (Int32 i = 0; i < (Int32)componentsInChildren.Length; i++)
     {
         Int32      num       = 0;
         Material[] materials = componentsInChildren[i].materials;
         for (Int32 j = 0; j < (Int32)materials.Length; j++)
         {
             Material material = materials[j];
             String   text     = material.name.Replace("(Instance)", String.Empty);
             if (battlebg.nf_BbgNumber == 171 && num == 0 && shaderName.Contains("Minus"))
             {
                 material.shader = ShadersLoader.Find("PSX/BattleMap_Moon");
             }
             else if ((battlebg.nf_BbgNumber == 92 && num == 3 && shaderName.Contains("Plus")) || (battlebg.nf_BbgNumber == 52 && num == 6 && shaderName.Contains("Plus")))
             {
                 material.shader = ShadersLoader.Find("PSX/BattleMap_Plus_Abr_1_Off");
             }
             else if (text.Contains("a"))
             {
                 material.shader = ShadersLoader.Find(shaderName + "_Abr_1");
             }
             else if (text.Contains("s"))
             {
                 material.shader = ShadersLoader.Find(shaderName + "_Abr_0");
                 material.SetColor("_Color", new Color32(Byte.MaxValue, Byte.MaxValue, Byte.MaxValue, 110));
             }
             else
             {
                 material.shader = ShadersLoader.Find(shaderName);
             }
             num++;
         }
     }
 }
Esempio n. 13
0
        public static void GeoSetABR(GameObject go, String type)
        {
            Shader shader;

            if (type == "GEO_POLYFLAGS_TRANS_100_PLUS_25")
            {
                shader = FF9StateSystem.Battle.fadeShader;
            }
            else if (type == "SEMI_TRANS_50_PLUS_50" || type == "PSX/BattleMap_StatusEffect")
            {
                shader = FF9StateSystem.Battle.battleShader;
            }
            else
            {
                shader = ShadersLoader.Find(type);
            }
            SkinnedMeshRenderer[] componentsInChildren = go.GetComponentsInChildren <SkinnedMeshRenderer>();
            for (Int32 i = 0; i < (Int32)componentsInChildren.Length; i++)
            {
                componentsInChildren[i].material.shader = shader;
                componentsInChildren[i].material.SetFloat("_Cutoff", 0.5f);
                componentsInChildren[i].material.SetTexture("_DetailTex", FF9StateSystem.Battle.detailTexture);
            }
            MeshRenderer[] componentsInChildren2 = go.GetComponentsInChildren <MeshRenderer>();
            for (Int32 j = 0; j < (Int32)componentsInChildren2.Length; j++)
            {
                Material[] materials = componentsInChildren2[j].materials;
                for (Int32 k = 0; k < (Int32)materials.Length; k++)
                {
                    Material material = materials[k];
                    material.shader = shader;
                    material.SetFloat("_Cutoff", 0.5f);
                    material.SetTexture("_DetailTex", FF9StateSystem.Battle.detailTexture);
                }
            }
        }
Esempio n. 14
0
    public static void FF9FieldCharDispatch(Int32 uid, Int32 Parm, Int32 Arg1, Int32 Arg2, Int32 Arg3)
    {
        FF9FieldCharState ff9FieldCharState = FF9StateSystem.Field.FF9Field.loc.map.charStateArray[uid];
        FF9Char           ff9Char           = FF9StateSystem.Common.FF9.charArray[uid];

        switch (Parm)
        {
        case 0:
            if ((Arg1 & 255) == 255)
            {
                ff9Char.attr = (UInt32)((UInt64)ff9Char.attr & 18446744073709486079UL);
            }
            else
            {
                if (Arg1 != (Int32)ff9FieldCharState.arate)
                {
                    ff9Char.attr |= 262144u;
                }
                ff9Char.attr |= 65536u;
            }
            ff9FieldCharState.arate = (SByte)Arg1;
            break;

        case 4:
            if (Arg1 != 0)
            {
                fldchar.geoSlice(ff9Char.geo, Arg2);
                ff9Char.attr |= 1048576u;
            }
            else
            {
                ff9Char.attr = (UInt32)((UInt64)ff9Char.attr & 18446744073708503039UL);
            }
            break;

        case 8:
        case 9:
        case 10:
        case 11:
        {
            FF9FieldCharMirror ff9FieldCharMirror = ff9FieldCharState.mirror;
            FF9Char            ff9Char2;
            if (ff9FieldCharMirror == null)
            {
                ff9FieldCharMirror          = (ff9FieldCharState.mirror = new FF9FieldCharMirror());
                ff9Char2                    = (ff9FieldCharMirror.chr = ff9Char);
                ff9Char2.attr               = 0u;
                ff9FieldCharMirror.geo      = ModelFactory.CreateModel(FF9BattleDB.GEO.GetValue((Int32)ff9Char.evt.model), false);
                ff9FieldCharMirror.geo.name = ff9Char.geo.name + "_mirror";
                Shader     shader = ShadersLoader.Find("PSX/FieldMapActor");
                Renderer[] componentsInChildren = ff9FieldCharMirror.geo.GetComponentsInChildren <Renderer>();
                Renderer[] array = componentsInChildren;
                for (Int32 i = 0; i < (Int32)array.Length; i++)
                {
                    Renderer renderer = array[i];
                    renderer.material.shader = shader;
                    renderer.material.SetColor("_Color", new Color(0.5f, 0.5f, 0.5f));
                    if (FF9StateSystem.Common.FF9.fldMapNo == 2653 || FF9StateSystem.Common.FF9.fldMapNo == 2654)
                    {
                        renderer.material.renderQueue = 2000;
                    }
                }
                ff9FieldCharMirror.geo.transform.SetParent(ff9Char.geo.transform.transform.parent);
                ff9FieldCharMirror.evt = ff9Char.evt;
                ff9FieldCharMirror.geo.transform.localScale       = new Vector3(-1f, 1f, 1f);
                ff9FieldCharMirror.geo.transform.localEulerAngles = Vector3.zero;
                ff9FieldCharMirror.geo.transform.localPosition    = Vector3.zero;
                ff9FieldCharMirror.actor = ff9FieldCharMirror.geo.AddComponent <FieldMapActor>();
                ff9FieldCharMirror.actor.meshRenderer = ff9FieldCharMirror.geo.GetComponentsInChildren <Renderer>();
                ff9FieldCharMirror.parent             = ff9Char;
                ff9FieldCharMirror.point  = Vector3.zero;
                ff9FieldCharMirror.normal = Vector3.zero;
                ff9FieldCharMirror.clr[0] = 0;
            }
            ff9Char2 = ff9FieldCharMirror.chr;
            if (FF9Char.ff9charptr_attr_test(ff9FieldCharMirror.chr, 1) == 0)
            {
                ff9Char2.evt = ff9Char.evt;
                FF9Char.ff9charptr_attr_set(ff9FieldCharMirror.chr, 33554433);
            }
            switch (Parm)
            {
            case 8:
                if (Arg1 != 0)
                {
                    FF9Char.ff9charptr_attr_set(ff9FieldCharMirror.chr, 16777216);
                    ff9FieldCharMirror.geo.SetActive(true);
                }
                else
                {
                    FF9Char.ff9charptr_attr_clear(ff9FieldCharMirror.chr, 16777216);
                    ff9FieldCharMirror.geo.SetActive(false);
                }
                break;

            case 9:
                ff9FieldCharMirror.point = new Vector3((Single)Arg1, (Single)Arg2, (Single)Arg3);
                break;

            case 10:
                ff9FieldCharMirror.normal = new Vector3((Single)(Arg1 >> 12), (Single)(Arg2 >> 12), (Single)(Arg3 >> 12));
                break;

            case 11:
                ff9FieldCharMirror.clr[0] = (Byte)Arg1;
                ff9FieldCharMirror.clr[1] = (Byte)Arg2;
                ff9FieldCharMirror.clr[2] = (Byte)Arg3;
                ff9FieldCharMirror.clr[3] = 2;
                break;
            }
            break;
        }

        case 16:
        case 17:
        case 18:
        case 19:
        {
            FF9FieldCharSound ff9FieldCharSound;
            if ((ff9FieldCharSound = FF9Snd.ff9fieldSoundGetChar(ff9Char, Arg1, Arg2)) == null && Parm != 19)
            {
                ff9FieldCharSound = FF9Snd.ff9fieldSoundNewChar(ff9Char, Arg1, Arg2);
            }
            switch (Parm)
            {
            case 16:
                ff9FieldCharSound.sndEffectID[0] = (UInt16)Arg3;
                break;

            case 17:
                ff9FieldCharSound.sndEffectID[1] = (UInt16)Arg3;
                break;

            case 18:
                ff9FieldCharSound.pitchRand = (SByte)((Arg3 == 0) ? 0 : 1);
                break;

            case 19:
                FF9Snd.ff9fieldSoundDeleteChar(ff9Char, Arg1, Arg2);
                break;
            }
            break;
        }
        }
    }
Esempio n. 15
0
    public static GameObject CreateModel(String path, Boolean isBattle = false)
    {
        String text = path;

        path = ModelFactory.CheckUpscale(path);
        String renameModelPath = ModelFactory.GetRenameModelPath(path);

        UnityEngine.Object @object = AssetManager.Load <GameObject>(renameModelPath, false);
        if (@object == (UnityEngine.Object)null)
        {
            return((GameObject)null);
        }
        GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(@object);

        if (text == "GEO_MAIN_F3_ZDN" || text == "GEO_MAIN_F4_ZDN" || text == "GEO_MAIN_F5_ZDN")
        {
            Renderer[] componentsInChildren = gameObject.GetComponentsInChildren <Renderer>();
            Renderer[] array = componentsInChildren;
            for (Int32 i = 0; i < (Int32)array.Length; i++)
            {
                Renderer renderer = array[i];
                String   name     = renderer.material.mainTexture.name;
                Char     c        = name[name.Length - 1];
                String   text2    = ModelFactory.GetGEOID(text).ToString();
                String   str      = text2 + "_" + c;
                String   name2    = "Models/2/" + text2 + "/" + str;
                Texture  texture  = AssetManager.Load <Texture>(name2, false);
                renderer.material.SetTexture("_MainTex", texture);
            }
        }
        Shader shader;

        if (text.Contains("GEO_SUB_W0"))
        {
            if (text.Contains("GEO_SUB_W0_025"))
            {
                shader = ShadersLoader.Find("WorldMap/ShadowActor");
            }
            else
            {
                shader = ShadersLoader.Find("WorldMap/Actor");
            }
        }
        else
        {
            shader = ShadersLoader.Find((!isBattle) ? "Unlit/Transparent Cutout" : "BattleMap_Common");
        }
        SkinnedMeshRenderer[] componentsInChildren2 = gameObject.GetComponentsInChildren <SkinnedMeshRenderer>();
        for (Int32 j = 0; j < (Int32)componentsInChildren2.Length; j++)
        {
            componentsInChildren2[j].material.shader = shader;
        }
        MeshRenderer[] componentsInChildren3 = gameObject.GetComponentsInChildren <MeshRenderer>();
        for (Int32 k = 0; k < (Int32)componentsInChildren3.Length; k++)
        {
            Material[] materials = componentsInChildren3[k].materials;
            for (Int32 l = 0; l < (Int32)materials.Length; l++)
            {
                Material material = materials[l];
                String   text3    = material.name.Replace("(Instance)", String.Empty);
                if (componentsInChildren3[k].name == "Group_2")
                {
                    material.shader = ShadersLoader.Find("BattleMap_Ground");
                }
                else if (text3.Contains("a"))
                {
                    material.shader = ShadersLoader.Find("PSX/BattleMap_Abr_1");
                }
                else
                {
                    material.shader = shader;
                }
            }
        }
        if (ModelFactory.garnetShortHairTable.Contains(text))
        {
            Boolean garnetShortHair;

            if (Configuration.Graphics.GarnetHair == 1)
            {
                garnetShortHair = false;
            }
            else if (Configuration.Graphics.GarnetHair == 2)
            {
                garnetShortHair = true;
            }
            else
            {
                garnetShortHair = BitConverter.ToUInt16(FF9StateSystem.EventState.gEventGlobal, 0) >= 10300;
            }

            if (garnetShortHair)
            {
                Renderer[] componentsInChildren4 = gameObject.transform.GetChildByName("long_hair").GetComponentsInChildren <Renderer>();
                Renderer[] array2 = componentsInChildren4;
                for (Int32 m = 0; m < (Int32)array2.Length; m++)
                {
                    Renderer renderer2 = array2[m];
                    renderer2.enabled = false;
                }
            }
            else
            {
                Renderer[] componentsInChildren5 = gameObject.transform.GetChildByName("short_hair").GetComponentsInChildren <Renderer>();
                Renderer[] array3 = componentsInChildren5;
                for (Int32 n = 0; n < (Int32)array3.Length; n++)
                {
                    Renderer renderer3 = array3[n];
                    renderer3.enabled = false;
                }
            }
        }
        if (gameObject != (UnityEngine.Object)null)
        {
            AnimationFactory.AddAnimToGameObject(gameObject, text);
            if (text.Contains("GEO_MON_"))
            {
                if (ModelFactory.upscaleTable.ContainsKey(text))
                {
                    text = ModelFactory.upscaleTable[text];
                }
                text = text.Replace("_UP0", "_B3");
                AnimationFactory.AddAnimToGameObject(gameObject, text);
            }
        }
        if (gameObject != (UnityEngine.Object)null)
        {
            if (isBattle)
            {
                Transform childByName = gameObject.transform.GetChildByName("field_model");
                if (childByName != (UnityEngine.Object)null)
                {
                    Renderer[] componentsInChildren6 = childByName.GetComponentsInChildren <Renderer>();
                    Renderer[] array4 = componentsInChildren6;
                    for (Int32 num2 = 0; num2 < (Int32)array4.Length; num2++)
                    {
                        Renderer renderer4 = array4[num2];
                        renderer4.enabled = false;
                    }
                }
            }
            else
            {
                Transform childByName2 = gameObject.transform.GetChildByName("battle_model");
                if (childByName2 != (UnityEngine.Object)null)
                {
                    Renderer[] componentsInChildren7 = childByName2.GetComponentsInChildren <Renderer>();
                    Renderer[] array5 = componentsInChildren7;
                    for (Int32 num3 = 0; num3 < (Int32)array5.Length; num3++)
                    {
                        Renderer renderer5 = array5[num3];
                        renderer5.enabled = false;
                    }
                }
            }
        }
        return(gameObject);
    }
Esempio n. 16
0
 private static void InitMaterial()
 {
     PSXGPU.matPSXShaderNoTexture        = new PSXMaterial(ShadersLoader.Find("PSXShaderNoTexture"));
     PSXGPU.matPSXShaderTextureNoShading = new PSXMaterial(ShadersLoader.Find("PSXShaderTextureNoShading"));
     PSXGPU.matPSXShaderTextureShading   = new PSXMaterial(ShadersLoader.Find("PSXShaderTextureShading"));
 }
Esempio n. 17
0
    public static void ff9fieldCharEffectService()
    {
        Dictionary <Int32, FF9Char>           charArray      = FF9StateSystem.Common.FF9.charArray;
        Dictionary <Int32, FF9FieldCharState> charStateArray = FF9StateSystem.Field.FF9Field.loc.map.charStateArray;

        if (charArray == null)
        {
            return;
        }
        List <Int32> list = new List <Int32>(charArray.Keys);

        foreach (Int32 key in list)
        {
            if (charArray.ContainsKey(key))
            {
                FF9Char ff9Char = charArray[key];
                if (charStateArray.ContainsKey(key))
                {
                    FF9FieldCharState ff9FieldCharState = charStateArray[key];
                    UInt32            num  = (UInt32)(ff9Char.attr & 65536u);
                    Int32             num2 = (Int32)((UInt64)(ff9FieldCharState.attr & 65536u) ^ (UInt64)((Int64)num));
                    Int32             num3 = FF9Char.ff9charptr_attr_test(ff9Char, 262144);
                    Int32             num4 = FF9Char.ff9charptr_attr_test(ff9Char, 131072);
                    Boolean           flag = num2 != 0 || num3 != 0 || num4 != 0;
                    if (ff9Char.geo)
                    {
                        Renderer[] componentsInChildren = ff9Char.geo.GetComponentsInChildren <Renderer>();
                        if (flag)
                        {
                            if (FF9Char.ff9charptr_attr_test(ff9Char, 65536) != 0)
                            {
                                Shader     shader = ShadersLoader.Find("PSX/Actor_Abr_" + ff9FieldCharState.arate);
                                Renderer[] array  = componentsInChildren;
                                for (Int32 i = 0; i < (Int32)array.Length; i++)
                                {
                                    Renderer   renderer  = array[i];
                                    Material[] materials = renderer.materials;
                                    for (Int32 j = 0; j < (Int32)materials.Length; j++)
                                    {
                                        Material material = materials[j];
                                        material.shader = shader;
                                    }
                                }
                            }
                            else
                            {
                                Shader shader2 = ShadersLoader.Find("PSX/FieldMapActor");

                                Renderer[] array2 = componentsInChildren;
                                for (Int32 k = 0; k < (Int32)array2.Length; k++)
                                {
                                    Renderer renderer2 = array2[k];
                                    renderer2.material.shader = shader2;
                                }
                            }
                            if (FF9Char.ff9charptr_attr_test(ff9Char, 131072) != 0)
                            {
                                FF9Char.ff9charptr_attr_clear(ff9Char, 131072);
                            }
                            FF9Char.ff9charptr_attr_clear(ff9Char, 262144);
                            if (num2 != 0 || num3 != 0)
                            {
                                FF9Char.ff9charptr_attr_set(ff9Char, 131072);
                            }
                            ff9FieldCharState.attr = (ff9FieldCharState.attr & 0xFFFEFFFF) | num;
                        }
                        FF9FieldCharColor ff9FieldCharColor = ff9FieldCharState.clr[0];
                        if (ff9FieldCharColor.active && !FF9StateSystem.Field.isDebugWalkMesh && (Int32)componentsInChildren.Length > 0)
                        {
                            Renderer[] array3 = componentsInChildren;
                            for (Int32 l = 0; l < (Int32)array3.Length; l++)
                            {
                                Renderer   renderer3  = array3[l];
                                Material[] materials2 = renderer3.materials;
                                for (Int32 m = 0; m < (Int32)materials2.Length; m++)
                                {
                                    Material material2 = materials2[m];
                                    Color32  c         = renderer3.material.GetColor("_Color");
                                    c.r = ff9FieldCharColor.r;
                                    c.g = ff9FieldCharColor.g;
                                    c.b = ff9FieldCharColor.b;
                                    material2.SetColor("_Color", c);
                                    ff9FieldCharState.clr[0] = ff9FieldCharState.clr[1];
                                }
                            }
                            ff9FieldCharState.clr[1] = default(FF9FieldCharColor);
                        }
                        FF9FieldCharMirror mirror = ff9FieldCharState.mirror;
                        if (mirror != null && FF9Char.ff9charptr_attr_test(mirror.chr, 16777216) != 0)
                        {
                            FF9Char chr    = mirror.chr;
                            Vector3 vector = mirror.point + ff9Char.geo.transform.localPosition;
                            vector   += mirror.point;
                            vector.y *= -1f;
                            mirror.geo.transform.position    = vector;
                            mirror.geo.transform.eulerAngles = ff9Char.geo.transform.eulerAngles;
                            Animation component  = ff9Char.geo.GetComponent <Animation>();
                            Animation component2 = mirror.geo.GetComponent <Animation>();
                            String    text       = FF9DBAll.AnimationDB.GetValue((Int32)ff9Char.evt.anim);
                            if (component2.GetClip(text) == (UnityEngine.Object)null)
                            {
                                AnimationClip clip = component.GetClip(text);
                                component2.AddClip(clip, text);
                            }
                            component2.Play(text);
                            component2[text].speed = 0f;
                            component2[text].time  = component[text].time;
                            component2.Sample();
                            Renderer[] componentsInChildren2 = mirror.geo.GetComponentsInChildren <Renderer>();
                            if (mirror.clr[3] != 0)
                            {
                                Color32 c2 = default(Color32);
                                c2.r = mirror.clr[0];
                                c2.g = mirror.clr[1];
                                c2.b = mirror.clr[2];
                                Renderer[] array4 = componentsInChildren2;
                                for (Int32 n = 0; n < (Int32)array4.Length; n++)
                                {
                                    Renderer renderer4 = array4[n];
                                    renderer4.material.SetColor("_Color", c2);
                                }
                                Byte[] clr  = mirror.clr;
                                Int32  num5 = 3;
                                clr[num5] = (Byte)(clr[num5] - 1);
                            }
                        }
                    }
                }
            }
        }
    }
Esempio n. 18
0
    private void CreateMaterial()
    {
        this.mTextureClip  = false;
        this.mLegacyShader = false;
        this.mClipCount    = this.panel.clipCount;
        String text = (!(this.mShader != (UnityEngine.Object)null)) ? ((!(this.mMaterial != (UnityEngine.Object)null)) ? "Unlit/Transparent Colored" : this.mMaterial.shader.name) : this.mShader.name;

        text = text.Replace("GUI/Text Shader", "Unlit/Text");
        if (text.Length > 2 && text[text.Length - 2] == ' ')
        {
            Int32 num = (Int32)text[text.Length - 1];
            if (num > 48 && num <= 57)
            {
                text = text.Substring(0, text.Length - 2);
            }
        }
        if (text.StartsWith("Hidden/"))
        {
            text = text.Substring(7);
        }
        text = text.Replace(" (SoftClip)", String.Empty);
        text = text.Replace(" (TextureClip)", String.Empty);
        if (this.panel.clipping == UIDrawCall.Clipping.TextureMask)
        {
            this.mTextureClip = true;
            this.shader       = ShadersLoader.Find("Hidden/" + text + " (TextureClip)");
        }
        else if (this.mClipCount != 0)
        {
            this.shader = ShadersLoader.Find(String.Concat(new Object[]
            {
                "Hidden/",
                text,
                " ",
                this.mClipCount
            }));
            if (this.shader == (UnityEngine.Object)null)
            {
                this.shader = ShadersLoader.Find(text + " " + this.mClipCount);
            }
            if (this.shader == (UnityEngine.Object)null && this.mClipCount == 1)
            {
                this.mLegacyShader = true;
                this.shader        = ShadersLoader.Find(text + " (SoftClip)");
            }
        }
        else
        {
            this.shader = ShadersLoader.Find(text);
        }
        if (this.shader == (UnityEngine.Object)null)
        {
            this.shader = ShadersLoader.Find("Unlit/Transparent Colored");
        }
        if (this.mMaterial != (UnityEngine.Object)null)
        {
            this.mDynamicMat           = new Material(this.mMaterial);
            this.mDynamicMat.name      = "[NGUI] " + this.mMaterial.name;
            this.mDynamicMat.hideFlags = (HideFlags.DontSaveInEditor | HideFlags.NotEditable | HideFlags.DontSaveInBuild | HideFlags.DontUnloadUnusedAsset);
            this.mDynamicMat.CopyPropertiesFromMaterial(this.mMaterial);
            String[] shaderKeywords = this.mMaterial.shaderKeywords;
            for (Int32 i = 0; i < (Int32)shaderKeywords.Length; i++)
            {
                this.mDynamicMat.EnableKeyword(shaderKeywords[i]);
            }
            if (this.shader != (UnityEngine.Object)null)
            {
                this.mDynamicMat.shader = this.shader;
            }
            else if (this.mClipCount != 0)
            {
                global::Debug.LogError(String.Concat(new Object[]
                {
                    text,
                    " shader doesn't have a clipped shader version for ",
                    this.mClipCount,
                    " clip regions"
                }));
            }
        }
        else
        {
            this.mDynamicMat           = new Material(this.shader);
            this.mDynamicMat.name      = "[NGUI] " + this.shader.name;
            this.mDynamicMat.hideFlags = (HideFlags.DontSaveInEditor | HideFlags.NotEditable | HideFlags.DontSaveInBuild | HideFlags.DontUnloadUnusedAsset);
        }
    }