コード例 #1
0
    /*
     * Build Popup Elements
     * */
    public void Build(GameObject parent)
    {
        backGround = new GraphickObject();
        backGround.Build(parent, "Popup");
        backGround.setImage(parent.GetComponent <FieldBuilder>().GetSprite(11));
        backGround.setScale(new Vector3(0.5f, 0.5f, 0));
        backGround.SetLayer(5);

        button = new GraphickObject();
        button.Build(backGround.GetGameObject(), "PopupButton");
        button.setImage(parent.GetComponent <FieldBuilder>().GetSprite(12));
        button.setPosion(new Vector3(0, -1, 0));
        button.setScale(new Vector3(0.8f, 0.8f, 0));
        button.SetBoxCollider();
        button.SetLayer(5);
        button.SetActive(false);

        NoBut = new GraphickObject();
        NoBut.Build(backGround.GetGameObject(), "PopupNoButton");
        NoBut.setImage(parent.GetComponent <FieldBuilder>().GetSprite(13));
        NoBut.setPosion(new Vector3(-1.5f, -1, 0));
        NoBut.setScale(new Vector3(2f, 2f, 0));
        NoBut.SetBoxCollider();
        NoBut.SetLayer(5);
        NoBut.SetActive(false);

        YesBut = new GraphickObject();
        YesBut.Build(backGround.GetGameObject(), "PopupYesButton");
        YesBut.setImage(parent.GetComponent <FieldBuilder>().GetSprite(13));
        YesBut.setPosion(new Vector3(1.5f, -1, 0));
        YesBut.setScale(new Vector3(2f, 2f, 0));
        YesBut.SetBoxCollider();
        YesBut.SetLayer(5);
        YesBut.SetActive(false);

        text = new GraphickObject();
        text.BuildText(parent, "Message");
        text.SetText("Message", 0.2f, 6);
        text.SetTextColor(Color.black);
        text.SetTextAlgment(TextAlignment.Center);

        noButTxt = new GraphickObject();
        noButTxt.BuildText(NoBut.GetGameObject(), "NO");
        noButTxt.SetText("NO", 0.1f, 6);
        noButTxt.SetTextColor(Color.black);
        noButTxt.SetTextAlgment(TextAlignment.Center);
        noButTxt.setPosion(new Vector3(-1.7f, -0.85f, 0));
        noButTxt.setScale(new Vector3(2f, 2f, 0));

        yesButTxt = new GraphickObject();
        yesButTxt.BuildText(YesBut.GetGameObject(), "YES");
        yesButTxt.SetText("YES", 0.1f, 6);
        yesButTxt.SetTextColor(Color.black);
        yesButTxt.SetTextAlgment(TextAlignment.Center);
        yesButTxt.setPosion(new Vector3(1.25f, -0.85f, 0));
        yesButTxt.setScale(new Vector3(2f, 2f, 0));

        backGround.AddPopupViewComponent().ResetPArametr(this.backGround, this.button, this.text, this.YesBut, this.NoBut);
    }