コード例 #1
0
ファイル: GameCommands.cs プロジェクト: eugeneUG/Murple
        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);
                }
            }
        }
コード例 #2
0
ファイル: MurpleLoader.cs プロジェクト: eugeneUG/Murple
        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;
        }