Пример #1
0
        public static Dictionary <TK, T> LoadDictionary <TK, T>(string text) where T : ITableToolData, new()
        {
            PrepareForLoad <T>(text);
            Dictionary <TK, T> dic    = new Dictionary <TK, T>();
            Onload             onload = (a, b) =>
            {
                T t = new T();
                t.SetData(b);
                dic[(TK)b[0]] = t;
            };

            Load(onload);
            ReleaseData();
            return(dic);
        }
Пример #2
0
        public static T[] LoadTable <T>(string text) where T : ITableToolData, new()
        {
            PrepareForLoad <T>(text);

            T[]    list   = new T[_lines.Length - PARAM_COUNT];
            Onload onload = (a, b) =>
            {
                list[a] = new T();
                list[a].SetData(b);
            };

            Load(onload);
            ReleaseData();
            return(list);
        }
Пример #3
0
    /* UNITY FUNCTIONS */

    //enforce singleton
    private void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        //DontDestroyOnLoad(gameObject);
    }
Пример #4
0
        private static void Load(Onload onload)
        {
            int i = 0, j = 0;

            object[] paramList;

            for (i = PARAM_COUNT; i < _lines.Length; i++)
            {
                paramList = new object[_needRead.Count];

                string[] words = _lines[i].SplitStringByTab();
                for (j = 0; j < _needRead.Count; j++)
                {
                    paramList[j] = ParseExcelType(words[_needRead[j]], _tableData.ConstructorTypes[j]);
                }

                onload(i - PARAM_COUNT, paramList);
            }
        }