예제 #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);
        }
예제 #3
0
        public static string GeneratePlayerDataScript(List <PlayerDataEditorData> datas)
        {
            ClassGenerationData classData = new ClassGenerationData
            {
                m_ClassName = "PlayerData",
                m_Namespace = PlayerDataCodeGeneratorConstants.NAMESPACE_GAME,
                m_Usings    = new string[] { "UniRx", PlayerDataCodeGeneratorConstants.NAMESPACE_FRAMEWORK },
                m_ClassType = ClassType.Partial
            };

            for (int i = 0; i < datas.Count; i++)
            {
                classData.m_FieldGenerationDatas.Add(PlayerDataFieldGenerator.GeneratePlayerDataField(datas[i]));
            }

            string code = ClassGenerator.CreateClass(classData);

            return(code);
        }