Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        buttonsOnPanel = GetComponentsInChildren <Button> ();
        GameObject errorTextObject = ComponentFinderExtension.FindChildByName(this.gameObject, "ErrorText");

        //assign buttons for both panels to toggle changes only givepanel same length can do in 1 for loop
        givePanel    = this.transform.FindChild("GivePanel").gameObject.GetComponentsInChildren <Button> ();
        getPanel     = this.transform.FindChild("GetPanel").gameObject.GetComponentsInChildren <Button> ();
        getGoldPanel = this.transform.FindChild("GetGoldPanel").gameObject.GetComponentsInChildren <Button> ();
        for (int i = 0; i < givePanel.Length; i++)
        {
            //get instance
            TradePanelButton giveinstance    = givePanel[i].GetComponentInChildren <TradePanelButton>();
            TradePanelButton getinstance     = getPanel [i].GetComponentInChildren <TradePanelButton> ();
            TradePanelButton getgoldinstance = getGoldPanel [i].GetComponentInChildren <TradePanelButton> ();

            //assign ids and instances
            giveinstance.id          = i;
            getinstance.id           = i;
            getgoldinstance.id       = i;
            giveinstance.instance    = this;
            getinstance.instance     = this;
            getgoldinstance.instance = this;

            //assign listeners
            getPanel[i].onClick.AddListener(getinstance.SelectionGetEvent);
            givePanel[i].onClick.AddListener(giveinstance.SelectionGiveEvent);
            getGoldPanel[i].onClick.AddListener(getgoldinstance.SelectionGetGoldEvent);
        }

        errorText = errorTextObject.GetComponent <Text> ();
        errorText.gameObject.SetActive(false);
        giveglow.gameObject.SetActive(false);
        getglow.gameObject.SetActive(false);
        getgoldglow.gameObject.SetActive(false);
    }
Exemplo n.º 2
0
 public void setGetGoldGlow(TradePanelButton button)
 {
     getgoldglow.gameObject.SetActive(true);
     getgoldglow.gameObject.transform.position = button.gameObject.transform.position;
 }
Exemplo n.º 3
0
 public void setGiveGlow(TradePanelButton button)
 {
     giveglow.gameObject.SetActive(true);
     giveglow.gameObject.transform.position = button.gameObject.transform.position;
 }