public void ProcessCommand(Murple.Control murpleControl, string command) { Murple.Pod commandsPod = murpleControl.GetPod("Commands"); if (commandsPod == null) return; Murple.StatBase commandsStatBase = commandsPod.GetStat("Commands"); //List<Murple.Pod> commandPods = new List<Murple.Pod>(); //Murple.StatHelper.Get(commandsStatBase, ref commandPods); List<Murple.Pod> commandPods = (List<Murple.Pod>)commandsStatBase.Get(); string delimiterString = " "; char[] delimiter = delimiterString.ToCharArray(); string[] commandValues = command.Split(delimiter); string primeCommand = commandValues[0]; List<string> commandOptions = new List<string>(); if (commandValues.Length > 1) { for (int i = 1; i < commandValues.Length; ++i) commandOptions.Add(commandValues[i]); } foreach (Murple.Pod thisPod in commandPods) { if (thisPod.Name.ToLower() == ("Commands|" + primeCommand).ToLower()) { ProcessCommandSequence(murpleControl, thisPod, commandOptions); } } }
//private GameTime mTime = new GameTime(); public GameMaster(Murple.Control murpleControl, TextBox mainTextWindow) { mCommands = new GameCommands(mainTextWindow); mMurpleControl = murpleControl; //mStoryControl = new StorySystem.Control(mMurpleControl); //mTime.Initialise(); }
// ---------------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------------- private bool DoCommandCheckFocus(Murple.Control murpleControl, List<string> commandOptions) { if (murpleControl.Focus != null) return true; mMainTextWindow.Text += "No focus pod has been set yet." + Environment.NewLine; return false; }
public Control(Murple.Control murpleControl) { mMurpleControl = murpleControl; mMurpleControl.LoadDatabaseFile(mMurpleDatabaseFilename); mMurpleControl.LoadDefinitionFile(mMurpleDefinitionFilename); mMurpleControl.LoadDataFile(mMurpleDataFilename); PopulateSystem(10); }
// ---------------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------------- private void DoCommandFocus(Murple.Control murpleControl, List<string> commandOptions) { string podToFocusOn = null; if (commandOptions.Count > 0) { for (int i = 0; i < commandOptions.Count; ++i) { podToFocusOn += commandOptions[i]; if (i < commandOptions.Count - 1) podToFocusOn += " "; } if (murpleControl.SetFocus(podToFocusOn) == true) { mMainTextWindow.Text += "Focus set to: " + podToFocusOn + Environment.NewLine; } } }
public void PrintUUID(Murple.Control control, Object valueAsObject) { System.Guid value = (System.Guid)valueAsObject; System.Diagnostics.Debug.Print(value.ToString()); }
public void PrintStringIntDictionary(Murple.Control control, Object valueAsObject) { Dictionary<string, int> value = (Dictionary<string, int>)valueAsObject; foreach (KeyValuePair<string, int> thisValue in value) { System.Diagnostics.Debug.Print(string.Format(" - {0}: {1}", thisValue.Key, thisValue.Value)); } }
public void PrintPodList(Murple.Control control, Object valueAsObject) { List<Pod> value = (List<Pod>)valueAsObject; foreach (Pod thisPod in value) { System.Diagnostics.Debug.Print(string.Format(" - #Pod Ref# {0}", thisPod.Name)); } }
public void PrintImage(Murple.Control control, Object valueAsObject) { Image value = (Image)valueAsObject; System.Diagnostics.Debug.Print(string.Format("#Image# {0}", value.Name)); }
public void PrintDatabaseType(Murple.Control control, Object valueAsObject) { Database.DatabaseType value = (Database.DatabaseType)valueAsObject; Database thisDatabase = control.Database[value.mDatabaseName]; string databaseValue = ""; thisDatabase.Get(value, out databaseValue); System.Diagnostics.Debug.Print(string.Format("{0}", databaseValue)); }
public string GetPrintableStringList(Murple.Control control, Object valueAsObject) { string textBuffer = ""; List<string> value = (List<string>)valueAsObject; foreach (string thisString in value) { textBuffer += Environment.NewLine; textBuffer += string.Format("\t- {0}", thisString); } return textBuffer; }
public void SetUIElement(string statName, Murple.StatBase statBase) { if (mMurpleUIElement.ContainsKey(statName) == true) { MurpleUIElement thisUIElement = mMurpleUIElement[statName]; thisUIElement.Stat = statBase; if (thisUIElement.ElementType == MurpleUIElement.Type.InputField && statBase.IsStatType(StatHelper.StatType.String) == true) { string statValue = (string)statBase.Get(); ((InputField)thisUIElement.UIElement).text = statValue; } else if (thisUIElement.ElementType == MurpleUIElement.Type.Dropdown && statBase.IsStatType(StatHelper.StatType.DatabaseType) == true) { Dropdown thisDropDown = (Dropdown)thisUIElement.UIElement; Database.DatabaseType statValue = (Database.DatabaseType)statBase.Get(); if (statValue.mDataIndex == 0) { // If we are the same as the default value then it will not uodate the element (Unity fail!!!) // So force it to the last and then back again. thisDropDown.value = thisDropDown.options.Count - 1; thisDropDown.value = 0; } else { thisDropDown.value = statValue.mDataIndex; } //((InputField)thisUIElement.UIElement).text = value; } } }
public void AddPod(Murple.Pod newPod) { MurpleControl.AddPod(newPod.UUID, newPod, mMurpleData); }
private Stat<Pod> GetPod(Murple.Control murpleControl, XmlNode thisChild, string filename, string name) { // The Xml has a reference to the name of the pod, we can create a dummy one here to be filled in later. // Or if the Pod is already loaded than we will link it here. Stat<Pod> newChildPod = new Stat<Pod>(new Pod()); System.Guid childPodUUID = System.Guid.Empty; // Can't do this in .Net 3.5 (Unity) //if (System.Guid.TryParse(thisChild.InnerText, out childPodUUID) == false) //{ // childPodUUID = Pod.GenerateUUID(); //} childPodUUID = new System.Guid(thisChild.InnerText); // Have to do this non-safe way :( if (murpleControl.HasPod(childPodUUID)) newChildPod.Value = murpleControl.GetPod(childPodUUID); else newChildPod.Value = murpleControl.AddMurpleFromDefinition(name); ; return newChildPod; //murpleControl.AddPod(childPodName, newChildPod.Value, filename); //thisStatBase = newChildPod; }
// ---------------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------------- private void DoCommandPrint(Murple.Control murpleControl, List<string> commandOptions) { string podToPrint = null; if (commandOptions.Count > 0) { for (int i = 0; i < commandOptions.Count; ++i) { podToPrint += commandOptions[i]; if (i < commandOptions.Count - 1) podToPrint += " "; } } string textBuffer = murpleControl.Print(commandOptions.Count == 0 ? System.Guid.Empty : new System.Guid(podToPrint)); if (mMainTextWindow == null) { System.Diagnostics.Debug.Print(textBuffer); } else { mMainTextWindow.Text = textBuffer; mMainTextWindow.SelectionStart = mMainTextWindow.Text.Length - 1; mMainTextWindow.SelectionLength = 0; mMainTextWindow.ScrollToCaret(); } }
// ---------------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------------- // FILLMEIN public string GetPrintableSimple(Murple.Control control, Object valueAsObject) { string textBuffer = ""; textBuffer = string.Format("{0}", valueAsObject); return textBuffer; }
public string GetPrintableStringIntDictionary(Murple.Control control, Object valueAsObject) { string textBuffer = ""; Dictionary<string, int> value = (Dictionary<string, int>)valueAsObject; foreach (KeyValuePair<string, int> thisValue in value) { textBuffer += string.Format(" - {0}: {1}", thisValue.Key, thisValue.Value); } return textBuffer; }
public static void Print(Murple.Control control, System.Type templateType, Object valueAsObject) { StatHelperData thisHelper = GetHelper(templateType); if (thisHelper.OnPrint != null) thisHelper.OnPrint(control, valueAsObject); }
public string GetPrintableUUID(Murple.Control control, Object valueAsObject) { string textBuffer = ""; System.Guid value = (System.Guid)valueAsObject; textBuffer += value.ToString(); return textBuffer; }
public string GetPrintableDatabaseType(Murple.Control control, Object valueAsObject) { string textBuffer = ""; Database.DatabaseType value = (Database.DatabaseType)valueAsObject; Database thisDatabase = control.Database[value.mDatabaseName]; string databaseValue = ""; thisDatabase.Get(value, out databaseValue); textBuffer += string.Format("{0}", databaseValue); return textBuffer; }
public void PrintDatabaseTypeList(Murple.Control control, Object valueAsObject) { List<Database.DatabaseType> value = (List<Database.DatabaseType>)valueAsObject; foreach (Database.DatabaseType thisDatabaseType in value) { Database thisDatabase = control.Database[thisDatabaseType.mDatabaseName]; string databaseValue = ""; thisDatabase.Get(thisDatabaseType, out databaseValue); System.Diagnostics.Debug.Print(string.Format(" - {0}", databaseValue)); } }
public string GetPrintableDatabaseTypeList(Murple.Control control, Object valueAsObject) { string textBuffer = ""; List<Database.DatabaseType> value = (List<Database.DatabaseType>)valueAsObject; foreach (Database.DatabaseType thisDatabaseType in value) { Database thisDatabase = control.Database[thisDatabaseType.mDatabaseName]; string databaseValue = ""; thisDatabase.Get(thisDatabaseType, out databaseValue); textBuffer += string.Format(" - {0}", databaseValue); return textBuffer; } return textBuffer; }
public void PrintPod(Murple.Control control, Object valueAsObject) { Pod value = (Pod)valueAsObject; System.Diagnostics.Debug.Print(string.Format("#Pod Ref# {0}", value.Name)); }
public string GetPrintableImage(Murple.Control control, Object valueAsObject) { string textBuffer = ""; Image value = (Image)valueAsObject; textBuffer += string.Format("#Image# {0}", value.Name); return textBuffer; }
// ---------------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------------- // FILLMEIN public void PrintSimple(Murple.Control control, Object valueAsObject) { System.Diagnostics.Debug.Print(string.Format("{0}", valueAsObject)); }
public string GetPrintablePod(Murple.Control control, Object valueAsObject) { string textBuffer = ""; Pod value = (Pod)valueAsObject; textBuffer += string.Format("#Pod Ref# {0}", value.Name); return textBuffer; }
public void PrintStringList(Murple.Control control, Object valueAsObject) { List<string> value = (List<string>)valueAsObject; foreach (string thisString in value) { System.Diagnostics.Debug.Print(string.Format(" - {0}", thisString)); } }
public string GetPrintablePodList(Murple.Control control, Object valueAsObject) { string textBuffer = ""; List<Pod> value = (List<Pod>)valueAsObject; foreach (Pod thisPod in value) { textBuffer += Environment.NewLine; textBuffer += string.Format("\t- #Pod Ref# {0}", thisPod.Name); } return textBuffer; }
public static string GetPrintable(Murple.Control control, System.Type templateType, Object valueAsObject) { string textBuffer = ""; StatHelperData thisHelper = GetHelper(templateType); if (thisHelper.OnGetPrintable != null) textBuffer = thisHelper.OnGetPrintable(control, valueAsObject); return textBuffer; }
// ---------------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------------- private void ProcessCommandSequence(Murple.Control murpleControl, Murple.Pod thisPod, List<string> commandOptions) { //List<string> commandSequence = new List<string>(); //Murple.StatHelper.Get(thisPod.GetStat("Sequence"), ref commandSequence); List<string> commandSequence = (List<string>)thisPod.GetStat("Sequence").Get(); foreach (string currentCommand in commandSequence) { if (currentCommand.ToLower() == "print") DoCommandPrint(murpleControl, commandOptions); if (currentCommand.ToLower() == "focus") DoCommandFocus(murpleControl, commandOptions); if (currentCommand.ToLower() == "checkfocus") { if (DoCommandCheckFocus(murpleControl, commandOptions) == false) return; } if (currentCommand.ToLower() == "setstat") DoCommandSetStat(murpleControl, commandOptions); } }