//setting player selection glow public void setSelectionGlow(TradePlayerPanelButton button) { ahack = button; selectionGlow.gameObject.SetActive(true); selectionGlow.gameObject.transform.position = button.gameObject.transform.position; }
public void OpenPanel(List <Player> opponents, AssetTuple playerAssets) { this.gameObject.SetActive(true); //setting texts confirmtext.text = "Send Offer"; canceltext.text = "Cancel"; playertext.text = "Player Selection"; waiting.text = "Waiting For Response..."; //texts start out disabled confirmtext.gameObject.SetActive(false); canceltext.gameObject.SetActive(false); waiting.gameObject.SetActive(false); //confirm map to sending confirm.onClick.AddListener(sendTrade); //counter not possible counter.gameObject.SetActive(false); //cancel button mapped to close panel cancel.onClick.AddListener(Cancel); //there is no selection to start with selectionGlow.gameObject.SetActive(false); for (int i = 0; i < 3; i++) { if ((i + 1) > opponents.Count) { optionsPanel [i].gameObject.SetActive(false); } else { optionsPanel [i].gameObject.SetActive(true); optionsPanel [i].enabled = true; optionsPanel [i].image.color = opponents [i].playerColor; TradePlayerPanelButton current = optionsPanel [i].GetComponentInChildren <TradePlayerPanelButton>(); //set values for the buttons current.instance = this; current.playernumber = opponents [i].playerNumber - 1; current.avatar.sprite = opponents [i].avatar; } } //set texts to 0 for (int i = 0; i < 8; i++) { giveAssetNumTexts [i].text = "0"; getAssetNumTexts [i].text = "0"; } for (int i = 0; i < giveAssetSliders.Length; i++) { //make sure all sliders are enabled giveAssetSliders [i].enabled = true; getAssetSliders [i].enabled = true; //give should be set to the max value of what player has, get set to 10 giveAssetSliders [i].maxValue = 10; giveAssetSliders [i].minValue = giveAssetSliders [i].value = 0; getAssetSliders [i].maxValue = 10; getAssetSliders [i].minValue = giveAssetSliders [i].value = 0; } //the tuple for player assets currentTuple = playerAssets; //default selection playerSelection = opponents [0].playerNumber - 1; //put glow on the selection; selectionMade = true; ahack = optionsPanel[0].GetComponentInChildren <TradePlayerPanelButton>(); //selection not made make this panel active this.gameObject.SetActive(true); }
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); }