public void CreatesScripts() { var result = new ScriptCreator().Create("prefix", typeof(ScriptOwner)); Assert.Single(result); Assert.Equal("prefix/lorem-ipsum", result.Single().Path); }
void DrawBody() { GUILayout.BeginArea(bodyRect); GUILayout.Space(10); controllerName = EditorGUILayout.TextField("Controller Name", controllerName); GUILayout.Space(107); if (GUILayout.Button("Create", GUILayout.Height(40))) { ScriptCreator.CreateScriptAsset("Assets/HappyGameCompany/ScriptTemplates/NewControllerTemplate.cs.txt", "Assets/_Scripts/Controllers/" + controllerName + ".cs"); this.Close(); } GUILayout.EndArea(); }
public IEnumerable <App> Create() { foreach (var type in AppTypeProvider.GetTypes()) { var attribute = CustomAttributeExtensions.GetCustomAttribute <AppAttribute>(type); var translationAttribute = CustomAttributeExtensions.GetCustomAttribute <TranslationsAttribute>(type); var translations = translationAttribute != null?TranslationRepositoryCreator.Create(translationAttribute.Path) : new EmptyTranslationRepository(); yield return(new App( attribute.Id, scripts: ScriptCreator.Create(type), styles: StyleCreator.Create(type), translations: translations )); } }
void DrawBody() { GUILayout.BeginArea(bodyRect); GUILayout.Space(10); stateName = EditorGUILayout.TextField("State Name", stateName); GUILayout.Space(10); ScriptKeywordProcessor.onEnterEnabled = EditorGUILayout.Toggle("onEnter", ScriptKeywordProcessor.onEnterEnabled); ScriptKeywordProcessor.onExecuteEnabled = EditorGUILayout.Toggle("onExecute", ScriptKeywordProcessor.onExecuteEnabled); ScriptKeywordProcessor.onExitEnabled = EditorGUILayout.Toggle("onExit", ScriptKeywordProcessor.onExitEnabled); GUILayout.Space(10); ScriptKeywordProcessor.onPlayerInputEnabled = EditorGUILayout.Toggle("onPlayerInput", ScriptKeywordProcessor.onPlayerInputEnabled); GUILayout.Space(15); if (GUILayout.Button("Create", GUILayout.Height(40))) { ScriptCreator.CreateScriptAsset("Assets/HappyGameCompany/ScriptTemplates/NewStateTemplate.cs.txt", "Assets/_Scripts/State Machine/States/" + stateName + ".cs"); this.Close(); } GUILayout.EndArea(); }
public string GetCodeStr(string languageType, ExcelFieldInfo fieldInfo) { var creator = new ScriptCreator(fieldInfo); creator.CreateScript(); var codeStr = string.Empty; switch (languageType) { case "Csharp": codeStr = $"{fieldInfo.EnglishName.ToLower()} " + $"= {fieldInfo.CsType}.Create(cells[{fieldInfo.Index}]);"; break; case "TypeScript": break; } return(codeStr); }
public IEnumerable <App> Create() { foreach (var component in ComponentRepository.GetAll()) { foreach (var type in AppTypeProvider.GetTypes(component)) { var attribute = CustomAttributeExtensions.GetCustomAttribute <AppAttribute>(type); var translationAttribute = CustomAttributeExtensions.GetCustomAttribute <TranslationsAttribute>(type); var translations = translationAttribute != null?TranslationRepositoryCreator.Create(component.Id + "/" + translationAttribute.Path) : new EmptyTranslationRepository(); yield return(new App( attribute.Id, component, scripts: ScriptCreator.Create(component.Id, type), styles: StyleCreator.Create(component.Id, type), resources: ResourceCreator.Create(component.Id, type), translations: translations )); } } }
public override void Action(int instanceId, string pathName, string resourceFile) { UnityEngine.Object o = ScriptCreator.CreateScriptAssetFromTemplate(pathName, resourceFile); ProjectWindowUtil.ShowCreatedAsset(o); }
public IEnumerable <Component> Create() { var result = new List <Component>(); foreach (var type in ComponentTypeProvider.GetTypes()) { var attribute = type.GetCustomAttribute <ComponentAttribute>(); if (attribute == null) { continue; } result.Add(new Component(attribute.Id, new AssemblyWrapper(type.Assembly), ComponentDependencyCreator.Create(type), ComponentControllerCreator.Create(type), ScriptCreator.Create(attribute.Id, type), StyleCreator.Create(attribute.Id, type), ResourceCreator.Create(attribute.Id, type))); } if (Logger.IsEnabled(LogLevel.Information)) { Logger.LogInformation($"Detected {result.Count} components: {string.Join(", ", result.Select(r => r.Id))}"); } return(result); }
public void GenerateTestScripts(List <Rootobject> tc, List <Signal> i_signals, string path) { testcaseData = tc; signals = i_signals; string time = ""; string filePath = path; try { ScriptCreator Creator = new ScriptCreator(filePath); Creator.StartScripting(); //Mapping Rules to Map Signal Names with Technical Signals foreach (Rootobject rootobj in testcaseData) { if (rootobj.actions != null) { int stepcout = 0; foreach (Actions act in rootobj.actions) { string[] delimiters = { ";" }; List <string> SplitActionValue = act.Action.Split(delimiters, StringSplitOptions.None).ToList(); CompareInfo myComp = CultureInfo.InvariantCulture.CompareInfo; foreach (string str in SplitActionValue) { if (myComp.IsPrefix(str.Trim(), "Time") || myComp.IsPrefix(str.Trim(), "time")) { string[] delimiters2 = { "=" }; List <string> SplitActionValue2 = str.Split(delimiters2, StringSplitOptions.None).ToList(); time = SplitActionValue2[1]; } } foreach (string str in SplitActionValue) { if (str.Trim().Length > 1) { string[] delimiters2 = { "=" }; List <string> SplitActionValue2 = str.Split(delimiters2, StringSplitOptions.None).ToList(); if (signals.Any(x => x.LogicalName.Trim() == SplitActionValue2[0].Trim())) { Signal sig = new Signal(); sig = signals.Find(x => x.LogicalName.Trim() == SplitActionValue2[0].Trim()); string valPri = sig.PrimarySignalName; string valSec = sig.SecondarySignalName; string val2Pri = sig.Primary2SignalName; string val2Sec = sig.Secondary2SignalName; if (sig.Stype == "Input") { if (stepcout == 0) { Creator.ActionStep(rootobj.currentElementName); stepcout++; } Creator.ScriptAction(valPri, valSec, SplitActionValue2[1], SplitActionValue2[1]); } else { if (sig.LogicalName != "Time") { if (stepcout == 0) { Creator.VerificationStep(rootobj.currentElementName); stepcout++; } Creator.ScriptVerify(valPri, valSec, SplitActionValue2[1], SplitActionValue2[1], val2Pri, val2Sec, SplitActionValue2[1], SplitActionValue2[1], time); } } } else { MessageBox.Show("Missing Information of " + SplitActionValue2[0].Trim() + " in XML"); } } } } } } Creator.EndScripting(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } //Generating Test Scripts }