Пример #1
0
        protected override ConfigFileContent LoadJsonConfig(string json)
        {
            ConfigFileContentList gameList = JsonUtility.FromJson <ConfigFileContentList>(json);

            if (gameList.Entries == null || gameList.Entries.Length == 0 || transform.GetSiblingIndex() > gameList.Entries.Length - 1)
            {
                return(null);
            }

            return(gameList.Entries[transform.GetSiblingIndex()]);
        }
Пример #2
0
        protected override string GetJsonConfig()
        {
            GameModelSetup[] gameModelSetups = transform.parent.GetComponentsInChildren <GameModelSetup>();
            if (gameModelSetups.Length == 0)
            {
                return(null);
            }

            ConfigFileContentList gameList = new ConfigFileContentList(gameModelSetups.Length);

            for (int i = 0; i < gameModelSetups.Length; ++i)
            {
                gameList.Entries[i] = new ConfigFileContent(gameModelSetups[i]);
            }

            return(JsonUtility.ToJson(gameList, true));
        }