void Update() { for (int i = 0; i < giveAssetSliders.Length; i++) { giveAssetNumTexts [i].text = giveAssetSliders [i].value.ToString(); getAssetNumTexts [i].text = getAssetSliders [i].value.ToString(); } if (selectionMade == true) { ahack.UpdateSelection(); } }
public void OpenRespond(Player sender, AssetTuple give, AssetTuple recieve) { this.gameObject.SetActive(true); selectionGlow.gameObject.SetActive(false); //setting texts confirmtext.text = "Accept Offer"; canceltext.text = "Reject Offer"; playertext.text = "Offer From"; waiting.text = "Waiting For Response..."; confirm.onClick.RemoveAllListeners(); cancel.onClick.RemoveAllListeners(); //texts start out disabled confirmtext.gameObject.SetActive(false); canceltext.gameObject.SetActive(false); waiting.gameObject.SetActive(false); //confirm is now accept trade confirm.onClick.AddListener(sendResponse); //activate counter button and add listener counter.onClick.AddListener(Counter); counter.gameObject.SetActive(true); //change cancel to reject cancel.onClick.AddListener(Reject); selectionGlow.gameObject.SetActive(false); //fill assets in reverse and disable changing them for (int i = 0; i < giveAssetSliders.Length; i++) { giveAssetSliders [i].maxValue = 10; getAssetSliders [i].maxValue = 10; giveAssetSliders [i].value = recieve.GetValueAtIndex(i); getAssetSliders [i].value = give.GetValueAtIndex(i); giveAssetSliders [i].enabled = false; getAssetSliders [i].enabled = false; } //only 1 player display is needed optionsPanel [0].gameObject.SetActive(true); optionsPanel [1].gameObject.SetActive(false); optionsPanel [2].gameObject.SetActive(false); //1st player panel is enabled but changing it is not possible optionsPanel [0].enabled = false; //set the color and avatar of the panel optionsPanel [0].image.color = sender.playerColor; TradePlayerPanelButton current = optionsPanel [0].GetComponentInChildren <TradePlayerPanelButton>(); //set values for the buttons current.instance = this; //no offset this is correct current.playernumber = sender.playerNumber - 1; current.avatar.sprite = sender.avatar; selectionMade = true; ahack = current; //set button glow current.UpdateSelection(); this.gameObject.SetActive(false); this.gameObject.SetActive(true); }