示例#1
0
 // Start is called before the first frame update
 void Awake()
 {
     _UniqueInstance = this;
     InitStatData("Archer", 10, 10);
     Ring = Instantiate(TargetRing, GameObject.FindGameObjectWithTag("InGameObject").transform);
     Ring.SetActive(false);
     JS          = GameObject.FindGameObjectWithTag("JS").GetComponent <JSController>();
     animator    = GetComponent <Animator>();
     _maincamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();
 }
示例#2
0
        public JsonResult CodeGenerate(string entity, List <JPropertyInfo> props)
        {
            try
            {
                string templates = Config.Root + "Templates";
                if (!Directory.Exists(templates))
                {
                    Directory.CreateDirectory(templates);
                }
                string component = Config.Root + "Templates\\Components";
                if (!Directory.Exists(component))
                {
                    Directory.CreateDirectory(component);
                }

                //Generate scripts directories
                string script = Config.ScriptProject + "\\Scripts";
                if (!Directory.Exists(script))
                {
                    Directory.CreateDirectory(script);
                }
                script = Config.ScriptProject + "\\Scripts\\Controllers";
                if (!Directory.Exists(script))
                {
                    Directory.CreateDirectory(script);
                }
                script = Config.ScriptProject + "\\Scripts\\Services";
                if (!Directory.Exists(script))
                {
                    Directory.CreateDirectory(script);
                }
                //services
                script = Config.ServiceProject + "\\Interfaces";
                if (!Directory.Exists(script))
                {
                    Directory.CreateDirectory(script);
                }
                script = Config.ServiceProject + "\\Implementation";
                if (!Directory.Exists(script))
                {
                    Directory.CreateDirectory(script);
                }

                ICode code = new TemplateCode();
                System.IO.File.WriteAllText(component + "\\" + entity + ".html", code.CodeGenerate(entity, props));
                code        = new JSController();
                code.Config = this.Config;
                System.IO.File.WriteAllText(Config.ScriptProject + "\\Scripts\\Controllers\\" + entity + "Ctrl.cs", code.CodeGenerate(entity, props));
                code        = new JSService();
                code.Config = this.Config;
                System.IO.File.WriteAllText(Config.ScriptProject + "\\Scripts\\Services\\" + entity + "Service.cs", code.CodeGenerate(entity, props));
                code = new CSController();
                System.IO.File.WriteAllText(Config.Root + "Controllers\\" + entity + "Controller.cs", code.CodeGenerate(entity, props));
                code = new CSServiceInterface();
                System.IO.File.WriteAllText(Config.ServiceProject + "\\Interfaces\\I" + entity + "Service.cs", code.CodeGenerate(entity, props));
                code = new CSServiceImplementation();
                System.IO.File.WriteAllText(Config.ServiceProject + "\\Implementation\\" + entity + "Service.cs", code.CodeGenerate(entity, props));

                WidgetManager widgetManager = new WidgetManager();
                widgetManager.RootPath = Config.Root;
                widgetManager.AddWidget(new JwtWidget {
                    Name = entity, PropertyList = props
                });
                return(Json(new { message = "Successfully Generated." }));
            }
            catch (Exception ex)
            {
                return(Json(new { message = ex.ToString() }));
            }
        }
示例#3
0
 // Start is called before the first frame update
 void Awake()
 {
     _uniqeinstance = this;
 }