Skip to content

Commit

Permalink
- fuck ugui
Browse files Browse the repository at this point in the history
  • Loading branch information
leviyuan committed Jul 18, 2017
1 parent 6daa729 commit 2ab2457
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 10 deletions.
Binary file modified TTConsole.Unity/Assets/Dlls/Editor/TinyTeam.Debuger.Editor.dll
Binary file not shown.
Binary file modified TTConsole.Unity/Assets/Dlls/Editor/TinyTeam.Debuger.Editor.pdb
Binary file not shown.
1 change: 1 addition & 0 deletions TTConsole.VS/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.vs/
Binary file modified TTConsole.VS/Build/Server/TinyTeam.Debuger.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
23 changes: 13 additions & 10 deletions TTConsole_Source_Unity/Assets/Console/Console.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static Console Instance
//singleton.hideFlags = HideFlags.HideInHierarchy;
_instance.Init();

DontDestroyOnLoad(singleton);
// DontDestroyOnLoad(singleton);
}
else
{
Expand Down Expand Up @@ -737,15 +737,8 @@ private void DrawWindow(bool isHide)
canvas.sortingOrder = 88888;

UnityEngine.UI.CanvasScaler cs = windows.AddComponent<UnityEngine.UI.CanvasScaler>();

//only mobile platform should use screen size.
if (!Application.isEditor)
{
cs.uiScaleMode = UnityEngine.UI.CanvasScaler.ScaleMode.ScaleWithScreenSize;
cs.screenMatchMode = UnityEngine.UI.CanvasScaler.ScreenMatchMode.MatchWidthOrHeight;
cs.referenceResolution = new Vector2(960f, 640f);
cs.matchWidthOrHeight = 1.0f;
}
cs.uiScaleMode = UnityEngine.UI.CanvasScaler.ScaleMode.ConstantPixelSize;
cs.scaleFactor = Screen.dpi / 100f * (Application.isEditor ? 1f : 0.5f);

UnityEngine.UI.GraphicRaycaster gr = windows.AddComponent<UnityEngine.UI.GraphicRaycaster>();
gr.blockingObjects = UnityEngine.UI.GraphicRaycaster.BlockingObjects.All;
Expand All @@ -764,6 +757,7 @@ void InitBlackground(GameObject windows)
//background
GameObject background = new GameObject("blackground");
background.transform.parent = windows.transform;
background.transform.localScale = Vector3.one;
UnityEngine.UI.Image img_bgm = background.AddComponent<UnityEngine.UI.Image>();
img_bgm.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, 0);
img_bgm.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, 0);
Expand All @@ -778,6 +772,7 @@ void InitScrollView(GameObject windows)
//content_scroll_view
GameObject scrollView = new GameObject("scrollview");
scrollView.transform.parent = windows.transform;
scrollView.transform.localScale = Vector3.one;
sr_content = scrollView.AddComponent<UnityEngine.UI.ScrollRect>();
sr_content.horizontal = false;

Expand All @@ -797,6 +792,7 @@ void InitScrollContent(GameObject scrollView)
//content_text
GameObject scroll_content = new GameObject("content");
scroll_content.transform.parent = scrollView.transform;
scroll_content.transform.localScale = Vector3.one;
text_content = scroll_content.AddComponent<UnityEngine.UI.Text>();
text_content.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, 0);
text_content.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, 0);
Expand All @@ -816,6 +812,7 @@ void InitInput(GameObject windows)
{
GameObject input_obj = new GameObject("input");
input_obj.transform.parent = windows.transform;
input_obj.transform.localScale = Vector3.one;
UnityEngine.UI.Image img_input = input_obj.AddComponent<UnityEngine.UI.Image>();
img_input.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, 0);
img_input.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Bottom, -15, 30);
Expand All @@ -826,6 +823,7 @@ void InitInput(GameObject windows)

GameObject input_placeholder = new GameObject("placeHolder");
input_placeholder.transform.parent = input_obj.transform;
input_placeholder.transform.localScale = Vector3.one;
UnityEngine.UI.Text text_holder = input_placeholder.AddComponent<UnityEngine.UI.Text>();
text_holder.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, 0);
text_holder.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 5, -10);
Expand All @@ -838,6 +836,7 @@ void InitInput(GameObject windows)

GameObject input_page = new GameObject("pageamount");
input_page.transform.parent = input_obj.transform;
input_page.transform.localScale = Vector3.one;
text_pageCount = input_page.AddComponent<UnityEngine.UI.Text>();
text_pageCount.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, 0);
text_pageCount.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 5, -10);
Expand All @@ -851,6 +850,7 @@ void InitInput(GameObject windows)

GameObject input_text_obj = new GameObject("inputText");
input_text_obj.transform.parent = input_obj.transform;
input_text_obj.transform.localScale = Vector3.one;
UnityEngine.UI.Text text_input = input_text_obj.AddComponent<UnityEngine.UI.Text>();
text_input.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 10, -20);
text_input.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 5, -10);
Expand All @@ -876,6 +876,7 @@ void InitButtons(GameObject windows)
{
btnParent = new GameObject("btns").AddComponent<RectTransform>();
btnParent.SetParent(windows.transform);
btnParent.transform.localScale = Vector3.one;
btnParent.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, 0);
btnParent.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, 0);
btnParent.anchorMin = Vector2.zero;
Expand All @@ -896,6 +897,7 @@ void UpdateButtons()
{
GameObject cmd_btn = new GameObject("btn-" + enumerator.Current.Key);
cmd_btn.transform.parent = btnParent.transform;
cmd_btn.transform.localScale = Vector3.one;
UnityEngine.UI.Image image = cmd_btn.AddComponent<UnityEngine.UI.Image>();
image.color = new Color(0, 0, 0, 1);
RectTransform rectTransform = cmd_btn.transform as RectTransform;
Expand All @@ -904,6 +906,7 @@ void UpdateButtons()
rectTransform.anchoredPosition = new Vector2(100 * (count % rowCount), 30 * (count / rowCount));
GameObject text_obj = new GameObject("text");
text_obj.transform.parent = cmd_btn.transform;
text_obj.transform.localScale = Vector3.one;
UnityEngine.UI.Text btn_text = text_obj.AddComponent<UnityEngine.UI.Text>();
btn_text.text = "[" + enumerator.Current.Key + "]";
btn_text.rectTransform.anchorMin = btn_text.rectTransform.anchorMax = Vector2.zero;
Expand Down
Binary file modified TTConsole_Source_Unity/Assets/test.unity
Binary file not shown.
Binary file modified TTConsole_Source_Unity/ProjectSettings/EditorBuildSettings.asset
Binary file not shown.
Binary file modified TTConsole_Source_Unity/ProjectSettings/GraphicsSettings.asset
Binary file not shown.
Binary file modified TTConsole_Source_Unity/ProjectSettings/ProjectSettings.asset
Binary file not shown.

0 comments on commit 2ab2457

Please sign in to comment.