private void ParseGenericEncounterScripts(string folderPath) { List <string> genericScriptFiles = new List <string>(); SearchForFileType(folderPath, "*.lua", genericScriptFiles); foreach (string filepath in genericScriptFiles) { EncounterScriptFile file = new EncounterScriptFile(filepath); file.Load(); mGenericScriptNodes.Add(file.Name, file); } }
public bool AddNewGenericScriptNode(IGraphOwner owner, string scriptNodeName, string filePath) { if (mCurrentGraphRoot == null) { return(false); } EncounterScriptFile scriptFile = mGenericScriptNodes[scriptNodeName]; scriptFile.WriteDefaultToFile(filePath); GameMasterNode newNode = new GameMasterNode(mCurrentGraphRoot.Module, filePath); mGameMasterNodes.Add(newNode.Path, newNode); newNode.Load(mGameMasterNodes); string nodeName = Path.GetFileNameWithoutExtension(filePath); CampaignNodeData campaignNodeData = mCurrentGraphRoot.NodeData as CampaignNodeData; string arcsDir = Path.GetFullPath(Path.Combine(campaignNodeData.NodeFile.Path, "..", "arcs")).ToUpperInvariant(); string filePathUpper = Path.GetFullPath(filePath).ToUpperInvariant(); bool foundMatchingArc = false; foreach (var arcNode in campaignNodeData.GetAllArcs()) { string arcDir = Path.GetFullPath(Path.Combine(arcNode.Path, "..")).ToUpperInvariant(); if (filePathUpper.StartsWith(arcDir)) { // Add new node to arc's index file (ex. game_events_arc) using nodeName as the key (arcNode.NodeData as ArcNodeData).AddEncounter(newNode.NodeData as EncounterNodeData); newNode.Owner = arcNode; foundMatchingArc = true; break; } } if (!foundMatchingArc) { (mCurrentGraphRoot.NodeData as CampaignNodeData).OrphanedNodes.Add(newNode); newNode.Owner = mCurrentGraphRoot; } newNode.IsModified = true; newNode.SaveIfNecessary(); RefreshGraph(owner); return(true); }
private void ParseEncounterScripts(string moduleName, string folderPath) { List <string> filePaths = new List <string>(); SearchForFileType(folderPath, "*.lua", filePaths); foreach (string filepath in filePaths) { EncounterScriptFile file = new EncounterScriptFile(filepath); file.Load(); string fileName = file.Name; if (mCustomScriptNodes.ContainsKey(fileName)) { int numCollisions = 0; kCollisions.TryGetValue(fileName, out numCollisions); numCollisions++; kCollisions[fileName] = numCollisions; fileName = fileName + "(" + numCollisions + ")"; } mCustomScriptNodes.Add(fileName, file); } }
private void ParseGenericEncounterScripts(string folderPath) { List<string> genericScriptFiles = new List<string>(); SearchForFileType(folderPath, "*.lua", genericScriptFiles); foreach (string filepath in genericScriptFiles) { EncounterScriptFile file = new EncounterScriptFile(filepath); file.Load(); mGenericScriptNodes.Add(file.Name, file); } }
private void ParseEncounterScripts(string moduleName, string folderPath) { List<string> filePaths = new List<string>(); SearchForFileType(folderPath, "*.lua", filePaths); foreach (string filepath in filePaths) { EncounterScriptFile file = new EncounterScriptFile(filepath); file.Load(); string fileName = file.Name; if (mCustomScriptNodes.ContainsKey(fileName)) { int numCollisions = 0; kCollisions.TryGetValue(fileName, out numCollisions); numCollisions++; kCollisions[fileName] = numCollisions; fileName = fileName + "(" + numCollisions + ")"; } mCustomScriptNodes.Add(fileName, file); } }