Exemple #1
0
 public void OnMouseDown()
 {
     if (noComparison || data.getData(comparisonData) != comparisonResult || data.getData("equippedItem.Name") != "None")
     {
         previousParent             = transform.parent;
         transform.parent           = GameObject.Find("UI").transform;
         grabbed                    = true;
         GameManager.draggingObject = true;
         GameManager.draggedObject  = this.gameObject;
     }
 }
    public void parseFields()
    {
        if (displayCode.Length <= 1)
        {
            return;
        }
        string[] lines = displayCode.Split('\n');
        comparisons.Clear();
        string currentComparison = "";

        comparisons.Add("none", "");
        foreach (string line in lines)
        {
            if (line[0] == '#')
            {
                string[] headerFields = line.Split('|');
                headerFields[0] = headerFields[0].Substring(1);
                uiObject.createHeader(int.Parse(data.getData(headerFields[0])), data.getData(headerFields[1]));
                continue;
            }
            if (line[0] == '=')
            {
                uiObject.createSeperator();
                continue;
            }
            if (line[0] == '[')
            {
                currentComparison = line.Substring(1, line.Length - 2);
                comparisons.Add(currentComparison, "");
            }
            else if (currentComparison != "")
            {
                comparisons[currentComparison] += line + '\n';
            }
            else
            {
                comparisons["none"] += line + '\n';
            }
        }

        foreach (KeyValuePair <string, string> entry in comparisons)
        {
            if (entry.Value == "")
            {
                continue;
            }
            string value = entry.Value.Substring(0, entry.Value.Length - 1);
            if (entry.Key == data.getData(comparisonVal) || entry.Key == "none")
            {
                string[] nlines = value.Split('\n');

                foreach (string line in nlines)
                {
                    string[] fields = line.Split('|');
                    if (fields.Length < 2)
                    {
                        uiObject.createDescText(data.getData(fields[0]));
                    }
                    else
                    {
                        uiObject.createText(fields[0], data.getData(fields[1]));
                    }
                }
            }
        }
    }