internal override void UseCard() { PlayerInGame localPlayer = PlayerInGame.localPlayerInGame; // If target can be chosen if (choosable) { //Debug.Log("Putting choosable card on table"); transform.SetParent(localPlayer.handContent); // Storing card to use it upon choosing target localPlayer.storedObject = this.gameObject; switch (target) { case Target.Player: ChoicePanel.PrepareToReceiveObjects(ChoicePanelTitle.ChoosePlayerTarget); ChoicePanel.ReceivePlayersToChoose(); break; case Target.Monster: if (TableDropZone.singleton.transform.GetComponentsInChildren <MonsterCard>().Length > 1) // If there are multiple monsters in battle { ChoicePanel.PrepareToReceiveObjects(ChoicePanelTitle.ChooseMonsterToBuff); foreach (var monster in TableDropZone.singleton.transform.GetComponent <TableDropZone>().BorrowMonsterCards()) { ChoicePanel.ReceiveObjectToChoose(monster); // Create placeholders of monsters on table and send monsters to choice panel } } else { localPlayer.UseStoredCardOnTarget(gameManager.fightingMonsters[0].GetComponent <Card>().GetNetId()); // Apply Buff to only Monster in battle } break; case Target.Any: ChoicePanel.PrepareToReceiveObjects(ChoicePanelTitle.ChooseFightingTarget); foreach (var monster in TableDropZone.singleton.transform.GetComponent <TableDropZone>().BorrowMonsterCards()) { ChoicePanel.ReceiveObjectToChoose(monster); } ChoicePanel.ReceiveFightingPlayersToChoose(); break; default: break; } } else { localPlayer.UseCardOnLocalPlayer(this.netId); } }
public void OnPointerClick(PointerEventData eventData) { // On left mouse click, select held object. if (eventData.button == PointerEventData.InputButton.Left) { ChoicePanel.Choose(heldObject); } // On different, call click on held player stats object. else if (heldObject.GetComponent <PlayerStats>()) { heldObject.GetComponent <PlayerStats>().OnPointerClick(eventData); } }
public void Instantiate(int choiceCount) { choicePanels = new List <ChoicePanel>(); for (int i = 0; i < choiceCount; i++) { ChoicePanel choicePanel = Instantiate(choicePanelPrefab).GetComponent <ChoicePanel>(); choicePanel.transform.parent = choiceCenter; choicePanel.gameObject.transform.localPosition = Vector3.up * (panelOffset - i * panelSpacing) + Vector3.up * panelSpacing * 0.5f * (choiceCount - 1) + Vector3.back * panelZOffset; choicePanels.Add(choicePanel); } }
internal void Initialize(ChoicePanel choicePanel, GameObject objectToHold, Transform heldObjectContainer) { Debug.Log("Initializating Placeholder For - " + objectToHold); // Preventing cards in choicePanel from being dragged if (objectToHold.GetComponent <Draggable>()) { objectToHold.GetComponent <Draggable>().enabled = false; } objectToHold.GetComponent <Image>().raycastTarget = false; // Set placeholder values and hierarchy this.transform.SetParent(heldObjectContainer); heldObject = objectToHold; objectToHold.transform.SetParent(this.transform); }
internal void UpdateOption(int chosenOptionIndex) { this.chosenOptionIndex = chosenOptionIndex; for (int i = 0; i < choicePanels.Count; i++) { ChoicePanel panel = choicePanels[i]; if (i == chosenOptionIndex) { panel.Show(); panel.Focus(); } else { panel.Blur(); } } }
public override void Focus() { bubbleFrame.material.color = focusColor; for (int i = 0; i < choicePanels.Count; i++) { ChoicePanel panel = choicePanels[i]; panel.ChoiceBubbleInFocus = true; panel.Show(); if (i == chosenOptionIndex) { panel.Focus(); } else { panel.Blur(); } } }
//This is so that arrow keys are detected protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch (keyData) { case Keys.Down: if (ChosenUnit < totalNoUnits - 1) { ChosenUnit++; } break; case Keys.Up: if (ChosenUnit > 0) { ChosenUnit--; } break; case Keys.PageDown: ChosenUnit = Math.Min(ChosenUnit + 16, totalNoUnits - 1); break; case Keys.PageUp: ChosenUnit = Math.Max(ChosenUnit - 16, 0); break; } //Update relations between chosen value & bar value if (ChosenUnit > BarValue + 15) { BarValue = ChosenUnit - 15; } else if (ChosenUnit < BarValue) { BarValue = ChosenUnit; } VerticalBar.Value = BarValue; //also update the bar value of control ChoicePanel.Refresh(); //refresh the panel return(base.ProcessCmdKey(ref msg, keyData)); }
void Awake() { instance = this; }
//Once slider value changes --> redraw list private void VerticalBarValueChanged(object sender, EventArgs e) { BarValue = VerticalBar.Value; ChoicePanel.Refresh(); }
private void VeteranButton_Click(object sender, EventArgs e) { IsVeteran = !IsVeteran; ChoicePanel.Refresh(); }
private void ChoicePanel_MouseDown(object sender, MouseEventArgs e) { ChosenUnit = BarValue + e.Location.Y / 23; ChoicePanel.Refresh(); //refresh the panel }
void Awake() { parent = GetComponentInParent <ChoicePanel>(); }
ChoicePanel() { singleton = this; }