Ejemplo n.º 1
0
        private static void AddButtonOk(Transform parent)
        {
            GameObject buttonObject = new GameObject("Button");

            buttonObject.transform.SetParent(parent);

            RectTransform rectTransform = buttonObject.AddComponent <RectTransform>();

            rectTransform.SetWidth(buttonWidth);
            rectTransform.SetHeight(buttonHeight);
            rectTransform.SetLeftTopPosition(new Vector2(boxWidth - (buttonWidth + buttonMargin), (buttonHeight + buttonMargin) - boxHeight));

            Image image = buttonObject.AddComponent <Image>();

            image.color = RectUtils.HexToColor(buttonColor, windowAlpha);

            Button button = buttonObject.AddComponent <Button>();

            button.targetGraphic = image;
            button.onClick.AddListener(parent.gameObject.GetComponent <RectMessageBox>().ButtonOkClick);

            AddButtonText(buttonObject, "Ok");
        }
Ejemplo n.º 2
0
 public static void SetCurs(string path, string file)
 {
     Cursor.SetCursor(RectUtils.LoadSprite(path, file).texture, Vector2.zero, CursorMode.ForceSoftware);
 }