// *********************************************************************** // Assembly : Unity // Author : KimCh // Created : // // Last Modified By : KimCh // Last Modified On : // *********************************************************************** // // // *********************************************************************** using System.Collections.Generic; namespace G { public class GlobalProxy : F.GameProxy { #region FIELD private readonly Dictionary _configs = new Dictionary(); #endregion #region METHOD /// /// /// /// /// public int GetInt(int id) { var paramItem = ItemProxy.Instance.GetStaticItem(id); if (paramItem != null) { return paramItem.intValue; } return 0; } /// /// /// /// /// 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(id); if (paramItem != null) { return paramItem.stringValue; } return ""; } /// /// /// /// /// public string GetString(string key) { if (_configs.TryGetValue(key, out var item)) return item.stringValue; return ""; } #endregion #region Proxy public static GlobalProxy Instance => GetInstance(); public override void LoadCompleted() { var paramItems = ItemProxy.Instance.GetStaticItems(); if (paramItems != null) { foreach (var item in paramItems) { _configs.Add(item.key, item); } } } #endregion } }