/// <summary> /// Resets all properties to their default values. /// </summary> public void Clear() { ContextCoalitionsBlue = TemplateTools.CheckValue <DBEntryCoalition>(Database.Instance.Common.DefaultCoalitionBlue); ContextCoalitionsRed = TemplateTools.CheckValue <DBEntryCoalition>(Database.Instance.Common.DefaultCoalitionRed); ContextDecade = Decade.Decade2000; ContextTheaterID = TemplateTools.CheckValue <DBEntryTheater>(Database.Instance.Common.DefaultTheater); ContextTheaterRegionsCoalitions = CountryCoalition.Default; EnvironmentBadWeatherChance = AmountN.Random; EnvironmentNightMissionChance = AmountN.Random; MissionsCount = 5; MissionsObjectiveCount = Amount.Average; MissionsObjectiveDistance = Amount.Average; MissionsTypes = new string[] { Database.Instance.Common.DefaultObjective }; OptionsPreferences = new MissionTemplatePreferences[0]; OptionsUnitMods = new string[0]; PlayerAircraft = TemplateTools.CheckValuePlayerAircraft(Database.Instance.Common.DefaultPlayerAircraft); PlayerCoalition = Coalition.Blue; PlayerStartLocation = PlayerStartLocation.Runway; SituationEnemyAirDefense = AmountN.Random; SituationEnemyAirForce = AmountN.Random; SituationFriendlyAirDefense = AmountN.Random; SituationFriendlyAirForce = AmountN.Random; SituationVariation = CampaignDifficultyVariation.Random; }
private void OnEnable() { if (debug) { Debug.Log("<color=green>Dialogue Editor: OnEnable (Selection.activeObject=" + Selection.activeObject + ", database=" + database + ")</color>", Selection.activeObject); } instance = this; template = TemplateTools.LoadFromEditorPrefs(); minSize = new Vector2(720, 240); if (Selection.activeObject != null) { SelectObject(Selection.activeObject); } else if (EditorWindow.focusedWindow == this) { SelectObject(database); } toolbar.UpdateTabNames(template.treatItemsAsQuests); if (database != null) { ValidateConversationMenuTitleIndex(); } #if UNITY_2017_2_OR_NEWER EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; EditorApplication.playModeStateChanged += OnPlayModeStateChanged; #else EditorApplication.playmodeStateChanged -= OnPlaymodeStateChanged; EditorApplication.playmodeStateChanged += OnPlaymodeStateChanged; #endif //nodeStyle = null; showQuickDialogueTextEntry = false; LoadEditorSettings(); }
void OnEnable() { instance = this; minSize = new Vector2(320, 128); template = TemplateTools.LoadFromEditorPrefs(); prefs = ConverterPrefsTools.Load(); }
public void Execute(HttpServer.IHttpClientContext context, HttpServer.IHttpRequest request, HttpServer.IHttpResponse response, HttpServer.Sessions.IHttpSession session) { if (!request.Param.Contains("number")) { return; } var call = _plugin.PluginManager.Core.CallManager.MakeCall(request.Param["number"].Value); var content = TemplateTools.ProcessTemplate( "Call.html", new Dictionary <string, string>() { { "number", call.Number } }); response.Connection = HttpServer.ConnectionType.Close; response.ContentType = "text/html"; response.ContentLength = content.Length; response.AddHeader("Content-type", "text/html"); response.SendHeaders(); response.SendBody(content); //response.Connection = HttpServer.ConnectionType.Close; //response.Redirect(String.Format("/callstate?call_id={0}", call.SessionId)); //response.Send(); }
public void Execute(HttpServer.IHttpClientContext context, HttpServer.IHttpRequest request, HttpServer.IHttpResponse response, HttpServer.Sessions.IHttpSession session) { if (!request.Param.Contains("call_id")) { return; } var call = _plugin.PluginManager.Core.CallManager[Int32.Parse(request.Param["call_id"].Value)]; var content = TemplateTools.ProcessTemplate( "CallState.html", new Dictionary <string, string>() { { "number", call.Number }, { "state", ConvertState(call.State) } }); response.Connection = HttpServer.ConnectionType.Close; response.ContentType = "text/html"; response.ContentLength = content.Length; response.AddHeader("Content-type", "text/html"); response.SendHeaders(); response.SendBody(content); }
public void Execute(HttpServer.IHttpClientContext context, HttpServer.IHttpRequest request, HttpServer.IHttpResponse response, HttpServer.Sessions.IHttpSession session) { var filePath = request.Uri.LocalPath; // Prevent hacking filePath = filePath.Replace('/', '\\'); filePath = filePath.Substring(filePath.LastIndexOf('\\')); if (filePath[0] == '\\') { filePath = filePath.Substring(1); } response.Connection = HttpServer.ConnectionType.Close; try { var content = TemplateTools.ReadResourceFile(filePath); response.ContentType = GetMimeTypeByExtension(filePath); response.ContentLength = content.Length; response.SendHeaders(); response.SendBody(content); } catch { response.Reason = "HTTP/1.1 404 Not Found"; response.Send(); } }
private Variable CreateNewVariable(string group) { if (template == null) { template = TemplateTools.LoadFromEditorPrefs(); } var id = template.GetNextVariableID(database); var newVariableName = "New Variable " + id; var addGroup = !(string.IsNullOrEmpty(group) || group == UngroupedVariableGroup); if (addGroup) { newVariableName = group + "." + newVariableName; } var newVariable = template.CreateVariable(id, newVariableName, string.Empty); if (!Field.FieldExists(newVariable.fields, "Name")) { newVariable.fields.Add(new Field("Name", string.Empty, FieldType.Text)); } if (!Field.FieldExists(newVariable.fields, "Initial Value")) { newVariable.fields.Add(new Field("Initial Value", string.Empty, FieldType.Text)); } if (!Field.FieldExists(newVariable.fields, "Description")) { newVariable.fields.Add(new Field("Description", string.Empty, FieldType.Text)); } database.variables.Add(newVariable); EditorUtility.SetDirty(database); UpdateVariableWindows(); return(newVariable); }
private void ResetTemplate() { if (EditorUtility.DisplayDialog("Reset template?", "You cannot undo this action.", "Reset", "Cancel")) { template = Template.FromDefault(); TemplateTools.SaveToEditorPrefs(template); Repaint(); } }
protected virtual void OnEnable() { prefs = Prefs.Load(); database = GetDatabaseFromGuid(prefs.databaseGuid); template = TemplateTools.LoadFromEditorPrefs(); storyInfoReorderableList = new ReorderableList(prefs.storyInfoList, typeof(string), true, true, true, true); storyInfoReorderableList.drawHeaderCallback += OnDrawFilenameListHeader; storyInfoReorderableList.drawElementCallback += OnDrawFilenameListElement; storyInfoReorderableList.onAddCallback += OnAddFilenameToList; lastDirectory = (prefs.storyInfoList.Count > 0) ? Path.GetDirectoryName(prefs.storyInfoList[0].jsonFilename) : string.Empty; RefreshActorPopupData(); }
private void OnDisable() { if (debug) { Debug.Log("<color=orange>Dialogue Editor: OnDisable</color>"); } #if UNITY_2017_2_OR_NEWER EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; #else EditorApplication.playmodeStateChanged -= OnPlaymodeStateChanged; #endif TemplateTools.SaveToEditorPrefs(template); inspectorSelection = null; instance = null; SaveEditorSettings(); }
private void DrawTemplates() { EditorGUI.BeginChangeCheck(); EditorWindowTools.StartIndentedSection(); DrawTemplate("Actors", template.actorFields, template.actorPrimaryFieldTitles, ref templateFoldouts.actors); DrawTemplate("Items", template.itemFields, null, ref templateFoldouts.items); DrawTemplate("Quests", template.questFields, template.questPrimaryFieldTitles, ref templateFoldouts.quests); DrawTemplate("Locations", template.locationFields, null, ref templateFoldouts.locations); DrawTemplate("Variables", template.variableFields, null, ref templateFoldouts.variables); DrawTemplate("Conversations", template.conversationFields, template.conversationPrimaryFieldTitles, ref templateFoldouts.conversations); DrawTemplate("Dialogue Entries", template.dialogueEntryFields, template.dialogueEntryPrimaryFieldTitles, ref templateFoldouts.dialogueEntries); DrawDialogueLineColors(); EditorWindowTools.EndIndentedSection(); if (EditorGUI.EndChangeCheck()) { TemplateTools.SaveToEditorPrefs(template); } }
static void Main(string[] args) { string path = Environment.CurrentDirectory; while (!Directory.Exists(Path.Combine(path, "Input"))) { path = Path.GetDirectoryName(path); } string inputPath = Path.Combine(path, "Input"); string outputPath = Path.Combine(path, "Output"); Template.Global.RegisterPath(inputPath); Template.Global.Culture = CultureInfo.InvariantCulture; Template.Global.Data.Set("Lang", TemplateTools.ReadStrings(Path.Combine(inputPath, "Strings.txt"))); Template.Global.QuickData = Template.Global.Data.Get("Lang"); var data = new TemplateData(); data.Set("User", Environment.UserName); data.Set("Version", Environment.OSVersion.Version); var query = from server in new int[] { 10, 20, 50, 51, 52, 53, 54 } select new { Server = "Server" + server, Number = server, Status = "OK" }; data.Set("Servers", query); var drives = DriveInfo.GetDrives().Where(drive => drive.IsReady); data.Set("Drives", drives); foreach (string input in Directory.GetFiles(inputPath, "*.htm")) { var output = Path.Combine(outputPath, Path.GetFileName(input)); var template = Template.FromFile(input, data); var result = template.Render(); File.WriteAllText(output, result, template.CurrentEncoding); } }
private void OnEnable() { instance = this; minSize = new Vector2(300, 240); database = DialogueEditorWindow.GetCurrentlyEditedDatabase(); if (database == null) { EditorTools.FindInitialDatabase(); } if (database == null && EditorPrefs.HasKey(DatabaseGUIDPrefsKey)) { var guid = EditorPrefs.GetString(DatabaseGUIDPrefsKey); database = AssetDatabase.LoadAssetAtPath <DialogueDatabase>(guid); } template = TemplateTools.LoadFromEditorPrefs(); if (variableView == null) { variableView = new DialogueEditorVariableView(); } variableView.Initialize(database, template, false); }
private void SaveTemplate() { TemplateTools.SaveToEditorPrefs(template); SaveTemplateToDatabase(); }
void LoadTemplate() { template = TemplateTools.LoadFromEditorPrefs(); }