private void GiveUpOnClick() { ConfirmUI.Open("確定要放棄嗎?\n放棄後會直接回到村莊。", "確定", "取消", () => { BattleController.Instance.GiveUp(); }, null); }
public static void Open(string commentText, string confirmText, string cancelText, Action confirmCallback, Action cancelCallback) { if (_instance == null) { _instance = ResourceManager.Instance.Spawn("ConfirmUI", ResourceManager.Type.UI).GetComponent <ConfirmUI>(); } _instance.Init(commentText, confirmText, cancelText, confirmCallback, cancelCallback); }
/// <summary> /// Set confirmation UI /// </summary> /// <param name="confirmContainer"></param> public void SetConfirmation(ConfirmUI confirmContainer) { if (!confirmContainer) { return; } confirmContainer.shopScriptableObject = shopScriptableObject; confirmContainer.SetConfirmUi(); confirmContainer.gameObject.SetActive(true); }
private void CloseOnClick() { if (ItemManager.Instance.CurrentBagVolume > ItemManager.Instance.MaxBagVolume) { ConfirmUI.Open("背包已滿!請選擇要丟棄的道具。", "確定", null); } else { Close(); } }
public void Interactive(Vector2Int position) { if (_mapInfo.TreasureDic.ContainsKey(position)) { ItemManager.Instance.AddItem(_mapInfo.TreasureDic[position].ItemList, ItemManager.Type.Bag); TilePainter.Instance.Clear(1, position); ItemConfirmUI.Open(_mapInfo.TreasureDic[position].ItemList); _mapInfo.TreasureDic.Remove(position); _pathFindList.Add(position); if (ItemManager.Instance.BagIsFull()) { ConfirmUI.Open("背包已滿!請選擇要丟棄的道具。", "確定", () => { BagUI.Open(ItemManager.Type.Bag); }); } SetInteractive(Vector2Int.RoundToInt(_player.transform.position)); } else if (_mapInfo.DoorList.Contains(position)) { if (ItemManager.Instance.UseKey()) { TilePainter.Instance.Clear(1, position); _mapInfo.DoorList.Remove(position); _pathFindList.Add(position); SetVisibleRange(false); ExploreUI.Instance.RefreshLittleMap(Vector2Int.RoundToInt(_player.transform.position), _mapInfo.ExploredList, _mapInfo.ExploredWallList); } else { ConfirmUI.Open("需要一把鑰匙將鎖打開。", "確定", null); } SetInteractive(Vector2Int.RoundToInt(_player.transform.position)); } else if (_mapInfo.ExploreEventDic.ContainsKey(position)) { _player.Stop(); EventUI.Open(_mapInfo.ExploreEventDic[position], (isDonothing) => { _player.UnlockStop(); ContinueEnemy(); if (!isDonothing) { TilePainter.Instance.Clear(1, position); _mapInfo.ExploreEventDic.Remove(position); _pathFindList.Add(position); } SetInteractive(Vector2Int.RoundToInt(_player.transform.position)); }); } }
public void Confirm(string content, string title = "系统消息确认", ConfirmUI.Complete handler = null) { ConfirmUI confirm = GetNewUI <ConfirmUI>(); RectTransform rtf = confirm.transform as RectTransform; //设置UI容器大小 rtf.sizeDelta = new Vector2(Screen.width, Screen.height); rtf.anchorMin = Vector2.zero; rtf.anchorMax = Vector2.one; rtf.offsetMin = new Vector2(0, 0); rtf.offsetMax = new Vector2(0, 0); confirm.SetData(content, title); confirm.onClosedHandler += handler; }
private void BagIconOnClick(object obj) { Item item = (Item)obj; if (item.ID == 0) //如果道具為緊急逃脫裝置,則不得移除,因為它是必備的道具 { ConfirmUI.Open("必需攜帶緊急逃脫裝置。", "確定", null); } else { ItemManager.Instance.AddItem(item, 1, ItemManager.Type.Warehouse); ItemManager.Instance.MinusItem(item, 1, ItemManager.Type.Bag); Refresh(); } }
private void MapOnClick(object obj) { if (obj != null) { DungeonGroupData.RootObject group = (DungeonGroupData.RootObject)obj; List <DungeonData.RootObject> floorList = DungeonData.GetFloorList(group.ID, ExploreController.Instance.ArriveFloor); FloorScrollView.SetData(new ArrayList(floorList)); FloorScrollView.gameObject.SetActive(true); //GroupScrollView.gameObject.SetActive(false); MapGroup.SetActive(false); GroupLabel.text = group.Name; } else { ConfirmUI.Open("敬請期待!", "確定", null); } }
public ConfirmUI Confirm(string content = "", string title = "消息", ConfirmUI.ConfirmHandler handler = null) { ConfirmUI malert = GetNewUI <ConfirmUI>(); RectTransform pref = malert.GetComponent <RectTransform>(); pref.SetParent(root); pref.localPosition = Vector3.zero; pref.sizeDelta = new Vector2(Screen.width, Screen.height); pref.offsetMin = new Vector2(0, 0); pref.offsetMax = new Vector2(0, 0); pref.sizeDelta = new Vector2(Screen.width, Screen.height); pref.localScale = Vector3.one; malert.SetData(content, title); malert.OnConfirmHandler += handler; return(malert); }
private void ConfirmOnClick() { if (ItemManager.Instance.BagIsFull()) { ConfirmUI.Open("背包已滿!請選擇要丟棄的道具。", "確定", () => { BagUI.Open(ItemManager.Type.Bag); }); } else { if (_callback != null) { _callback(); } } }
private void NewOnClick() { if (ProgressManager.Instance.Memo.FirstFlag) //已完成新手教學 { ConfirmUI.Open("請問你確定要重新開始遊戲嗎?", "確定", "取消", () => { GameSystem.Instance.ClearMemo(); GameSystem.Instance.InitManager(); gameObject.SetActive(false); Plot_1 plot_1 = new Plot_1(); plot_1.Start(); }, null); } else { gameObject.SetActive(false); Plot_1 plot_1 = new Plot_1(); plot_1.Start(); } }
public void OnUILoadFinish(ConfirmUI confirmUI) { this.ui = confirmUI; }
private void Close() { Destroy(_instance.gameObject); _instance = null; }