Files
PrinceOfGlory/Assets/Scripts/Logic/Network/NetConfig.cs
kridoo 6e91a0c7f0 111
2025-09-15 17:32:08 +08:00

55 lines
1.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "WebSocketNetConfig", menuName = "WebSocketNetConfig", order = 0)]
public class NetConfig : ScriptableObject
{
[Header("--------- 测试 ------------")]
[Header("测试服")]
public string Address_Test = "ws://10.0.6.171:8888/game/ws";
[Space(50)]
[Header("--------- 正式 ------------")]
[Header("正式服")]
public string Address_Production = "ws://192.168.1.88:8888/game/ws";
[Space(50)]
[Header("使用网络连接地址")]
public UseAddress UseNet = UseAddress.Address_Test;
[Space(50)]
[Header("websocket 使用字节流模式 互斥")]
public bool UseByte = true;
[Header("websocket 使用文本模式 互斥")]
public bool UseText = false;
[Header("显示websocket的log")]
public bool ShowLog = true;
[Header("心跳开关")]
public bool HeartBeatEnable = false;
[Header("模拟断线重连")]
public bool SimulateOfflineReConnect = false;
[Header("断线期间,是否缓存未发送成功的请求")]
public bool CacheRequestOnDisconnect = false;
public string GetUrl()
{
switch (UseNet)
{
case UseAddress.Address_Test: return Address_Test;
case UseAddress.Address_Production: return Address_Production;
}
return "";
}
}
public enum UseAddress
{
[InspectorName("测试服")]
Address_Test,
[InspectorName("正式服")]
Address_Production,
}