예제 #1
0
        private static string GenerateEmptyCustomEntityNetworkCode(EntitySave entitySave)
        {
            ICodeBlock topBlock = new CodeBlockBaseNoIndent(null);

            string entityNamespace = CodeGeneratorCommonLogic.GetElementNamespace(entitySave);

            ICodeBlock codeBlock = topBlock.Namespace(entityNamespace);

            codeBlock = codeBlock.Class("public partial", entitySave.GetStrippedName());

            codeBlock.Function("void", "CustomUpdateFromState", $"{CodeGeneratorCommonLogic.GetNetStateFullName(entitySave)} state");
            codeBlock.Function("void", "CustomGetState", $"{CodeGeneratorCommonLogic.GetNetStateFullName(entitySave)} state");



            return(topBlock.ToString());
        }
        private static string GetGeneratedScreenCode(ScreenSave screenSave)
        {
            ICodeBlock topBlock = new CodeBlockBaseNoIndent(null);

            string screenNamespace = CodeGeneratorCommonLogic.GetElementNamespace(screenSave);

            ICodeBlock codeBlock = topBlock.Namespace(screenNamespace);

            codeBlock = codeBlock.Class("public partial", screenSave.GetStrippedName(), " : RedGrin.INetworkArena");

            GenerateRequestCreateEntity(codeBlock);

            GenerateRequestDestroy(codeBlock);



            return(topBlock.ToString());
        }
예제 #3
0
        private static string GetGeneratedEntityNetworkCode(EntitySave entitySave)
        {
            ICodeBlock topBlock = new CodeBlockBaseNoIndent(null);

            string entityNamespace = CodeGeneratorCommonLogic.GetElementNamespace(entitySave);

            ICodeBlock codeBlock = topBlock.Namespace(entityNamespace);

            codeBlock = codeBlock.Class("public partial", entitySave.GetStrippedName(), " : RedGrin.INetworkEntity");

            codeBlock.AutoProperty("public long", "OwnerId");
            codeBlock.AutoProperty("public long", "EntityId");

            GenerateGetStateMethod(entitySave, codeBlock);

            GenerateUpdateFromStateMethod(entitySave, codeBlock);

            return(topBlock.ToString());
        }
        private static string GenerateEmptyCustomScreenNetworkCode(ScreenSave screen)
        {
            ICodeBlock topBlock = new CodeBlockBaseNoIndent(null);

            string screenNamespace = CodeGeneratorCommonLogic.GetElementNamespace(screen);

            ICodeBlock codeBlock = topBlock.Namespace(screenNamespace);

            codeBlock = codeBlock.Class("public partial", screen.GetStrippedName());

            codeBlock.Function("void",
                               "CustomRequestCreateNetworkEntity",
                               "ref RedGrin.INetworkEntity entity, object entityData")
            .Line();

            codeBlock.Line();

            codeBlock.Function("void",
                               "CustomRequestDestroyNetworkEntity",
                               "RedGrin.INetworkEntity entity")
            .Line();

            return(topBlock.ToString());
        }