private async void OnDeleteButtonClicked() { ConfirmPopup confirmPopup = PopupHUD.Instance.Show <ConfirmPopup>(); confirmPopup.SetTile(null, false); confirmPopup.SetMessage("Bạn có muốn xoá không?"); confirmPopup.SetConfirmText("Xoá"); confirmPopup.SetCancelText("Thoát"); confirmPopup.SetOnConfirm(async() => { List <Bill> bills = BillList.Instance.Bills; bills.Remove(originBill); if (Application.internetReachability == NetworkReachability.NotReachable) { Debug.Log("Error. Check internet connection!"); } else { await GameSaveData.Instance.SaveData(true); Hide(); } }); }
private void ShowEditItem() { mSelectedItemIndex = EditorGUILayout.Popup("Item: ", mSelectedItemIndex, mItemOptions); InventoryItem nextItem = ItemList[mSelectedItemIndex]; if (nextItem != mSelectedItem) { // clear the sprite so it will be reloaded mSelectedItemSprite = null; mSelectedItem = ItemList[mSelectedItemIndex]; } System.Type currentType = mSelectedItem.GetType(); #region Consumables if (currentType == typeof(HPRecover)) { HPRecover item = (HPRecover)mSelectedItem; ShowEditItemBase(item); // recovery item.Amount = EditorGUILayout.IntField("Amount: ", Mathf.Clamp(item.Amount, 0, 999)); } //if (currentType == typeof(RecoveryItem)) //{ // RecoveryItem item = (RecoveryItem)mSelectedItem; // ShowEditItemBase(item); // // recovery // item.ConsumableStatType = (Enums.eConsumableStatType)EditorGUILayout.EnumPopup("Stat Type: ", item.ConsumableStatType); // item.Amount = EditorGUILayout.IntField("Amount: ", Mathf.Clamp(item.Amount, 0, 999)); //} //else if (currentType == typeof(StatUpgradeItem)) //{ // StatUpgradeItem item = (StatUpgradeItem)mSelectedItem; // ShowEditItemBase(item); // // stat upgrade // item.StatType = (Enums.eStatType)EditorGUILayout.EnumPopup("Boost Stat: ", item.StatType); // item.Amount = EditorGUILayout.IntField("Amount: ", Mathf.Clamp(item.Amount, 0, 999)); //} //else if (currentType == typeof(StatusEffectItem)) //{ // StatusEffectItem item = (StatusEffectItem)mSelectedItem; // ShowEditItemBase(item); // // status effect // item.Effect = (Enums.eStatusEffect)EditorGUILayout.EnumPopup("Effect: ", item.Effect); //} //else if (currentType == typeof(WeaponUpgradeItem)) //{ // WeaponUpgradeItem item = (WeaponUpgradeItem)mSelectedItem; // ShowEditItemBase(item); // // weapon upgrade // item.Amount = EditorGUILayout.IntField("Amount: ", Mathf.Clamp(item.Amount, 0, 999)); //} //else if (currentType == typeof(CharacterSupportItem)) //{ // // TODO //} #endregion #region Companions else if (currentType == typeof(CompanionItem)) { CompanionItem item = (CompanionItem)mSelectedItem; ShowEditItemBase(item); ShowEditEquippableBase(item); // companion } #endregion #region Stat Boosts else if (currentType == typeof(StatBoostItem)) { StatBoostItem item = (StatBoostItem)mSelectedItem; ShowEditItemBase(item); ShowEditEquippableBase(item); // stat boost item.StatType = (Enums.eStatType)EditorGUILayout.EnumPopup("Stat: ", item.StatType); item.Amount = EditorGUILayout.IntField("Amount: ", Mathf.Clamp(item.Amount, 0, 999)); } else if (currentType == typeof(LongTermEffectItem)) { LongTermEffectItem item = (LongTermEffectItem)mSelectedItem; ShowEditItemBase(item); ShowEditEquippableBase(item); // long term effect item.EffectType = (Enums.eLongTermEffectType)EditorGUILayout.EnumPopup("Effect: ", item.EffectType); item.Delay = EditorGUILayout.FloatField("Interval: ", Mathf.Clamp(item.Delay, 0, 10)); item.Amount = EditorGUILayout.IntField("Amount: ", Mathf.Clamp(item.Amount, 0, 999)); } else if (currentType == typeof(ResistItem)) { ResistItem item = (ResistItem)mSelectedItem; ShowEditItemBase(item); ShowEditEquippableBase(item); // resist item.Effect = (Enums.eStatusEffect)EditorGUILayout.EnumPopup("Effect: ", item.Effect); item.Percent = EditorGUILayout.FloatField("Percent: ", Mathf.Clamp(item.Percent, 0, 100)); } #endregion #region Armours else if (currentType == typeof(HeadArmourItem)) { HeadArmourItem item = (HeadArmourItem)mSelectedItem; ShowEditItemBase(item); ShowEditEquippableBase(item); // head armour } else if (currentType == typeof(BodyArmourItem)) { BodyArmourItem item = (BodyArmourItem)mSelectedItem; ShowEditItemBase(item); ShowEditEquippableBase(item); // body armour item.Slots = EditorGUILayout.IntField("# Slots: ", Mathf.Clamp(item.Slots, 0, 5)); } else if (currentType == typeof(ArmArmourItem)) { ArmArmourItem item = (ArmArmourItem)mSelectedItem; ShowEditItemBase(item); ShowEditEquippableBase(item); // arm armour } #endregion #region Weapons else if (currentType == typeof(MeleeWeaponItem)) { MeleeWeaponItem item = (MeleeWeaponItem)mSelectedItem; ShowEditItemBase(item); ShowEditEquippableBase(item); // melee weapon item.TwoHanded = EditorGUILayout.Toggle("Two Handed?: ", item.TwoHanded); } else if (currentType == typeof(RangedWeaponItem)) { RangedWeaponItem item = (RangedWeaponItem)mSelectedItem; ShowEditItemBase(item); ShowEditEquippableBase(item); // ranged weapon item.Range = EditorGUILayout.FloatField("Range: ", Mathf.Clamp(item.Range, 0, 99)); } else if (currentType == typeof(MagicWeaponItem)) { MagicWeaponItem item = (MagicWeaponItem)mSelectedItem; ShowEditItemBase(item); ShowEditEquippableBase(item); // magic weapon item.FocusType = (Enums.eMagicFocusType)EditorGUILayout.EnumPopup("Focus: ", item.FocusType); item.MagicType = (Enums.eMagicType)EditorGUILayout.EnumPopup("Type: ", item.MagicType); item.Radius = EditorGUILayout.FloatField("Radius: ", Mathf.Clamp(item.Radius, 0, 99)); item.MagicEffect = (Enums.eStatusEffect)EditorGUILayout.EnumPopup("Effect: ", item.MagicEffect); item.MPCost = EditorGUILayout.IntField("Cost: ", Mathf.Clamp(item.MPCost, 0, 999)); } #endregion if (GUILayout.Button("Delete Item")) { mConfirmPopup = ConfirmPopup.Create(); mConfirmPopup.OnResultClicked += OnPopupClosed; mConfirmPopup.SetMessage("Are you sure you'd like to delete this item?"); } if (GUILayout.Button("Update")) { Save(); } }