12345678910111213141516171819202122232425262728293031323334353637 |
- using System;
- using System.Threading;
- using Ragdoll;
- using UnityEngine;
- namespace HttpApi
- {
- public class RdFakeSocket : ScriptSingleton<RdFakeSocket>
- {
- private const int SleepTime = 2000;
- private Thread _thread;
- private volatile bool _workerRunning = false;
- public void Start()
- {
- _workerRunning = true;
- _thread = new Thread(Worker);
- _thread.Start();
- }
- private async void Worker()
- {
- while (_workerRunning)
- {
- Thread.Sleep(SleepTime);
- var response = await Api.RefreshMsgList();
- }
- }
- public void Stop()
- {
- _workerRunning = false;
- }
- }
- }
|