using FLOW; using System.Collections; using System.Collections.Generic; using System.IO; using System.Text; using UnityCommon; using UnityEngine; namespace DTYJ { public class ShuiZaiCtrl : MonoBehaviour { public static ShuiZaiCtrl Instance { get; private set; } public FlowSimulation flowSim_Up, flowSim_down; public FlowModifier flowModifierAddLiquid_Up, flowModifierAddLiquid_down1, flowModifierAddLiquid_down2, flowModifierAddLiquid_down3; private void Awake() { Instance = this; flowSim_Up.gameObject.SetActive(OnlineCtrl.Instance.mineRoleName != RoleName.站务员_站台); flowSim_down.gameObject.SetActive(OnlineCtrl.Instance.mineRoleName == RoleName.站务员_站台); Utility.Update(5, () => { foreach (var kvp in dicDepth) { ControllerPanel.instance.CmdOnLevel(kvp.Key, kvp.Value); } }); string filePath = Path.Combine(Application.streamingAssetsPath, "Data/水灾预案配置.csv"); string[] strLines = File.ReadAllLines(filePath, UnicodeEncoding.GetEncoding("GBK")); List list = new List(); list.AddRange(strLines); //for (int i = 1; i < strLines.Length; i++) //{ // string line = strLines[i]; // var arr = line.Split(','); // if (arr.Length >= 2) // { // list.Add(arr[1]); // } //} UIYuAnCtrl.Instance.Init(list); UIYuAnCtrl.Instance.Show(true); } private void OnDestroy() { UIYuAnCtrl.Instance.Show(false); } public Dictionary dicDepth = new Dictionary(); public void OnSampleDepth(FlowSample flowSample) { dicDepth[flowSample.name] = flowSample.FluidDepth; } public void SetFlowValue_up(float v) { flowModifierAddLiquid_Up.Strength = v; } public void OnFluidDepth(FlowSimulation simulation, float depth) { //flowModifierAddLiquid_down.Strength = depth; ControllerPanel.instance?.CmdSetShuiZai_down(depth); } public void OnFluidComing() { //flowModifierAddLiquid_down.Strength = depth; ControllerPanel.instance?.CmdSetShuiZai_down(1.5f); } public void OnFluidLeave() { ControllerPanel.instance?.CmdSetShuiZai_down(0); } public void SetFlowValue_down(float v) { flowModifierAddLiquid_down1.Strength = v; flowModifierAddLiquid_down2.Strength = v; flowModifierAddLiquid_down3.Strength = v; } public void UpdateGround() { flowSim_Up?.UpdateGround(); flowSim_down?.UpdateGround(); } } }