Tanoda
RebuildChecker.cs
Go to the documentation of this file.
1using System.Collections;
2using System.Collections.Generic;
3using UnityEngine;
4
6{
7 public class RebuildChecker
8 {
9 IInputField input;
10
11 string beforeString;
12 int beforeCaretPosition;
13 int beforeSelectionFocusPosition;
14 int beforeSelectionAnchorPosition;
15 //Vector2 anchoredPosition;
16
18 {
19 this.input = input;
20 }
21
22 public bool NeedRebuild(bool debug = false)
23 {
24 var res = false;
25
26 // any not same
27 if (beforeString != input.text)
28 {
29 if(debug) Debug.Log(string.Format("beforeString : {0} != {1}", beforeString, input.text));
30 beforeString = input.text;
31 res = true;
32 }
33
34 if (beforeCaretPosition != input.caretPosition)
35 {
36 if (debug) Debug.Log(string.Format("beforeCaretPosition : {0} != {1}", beforeCaretPosition, input.caretPosition));
37 beforeCaretPosition = input.caretPosition;
38 res = true;
39 }
40
41 if (beforeSelectionFocusPosition != input.selectionFocusPosition)
42 {
43 if (debug) Debug.Log(string.Format("beforeSelectionFocusPosition : {0} != {1}", beforeSelectionFocusPosition, input.selectionFocusPosition));
44 beforeSelectionFocusPosition = input.selectionFocusPosition;
45 res = true;
46 }
47
48 if (beforeSelectionAnchorPosition != input.selectionAnchorPosition)
49 {
50 if (debug) Debug.Log(string.Format("beforeSelectionAnchorPosition : {0} != {1}", beforeSelectionAnchorPosition, input.selectionAnchorPosition));
51 beforeSelectionAnchorPosition = input.selectionAnchorPosition;
52 res = true;
53 }
54
55 //if (anchoredPosition != input.TextComponentRectTransform().anchoredPosition)
56 //{
57 // if (debug) Debug.Log(string.Format("anchoredPosition : {0} != {1}", anchoredPosition, input.TextComponentRectTransform().anchoredPosition));
58 // anchoredPosition = input.TextComponentRectTransform().anchoredPosition;
59 // res = true;
60 //}
61 return res;
62 }
63 }
64}
UnityEngine.Debug Debug
Definition: TanodaServer.cs:19
bool NeedRebuild(bool debug=false)