public void CreateShortcutKeeperUI() { Sprite associatedSprite = instance.Data.AssociatedSprite; ShorcutUI = Instantiate(GameManager.Instance.PrefabUIUtils.PrefabShorcutCharacter, GameManager.Instance.Ui.goShortcutKeepersPanel.transform); ShorcutUI.name = "Panel_Shortcut_" + instance.Data.PawnName; ShorcutUI.transform.GetChild((int)PanelShortcutChildren.Image).GetComponent <Image>().sprite = associatedSprite; ShorcutUI.transform.localScale = Vector3.one; ShorcutUI.GetComponent <Button>().onClick.AddListener(() => GoToKeeper()); int row = 21; int column = 10; for (int i = 0; i < Data.MaxActionPoint; i++) { GameObject pa = Instantiate(GameManager.Instance.PrefabUIUtils.PrefabShortcutActionPAUI, ShorcutUI.transform.position, ShorcutUI.transform.rotation); pa.transform.SetParent(ShorcutUI.transform.GetChild((int)PanelShortcutChildren.ActionPoints), false); // Attention ça c'est de la merde if (i < 2) { pa.transform.localPosition = new Vector3(-17 + i * column, -40 + i * row, 0); } else { pa.transform.localPosition = new Vector3(9 + ((i - 2) * 20f), 1 + ((i - 2) * 11f), 0); } // Fin lol pa.transform.localScale = Vector3.one; } shortcutActionPointUi = ShorcutUI.transform.GetChild((int)PanelShortcutChildren.ActionPoints).gameObject; }
public void CreateShortcutEscortUI() { Sprite associatedSprite = instance.Data.AssociatedSprite; ShorcutUI = Instantiate(GameManager.Instance.PrefabUIUtils.PrefabShorcutCharacter, GameManager.Instance.Ui.goShortcutKeepersPanel.transform); ShorcutUI.transform.localScale = Vector3.one; ShorcutUI.transform.localPosition = Vector3.zero; ShorcutUI.transform.GetChild((int)PanelShortcutChildren.Image).GetComponent <Image>().sprite = associatedSprite; // ? ? ShorcutUI.transform.SetAsFirstSibling(); // TMP Destroy action points irrelevent for (int i = 0; i < ShorcutUI.transform.GetChild((int)PanelShortcutChildren.ActionPoints).childCount; i++) { Destroy(ShorcutUI.transform.GetChild((int)PanelShortcutChildren.ActionPoints).transform.GetChild(i).gameObject); } // TMP ShorcutUI.GetComponent <Button>().onClick.AddListener(() => GoToEscorted()); }