Beispiel #1
0
        void Start()
        {
            if (SlotGraphic != null)
            {
                CharacterSpacing += SlotGraphic.bounds.size.x;
            }

            cursorParticle = Cursor.GetComponentInChildren <ParticleSystem>();

            DisplayTextMeshes = new TextMesh[MaxChars];

            DisplayTextMeshes[0]               = new GameObject("Display" + 0).AddComponent <TextMesh>();
            DisplayTextMeshes[0].font          = TextFont;
            DisplayTextMeshes[0].fontSize      = FontSize;
            DisplayTextMeshes[0].color         = TextColor;
            DisplayTextMeshes[0].characterSize = 0.1f;
            DisplayTextMeshes[0].GetComponent <Renderer>().material = TextFont.material;
            DisplayTextMeshes[0].alignment               = TextAlignment.Center;
            DisplayTextMeshes[0].anchor                  = TextAnchor.MiddleCenter;
            DisplayTextMeshes[0].transform.parent        = DisplayChars;
            DisplayTextMeshes[0].transform.localPosition = Vector3.zero;
            DisplayTextMeshes[0].transform.localScale    = Vector3.one;
            DisplayTextMeshes[0].gameObject.layer        = gameObject.layer;
            SortingOrder so = DisplayTextMeshes[0].gameObject.AddComponent <SortingOrder>();

            SortingOrder sso = GetComponentInParent <SortingOrder>();

            so.AlwaysUpdate  = true;
            so.Order         = sso.Order + 1;
            so.SortLayerName = sso.SortLayerName;

            BoxCollider2D col = DisplayTextMeshes[0].gameObject.AddComponent <BoxCollider2D>();

            col.size = new Vector2(CharacterSpacing, 1);

            DisplayTextMeshes[0].gameObject.AddComponent <PYButton>().onClick.AddListener(OnCharacterDisplayClicked);

            for (int i = 1; i < DisplayTextMeshes.Length; i++)
            {
                DisplayTextMeshes[i]                         = ((GameObject)Instantiate(DisplayTextMeshes[0].gameObject)).GetComponent <TextMesh>();
                DisplayTextMeshes[i].name                    = "Display" + i;
                DisplayTextMeshes[i].transform.parent        = DisplayChars;
                DisplayTextMeshes[i].transform.localPosition = Vector3.right * i * CharacterSpacing;
                DisplayTextMeshes[i].transform.localScale    = Vector3.one;
                DisplayTextMeshes[i].gameObject.layer        = gameObject.layer;

                DisplayTextMeshes[i].GetComponent <PYButton>().onClick.AddListener(OnCharacterDisplayClicked);
            }

            UpdateCursorPosition(1);

            PlayTableKeyboard.Instance.SetTextDelegates = SetText;
        }
Beispiel #2
0
 public void SetOrder(int order, string layerName)
 {
     SortingOrder.ChangeSortingOrder(order, layerName);
 }
Beispiel #3
0
 public void SetOrder(int order)
 {
     SortingOrder.ChangeSortingOrder(order);
 }