Ejemplo n.º 1
0
        public override void init(Dictionary <string, string> param)
        {
            this.param = param;

            GameObject g = Resources.Load(GameSetting.PATH_PREFAB + "Text") as GameObject;

            this.rootObject = (GameObject)Instantiate(g, new Vector3(0, 0.5f, -3.2f), Quaternion.identity);

            GUIText guiText = this.rootObject.GetComponent <GUIText> ().guiText;

            guiText.alignment = TextEnum.textAlignment(this.param["alignment"]);
            guiText.anchor    = TextEnum.textAnchor(this.param["anchor"]);


            string color = this.param ["color"];

            Color objColor = ColorX.HexToRGB(color);

            objColor.a    = 0;
            guiText.color = objColor;

            guiText.fontSize = int.Parse(this.param ["fontsize"]);

            this.guiScaler       = new GuiScaler(guiText);
            this.rootObject.name = this.name;

            if (this.param ["layer"] == "ui")
            {
                //タグをつける
                this.rootObject.tag = "ui";
            }
        }
Ejemplo n.º 2
0
        public override void init(Dictionary <string, string> param)
        {
            this.param = param;

            GameObject g = Resources.Load(GameSetting.PATH_PREFAB + "Text") as GameObject;

            this.rootObject = (GameObject)Instantiate(g, new Vector3(0, 0.5f, -3.2f), Quaternion.identity);

            GameObject canvas = GameObject.Find("Canvas") as GameObject;

            this.rootObject.name             = param ["name"];
            this.rootObject.transform.parent = canvas.transform;

            UnityEngine.UI.Text guiText = this.rootObject.GetComponent <Text> ();

            //Debug.Log (this.param ["anchor"]);
            //Debug.Log (TextEnum.textAnchor (this.param ["anchor"]));
            guiText.alignment = TextEnum.textAnchor(this.param ["anchor"]);

            string color = this.param ["color"];

            Color objColor = ColorX.HexToRGB(color);

            objColor.a    = 0;
            guiText.color = objColor;

            guiText.fontSize = int.Parse(this.param ["fontsize"]);

            this.rootObject.name = this.name;
        }
Ejemplo n.º 3
0
        public override void init(Dictionary <string, string> param)
        {
            this.param = param;

            GameObject g      = Resources.Load(GameSetting.PATH_PREFAB + "Button") as GameObject;
            GameObject canvas = GameObject.Find("Canvas") as GameObject;

            this.rootObject = (GameObject)Instantiate(g, new Vector3(0, 0.5f, -3.2f), Quaternion.identity);

            this.rootObject.name             = param ["name"];
            this.rootObject.transform.parent = canvas.transform;

            // TODO 独自
            GameObject jokerObj = GameObject.Find("JokerObject");

            this.rootObject.transform.parent = jokerObj.transform;
            // TODO

            this.targetText   = this.rootObject.GetComponentInChildren <Text> ();
            this.targetButton = this.rootObject.GetComponentInChildren <Button> ();

            this.targetText.alignment = TextEnum.textAnchor(this.param ["anchor"]);
            //TextEnum.textAlignment(this.param["alignment"]);
            //this.targetText.anchor    = TextEnum.textAnchor(this.param["anchor"]);

            string color = this.param ["color"];

            Color objColor = ColorX.HexToRGB(color);

            objColor.a            = 0;
            this.targetText.color = objColor;

            this.targetText.fontSize = int.Parse(this.param ["fontsize"]);


            /*
             * this.guiScaler = new GuiScaler (guiText);
             * this.rootObject.name = this.name;
             */
            /*
             * if (this.param ["layer"] == "ui") {
             *      //タグをつける
             *      this.rootObject.tag = "ui";
             * }
             */
        }