You've already forked taptap2024_GJ_chidouren
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
|
|
using System.Collections.Generic;
|
||
|
|
|
||
|
|
namespace IcecreamView
|
||
|
|
{
|
||
|
|
public class IC_ViewData
|
||
|
|
{
|
||
|
|
internal const string DefaultCode = "DEFAULT_MSG";
|
||
|
|
public string code;
|
||
|
|
public List<object> values;
|
||
|
|
public int MsgCount => values?.Count ?? 0;
|
||
|
|
|
||
|
|
public IC_ViewData(params object[] values)
|
||
|
|
{
|
||
|
|
this.code = DefaultCode;
|
||
|
|
this.values = new List<object>();
|
||
|
|
this.values.AddRange(values);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static IC_ViewData CreateData(string code, params object[] values)
|
||
|
|
{
|
||
|
|
var data = new IC_ViewData(values);
|
||
|
|
data.code = code;
|
||
|
|
return data;
|
||
|
|
}
|
||
|
|
|
||
|
|
public T GetValue<T>(int index = 0)
|
||
|
|
{
|
||
|
|
if (this.values[index] == null)
|
||
|
|
return default;
|
||
|
|
return (T) this.values[index];
|
||
|
|
}
|
||
|
|
|
||
|
|
public object GetValue(int index = 0)
|
||
|
|
{
|
||
|
|
if (this.values[index] == null)
|
||
|
|
return default;
|
||
|
|
return this.values[index];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|