public void Service() { if (!this._isReady) { return; } for (Int32 i = 0; i < this._spsList.Count; i++) { BattleSPS battleSPS = this._spsList[i]; if ((battleSPS.type != 0 || battleSPS.spsBin != null) && (battleSPS.attr & 1) != 0) { if (battleSPS.lastFrame != -1) { battleSPS.lastFrame = battleSPS.curFrame; battleSPS.curFrame += battleSPS.frameRate; if (battleSPS.curFrame >= battleSPS.frameCount) { battleSPS.curFrame = 0; } else if (battleSPS.curFrame < 0) { battleSPS.curFrame = (battleSPS.frameCount >> 4) - 1 << 4; } } } } }
public void Init() { this.rot = new Vector3(0f, 0f, 0f); this._isReady = false; this._spsList = new List <BattleSPS>(); this._spsBinDict = new Dictionary <Int32, KeyValuePair <Int32, Byte[]> >(); for (Int32 i = 0; i < 96; i++) { GameObject gameObject = new GameObject("SPS_" + i.ToString("D4")); gameObject.transform.parent = base.transform; gameObject.transform.localScale = Vector3.one; gameObject.transform.localPosition = Vector3.zero; MeshRenderer meshRenderer = gameObject.AddComponent <MeshRenderer>(); MeshFilter meshFilter = gameObject.AddComponent <MeshFilter>(); BattleSPS battleSPS = gameObject.AddComponent <BattleSPS>(); battleSPS.Init(); battleSPS.spsIndex = i; battleSPS.spsTransform = gameObject.transform; battleSPS.meshRenderer = meshRenderer; battleSPS.meshFilter = meshFilter; this._spsList.Add(battleSPS); } this.MapName = FF9StateSystem.Field.SceneName; this._isReady = this._loadSPSTexture(); }
public void UpdateBtlStatus(BTL_DATA btl, BattleStatus status, Vector3 pos, Vector3 rot, Int32 frame) { Int32 objSpsIndex = this.GetObjSpsIndex(btl, status); BattleSPS battleSPS = this._spsList[objSpsIndex]; battleSPS.pos = new Vector3(pos.x, pos.y, pos.z); battleSPS.curFrame = frame << 4; if ((battleSPS.attr & 1) == 0) { BattleSPS battleSPS2 = battleSPS; battleSPS2.attr = (Byte)(battleSPS2.attr | 1); } battleSPS.isUpdate = true; }
public void SetBtlStatus(Int32 ObjNo, Int32 StatusNo, Byte abr = 0, Int32 type = 0) { BattleSPS battleSPS = this._spsList[ObjNo]; if (StatusNo != -1) { battleSPS.type = type; if (type == 0) { if (this._loadSPSBin(StatusNo)) { battleSPS.spsBin = this._spsBinDict[StatusNo].Value; battleSPS.curFrame = 0; battleSPS.frameCount = this._spsBinDict[StatusNo].Key; battleSPS.arate = abr; BattleSPS battleSPS2 = battleSPS; battleSPS2.attr = (Byte)(battleSPS2.attr & 254); if ((battleSPS.attr & 1) == 0) { battleSPS.meshRenderer.enabled = false; } battleSPS.refNo = StatusNo; battleSPS.spsScale = BattleSPSSystem.statusTextures[battleSPS.refNo].spsScale; battleSPS.spsDistance = BattleSPSSystem.statusTextures[battleSPS.refNo].spsDistance; } } else { battleSPS.refNo = StatusNo; if (battleSPS.shpGo == null) { battleSPS.GenerateSHP(); } } } else { battleSPS.spsBin = null; battleSPS.meshRenderer.enabled = false; if (battleSPS.type == 1) { battleSPS.type = 0; for (Int32 i = 0; i < (Int32)battleSPS.shpGo.Length; i++) { battleSPS.shpGo[i].SetActive(false); } } } }
public void SetActiveSHP(Boolean active) { for (Int32 i = 0; i < this._spsList.Count; i++) { BattleSPS battleSPS = this._spsList[i]; if (battleSPS.shpGo == null) { return; } for (Int32 j = 0; j < (Int32)battleSPS.shpGo.Length; j++) { battleSPS.shpGo[j].SetActive(active); } } }
public void GenerateSPS() { if (!this._isReady) { return; } for (Int32 i = 0; i < this._spsList.Count; i++) { BattleSPS battleSPS = this._spsList[i]; if ((battleSPS.type != 0 || battleSPS.spsBin != null) && (battleSPS.attr & 1) != 0) { if (battleSPS.type == 0) { if (battleSPS.charTran != (UnityEngine.Object)null && battleSPS.boneTran != (UnityEngine.Object)null) { battleSPS.pos = battleSPS.boneTran.position + battleSPS.posOffset; } if (battleSPS.isUpdate) { battleSPS.meshRenderer.enabled = true; battleSPS.GenerateSPS(); battleSPS.isUpdate = false; } else { battleSPS.meshRenderer.enabled = false; } } else { battleSPS.AnimateSHP(); } battleSPS.lastFrame = battleSPS.curFrame; } } }
public void FF9FieldSPSSetObjParm(Int32 ObjNo, Int32 ParmType, Int32 Arg0, Int32 Arg1, Int32 Arg2) { BattleSPS battleSPS = this._spsList[ObjNo]; if (ParmType == 130) { if (Arg0 != -1) { if (this._loadSPSBin(Arg0)) { battleSPS.spsBin = this._spsBinDict[Arg0].Value; battleSPS.curFrame = 0; battleSPS.frameCount = this._spsBinDict[Arg0].Key; } battleSPS.refNo = Arg0; } else { battleSPS.spsBin = null; battleSPS.meshRenderer.enabled = false; } } else if (ParmType == 131) { if (Arg1 != 0) { BattleSPS battleSPS2 = battleSPS; battleSPS2.attr = (Byte)(battleSPS2.attr | (Byte)Arg0); } else { BattleSPS battleSPS3 = battleSPS; battleSPS3.attr = (Byte)(battleSPS3.attr & (Byte)(~(Byte)Arg0)); } if ((battleSPS.attr & 1) == 0) { battleSPS.meshRenderer.enabled = false; } else { battleSPS.meshRenderer.enabled = true; } } else if (ParmType == 135) { battleSPS.pos = new Vector3((Single)Arg0, (Single)(Arg1 * -1), (Single)Arg2); } else if (ParmType == 140) { battleSPS.rot = new Vector3((Single)Arg0 / 4096f * 360f, (Single)Arg1 / 4096f * 360f, (Single)Arg2 / 4096f * 360f); } else if (ParmType == 145) { battleSPS.scale = Arg0; } else if (ParmType == 150) { Obj objUID = PersistenSingleton <EventEngine> .Instance.GetObjUID(Arg0); battleSPS.charNo = Arg0; battleSPS.boneNo = Arg1; battleSPS.charTran = objUID.go.transform; battleSPS.boneTran = objUID.go.transform.GetChildByName("bone" + battleSPS.boneNo.ToString("D3")); } else if (ParmType == 155) { battleSPS.fade = (Byte)Arg0; } else if (ParmType == 156) { battleSPS.arate = (Byte)Arg0; } else if (ParmType == 160) { battleSPS.frameRate = Arg0; } else if (ParmType == 161) { battleSPS.curFrame = Arg0 << 4; } else if (ParmType == 165) { battleSPS.posOffset = new Vector3((Single)Arg0, (Single)(-(Single)Arg1), (Single)Arg2); } else if (ParmType == 170) { battleSPS.depthOffset = Arg0; } }