// Start is called before the first frame update public void Reload() { TextAsset loadedTextAsset = Resources.Load <TextAsset>(dataFile); List <string> data = FileManager.ReadTextAsset(loadedTextAsset); for (int i = 1; i < data.Count; i++) { string line = data[i]; //each element is split by a double space. string[] parts = line.Split(new string[1] { " " }, System.StringSplitOptions.RemoveEmptyEntries); CDD cd = new CDD(""); for (int a = 0; a < parts.Length; a++) { string[] titleAndValue = parts[a].Split('='); string title = titleAndValue[0]; string value = titleAndValue[1]; switch (title) { case "name": cd.name = value; break; case "nickname": cd.nickName = value; break; case "name color": cd.nameColor = string.Format("<color={0}>", value); break; // case "dialogue font": cd.speechFont = Resources.Load <TMP_FontAsset>("Fonts & Materials/" + value); if (cd.speechFont == null) { //cd.speechFont = TMP_FontAsset.defaultFontAsset; break; } } } //all values are set, add the character to the data lists so it can be accessed quickly. characterNicknameDictionary.Add(cd.nickName, cd.name); characterVariables.Add(cd.name, cd); } }
public RunForm(ObservableCollection <Group> commands, MainView mainV, bool isChooseDD) { MainV = mainV; Groups = new ObservableCollection <Group>(commands.Where(t => t.IsEnabled).ToList()); InitializeComponent(); this.DataContext = this; KeysToRegisterList = new List <int>(); CurrentGroup = new Group(); InitialTray(); WindowState = WindowState.Minimized; IsChooseDD = isChooseDD; if (IsChooseDD) { dd = new CDD(); string path = System.Windows.Forms.Application.StartupPath + "\\DD81200x64.64.dll"; if (!LoadDllFile(path, this)) { return; } } }
//returns true if points are vertices of the convex core private static bool CheckConvexCore(Point2 u, Point2 v, int[] gap, out bool uRedundant, out bool vRedundant) { List <Point2> corePoints = new List <Point2>(); var index0 = ""; var indexk = ""; Point2 q; corePoints.Add(u); corePoints.Add(v); for (int i = 0; i < Globals.d; i++) { // have to finalize key format being used in dictionary. index0 = (Globals.d - 1).ToString() + Globals.k.ToString() + gap[i].ToString(); indexk = (Globals.d - 1).ToString() + Globals.k.ToString() + (((2 * Globals.gap - gap[i]) > Globals.gap) ? (Globals.gap) : (2 * Globals.gap - gap[i])).ToString(); //List<Point> corePoints0 = FileIO.readPointsFromFile(Globals.directory + "/" + index0 + "/coreSet"); //List<Point> corePointsk = FileIO.readPointsFromFile(Globals.directory + "/" + indexk + "/coreSet"); var corePoints0 = (Globals.CoreSet.ContainsKey(index0)) ? Globals.CoreSet[index0] : new List <Point2>(); var corePointsk = (Globals.CoreSet.ContainsKey(indexk)) ? Globals.CoreSet[indexk] : new List <Point2>(); foreach (Point2 p in corePoints0) { q = p.Clone(); q.IncreaseByDimensionality(i, true); corePoints.Add(q); } foreach (Point2 p in corePointsk) { q = p.Clone(); q.IncreaseByDimensionality(i, false); corePoints.Add(q); } } return(CDD.CheckPointsConvexHullVertices(corePoints, u, v, out uRedundant, out vRedundant)); }
/// <summary> /// Get the details for the character by this name or nickname. /// </summary> /// <param name="characterName"></param> /// <returns></returns> public CDD GetDetailsForCharacter(string characterName) { string actualCharacterName = ""; //if this is not a nickname, this is the actual name if (!characterNicknameDictionary.TryGetValue(characterName, out actualCharacterName)) { actualCharacterName = characterName; } CDD retval = null; if (characterVariables.TryGetValue(actualCharacterName, out retval)) { return(retval); } else { retval = new CDD(actualCharacterName); return(retval); } }