| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- 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<string> list = new List<string>();
- 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<string, float> dicDepth = new Dictionary<string, float>();
- 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();
- }
- }
- }
|