public IEnumerator EmptyStringError() { var box = BoxElement.GO( null,// bg画像 () => { Debug.Log("ルートがタップされた"); }, TextElement.GO(null)// テキスト ); // レイアウトに使うクラスを生成する var layouter = new BasicLayouter(); // コンテンツのサイズをセットする var size = new Vector2(600, 100); // レイアウトを行う box = LayouTaro.Layout( canvas.transform, size, box, layouter ); var rectTrans = box.gameObject.GetComponent <RectTransform>(); rectTrans.anchoredPosition3D = Vector3.zero; rectTrans.localScale = Vector3.one; ScreenCapture.CaptureScreenshot("./images/" + methodName); yield break; }
public IEnumerator GetMissingChar3Relayout() { var box = BoxElement.GO( null,// bg画像 () => { Debug.Log("ルートがタップされた"); }, TextElement.GO("aaaaaaaaaaaaabbbbbbbbb💚🎮✨✨cccccccccccccccccccccccccccccccddddddddddddddddddddd") ); // レイアウトに使うクラスを生成する var layouter = new BasicLayouter(); // コンテンツのサイズをセットする var size = new Vector2(600, 100); var missingDetected = false; LayouTaro.SetOnMissingCharacterFound( missingChars => { missingDetected = true; } ); // レイアウトを行う box = LayouTaro.Layout( canvas.transform, size, box, layouter ); var rectTrans = box.gameObject.GetComponent <RectTransform>(); rectTrans.anchoredPosition3D = Vector3.zero; rectTrans.localScale = Vector3.one; Assert.True(missingDetected); box = LayouTaro.RelayoutWithUpdate( size, box, new Dictionary <LTElementType, object>() { { LTElementType.Text, "aaaaaaaaaaaaabbbbbbbbb💚🎮✨✨cccccccccccccccccccccccccccccccddddddddddddddddddddd" } }, layouter ); yield return(null); ScreenCapture.CaptureScreenshot("./images/" + methodName); yield break; }
public IEnumerator SpacesAndLayout3Relayout() { var box = BoxElement.GO( null,// bg画像 () => { Debug.Log("ルートがタップされた"); }, ButtonElement.GO(null, () => { }), TextElement.GO( "ここから " + // 全角スペースが9文字あり、かなりのサイズになる。 "・" ) // 連続するスペースと文字、・の直前で改行が発生する。 ); // レイアウトに使うクラスを生成する var layouter = new BasicLayouter(); // コンテンツのサイズをセットする var size = new Vector2(600, 100); // レイアウトを行う box = LayouTaro.Layout( canvas.transform, size, box, layouter ); var rectTrans = box.gameObject.GetComponent <RectTransform>(); rectTrans.anchoredPosition3D = Vector3.zero; rectTrans.localScale = Vector3.one; box = LayouTaro.RelayoutWithUpdate( size, box, new Dictionary <LTElementType, object> { { LTElementType.Text, "ここから " + // 全角スペースが9文字あり、かなりのサイズになる。 "・" } }, layouter ); yield return(null); while (false) { yield return(null); } ScreenCapture.CaptureScreenshot("./images/" + methodName); yield break; }
public IEnumerator WithEmojiComplex() { // 最後のgooooo..dが分離されて浮くように。 var box = BoxElement.GO( null,// bg画像 () => { Debug.Log("ルートがタップされた"); }, TextElement.GO("hannidjkfajfaoooood"), // テキスト ImageElement.GO(null), // 画像 ButtonElement.GO(null, () => { Debug.Log("ボタンがタップされた"); }), TextElement.GO("hannin is yasu!\U0001F60A\U0001F60B this is public problem! goooooooooooooad") // 59から絵文字を1文字削ると?2文字減る。文字数カウント的にはUTF8と同じ扱いなのか。うーん // 事前にサイズを取得、インデックスポイントを送り込んで、取り除いて、という形にするか。 // どうすればできる?載せ替える四角を成立させればいいか。単純に文字列コンテンツを絵文字でぶった切るか!!これは手な気がする。 // 他になんかないかな。いけるな、 // 文字列を最初に渡すときに、N個の絵文字が出た場合、\Uで検索して文字を取り出す。そんで、その文字がどんな画像になるか、っていうのを別途やる。そんで、 // それぞれの文字を出力して、サイズを割り出し、文字列を再構成する。 // 再構成した上でレイアウトすればいい。で、それぞれのレイアウト終了時に絵文字の画像を割り当てるか。 // この方法であれば、まあ、そもそも画像を割り当てるような置換ができれば優勝できるな。 // 割り出し方に問題が出るかな、例があると嬉しいな。ない。今はない。 ); // レイアウトに使うクラスを生成する var layouter = new BasicLayouter(); // コンテンツのサイズをセットする var size = new Vector2(600, 100); // レイアウトを行う box = LayouTaro.Layout( canvas.transform, size, box, layouter ); var rectTrans = box.gameObject.GetComponent <RectTransform>(); rectTrans.anchoredPosition3D = Vector3.zero; rectTrans.localScale = Vector3.one; ScreenCapture.CaptureScreenshot("./images/" + methodName); while (false) { yield return(null); } yield break; }
public override void Create(bool active) { base.Create(active); if (BackgroundColor.HasValue) { Background.color = BackgroundColor.Value; } BoxElement.Apply(Element); }
static ElementFactory() { _boxPrototype = new BoxElement(); _boxPrototype.Title = "New box element."; _circleProrotype = new CircleElement(); _circleProrotype.Title = "New circle element"; _connectorPrototype = new ConnectorElement(); _connectorPrototype.Title = "New connector element"; }
void Start() { // データのインスタンスを元に、レイアウトを開始する。 Debug.Log("レイアウト開始!"); /* * ・マルチ文字列、ラストが1ラインなら別にレイアウト巻き込まれていいよね * ・同じマルチ文字列で結果が違うやつがいる */ // データ構造を作る、自由に構造を書いていい。 var box = BoxElement.GO( null,// bg画像 () => { Debug.Log("ルートがタップされた"); }, TextElement.GO("hannin is yasu! this is public problem! gooooooooooooood"), // テキスト ImageElement.GO(null), // 画像 ButtonElement.GO(null, () => { Debug.Log("ボタンがタップされた"); }) ); // レイアウトに使うクラスを生成する var layouter = new MyLayouter(); // コンテンツのサイズをセットする var size = new Vector2(600, 100); // レイアウトを行う var go = box.gameObject; go = LayouTaro.Layout <BoxElement>( canvas.transform, size, go, layouter ); go.transform.SetParent(canvas.transform); go.GetComponent <RectTransform>().anchoredPosition = Vector2.zero; // 値の更新とリレイアウトを行う // goからBoxを取得し、Relayoutを行い、行った後のGameObjectを受け取る。同じインスタンスで中身の値が変わったものが返ってくる。 go = LayouTaro.RelayoutWithUpdate <BoxElement>( size, go, new Dictionary <LTElementType, object> { { LTElementType.Image, null }, { LTElementType.Text, "relayout!" } }, layouter ); }
public static void Implement() { BoxElement boxPrototype = new BoxElement(); DynamiFabric.AddPrototype(boxPrototype); CircleElement circlePrototype = new CircleElement(); DynamiFabric.AddPrototype(circlePrototype); ConnectorElement connectorPrototype = new ConnectorElement(); DynamiFabric.AddPrototype(connectorPrototype); BoxElement newBox = (BoxElement)DynamiFabric.CreateObject((typeof(BoxElement))); }
public IEnumerator RelayoutWithEmoji() { // generate your own data structure with parameters for UI. var box = BoxElement.GO( null,// UI bg with image () => { Debug.Log("root box element is tapped."); }, TextElement.GO("hannin is yasu! this is public problem\U0001F60A! gooooooooooooood "), // text. ImageElement.GO(null), // image. ButtonElement.GO(null, () => { Debug.Log("button is tapped."); }) ); // generate the layouter which you want to use for layout. var layouter = new BasicLayouter(); // set the default size of content. var size = new Vector2(600, 100); // do layout with LayouTaro. the GameObject will be returned with layouted structure. box = LayouTaro.Layout( canvas.transform, size, box, layouter ); var rectTrans = box.gameObject.GetComponent <RectTransform>(); rectTrans.anchoredPosition3D = Vector3.zero; rectTrans.localScale = Vector3.one; // update element values and re-layout with same GameObject. box = LayouTaro.RelayoutWithUpdate( size, box, new Dictionary <LTElementType, object> { { LTElementType.Image, null }, { LTElementType.Text, "relayout\U0001F60A!" } }, layouter ); yield return(null); ScreenCapture.CaptureScreenshot("./images/" + methodName); yield break; }
public IEnumerator DetectMissingEmoji() { // generate your own data structure with parameters for UI. var box = BoxElement.GO( null,// UI bg with image () => { Debug.Log("root box element is tapped."); }, TextElement.GO("\U0001F971\U0001F60A"), // text. ImageElement.GO(null), // image. ButtonElement.GO(null, () => { Debug.Log("button is tapped."); }) ); // generate the layouter which you want to use for layout. var layouter = new BasicLayouter(); // set the default size of content. var size = new Vector2(600, 100); var done = false; LayouTaro.SetOnMissingCharacterFound(chs => { var bytes = Encoding.UTF8.GetBytes(chs); foreach (var ch in bytes) { Debug.Log("missing ch byte:" + ch); } done = true; }); // do layout with LayouTaro. the GameObject will be returned with layouted structure. box = LayouTaro.Layout( canvas.transform, size, box, layouter ); var rectTrans = box.gameObject.GetComponent <RectTransform>(); rectTrans.anchoredPosition3D = Vector3.zero; rectTrans.localScale = Vector3.one; ScreenCapture.CaptureScreenshot("./images/" + methodName); Assert.True(done); yield break; }
private static bool Concentrate(BoxElement box) { foreach (Curve crv in box.InputSegments) { crv.DivideByCount(7, true, out Point3d[] pts); foreach (Point3d pt in pts) { box.VerbResults.Add(new LineCurve(pt, box.Dims.Center)); } } return(true); }
public static void Enact(BoxElement box) { box.VerbResults = new List <Curve>(); if (!VerbMethods.TryGetValue(box.Verb, out Func <BoxElement, bool> verbFunc)) { //Verb method is not implemented. Pass input curves as results. box.VerbResults.AddRange(box.InputSegments); } else { verbFunc(box); } }
public IEnumerator WithEmojiComplex2() { // 最後のgooooo..dが分離されて浮くように。 var box = BoxElement.GO( null,// bg画像 () => { Debug.Log("ルートがタップされた"); }, TextElement.GO("hannidjkfajfaoooood"), // テキスト ImageElement.GO(null), // 画像 ButtonElement.GO(null, () => { Debug.Log("ボタンがタップされた"); }), TextElement.GO("hannin is yasu!\U0001F60A this is public problem! goooooooooooooad"), // テキスト ImageElement.GO(null), // 画像 ImageElement.GO(null), // 画像 TextElement.GO("hannidjkfajfaoooood2") ); // レイアウトに使うクラスを生成する var layouter = new BasicLayouter(); // コンテンツのサイズをセットする var size = new Vector2(600, 100); // レイアウトを行う box = LayouTaro.Layout( canvas.transform, size, box, layouter ); var rectTrans = box.gameObject.GetComponent <RectTransform>(); rectTrans.anchoredPosition3D = Vector3.zero; rectTrans.localScale = Vector3.one; ScreenCapture.CaptureScreenshot("./images/" + methodName); while (false) { yield return(null); } yield break; }
public IEnumerator LayoutOneLineTextDoesNotContainInTheEndOfLine() { var box = BoxElement.GO( null,// bg画像 () => { Debug.Log("ルートがタップされた"); }, TextElement.GO("hannin is yasu! this is public problem! gooooooood"), // テキスト ImageElement.GO(null), // 画像 ImageElement.GO(6.558f + 0.0002f, 10f), TextElement.GO("lllllllllllllx"), TextElement.GO("dijklmnoああああああああああああいえああああ") ); // レイアウトに使うクラスを生成する var layouter = new BasicLayouter(); // コンテンツのサイズをセットする var size = new Vector2(600, 100); // レイアウトを行う box = LayouTaro.Layout( canvas.transform, size, box, layouter ); var rectTrans = box.gameObject.GetComponent <RectTransform>(); rectTrans.anchoredPosition3D = Vector3.zero; rectTrans.localScale = Vector3.one; yield return(null); while (false) { yield return(null); } ScreenCapture.CaptureScreenshot("./images/" + methodName); yield break; }
public IEnumerator GetMissingChar2() { var box = BoxElement.GO( null,// bg画像 () => { Debug.Log("ルートがタップされた"); }, TextElement.GO("a\U00011580a")// missingになる梵字 ); // レイアウトに使うクラスを生成する var layouter = new BasicLayouter(); // コンテンツのサイズをセットする var size = new Vector2(600, 100); var missingDetected = false; LayouTaro.SetOnMissingCharacterFound( missingChars => { missingDetected = true; } ); // レイアウトを行う box = LayouTaro.Layout( canvas.transform, size, box, layouter ); var rectTrans = box.gameObject.GetComponent <RectTransform>(); rectTrans.anchoredPosition3D = Vector3.zero; rectTrans.localScale = Vector3.one; Assert.True(missingDetected); ScreenCapture.CaptureScreenshot("./images/" + methodName); yield break; }
public IEnumerator MultilineAfterFilledOneLineLong() { // 行頭からの改行を行う要素がY位置ゼロよりも下方で発生する場合にレイアウトが狂うバグ var box = BoxElement.GO( null,// bg画像 () => { Debug.Log("ルートがタップされた"); }, TextElement.GO("dijklmnoああああああああああああ"), TextElement.GO("dijklmnoああああああああああああいえあああああああああああああああああああああああああああああああああああああああ") ); // レイアウトに使うクラスを生成する var layouter = new BasicLayouter(); // コンテンツのサイズをセットする var size = new Vector2(600, 100); // レイアウトを行う box = LayouTaro.Layout( canvas.transform, size, box, layouter ); var rectTrans = box.gameObject.GetComponent <RectTransform>(); rectTrans.anchoredPosition3D = Vector3.zero; rectTrans.localScale = Vector3.one; yield return(null); while (false) { yield return(null); } ScreenCapture.CaptureScreenshot("./images/" + methodName); yield break; }
public IEnumerator SpacesAndLayout2() { var box = BoxElement.GO( null,// bg画像 () => { Debug.Log("ルートがタップされた"); }, ButtonElement.GO(null, () => { }), TextElement.GO("ここから ・ ここまで")// 連続するスペースと文字 ); // レイアウトに使うクラスを生成する var layouter = new BasicLayouter(); // コンテンツのサイズをセットする var size = new Vector2(600, 100); // レイアウトを行う box = LayouTaro.Layout( canvas.transform, size, box, layouter ); var rectTrans = box.gameObject.GetComponent <RectTransform>(); rectTrans.anchoredPosition3D = Vector3.zero; rectTrans.localScale = Vector3.one; yield return(null); while (false) { yield return(null); } ScreenCapture.CaptureScreenshot("./images/" + methodName); yield break; }
private static bool Regulate(BoxElement box) { foreach (Curve crv in box.InputSegments) { var startPt = crv.PointAtStart; var endPt = crv.PointAtEnd; var resultCurves = new List <Curve>() { new LineCurve(startPt, new Point3d(box.Dims.MinCorner.X, box.Dims.MaxCorner.Y, 0)), new LineCurve(startPt, new Point3d(startPt.X, box.Dims.MinCorner.Y, 0)), new LineCurve(endPt, new Point3d(box.Dims.MaxCorner.X, box.Dims.MinCorner.Y, 0)), new LineCurve(endPt, new Point3d(endPt.X, box.Dims.MaxCorner.Y, 0)), }; box.VerbResults.AddRange(resultCurves); } return(true); }
public IEnumerator ImageAndButton() { // generate your own data structure with parameters for UI. var box = BoxElement.GO( null,// UI bg with image () => { Debug.Log("root box element is tapped."); }, ImageElement.GO(null),// image. ButtonElement.GO(null, () => { Debug.Log("button is tapped."); }) ); // generate the layouter which you want to use for layout. var layouter = new BasicLayouter(); // set the default size of content. var size = new Vector2(600, 100); // do layout with LayouTaro. the GameObject will be returned with layouted structure. box = LayouTaro.Layout( canvas.transform, size, box, layouter ); var rectTrans = box.gameObject.GetComponent <RectTransform>(); rectTrans.anchoredPosition3D = Vector3.zero; rectTrans.localScale = Vector3.one; yield return(null); ScreenCapture.CaptureScreenshot("./images/" + methodName); yield break; }
public IEnumerator BasicPattern() { var box = BoxElement.GO( null,// bg画像 () => { Debug.Log("ルートがタップされた"); }, TextElement.GO("hannin is yasu! this is public problem! gooooooooooooood"), // テキスト ImageElement.GO(null), // 画像 ButtonElement.GO(null, () => { Debug.Log("ボタンがタップされた"); }) ); // レイアウトに使うクラスを生成する var layouter = new BasicLayouter(); // コンテンツのサイズをセットする var size = new Vector2(600, 100); // レイアウトを行う box = LayouTaro.Layout( canvas.transform, size, box, layouter ); var rectTrans = box.gameObject.GetComponent <RectTransform>(); rectTrans.anchoredPosition3D = Vector3.zero; rectTrans.localScale = Vector3.one; ScreenCapture.CaptureScreenshot("./images/" + methodName); yield break; }