예제 #1
0
    public TypedScriptPromise <string> SimpleWait(ScriptContext ctx, int t)
    {
        if (_p != null)
        {
            return(null);
        }

        _p = new TypedScriptPromise <string>(ctx);
        return(_p);
    }
예제 #2
0
        public static bool js_get_classvalue <T>(JSContext ctx, JSValue val, out TypedScriptPromise <T> o)
        {
            ScriptPromise value;

            if (js_get_classvalue(ctx, val, out value))
            {
                o = value as TypedScriptPromise <T>;
                return(true);
            }
            o = null;
            return(false);
        }
예제 #3
0
    void OnGUI()
    {
        var p = _p;

        if (p == null)
        {
            return;
        }

        if (GUILayout.Button("Resolve"))
        {
            _p = null;
            p.Resolve("执行成功测试, 我是一个C#字符串, 传给JS");
        }

        if (GUILayout.Button("Reject"))
        {
            _p = null;
            p.Reject("执行失败测试");
        }
    }