コード例 #1
0
        public static string GeneratePlayerDataGetterScript(List <PlayerDataEditorData> datas)
        {
            ClassGenerationData classData = new ClassGenerationData
            {
                m_ClassName = "PlayerDataGetter",
                m_Namespace = PlayerDataCodeGeneratorConstants.NAMESPACE_GAME,
                m_Usings    = new string[] { "UniRx", "System", "System.Collections.Generic", PlayerDataCodeGeneratorConstants.NAMESPACE_FRAMEWORK },
                m_ClassType = ClassType.Partial
            };

            for (int i = 0; i < datas.Count; i++)
            {
                if (!datas[i].shouldGenerateGetter)
                {
                    continue;
                }

                classData.m_MethodGenerationDatas.AddRange(PlayerDataMethodGenerator.GenerateGetterMethods(datas[i]));
            }


            string code = ClassGenerator.CreateClass(classData);

            return(code);
        }
コード例 #2
0
        public static string GeneratePlayerDataLoaderScript(List <PlayerDataEditorData> datas, string category)
        {
            ClassGenerationData classData = new ClassGenerationData
            {
                m_ClassName = "PlayerDataLoader",
                m_Namespace = PlayerDataCodeGeneratorConstants.NAMESPACE_GAME,
                m_ClassType = ClassType.Partial,
                m_Usings    = new string[] { "UniRx", "System", "System.Collections.Generic", PlayerDataCodeGeneratorConstants.NAMESPACE_FRAMEWORK }
            };

            classData.m_MethodGenerationDatas.Add(PlayerDataMethodGenerator.GenerateLoadMethod(datas, category));

            string code = ClassGenerator.CreateClass(classData);

            return(code);
        }