Пример #1
0
        public void Play(GameNode node, Game game)
        {
            if (node.Message.Contains("&&"))
            {
                string[] delimiter = new string[] { "&&" };

                string[] messages = node.Message.Trim().Split(delimiter, StringSplitOptions.RemoveEmptyEntries);

                for (int i = 0; i < messages.Length; i++)
                {
                    string tempText = messages[i].Trim();

                    if (tempText.Contains("%%"))
                    {
                        tempText = tempText.Remove(0, 2);
                        game.ToggleActor(Int32.Parse(tempText));
                    }
                    else if (tempText.Contains("##"))
                    {
                        tempText = tempText.Remove(0, 2);
                        game.ToggleNode(Int32.Parse(tempText));
                    }
                }
            }
        }
Пример #2
0
        private void CreateNode(string tempNode)
        {
            string[] nodeData = tempNode.Split('~');
            GameNode newNode = new GameNode();
            newNode.ID = Int32.Parse(nodeData[0]);
            newNode.Actor = Int32.Parse(nodeData[1]);
            newNode.Message = nodeData[2];

            for (int i = 3; i < nodeData.Length; i++)
            {
                if (nodeData[i].IndexOf("&&") != -1)
                {
                    string command = nodeData[i].Substring(0, nodeData[i].IndexOf("&&"));
                    string output = nodeData[i].Substring(nodeData[i].IndexOf("&&") + 2);
                    newNode.AddCommandMap(new CommandMap(command, output));
                }
            }

            initializationList.AddLast(newNode);
        }