private void LoadMaskData(String fileName) { this.maskSheet.Clear(); this.maskData.Clear(); this.haveMask = false; this.currentMaskID = -1; this.loadedMask = 0; this.maskCount = 0; if (this.maskSheetData.ContainsKey(fileName)) { this.haveMask = true; this.maskName = fileName; this.maskCount = this.maskSheetData[this.maskName]; for (Int32 i = 0; i < this.maskCount; i++) { String name = String.Concat(new Object[] { "EmbeddedAsset/Movie/Mask/", this.maskName, "/", this.maskName, "_", i, ".txt" }); TextAsset textAsset = AssetManager.Load <TextAsset>(name, false); JSONNode jsonnode = JSONNode.Parse(textAsset.text); JSONClass asObject = jsonnode["frames"].AsObject; foreach (Object obj in asObject) { String key = ((KeyValuePair <String, JSONNode>)obj).Key; Int32 key2 = Int32.Parse(key); MaskFrame maskFrame = new MaskFrame(); JSONClass asObject2 = asObject[key].AsObject; JSONClass asObject3 = asObject2["frame"].AsObject; Vector4 frame = new Vector4((Single)asObject3["x"].AsInt, (Single)asObject3["y"].AsInt, (Single)asObject3["w"].AsInt, (Single)asObject3["h"].AsInt); JSONClass asObject4 = asObject2["spriteSourceSize"].AsObject; Vector4 sourceSize = new Vector4((Single)asObject4["x"].AsInt, (Single)asObject4["y"].AsInt, (Single)asObject4["w"].AsInt, (Single)asObject4["h"].AsInt); maskFrame.frame = frame; maskFrame.sourceSize = sourceSize; maskFrame.sheetID = i; this.maskData.Add(key2, maskFrame); } } if (this.maskCount > 0) { this.UpdateMarkSheet(); } } }
public void UpdateCamera() { Int32 num = this.GetFrame; if (this.audioDef != null && num < this.audioDef.Count) { MBG.MarkCharacterDepth = true; AUDIO_HDR_DEF audio_HDR_DEF = this.audioDef[num]; if (this.isMBG116 && num >= 1152 && num <= 1155) { audio_HDR_DEF = this.audioDef[1151]; } MBG_CAM_DEF mbgCameraA = audio_HDR_DEF.mbgCameraA; Vector2 centerOffset = mbgCameraA.GetCenterOffset(); if (this.currentFieldMap != (UnityEngine.Object)null && FF9StateSystem.Common.FF9.fldMapNo != 2752) { Vector2 offset = this.currentFieldMap.offset; Vector2 zero = Vector2.zero; zero.x = (Single)((Int16)(this.currentFieldMap.offset.x - (Single)mbgCameraA.centerOffset[0])); zero.y = (Single)((Int16)(this.currentFieldMap.offset.y + (Single)mbgCameraA.centerOffset[1])); this.currentFieldMap.mainCamera.transform.localPosition = zero; Shader.SetGlobalMatrix("_MatrixRT", mbgCameraA.GetMatrixRT()); Shader.SetGlobalFloat("_ViewDistance", mbgCameraA.GetViewDistance()); FF9StateSystem.Common.FF9.cam = mbgCameraA.GetMatrixRT(); FF9StateSystem.Common.FF9.proj = mbgCameraA.proj; } if ((FF9StateSystem.Settings.cfg.vibe == (UInt64)FF9CFG.FF9CFG_VIBE_ON || PersistenSingleton <FF9StateSystem> .Instance.mode == 5) && !PersistenSingleton <UIManager> .Instance.IsPause && UIManager.Field != (UnityEngine.Object)null && !UIManager.Field.isShowSkipMovieDialog) { vib.VIB_actuatorSet(0, audio_HDR_DEF.vibrate[0] / 255f, audio_HDR_DEF.vibrate[1] / 255f); } } if (FF9StateSystem.Common.FF9.fldMapNo != 2933) { num++; } if (this.haveMask && this.maskData.ContainsKey(num)) { ObjList activeObjList = PersistenSingleton <EventEngine> .Instance.GetActiveObjList(); for (ObjList objList = activeObjList; objList != null; objList = objList.next) { if (objList.obj.cid == 4) { SkinnedMeshRenderer[] componentsInChildren = objList.obj.go.GetComponentsInChildren <SkinnedMeshRenderer>(); SkinnedMeshRenderer[] array = componentsInChildren; for (Int32 i = 0; i < (Int32)array.Length; i++) { SkinnedMeshRenderer skinnedMeshRenderer = array[i]; Material[] materials = skinnedMeshRenderer.materials; for (Int32 j = 0; j < (Int32)materials.Length; j++) { Material material = materials[j]; if (skinnedMeshRenderer.material.shader != this.shader) { skinnedMeshRenderer.material.shader = this.shader; skinnedMeshRenderer.material.renderQueue = this.renderQueue; } } } } } MaskFrame maskFrame = this.maskData[num]; if (this.isMBG116 && num >= 1150 && num <= 1154) { maskFrame = this.maskData[1149]; } Shader.SetGlobalVector("_Frame", maskFrame.frame); Shader.SetGlobalVector("_SpriteSourceSize", maskFrame.sourceSize); Int32 sheetID = maskFrame.sheetID; Vector2 zero2 = Vector2.zero; zero2.x = maskFrame.frame.z; zero2.y = maskFrame.frame.w; if (this.maskSheet.ContainsKey(sheetID) && sheetID != this.currentMaskID && zero2 != Vector2.one) { Texture2D tex = this.maskSheet[sheetID]; Shader.SetGlobalTexture("_MBGMask", tex); if (this.maskSheet.ContainsKey(this.currentMaskID)) { Resources.UnloadAsset(this.maskSheet[this.currentMaskID]); this.maskSheet.Remove(this.currentMaskID); this.UpdateMarkSheet(); } this.currentMaskID = sheetID; } } if (this.currentFieldMap != (UnityEngine.Object)null && FF9StateSystem.Common.FF9.fldMapNo == 2933) { ObjList activeObjList2 = PersistenSingleton <EventEngine> .Instance.GetActiveObjList(); for (ObjList objList2 = activeObjList2; objList2 != null; objList2 = objList2.next) { if (objList2.obj.uid == 4 && num == 1154) { Actor actor = (Actor)objList2.obj; actor.flags = 0; } if (objList2.obj.uid == 4) { Actor actor2 = (Actor)objList2.obj; if (num > 1045) { Vector3 curPos = actor2.fieldMapActorController.curPos; curPos.y = -30f; actor2.fieldMapActorController.curPos = curPos; actor2.fieldMapActorController.SyncPosToTransform(); } } if (objList2.obj.uid == 1) { Actor actor3 = (Actor)objList2.obj; if (num == 366 || num == 392) { actor3.flags = 0; } else if (num == 393) { actor3.flags = 1; } else if ((num > 628 && num < 636) || num == 392 || num == 1156 || num == 89) { SkinnedMeshRenderer[] componentsInChildren2 = objList2.obj.go.GetComponentsInChildren <SkinnedMeshRenderer>(); SkinnedMeshRenderer[] array2 = componentsInChildren2; for (Int32 k = 0; k < (Int32)array2.Length; k++) { SkinnedMeshRenderer skinnedMeshRenderer2 = array2[k]; skinnedMeshRenderer2.enabled = true; } Transform transform = objList2.obj.go.transform.FindChild("battle_model"); if (transform == (UnityEngine.Object)null) { return; } Renderer[] componentsInChildren3 = transform.GetComponentsInChildren <Renderer>(); Renderer[] array3 = componentsInChildren3; for (Int32 l = 0; l < (Int32)array3.Length; l++) { Renderer renderer = array3[l]; renderer.enabled = false; } } else if (num == 88 || num == 391 || num == 1154 || num == 1155) { SkinnedMeshRenderer[] componentsInChildren4 = objList2.obj.go.GetComponentsInChildren <SkinnedMeshRenderer>(); SkinnedMeshRenderer[] array4 = componentsInChildren4; for (Int32 m = 0; m < (Int32)array4.Length; m++) { SkinnedMeshRenderer skinnedMeshRenderer3 = array4[m]; skinnedMeshRenderer3.enabled = false; } Transform transform2 = objList2.obj.go.transform.FindChild("battle_model"); if (transform2 == (UnityEngine.Object)null) { return; } Renderer[] componentsInChildren5 = transform2.GetComponentsInChildren <Renderer>(); Renderer[] array5 = componentsInChildren5; for (Int32 n = 0; n < (Int32)array5.Length; n++) { Renderer renderer2 = array5[n]; renderer2.enabled = false; } } else if (num == 980) { actor3.flags = 0; } } else if (objList2.obj.uid == 5) { Actor actor4 = (Actor)objList2.obj; if (num == 42) { actor4.flags = 0; } } } } }