Esempio n. 1
0
    public void GetPersonSpeakAttributes(PersonSpeakAttributes personSpeak, XElement xElement, string text)
    {
        personSpeak.text = text;
        foreach (var attribute in xElement.Attributes())
        {
            switch (attribute.Name.ToString())
            {
            case "person":
                personSpeak.personName = attribute.Value;
                break;

            case "person-ID":
                personSpeak.personID = Int32.Parse(attribute.Value);
                break;

            case "colorName":
                personSpeak.color = attribute.Value;
                break;

            case "boldName":
                personSpeak.bold = Convert.ToBoolean(attribute.Value);
                break;

            case "italicName":
                personSpeak.italic = Convert.ToBoolean(attribute.Value);
                break;
            }
        }
    }
Esempio n. 2
0
    public void InterateTheSubTree(XElement xElement)
    {
        Debug.Log(" sdasaaasaa");

        string nodeName = xElement.Name.ToString();

        switch (nodeName)
        {
        case "NextEvent":
            Debug.Log(" sdasaa");
            NextButtonInjector(xElement);
            break;

        case "LineBreak":
            SM4UIMainTextfield.instance.LineBreak();
            break;

        case "ClearTextField":
            Debug.Log("test");
            SM4UIMainTextfield.instance.ClearText();
            break;

        case "BlankLine":
            SM4UIMainTextfield.instance.BlankLine();
            break;

        case "HideImages":
            SM4ImageLoader.instance.ClearIntanciatedImages();
            SM4ImageLoader.instance.ClearLayerImages();
            break;

        case "SetImage":
            SM4ImageLoader.instance.InstanciateRawImage(GetImageAttributes(xElement));
            break;

        case "SetImageLayer":
            SM4ImageLoader.instance.AddLayerImage(GetImageAttributes(xElement));
            break;

        case "Points":
            Debug.Log(nodeName);
            break;

        default:

            break;
        }

        foreach (var node in xElement.Nodes())
        {
            if (node.NodeType == XmlNodeType.Text)
            {
                if (xElement.Name == "AddText")
                {
                    var formatAttributes = GetTextFormatAttributes(xElement);
                    SM4UIMainTextfield.instance.AddText(formatAttributes[0] + node.ToString() + formatAttributes[1]);
                }
                if (xElement.Name == "SetText")
                {
                    SM4UIMainTextfield.instance.AddText(node.ToString());
                }

                if (xElement.Name == "PersonSpeak")
                {
                    if (lastPersonspeak == node.Parent.ToString())
                    {
                        var formatAttributes = GetTextFormatAttributes(xElement);
                        SM4UIMainTextfield.instance.AddText(formatAttributes[0] + node.ToString() + formatAttributes[1]);
                    }
                    else
                    {
                        var personSpeak      = new PersonSpeakAttributes();
                        var formatAttributes = GetTextFormatAttributes(xElement);
                        GetPersonSpeakAttributes(
                            personSpeak,
                            xElement,
                            formatAttributes[0] + node.ToString() + formatAttributes[1]);
                        SM4UIMainTextfield.instance.PersonSpeak(personSpeak);
                        lastPersonspeak = node.Parent.ToString();
                    }
                }
            }

            if (xElement.Name == "if")
            {
                Debug.Log("If node always returns true");
                // uncomment the part below to actually chec
                // if (!CheckAttributeList(GetAttributeList(xElement)))
                // {
                //     continue;
                // }
                if (node.NodeType == XmlNodeType.Text)
                {
                    var formatAttributes = GetTextFormatAttributes(xElement);
                    SM4UIMainTextfield.instance.AddText(formatAttributes[0] + node.ToString() + formatAttributes[1]);
                }
            }

            if (node.NodeType == XmlNodeType.Element)
            {
                ReadSubTree(XElement.Load(node.CreateNavigator().ReadSubtree()));
            }
        }
    }
Esempio n. 3
0
    public void PersonSpeak(PersonSpeakAttributes attributes)
    {
        if (textfield.text != "")
        {
            AddText("\n");
        }
        var nameOfSM = SM4SlaveMakerControler.instance.slaveMaker.nameChar.first;

        if (nameOfSM == null)
        {
            nameOfSM = "SlaveMaker";
        }

        switch (attributes.personName)
        {
        case "sm":
            AddText("<color=#660000><b><i>");
            AddText(nameOfSM);
            AddText(" :</i></b></color>   ");
            AddText("<color=#000000>");
            AddText(attributes.text);
            AddText("</color>");
            break;

        case "smcustom":
            AddText("<color=#" + attributes.color + ">");
            if (attributes.bold)
            {
                AddText("<b>");
            }
            if (attributes.italic)
            {
                AddText("<i>");
            }
            AddText(nameOfSM);
            if (attributes.italic)
            {
                AddText("</i>");
            }
            if (attributes.bold)
            {
                AddText("</b>");
            }
            AddText(" :</color>   ");
            AddText(attributes.text);
            break;

        default:
            AddText("<color=#" + attributes.color + ">");
            if (attributes.bold)
            {
                AddText("<b>");
            }
            if (attributes.italic)
            {
                AddText("<i>");
            }
            AddText(attributes.personName);
            if (attributes.italic)
            {
                AddText("</i>");
            }
            if (attributes.bold)
            {
                AddText("</b>");
            }
            AddText(" :</color>   ");
            AddText(attributes.text);
            break;
        }
    }