Пример #1
0
    public void Setup()
    {
        rootObj = new GameObject();
        var rectTrans = rootObj.AddComponent <RectTransform>();

        rectTrans.anchorMin = new Vector2(0, 1);
        rectTrans.anchorMax = new Vector2(0, 1);
        rectTrans.pivot     = new Vector2(0, 1);

        view = rootObj.AddComponent <UUebViewComponent>();
        core = new UUebView.UUebViewCore(view);
        view.SetCore(core);

        var canvas = GameObject.Find("Canvas/MaterializeTestPlace");

        if (canvas == null)
        {
            var prefab     = Resources.Load <GameObject>("TestPrefabs/Canvas");
            var canvasBase = GameObject.Instantiate(prefab);
            canvasBase.name = "Canvas";
            canvas          = GameObject.Find("Canvas/MaterializeTestPlace");
        }


        rootObj.transform.SetParent(canvas.transform, false);

        rectTrans.anchoredPosition = new Vector2(100 * index, 0);
        index++;

        parser = new HTMLParser(core.resLoader, core.defaultImageDownloader);
    }
Пример #2
0
    public void Setup()
    {
        executor = new GameObject("htmlParserTest").AddComponent <UUebViewComponent>();
        var core = new UUebView.UUebViewCore(executor);

        executor.SetCore(core);
        loader = new ResourceLoader(executor.Core.CoroutineExecutor);

        parser = new HTMLParser(loader);
    }
Пример #3
0
    public void Setup()
    {
        executor = new GameObject("layoutMachineTest").AddComponent <UUebViewComponent>();
        var core = new UUebView.UUebViewCore(executor);

        executor.SetCore(core);

        loader = new ResourceLoader(executor.Core.CoroutineExecutor);
        defaultImageDownloader = new DefaultImageDownloader(executor.Core.CoroutineExecutor, loader);

        parser = new HTMLParser(loader, defaultImageDownloader);
    }
Пример #4
0
    public IEnumerator HideThenShow()
    {
        var source = @"
<!DOCTYPE uuebview href='resources://Views/MyInfoView/UUebTags'>
<bg>
    <textbg>
        <textbox>
            <updatetext>koko ni nihongo ga iikanji ni hairu.<br> good thing. long text will make large window. like this.</updatetext>
            <updatetext hidden='true' listen='readmore'>omake!</updatetext>
        </textbox>
    </textbg>
</bg>";

        UUebView.UUebViewComponent uUebView = null;

        var done = false;

        eventReceiverGameObj.GetComponent <TestReceiver>().OnLoaded = ids =>
        {
            uUebView = view.GetComponent <UUebViewComponent>();
            done     = true;
        };
        view = UUebView.UUebViewComponent.GenerateSingleViewFromHTML(eventReceiverGameObj, source, new Vector2(300, 100));

        var shown = false;

        Show(view, () => { shown = true; });

        yield return(WaitUntil(
                         () => shown && done,
                         () => { throw new TimeoutException("too late."); },
                         5
                         ));

        {
            var tree          = uUebView.Core.layoutedTree;
            var targetTextBox = tree.GetChildren()[0].GetChildren()[0].GetChildren()[0].GetChildren()[0].GetChildren()[0].GetChildren()[0].GetChildren()[1];
            True(targetTextBox.offsetY == 25f, "not match, targetTextBox.offsetY:" + targetTextBox.offsetY);
        }

        // show hidden contents.
        {
            var updated = false;
            eventReceiverGameObj.GetComponent <TestReceiver>().OnUpdated = ids =>
            {
                updated = true;
            };
            uUebView.EmitButtonEventById(null, string.Empty, "readmore");

            yield return(WaitUntil(
                             () => updated,
                             () => { throw new TimeoutException("too late."); },
                             5
                             ));
        }


        // hide hidden contents again.
        {
            var updated = false;
            eventReceiverGameObj.GetComponent <TestReceiver>().OnUpdated = ids =>
            {
                updated = true;
            };
            uUebView.EmitButtonEventById(null, string.Empty, "readmore");

            yield return(WaitUntil(
                             () => updated,
                             () => { throw new TimeoutException("too late."); }
                             ));
        }
        {
            var tree          = uUebView.Core.layoutedTree;
            var targetTextBox = tree.GetChildren()[0].GetChildren()[0].GetChildren()[0].GetChildren()[0].GetChildren()[0].GetChildren()[0].GetChildren()[1];
            True(targetTextBox.offsetY == 25f, "not match, targetTextBox.offsetY:" + targetTextBox.offsetY);
        }
        // ShowLayoutRecursive(tree, uUebView.Core.resLoader);
    }