72 lines
2.2 KiB
C#
72 lines
2.2 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Text;
|
|||
|
using System.Text.RegularExpressions;
|
|||
|
using UnityEngine;
|
|||
|
using Games.GlobeDefine;
|
|||
|
|
|||
|
namespace GCGame.Table
|
|||
|
{
|
|||
|
public class SystemParam
|
|||
|
{
|
|||
|
public static string GetSystemParam_STRING(int keyID)
|
|||
|
{
|
|||
|
Tab_SystemParam system = TableManager.GetSystemParamByID(keyID, 0);
|
|||
|
if (system == null)
|
|||
|
return "";
|
|||
|
string param = system.StringValue;
|
|||
|
param = param.Replace("\\", "");
|
|||
|
param = param.Replace("\"", "");
|
|||
|
return param;
|
|||
|
}
|
|||
|
public static int GetSystemParam_INT(int keyID)
|
|||
|
{
|
|||
|
Tab_SystemParam system = TableManager.GetSystemParamByID(keyID,0);
|
|||
|
if (system == null)
|
|||
|
return 0;
|
|||
|
string param = system.StringValue;
|
|||
|
param = param.Replace("\\", "");
|
|||
|
param = param.Replace("\"", "");
|
|||
|
int result = 0;
|
|||
|
int.TryParse(param, out result);
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public static float GetSystemParam_FLOAT(int keyID)
|
|||
|
{
|
|||
|
Tab_SystemParam system = TableManager.GetSystemParamByID(keyID, 0);
|
|||
|
if (system == null)
|
|||
|
return 0;
|
|||
|
string param = system.StringValue;
|
|||
|
param = param.Replace("\\", "");
|
|||
|
param = param.Replace("\"", "");
|
|||
|
float result = 0;
|
|||
|
float.TryParse(param, out result);
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public static Vector4 GetSystemParam_Vector(int keyID)
|
|||
|
{
|
|||
|
Tab_SystemParam system = TableManager.GetSystemParamByID(keyID, 0);
|
|||
|
if (system == null)
|
|||
|
return Vector4.zero;
|
|||
|
string param = system.StringValue;
|
|||
|
param = param.Replace("\\", "");
|
|||
|
param = param.Replace("\"", "");
|
|||
|
string[] strs = param.Split(',');
|
|||
|
Vector4 result = Vector4.zero;
|
|||
|
for(int i=0;i<4;i++)
|
|||
|
{
|
|||
|
if(strs.Length>i)
|
|||
|
{
|
|||
|
float data = 0;
|
|||
|
float.TryParse(strs[i], out data);
|
|||
|
result[i] = data;
|
|||
|
}
|
|||
|
}
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|