96 lines
1.9 KiB
C#
96 lines
1.9 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Unity
|
|||
|
// Author : KimCh
|
|||
|
// Created :
|
|||
|
//
|
|||
|
// Last Modified By : KimCh
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "GameProxy" company=""></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
namespace G
|
|||
|
{
|
|||
|
public class GlobalProxy : F.GameProxy
|
|||
|
{
|
|||
|
#region FIELD
|
|||
|
|
|||
|
private readonly Dictionary<string, ItemParam> _configs = new Dictionary<string, ItemParam>();
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region METHOD
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
/// <param name="id"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public int GetInt(int id)
|
|||
|
{
|
|||
|
var paramItem = ItemProxy.Instance.GetStaticItem<ItemParam>(id);
|
|||
|
if (paramItem != null)
|
|||
|
{
|
|||
|
return paramItem.intValue;
|
|||
|
}
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
/// <param name="key"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public int GetInt(string key)
|
|||
|
{
|
|||
|
if (_configs.TryGetValue(key, out var item))
|
|||
|
return item.intValue;
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
public string GetString(int id)
|
|||
|
{
|
|||
|
var paramItem = ItemProxy.Instance.GetStaticItem<ItemParam>(id);
|
|||
|
if (paramItem != null)
|
|||
|
{
|
|||
|
return paramItem.stringValue;
|
|||
|
}
|
|||
|
return "";
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
/// <param name="key"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public string GetString(string key)
|
|||
|
{
|
|||
|
if (_configs.TryGetValue(key, out var item))
|
|||
|
return item.stringValue;
|
|||
|
return "";
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Proxy
|
|||
|
|
|||
|
public static GlobalProxy Instance => GetInstance<GlobalProxy>();
|
|||
|
|
|||
|
public override void LoadCompleted()
|
|||
|
{
|
|||
|
var paramItems = ItemProxy.Instance.GetStaticItems<ItemParam>();
|
|||
|
if (paramItems != null)
|
|||
|
{
|
|||
|
foreach (var item in paramItems)
|
|||
|
{
|
|||
|
_configs.Add(item.key, item);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|