Example #1
0
    public void callback(WWW www)
    {
        string s = www.text;

        JsonData data = JsonMapper.ToObject(s);

        Debug.Log(data.ToJson());
        if (string.IsNullOrEmpty(data["error"].ToString()))
        {
            string function = stripWhiteSpace(data["latex"].ToString());
            Debug.Log(function);

            function = function.Replace("\\operatorname{sin}", "Sin");
            function = function.Replace("\\operatorname{cos}", "Cos");
            function = function.Replace("\\operatorname{tan}", "Tan");

            function = function.Replace("{", "(");
            function = function.Replace("}", ")");

            text.text = function;

            functionDrawer.draw(function);
        }
        else
        {
            text.text = data["error"].ToString();
        }
    }
    public void OnClick()
    {
        string s = "";

        switch (i)
        {
        case 0:
            s = "f(x)=x*x";
            break;

        case 1:
            s = "f(x,y)=(2*x+1)/y";
            break;

        case 2:
            s = "f(x,y)=(Sin(y+t),Sin(x))";
            break;

        case 3:
            s = "f(x,y,z)=(Sin(x),Cos(z),Sin(x))";
            break;
        }
        functionDrawer.draw(s);
        text.text = s;
        i++;
        if (i == 4)
        {
            i = 0;
        }
    }