Beispiel #1
0
        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);
                }
            }
        }
Beispiel #2
0
 //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();
 }
Beispiel #3
0
        // ----------------------------------------------------------------------------------------------------
        // ----------------------------------------------------------------------------------------------------
        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;
        }
Beispiel #4
0
        public Control(Murple.Control murpleControl)
        {
            mMurpleControl = murpleControl;

            mMurpleControl.LoadDatabaseFile(mMurpleDatabaseFilename);
            mMurpleControl.LoadDefinitionFile(mMurpleDefinitionFilename);
            mMurpleControl.LoadDataFile(mMurpleDataFilename);

            PopulateSystem(10);
        }
Beispiel #5
0
        // ----------------------------------------------------------------------------------------------------
        // ----------------------------------------------------------------------------------------------------
        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;
                }

            }
        }
Beispiel #6
0
 public void PrintUUID(Murple.Control control, Object valueAsObject)
 {
     System.Guid value = (System.Guid)valueAsObject;
     System.Diagnostics.Debug.Print(value.ToString());
 }
Beispiel #7
0
        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));
            }
        }
Beispiel #8
0
        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));
            }
        }
Beispiel #9
0
 public void PrintImage(Murple.Control control, Object valueAsObject)
 {
     Image value = (Image)valueAsObject;
     System.Diagnostics.Debug.Print(string.Format("#Image# {0}", value.Name));
 }
Beispiel #10
0
        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));
        }
Beispiel #11
0
        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;
        }
Beispiel #12
0
    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;
            }
        }
    }
Beispiel #13
0
 public void AddPod(Murple.Pod newPod)
 {
     MurpleControl.AddPod(newPod.UUID, newPod, mMurpleData);
 }
Beispiel #14
0
        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;
        }
Beispiel #15
0
        // ----------------------------------------------------------------------------------------------------
        // ----------------------------------------------------------------------------------------------------
        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();
            }
        }
Beispiel #16
0
        // ----------------------------------------------------------------------------------------------------
        // ----------------------------------------------------------------------------------------------------
        // FILLMEIN
        public string GetPrintableSimple(Murple.Control control, Object valueAsObject)
        {
            string textBuffer = "";

            textBuffer = string.Format("{0}", valueAsObject);

            return textBuffer;
        }
Beispiel #17
0
        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;
        }
Beispiel #18
0
        public static void Print(Murple.Control control, System.Type templateType, Object valueAsObject)
        {
            StatHelperData thisHelper = GetHelper(templateType);

            if (thisHelper.OnPrint != null)
                thisHelper.OnPrint(control, valueAsObject);
        }
Beispiel #19
0
 public string GetPrintableUUID(Murple.Control control, Object valueAsObject)
 {
     string textBuffer = "";
     System.Guid value = (System.Guid)valueAsObject;
     textBuffer += value.ToString();
     return textBuffer;
 }
Beispiel #20
0
        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;
        }
Beispiel #21
0
        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));
            }
        }
Beispiel #22
0
        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;
        }
Beispiel #23
0
 public void PrintPod(Murple.Control control, Object valueAsObject)
 {
     Pod value = (Pod)valueAsObject;
     System.Diagnostics.Debug.Print(string.Format("#Pod Ref# {0}", value.Name));
 }
Beispiel #24
0
 public string GetPrintableImage(Murple.Control control, Object valueAsObject)
 {
     string textBuffer = "";
     Image value = (Image)valueAsObject;
     textBuffer += string.Format("#Image# {0}", value.Name);
     return textBuffer;
 }
Beispiel #25
0
 // ----------------------------------------------------------------------------------------------------
 // ----------------------------------------------------------------------------------------------------
 // FILLMEIN
 public void PrintSimple(Murple.Control control, Object valueAsObject)
 {
     System.Diagnostics.Debug.Print(string.Format("{0}", valueAsObject));
 }
Beispiel #26
0
 public string GetPrintablePod(Murple.Control control, Object valueAsObject)
 {
     string textBuffer = "";
     Pod value = (Pod)valueAsObject;
     textBuffer += string.Format("#Pod Ref# {0}", value.Name);
     return textBuffer;
 }
Beispiel #27
0
        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));
            }
        }
Beispiel #28
0
        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;
        }
Beispiel #29
0
        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;
        }
Beispiel #30
0
        // ----------------------------------------------------------------------------------------------------
        // ----------------------------------------------------------------------------------------------------
        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);
            }
        }