You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

2962 lines
104 KiB

using EnhancedUI;
using IVDataFormat;
using IVServerFormat;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using System.Numerics;
using Vector2 = UnityEngine.Vector2;
using System;
public class BagMgr : MonoBehaviour
{
#region Const
private static BagMgr curMgr = null;
private const float F_LeftGoodsLeft = -190f;
private const float F_LeftGoodsMid = 0f;
#endregion Const
#region UI
[SerializeField]
private TextMeshProUGUI txtMainT;
[SerializeField]
private GameObject goMainBadge;
// 가방창.
[SerializeField]
private Canvas canvasUI;
private ButtonIV[] btnTabs;
private Image[] imgTabLineBottoms;
private Image[] imgTabLineRights;
private GameObject[] goTabLocks;
private GameObject[] goTabBadges;
private GameObject goSvGear, goSvTreasure, goSvConsume;
private RectTransform rtrfSvGear;
private GameObject groupSubTab3;
private ButtonIV[] btnSubTabs3;
private GameObject[] goSubTabBadges3;
private TextMeshProUGUI[] txtSubTabs3;
private GameObject groupSubTab2;
private ButtonIV[] btnSubTabs2;
private RectTransform rtrfTotalEfc;
private TextMeshProUGUI txtTotalLvT, txtTotalEfcT, txtTotalLv, txtTotalEfc;
private ButtonIV btnComposeAll;
[SerializeField] float weaponScrUITopValue = 247f;
[SerializeField] float armorScrUITopValue = 297f;
[SerializeField] float accScrUITopValue = 297f;
[SerializeField]
EScrController escrGear, escrTreasure, escrConsume;
// 왼쪽 정보창.
[SerializeField]
Canvas bagLeftGearInfo;
private GameObject goPpInfo;
private TextMeshProUGUI txtInfoT;
private RectTransform rtrfGoodsInfo;
private GoodsItem goodsInfo;
private GameObject goBtnInfoHelp;
// 장비 정보창.
[SerializeField] float weaponEffectPanelUITopValue = 196f;
[SerializeField] ViewGroup weaponViewGroup;
[SerializeField] float armorEffectPanelUITopValue = 246f;
[SerializeField] ViewGroup armorViewGroup;
[SerializeField] float accEffectPanelUITopValue = 246f;
[SerializeField] ViewGroup accViewGroup;
private GameObject groupInfoGear;
private TextMeshProUGUI txtInfoName;
private GraphicsColorSetter txtInfoNameColorSetter;
private TextMeshProUGUI txtInfoLv;
[SerializeField] TextMeshProUGUI[] txtInfoEfcTs;
[SerializeField] TextMeshProUGUI[] txtInfoEfcCurs;
[SerializeField] GameObject[] InfoEfcArrowObjs;
[SerializeField] TextMeshProUGUI[] txtInfoEfcNexts;
private GameObject goInfoMax;
private Image imgBtnInfoEnhance;
private ButtonIV btnInfoEnhance, btnInfoEquip, btnInfoCompose, btnInfoAwaken;
private TextMeshProUGUI txtInfoEnhance;
// 장비 효과 탭.
private GameObject goBtnInfoEfcAddLock;
private Image imgTabInfoLineRight;
private ButtonIV btnTabInfoEffect, btnTabInfoEffectAdd;
private GameObject groupInfoGearEffect, groupInfoGearEffectAdd;
// 장비 추가 효과.
private EfcAddItem[] efcAddItems;
private ButtonIV btnEfcAdd, btnEfcAddAuto;
private GameObject groupAutoNow;
private TextMeshProUGUI txtEfcAddPrice;
// 추가 효과 자동 변경.
private GameObject groupOptionAuto;
private ButtonIV btnEfcAddAutoStart;
private TextMeshProUGUI txtEfcAddPriceStart;
private EScrEfcOption[] efcOptionRarties;
[SerializeField]
private EScrController escrEfcAddAuto;
// 소모품 정보창.
private GameObject groupInfoConsume;
private TextMeshProUGUI txtInfoConsumeName, txtInfoConsumeDesc;
private ButtonIV btnInfoConsumeUse;
#endregion UI
#region Variables
private int iLoading = 1;
private bool bReLocalize = true;
private bool bReLocalizeGear, bReLocalizeTreasure = false;
private int iSelectedTab = -1;
private int iSelectedSubTab = -1;
private int iSvType = -1;
private int iSelectedId = -1;
private int iSelectedCount = 0;
private Dictionary<int, bool> dicInitNeeds = new Dictionary<int, bool>()
{
[cGoods.TBagWeapon] = true,
[cGoods.TBagArmorCape] = true,
[cGoods.TBagArmorHat] = true,
[cGoods.TBagArmorShoes] = true,
[cGoods.TBagAcceEar] = true,
[cGoods.TBagAcceNeck] = true,
[cGoods.TBagAcceRing] = true
};
private Dictionary<int, EnhancedUI.SmallList<int>> dicGearIdRows = new Dictionary<int, EnhancedUI.SmallList<int>>();
private Dictionary<int, int[]> dicGearIds = new Dictionary<int, int[]>();
private bool bInitNeedTreasure = true;
private bool bInitNeedConsume = true;
private bool bUpdateConsume = false;
private EnhancedUI.SmallList<int> consumeIdRows = new EnhancedUI.SmallList<int>();
private List<int> consumeIdList;
private bool bInitNeedOption = true;
// 자동 변경인지.
private bool bEfcAddAuto = false;
public static bool GetEfcAddAuto()
{
return curMgr.bEfcAddAuto;
}
// 변경 통신 중인지.
private bool bEfcAddChanging = false;
private int iEfcAddSlots = 0;
// 자동 변경 옵션 선택.
private bool[] bSelectedOptions;
// 자동 변경 옵션.
private eEffectType[] efcOptions;
private bool bClicking = false;
private nIdEnhance dataEnhance = null;
private Coroutine coEnhance = null;
private int currentPress = 0;
#endregion Variables
#region Base
public static void SLocalize(bool bmain)
{
if (curMgr != null)
curMgr.Localize(bmain);
}
// 번역.
private void Localize(bool bmain)
{
if (bmain)
{
txtMainT.text = LocalizationText.GetText("bag_title");
Transform trfcanvas = canvasUI.transform;
trfcanvas.Find("txtT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("bag_title");
btnTabs = trfcanvas.Find("tabWrapTop").GetComponentsInChildren<ButtonIV>(true);
goTabLocks = new GameObject[btnTabs.Length];
goTabBadges = new GameObject[btnTabs.Length];
for (int i = 0; i < btnTabs.Length; i++)
{
goTabLocks[i] = btnTabs[i].transform.Find("lock").gameObject;
goTabBadges[i] = btnTabs[i].transform.Find("badge").gameObject;
}
}
else
{
bReLocalize = false;
Transform trfcanvas = canvasUI.transform;
btnTabs[0].transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("bag_weapon");
btnTabs[1].transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("bag_armor");
btnTabs[2].transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("bag_acce");
btnTabs[3].transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("bag_treasure");
btnTabs[4].transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("bag_consume");
imgTabLineBottoms = new Image[btnTabs.Length];
imgTabLineRights = new Image[btnTabs.Length];
for (int i = 0; i < btnTabs.Length; i++)
{
imgTabLineBottoms[i] = btnTabs[i].transform.Find("linebottom").GetComponent<Image>();
imgTabLineRights[i] = btnTabs[i].transform.Find("lineright").GetComponent<Image>();
}
goSvGear = trfcanvas.Find("SvGear").gameObject;
goSvTreasure = trfcanvas.Find("SvTreasure").gameObject;
goSvConsume = trfcanvas.Find("SvConsume").gameObject;
rtrfSvGear = goSvGear.GetComponent<RectTransform>();
groupSubTab3 = trfcanvas.Find("groupSubTab3").gameObject;
btnSubTabs3 = groupSubTab3.transform.GetComponentsInChildren<ButtonIV>();
goSubTabBadges3 = new GameObject[btnSubTabs3.Length];
txtSubTabs3 = new TextMeshProUGUI[btnSubTabs3.Length];
for (int i = 0; i < btnSubTabs3.Length; i++)
{
txtSubTabs3[i] = btnSubTabs3[i].transform.Find("txt").GetComponent<TextMeshProUGUI>();
goSubTabBadges3[i] = btnSubTabs3[i].transform.Find("badge").gameObject;
}
groupSubTab2 = trfcanvas.Find("groupSubTab2").gameObject;
btnSubTabs2 = groupSubTab2.transform.GetComponentsInChildren<ButtonIV>();
btnSubTabs2[0].transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("bag_trs_normal");
btnSubTabs2[1].transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("bag_trs_rare");
rtrfTotalEfc = trfcanvas.Find("groupTotalEffect").GetComponent<RectTransform>();
txtTotalLvT = rtrfTotalEfc.Find("txtTotalLvT").GetComponent<TextMeshProUGUI>();
txtTotalEfcT = rtrfTotalEfc.Find("txtTotalEfcT").GetComponent<TextMeshProUGUI>();
txtTotalLv = rtrfTotalEfc.Find("txtTotalLv").GetComponent<TextMeshProUGUI>();
txtTotalEfc = rtrfTotalEfc.Find("txtTotalEfc").GetComponent<TextMeshProUGUI>();
btnComposeAll = trfcanvas.Find("btnComposeAll").GetComponent<ButtonIV>();
btnComposeAll.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_composeall");
// 왼쪽 정보창.
Transform trfleft = bagLeftGearInfo.transform;
goPpInfo = trfleft.gameObject;
txtInfoT = trfleft.Find("txtT").GetComponent<TextMeshProUGUI>();
rtrfGoodsInfo = trfleft.Find("GoodsItem").GetComponent<RectTransform>();
goodsInfo = rtrfGoodsInfo.GetComponent<GoodsItem>();
goBtnInfoHelp = trfleft.Find("btnInfo").gameObject;
Transform trfgear = trfleft.Find("groupGear");
groupInfoGear = trfgear.gameObject;
txtInfoName = trfgear.Find("txtName").GetComponent<TextMeshProUGUI>();
txtInfoNameColorSetter = txtInfoName.GetComponent<GraphicsColorSetter>();
txtInfoLv = trfgear.Find("txtLv").GetComponent<TextMeshProUGUI>();
btnInfoEquip = trfgear.Find("btnEquip").GetComponent<ButtonIV>();
btnInfoEquip.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_equip");
btnInfoEnhance = trfgear.Find("btnEnhance").GetComponent<ButtonIV>();
imgBtnInfoEnhance = btnInfoEnhance.GetComponent<Image>();
txtInfoEnhance = btnInfoEnhance.transform.Find("txtPrice").GetComponent<TextMeshProUGUI>();
btnInfoEnhance.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_enhance");
btnInfoAwaken = trfgear.Find("btnAwaken").GetComponent<ButtonIV>();
btnInfoAwaken.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_awaken");
btnInfoCompose = trfgear.Find("btnCompose").GetComponent<ButtonIV>();
btnInfoCompose.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_compose");
goInfoMax = trfgear.Find("goMax").gameObject;
goInfoMax.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText(Global.STR_MAX);
goBtnInfoEfcAddLock = trfgear.Find("goEffectAddLock").gameObject;
imgTabInfoLineRight = trfgear.Find("tabSubLine2").GetComponent<Image>();
btnTabInfoEffect = trfgear.Find("tabEffect").GetComponent<ButtonIV>();
btnTabInfoEffect.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_effect");
btnTabInfoEffectAdd = trfgear.Find("tabEffectAdd").GetComponent<ButtonIV>();
btnTabInfoEffectAdd.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_effectadd");
groupInfoGearEffect = trfgear.Find("groupEffect").gameObject;
// 장비 추가 효과.
groupInfoGearEffectAdd = trfgear.Find("groupEffectAdd").gameObject;
efcAddItems = groupInfoGearEffectAdd.GetComponentsInChildren<EfcAddItem>();
for (int i = 0; i < efcAddItems.Length; i++)
{
efcAddItems[i].Init();
efcAddItems[i].SetCondition(i + 1);
}
btnEfcAdd = groupInfoGearEffectAdd.transform.Find("btnChange").GetComponent<ButtonIV>();
txtEfcAddPrice = btnEfcAdd.transform.Find("txtPrice").GetComponent<TextMeshProUGUI>();
btnEfcAdd.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_changego");
btnEfcAddAuto = groupInfoGearEffectAdd.transform.Find("btnChangeAuto").GetComponent<ButtonIV>();
btnEfcAddAuto.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_changeauto");
groupAutoNow = groupInfoGearEffectAdd.transform.Find("groupAutoNow").gameObject;
groupAutoNow.transform.Find("txtProgress").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_autoprocessing");
// 추가 효과 자동 변경.
groupOptionAuto = trfleft.Find("groupOptionAuto").gameObject;
groupOptionAuto.transform.Find("txtInfo").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("bag_efcautomsg");
groupOptionAuto.transform.Find("txtRarityT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_selectrarity");
groupOptionAuto.transform.Find("txtOptionT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_selectefc");
btnEfcAddAutoStart = groupOptionAuto.transform.Find("btnChange").GetComponent<ButtonIV>();
txtEfcAddPriceStart = btnEfcAddAutoStart.transform.Find("txtPrice").GetComponent<TextMeshProUGUI>();
btnEfcAddAutoStart.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_changego");
efcOptionRarties = groupOptionAuto.transform.Find("rarities").GetComponentsInChildren<EScrEfcOption>();
efcOptionRarties[0].SetType(cGoods.TBag);
efcOptionRarties[1].SetType(cGoods.TBag);
efcOptionRarties[0].InitCell();
efcOptionRarties[1].InitCell();
efcOptionRarties[0].SetData(-1);
efcOptionRarties[1].SetData(-2);
efcOptionRarties[0].SetText(LocalizationText.GetText("awaken_grade_hero_up"));
efcOptionRarties[1].SetText(LocalizationText.GetText("awaken_grade_mystic"));
// 소모품.
groupInfoConsume = trfleft.Find("groupConsume").gameObject;
txtInfoConsumeName = groupInfoConsume.transform.Find("txtName").GetComponent<TextMeshProUGUI>();
txtInfoConsumeDesc = groupInfoConsume.transform.Find("txtDesc").GetComponent<TextMeshProUGUI>();
btnInfoConsumeUse = groupInfoConsume.transform.Find("btnUse").GetComponent<ButtonIV>();
btnInfoConsumeUse.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_use");
//scrollTopBar = canvasUI.transform.Find("tabWrapTop").GetComponent<ScrollRect>();
}
}
// 설정에서 언어 변경 시 처리.
public static void SReLocalize()
{
curMgr.Localize(true);
curMgr.bReLocalize = true;
curMgr.bReLocalizeGear = true;
curMgr.bReLocalizeTreasure = true;
}
// 백버튼 처리.
public static bool SCloseMenu()
{
return curMgr.CloseMenu();
}
private bool CloseMenu()
{
// 게임 시작 후 열린적 없음.
if (iSelectedTab < 0) return false;
// 추가 효과 자동 변경 설정.
if (groupOptionAuto.activeSelf)
{
BtnEfcAddAutoClose();
return true;
}
// 추가 효과 자동 변경 진행중.
if (bEfcAddAuto)
{
BtnEfcAddChangeAutoStop();
return true;
}
if (canvasUI.enabled)
{
CloseBag();
return true;
}
return false;
}
private void Awake()
{
curMgr = this;
}
void Start()
{
iLoading--;
SetBadge();
}
#endregion Base
#region UI
public static void SMoveBag(eEventMoveType content)
{
curMgr.OpenBag();
switch (content)
{
case eEventMoveType.BagWeapon:
curMgr.TabPress(0);
break;
case eEventMoveType.BagArmorCape:
curMgr.TabPress(1);
curMgr.TabSubPress(0);
break;
case eEventMoveType.BagArmorHat:
curMgr.TabPress(1);
curMgr.TabSubPress(1);
break;
case eEventMoveType.BagArmorShoes:
curMgr.TabPress(1);
curMgr.TabSubPress(2);
break;
case eEventMoveType.BagAccEar:
curMgr.TabPress(2);
curMgr.TabSubPress(0);
break;
case eEventMoveType.BagAccNeck:
curMgr.TabPress(2);
curMgr.TabSubPress(1);
break;
case eEventMoveType.BagAccRing:
curMgr.TabPress(2);
curMgr.TabSubPress(2);
break;
case eEventMoveType.BagConsume:
curMgr.TabPress(4);
break;
}
}
// 가방창 열기.
public void OpenBag()
{
if (iLoading > 0) return;
iLoading++;
if (bReLocalize)
Localize(false);
if (iSelectedTab < 0)
{
currentPress = 0;
}
// 장비.
else if (iSelectedTab < 3)
{
escrGear.scroller.RefreshActiveCellViews();
btnComposeAll.interactable = DataHandler.IsGearComposable(iSvType);
}
// 보물.
else if (iSelectedTab == 3)
{
escrTreasure.scroller.RefreshActiveCellViews();
}
// 소모품.
else if (iSelectedTab == 4)
{
CheckUpdateConsume();
}
goTabLocks[2].SetActive(!DataHandler.IsClearStage(DataHandler.Const.gearAccOpenStage));
goTabLocks[3].SetActive(!DataHandler.IsClearStage(DataHandler.Const.gearTreasureOpenStage));
goTabLocks[4].SetActive(!DataHandler.IsClearStage(DataHandler.Const.gearConsumeOpenStage));//서버에 없음
SetBadge();
canvasUI.enabled = true;
bagLeftGearInfo.enabled = true;
GameUIMgr.SRightWindowClose();
GameUIMgr.SOpenLeftPanel(dia: true, enhance: true, awaken: true, change:true);
GameUIMgr.SSetMainUiOn(false);
BattleMgr.CloseFailScroll();
TabPress(currentPress);
iLoading--;
SoundMgr.PlaySfx(SoundName.BtnPress);
}
// 가방창 닫기.
public void CloseBag()
{
if (!canvasUI.enabled)
return;
if (iLoading > 0)
return;
iLoading++;
DataHandler.CheckAchivement(eContent.Equipment);
canvasUI.enabled = false;
bagLeftGearInfo.enabled = false;
GameUIMgr.SCloseLeftPanel();
GameUIMgr.SSetMainUiOn(true);
groupOptionAuto.SetActive(false);
MissionMgr.SRefreshMission();
CloseLeftInfo();
SoundMgr.PlaySfx(SoundName.BtnPress);
iLoading--;
}
public static void SSetUpdateConsume()
{
curMgr.bUpdateConsume = true;
}
// 도움말 열기.
public void OpenHelp()
{
SoundMgr.PlaySfx(SoundName.BtnPress);
}
#endregion UI
#region Tab
public void TabPress(int index)
{
// 잠긴 컨텐츠.
if (goTabLocks[index].activeSelf)
{
if (index == 2)
GameUIMgr.SOpenToast(FormatString.TextOpenStageClear(DataHandler.Const.gearAccOpenStage));
else if (index == 3)
GameUIMgr.SOpenToast(FormatString.TextOpenStageClear(DataHandler.Const.gearTreasureOpenStage));
else if (index == 4)
GameUIMgr.SOpenToast(FormatString.TextOpenStageClear(DataHandler.Const.gearConsumeOpenStage));
SoundMgr.PlaySfx(SoundName.BtnPress);
return;
}
iLoading++;
CloseLeftInfo();
if (iSelectedTab >= 0)
{
btnTabs[iSelectedTab].interactable = true;
}
iSelectedTab = index;
currentPress = index;
btnTabs[iSelectedTab].interactable = false;
goSvGear.SetActive(iSelectedTab < 3);
goSvTreasure.SetActive(iSelectedTab == 3);
goSvConsume.SetActive(iSelectedTab == 4);
weaponViewGroup.Deactive();
armorViewGroup.Deactive();
accViewGroup.Deactive();
// 무기.
if (iSelectedTab == 0)
{
Vector2 v2pos = rtrfTotalEfc.anchoredPosition;
v2pos.y = -weaponEffectPanelUITopValue;
rtrfTotalEfc.anchoredPosition = v2pos;
v2pos = rtrfSvGear.offsetMax;
v2pos.y = -weaponScrUITopValue;
rtrfSvGear.offsetMax = v2pos;
groupSubTab3.SetActive(false);
groupSubTab2.SetActive(false);
rtrfTotalEfc.gameObject.SetActive(true);
weaponViewGroup.Active();
TabSubPress(0);
}
// 방어구, 악세.
else if (iSelectedTab < 3)
{
Vector2 v2pos = rtrfTotalEfc.anchoredPosition;
v2pos.y = iSelectedTab == 1 ? -armorEffectPanelUITopValue : -accEffectPanelUITopValue;
rtrfTotalEfc.anchoredPosition = v2pos;
v2pos = rtrfSvGear.offsetMax;
if (iSelectedTab == 1)
{
txtSubTabs3[0].text = LocalizationText.GetText("bag_armor_cape");
txtSubTabs3[1].text = LocalizationText.GetText("bag_armor_hat");
txtSubTabs3[2].text = LocalizationText.GetText("bag_armor_shoes");
armorViewGroup.Active();
v2pos.y = -armorScrUITopValue;
}
else
{
txtSubTabs3[0].text = LocalizationText.GetText("bag_acce_ear");
txtSubTabs3[1].text = LocalizationText.GetText("bag_acce_neck");
txtSubTabs3[2].text = LocalizationText.GetText("bag_acce_ring");
accViewGroup.Active();
v2pos.y = -accScrUITopValue;
}
rtrfSvGear.offsetMax = v2pos;
groupSubTab3.SetActive(true);
groupSubTab2.SetActive(false);
rtrfTotalEfc.gameObject.SetActive(true);
TabSubPress(0);
}
// 보물.
else if (iSelectedTab == 3)
{
groupSubTab3.SetActive(false);
groupSubTab2.SetActive(true);
rtrfTotalEfc.gameObject.SetActive(false);
// 추가효과 자동 변경창 열려있으면 닫기.
if (groupOptionAuto.activeSelf)
{
rtrfGoodsInfo.gameObject.SetActive(true);
groupInfoGear.SetActive(true);
//goBtnInfoHelp.SetActive(true);
groupOptionAuto.SetActive(false);
btnEfcAdd.gameObject.SetActive(true);
btnEfcAddAuto.gameObject.SetActive(true);
groupAutoNow.SetActive(false);
}
TabSubPress2(0);
}
// 소모품.
else
{
groupSubTab3.SetActive(false);
groupSubTab2.SetActive(false);
rtrfTotalEfc.gameObject.SetActive(false);
// 초기화.
if (bInitNeedConsume)
{
bInitNeedConsume = false;
int irowcnt = 4;
Dictionary<int, int> datas = DataHandler.GetBoxCounts();
consumeIdList = new List<int>();
foreach (var item in datas)
{
if (item.Value <= 0)
continue;
if (consumeIdList.Count % irowcnt == 0)
consumeIdRows.Add(consumeIdRows.Count);
consumeIdList.Add(item.Key);
}
escrConsume.LoadDatas(consumeIdRows);
bUpdateConsume = false;
}
else
{
CheckUpdateConsume();
}
// 추가효과 자동 변경창 열려있으면 닫기.
if (groupOptionAuto.activeSelf)
{
rtrfGoodsInfo.gameObject.SetActive(true);
groupInfoGear.SetActive(true);
//goBtnInfoHelp.SetActive(true);
groupOptionAuto.SetActive(false);
btnEfcAdd.gameObject.SetActive(true);
btnEfcAddAuto.gameObject.SetActive(true);
groupAutoNow.SetActive(false);
}
}
// 선 표시.
for (int i = 0; i < imgTabLineBottoms.Length; i++)
{
imgTabLineBottoms[i].enabled = iSelectedTab != i;
if (i == iSelectedTab)
{
imgTabLineBottoms[i].enabled = false;
imgTabLineRights[i].enabled = true;
}
else
{
imgTabLineBottoms[i].enabled = true;
imgTabLineRights[i].enabled = false;
}
}
// 무기, 방어구, 악세에서만 일괄합성 버튼 표시.
btnComposeAll.gameObject.SetActive(iSelectedTab <= 2);
SetBadge();
if (iSelectedSubTab < 3)
{
if (bReLocalizeGear)
{
bReLocalizeGear = false;
escrGear.Localize();
}
}
else if (iSelectedTab == 3)
{
if (bReLocalizeTreasure)
{
bReLocalizeTreasure = false;
escrTreasure.Localize();
}
}
SoundMgr.PlaySfx(SoundName.BtnPress);
iLoading--;
}
public void TabSubPress(int index)
{
iLoading++;
CloseLeftInfo();
iSelectedSubTab = index;
for (int i = 0; i < btnSubTabs3.Length; i++)
btnSubTabs3[i].interactable = i != iSelectedSubTab;
// 무기.
if (iSelectedTab == 0)
{
iSvType = cGoods.TBagWeapon;
escrGear.SetType(iSvType);
}
// 방어구.
else if (iSelectedTab == 1)
{
iSvType = cGoods.TBagArmor + iSelectedSubTab + 1;
escrGear.SetType(iSvType);
}
// 악세.
else if (iSelectedTab == 2)
{
iSvType = cGoods.TBagAcce + iSelectedSubTab + 1;
escrGear.SetType(iSvType);
}
// 초기화.
if (dicInitNeeds[iSvType])
{
dicInitNeeds[iSvType] = false;
int irowcnt = 4;
Dictionary<int, dGear> datas = DataHandler.GetGearEquips(iSvType);
dicGearIdRows.Add(iSvType, new EnhancedUI.SmallList<int>());
dicGearIds.Add(iSvType, new int[datas.Count]);
int itemindex = 0;
foreach (var item in datas)
{
if (itemindex % irowcnt == 0)
dicGearIdRows[iSvType].Add(dicGearIdRows[iSvType].Count);
dicGearIds[iSvType][itemindex] = item.Key;
itemindex++;
}
escrGear.LoadDatas(dicGearIdRows[iSvType]);
}
else
{
//escrGear.scroller.RefreshActiveCellViews();
escrGear.LoadDatas(dicGearIdRows[iSvType]);
}
SetTotalLvEfc();
btnComposeAll.interactable = DataHandler.IsGearComposable(iSvType);
int iequip = DataHandler.GetEquipedGear(iSvType) - 1;
if (iequip < 0)
SelectGear(iSvType, 0, 0);
else
SelectGear(iSvType, iequip / 4, iequip % 4);
SoundMgr.PlaySfx(SoundName.BtnPress);
iLoading--;
}
public void TabSubPress2(int index)
{
// 희귀 유물. 추후 업데이트.
if (index > 0)
{
GameUIMgr.SOpenToast(LocalizationText.GetText("msg_prepare"));
return;
}
iLoading++;
CloseLeftInfo();
iSelectedSubTab = index;
for (int i = 0; i < btnSubTabs2.Length; i++)
btnSubTabs2[i].interactable = i != iSelectedSubTab;
//iSvType = cGoods.TBagTreasure;
//escrTreasure.SetType(iSvType);
// 초기화.
if (bInitNeedTreasure)
{
bInitNeedTreasure = false;
Dictionary<int, dTreasure> datas = DataHandler.GetGearTreasures();
EnhancedUI.SmallList<int> treasures = new EnhancedUI.SmallList<int>();
foreach (var item in datas)
{
treasures.Add(item.Key);
}
escrTreasure.LoadDatas(treasures);
}
else
{
escrTreasure.scroller.RefreshActiveCellViews();
}
SoundMgr.PlaySfx(SoundName.BtnPress);
iLoading--;
}
public static void SSetBadge()
{
if (curMgr != null)
curMgr.SetBadge();
}
// 탭 뱃지 표시.
private void SetBadge()
{
if (!canvasUI.enabled)
{
bool bbadgemain = DataHandler.IsBoxNewHave();
if (!bbadgemain)
bbadgemain = DataHandler.IsGearNewHave(cGoods.TBagWeapon) || DataHandler.GetEquipedGear(cGoods.TBagWeapon) != DataHandler.GetGearLastHaveId(cGoods.TBagWeapon);
if (!bbadgemain)
bbadgemain = DataHandler.IsGearNewHave(cGoods.TBagArmorCape) || DataHandler.GetEquipedGear(cGoods.TBagArmorCape) != DataHandler.GetGearLastHaveId(cGoods.TBagArmorCape);
if (!bbadgemain)
bbadgemain = DataHandler.IsGearNewHave(cGoods.TBagArmorHat) || DataHandler.GetEquipedGear(cGoods.TBagArmorHat) != DataHandler.GetGearLastHaveId(cGoods.TBagArmorHat);
if (!bbadgemain)
bbadgemain = DataHandler.IsGearNewHave(cGoods.TBagArmorShoes) || DataHandler.GetEquipedGear(cGoods.TBagArmorShoes) != DataHandler.GetGearLastHaveId(cGoods.TBagArmorShoes);
if (DataHandler.IsClearStage(DataHandler.Const.gearAccOpenStage))
{
if (!bbadgemain)
bbadgemain = DataHandler.IsGearNewHave(cGoods.TBagAcceEar) || DataHandler.GetEquipedGear(cGoods.TBagAcceEar) != DataHandler.GetGearLastHaveId(cGoods.TBagAcceEar);
if (!bbadgemain)
bbadgemain = DataHandler.IsGearNewHave(cGoods.TBagAcceNeck) || DataHandler.GetEquipedGear(cGoods.TBagAcceNeck) != DataHandler.GetGearLastHaveId(cGoods.TBagAcceNeck);
if (!bbadgemain)
bbadgemain = DataHandler.IsGearNewHave(cGoods.TBagAcceRing) || DataHandler.GetEquipedGear(cGoods.TBagAcceRing) != DataHandler.GetGearLastHaveId(cGoods.TBagAcceRing);
}
goMainBadge.SetActive(bbadgemain);
return;
}
goTabBadges[0].SetActive(DataHandler.IsGearNewHave(cGoods.TBagWeapon) || DataHandler.GetEquipedGear(cGoods.TBagWeapon) != DataHandler.GetGearLastHaveId(cGoods.TBagWeapon));
bool[] bbadgearmors = new bool[3];
bbadgearmors[0] = DataHandler.IsGearNewHave(cGoods.TBagArmorCape) || DataHandler.GetEquipedGear(cGoods.TBagArmorCape) != DataHandler.GetGearLastHaveId(cGoods.TBagArmorCape);
bbadgearmors[1] = DataHandler.IsGearNewHave(cGoods.TBagArmorHat) || DataHandler.GetEquipedGear(cGoods.TBagArmorHat) != DataHandler.GetGearLastHaveId(cGoods.TBagArmorHat);
bbadgearmors[2] = DataHandler.IsGearNewHave(cGoods.TBagArmorShoes) || DataHandler.GetEquipedGear(cGoods.TBagArmorShoes) != DataHandler.GetGearLastHaveId(cGoods.TBagArmorShoes);
goTabBadges[1].SetActive(bbadgearmors[0] || bbadgearmors[1] || bbadgearmors[2]);
bool[] bbadgeacces = new bool[3];
if (DataHandler.IsClearStage(DataHandler.Const.gearAccOpenStage))
{
bbadgeacces[0] = DataHandler.IsGearNewHave(cGoods.TBagAcceEar) || DataHandler.GetEquipedGear(cGoods.TBagAcceEar) != DataHandler.GetGearLastHaveId(cGoods.TBagAcceEar);
bbadgeacces[1] = DataHandler.IsGearNewHave(cGoods.TBagAcceNeck) || DataHandler.GetEquipedGear(cGoods.TBagAcceNeck) != DataHandler.GetGearLastHaveId(cGoods.TBagAcceNeck);
bbadgeacces[2] = DataHandler.IsGearNewHave(cGoods.TBagAcceRing) || DataHandler.GetEquipedGear(cGoods.TBagAcceRing) != DataHandler.GetGearLastHaveId(cGoods.TBagAcceRing);
}
goTabBadges[2].SetActive(bbadgeacces[0] || bbadgeacces[1] || bbadgeacces[2]);
goTabBadges[4].SetActive(DataHandler.IsBoxNewHave());
// 방어구.
if (iSelectedTab == 1)
{
goSubTabBadges3[0].SetActive(bbadgearmors[0]);
goSubTabBadges3[1].SetActive(bbadgearmors[1]);
goSubTabBadges3[2].SetActive(bbadgearmors[2]);
}
// 악세.
else if (iSelectedTab == 2)
{
goSubTabBadges3[0].SetActive(bbadgeacces[0]);
goSubTabBadges3[1].SetActive(bbadgeacces[1]);
goSubTabBadges3[2].SetActive(bbadgeacces[2]);
}
if (goTabBadges[0].activeSelf || goTabBadges[1].activeSelf || goTabBadges[2].activeSelf || goTabBadges[4].activeSelf)
goMainBadge.SetActive(true);
else
goMainBadge.SetActive(false);
}
// 총합 레벨 효과 표시.
private void SetTotalLvEfc()
{
int[] ilvefcs = DataHandler.GetGearTotalLevels(iSvType);
txtTotalLv.text = FormatString.TextLv(ilvefcs[1]);
txtTotalEfc.text = FormatString.TextCntPerBlank(ilvefcs[0].ToString(), ilvefcs[3].ToString());
switch (iSvType)
{
case cGoods.TBagWeapon:
txtTotalLvT.text = LocalizationText.GetText("weapon_totallv");
txtTotalEfcT.text = FormatString.StringFormat(LocalizationText.GetText("weapon_addefc"), FormatString.TextEffectValue(eEffectType.GearBuff, ilvefcs[2]));
break;
case cGoods.TBagArmorCape:
txtTotalLvT.text = LocalizationText.GetText("cape_totallv");
txtTotalEfcT.text = FormatString.StringFormat(LocalizationText.GetText("cape_addefc"), FormatString.TextEffectValue(eEffectType.GearBuff, ilvefcs[2]));
break;
case cGoods.TBagArmorHat:
txtTotalLvT.text = LocalizationText.GetText("hat_totallv");
txtTotalEfcT.text = FormatString.StringFormat(LocalizationText.GetText("hat_addefc"), FormatString.TextEffectValue(eEffectType.GearBuff, ilvefcs[2]));
break;
case cGoods.TBagArmorShoes:
txtTotalLvT.text = LocalizationText.GetText("shoes_totallv");
txtTotalEfcT.text = FormatString.StringFormat(LocalizationText.GetText("shoes_addefc"), FormatString.TextEffectValue(eEffectType.GearBuff, ilvefcs[2]));
break;
case cGoods.TBagAcceEar:
txtTotalLvT.text = LocalizationText.GetText("ear_totallv");
txtTotalEfcT.text = FormatString.StringFormat(LocalizationText.GetText("ear_addefc"), FormatString.TextEffectValue(eEffectType.GearBuff, ilvefcs[2]));
break;
case cGoods.TBagAcceNeck:
txtTotalLvT.text = LocalizationText.GetText("neck_totallv");
txtTotalEfcT.text = FormatString.StringFormat(LocalizationText.GetText("neck_addefc"), FormatString.TextEffectValue(eEffectType.GearBuff, ilvefcs[2]));
break;
case cGoods.TBagAcceRing:
txtTotalLvT.text = LocalizationText.GetText("ring_totallv");
txtTotalEfcT.text = FormatString.StringFormat(LocalizationText.GetText("ring_addefc"), FormatString.TextEffectValue(eEffectType.GearBuff, ilvefcs[2]));
break;
}
}
// 소모품 목록 업데이트.
private void CheckUpdateConsume()
{
if (bInitNeedConsume)
return;
// 소모품 목록 업데이트.
if (bUpdateConsume)
{
bUpdateConsume = false;
Dictionary<int, int> datas = new Dictionary<int, int>(DataHandler.GetBoxCounts());
// 사라진 항목 제거.
for (int i = consumeIdList.Count - 1; i >= 0; i--)
{
int key = consumeIdList[i];
if (datas[key] <= 0)
consumeIdList.RemoveAt(i);
datas.Remove(key);
}
// 새로 생긴 항목 추가.
int index = 0;
foreach (var item in datas)
{
if (item.Value <= 0)
continue;
bool baddneed = true;
for (int k = index; k < consumeIdList.Count; k++)
{
if (item.Key < consumeIdList[k])
{
consumeIdList.Insert(k, item.Key);
index = k + 1;
baddneed = false;
break;
}
}
if (baddneed)
consumeIdList.Add(item.Key);
}
// 행 추가.
int irowcnt = consumeIdList.Count / 4 + 1;
while (irowcnt > consumeIdRows.Count)
{
consumeIdRows.Add(consumeIdRows.Count);
}
while (irowcnt < consumeIdRows.Count)
{
consumeIdRows.RemoveEnd();
}
escrConsume.LoadDatas(consumeIdRows);
}
else
{
escrConsume.scroller.RefreshActiveCellViews();
}
}
#endregion Tab
#region Gear
public static int SGetGearId(int isvtype, int irow, int icolumn)
{
return curMgr.GetGearId(isvtype, irow, icolumn);
}
// 장비 번호.
private int GetGearId(int isvtype, int irow, int icolumn)
{
int index = irow * 4 + icolumn;
if (index >= dicGearIds[isvtype].Length)
return -1;
return dicGearIds[isvtype][index];
}
// 선택된 장비인지.
public static bool SIsSelectGear(int idx)
{
return idx == curMgr.iSelectedId;
}
public static void SSelectGear(int isvtype, int irow, int icolumn)
{
if (curMgr.iLoading > 0)
return;
curMgr.isChange = true;
curMgr.SelectGear(isvtype, irow, icolumn);
}
// 장비 선택.
public void SelectGear(int isvtype, int irow, int icolumn)
{
iLoading++;
int key = GetGearId(isvtype, irow, icolumn);
iSelectedId = key;
OpenLeftInfo();
if (groupOptionAuto.activeSelf)
{
groupOptionAuto.SetActive(false);
rtrfGoodsInfo.gameObject.SetActive(true);
groupInfoGear.SetActive(true);
}
escrGear.scroller.RefreshActiveCellViews();
iLoading--;
}
#endregion Gear
#region Gear Equip
// 장비 장착.
public void BtnGearEquip()
{
if (iLoading > 0)
return;
iLoading++;
CoverCamera.Hold();
string url;
switch (iSvType)
{
case cGoods.TBagArmorCape:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEquip), UrlApi.BagCape);
break;
case cGoods.TBagArmorHat:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEquip), UrlApi.BagHat);
break;
case cGoods.TBagArmorShoes:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEquip), UrlApi.BagShoes);
break;
case cGoods.TBagAcceEar:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEquip), UrlApi.BagEar);
break;
case cGoods.TBagAcceNeck:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEquip), UrlApi.BagNeck);
break;
case cGoods.TBagAcceRing:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEquip), UrlApi.BagRing);
break;
default:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEquip), UrlApi.BagWeapon);
break;
}
SoundMgr.PlaySfx(SoundName.BtnPress);
SvConnectManager.Instance.RequestSvPost(true, 0, url, typeof(nIdLv), AGearEquipSucc, AGearEquipFail, new nIdLv(iSelectedId), true);
}
// 장비 장착 통신 실패.
private void AGearEquipFail(SvError error, object request)
{
CoverCamera.Release();
iLoading--;
}
// 장비 장착 통신 성공.
private void AGearEquipSucc(object result, object request)
{
if (DataHandler.EquipGear(iSvType, iSelectedId))
{
escrGear.scroller.RefreshActiveCellViews();
GameUIMgr.SOpenToast(LocalizationText.GetText("bag_equip"));
btnInfoEquip.interactable = false;
btnInfoEquip.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_equiping");
BattleMgr.StatRecalc();
SetBadge();
}
CoverCamera.Release();
iLoading--;
}
#endregion Gear Equip
#region Gear Enhance
// 장비 강화 시작.
public void OnBtnGearEnhanceDown()
{
if (iLoading > 0)
return;
if (bClicking)
return;
iLoading++;
bClicking = true;
dataEnhance = new nIdEnhance(iSelectedId, DataHandler.GetGearEquip(iSvType, iSelectedId).level);
StartCoroutine(nameof(CGearEnhance));
}
// 장비 강화 진행.
private IEnumerator CGearEnhance()
{
dGear gear = DataHandler.GetGearEquip(iSvType, iSelectedId);
int imaxlv = DataHandler.GetGearMaxLv(iSvType, iSelectedId);
BigInteger calcmultiply = BigInteger.Pow(gear.buyingCountInc, dataEnhance.aftLv - 1);
BigInteger calcdivide = BigInteger.Pow(dConst.RateMaxBi, dataEnhance.aftLv - 1);
BigInteger biprice = gear.buyingCount * calcmultiply / calcdivide;
int iprice = (int)biprice;
//BigInteger iprice = (dataEnhance.aftLv - 1) * gear.buyingCountInc + gear.buyingCount;
if (iprice > DataHandler.Goods.gearReinStone || dataEnhance.aftLv >= imaxlv)
{
OnBtnGearEnhanceUp();
yield break;
}
dataEnhance.aftLv++;
dataEnhance.tryCount++;
dataEnhance.useGoods += iprice;
DataHandler.SubEnhanceStone(iprice);
DataHandler.LvUpGearEquip(iSvType, iSelectedId, dataEnhance.aftLv, false);
SetLeftGearInfo();
GameUIMgr.SPlayEfcLeftEnhance();
SoundMgr.PlaySfx(SoundName.BtnPress);
SoundMgr.PlaySfx(SoundName.ReinforceSuccess);
yield return YieldInstructionCache.WaitForSeconds(0.4f);
while (bClicking)
{
calcmultiply = BigInteger.Pow(gear.buyingCountInc, dataEnhance.aftLv - 1);
calcdivide = BigInteger.Pow(dConst.RateMaxBi, dataEnhance.aftLv - 1);
biprice = gear.buyingCount * calcmultiply / calcdivide;
iprice = (int)biprice;
if (iprice > DataHandler.Goods.gearReinStone || dataEnhance.aftLv >= imaxlv)
{
OnBtnGearEnhanceUp();
yield break;
}
dataEnhance.aftLv++;
dataEnhance.tryCount++;
dataEnhance.useGoods += iprice;
DataHandler.SubEnhanceStone(iprice);
DataHandler.LvUpGearEquip(iSvType, iSelectedId, dataEnhance.aftLv, false);
SetLeftGearInfo();
GameUIMgr.SPlayEfcLeftEnhance();
SoundMgr.PlaySfx(SoundName.BtnPress);
SoundMgr.PlaySfx(SoundName.ReinforceSuccess);
yield return YieldInstructionCache.WaitForSeconds(0.1f);
}
}
// 장비 강화 종료.
public void OnBtnGearEnhanceUp()
{
if (!bClicking)
return;
CoverCamera.Hold();
StopCoroutine(nameof(CGearEnhance));
bClicking = false;
string url;
switch (iSvType)
{
case cGoods.TBagArmorCape:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEnhance), UrlApi.BagCape);
break;
case cGoods.TBagArmorHat:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEnhance), UrlApi.BagHat);
break;
case cGoods.TBagArmorShoes:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEnhance), UrlApi.BagShoes);
break;
case cGoods.TBagAcceEar:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEnhance), UrlApi.BagEar);
break;
case cGoods.TBagAcceNeck:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEnhance), UrlApi.BagNeck);
break;
case cGoods.TBagAcceRing:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEnhance), UrlApi.BagRing);
break;
default:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEnhance), UrlApi.BagWeapon);
break;
}
SvConnectManager.Instance.RequestSvPost(true, 0, url, typeof(nGearEnhanceReturn), AGearEnhanceSucc, AGearEnhanceFail, dataEnhance, true);
}
// 장비 강화 통신 실패.
private void AGearEnhanceFail(SvError error, object request)
{
DataHandler.AddEnhanceStone(dataEnhance.useGoods);
DataHandler.LvUpGearEquip(iSvType, iSelectedId, dataEnhance.befLv, true);
escrGear.scroller.RefreshActiveCellViews();
SetTotalLvEfc();
SetLeftGearInfo();
dataEnhance = null;
CoverCamera.Release();
iLoading--;
}
// 장비 강화 통신 성공.
private void AGearEnhanceSucc(object result, object request)
{
nGearEnhanceReturn data = result as nGearEnhanceReturn;
if (data == null)
{
AGearEnhanceFail(new SvError(eErrorCode.NULL_OR_EMPTY), request);
return;
}
DataHandler.SetGoods(data.playCurrency, true);
nIdLvInfo datalv;
switch (iSvType)
{
case cGoods.TBagArmorCape:
datalv = data.playGearCape;
break;
case cGoods.TBagArmorHat:
datalv = data.playGearHat;
break;
case cGoods.TBagArmorShoes:
datalv = data.playGearShoes;
break;
case cGoods.TBagAcceEar:
datalv = data.playGearEarring;
break;
case cGoods.TBagAcceNeck:
datalv = data.playGearNecklace;
break;
case cGoods.TBagAcceRing:
datalv = data.playGearRing;
break;
default:
datalv = data.playGearWeapon;
break;
}
DataHandler.LvUpGearEquip(iSvType, datalv.sid, datalv.lv, true);
escrGear.scroller.RefreshActiveCellViews();
SetTotalLvEfc();
SetLeftGearInfo();
BattleMgr.StatRecalc();
dataEnhance = null;
CoverCamera.Release();
iLoading--;
}
#endregion Gear Enhance
#region Gear Awaken
// 장비 각성.
public void BtnGearAwaken()
{
if (iSelectedId < 0)
return;
if (iLoading > 0)
return;
iLoading++;
dAwaken awaken = DataHandler.GetGearAwakenNext(iSvType, iSelectedId);
dGear gear = DataHandler.GetGearEquip(iSvType, iSelectedId);
int[] igearneeds = DataHandler.GetGearAwakenNeeds(iSvType, iSelectedId);
int[] ihavecounts = new int[4] { DataHandler.GetGearEquip(iSvType, igearneeds[0]).count, DataHandler.GetGearEquip(iSvType, igearneeds[1]).count,
DataHandler.GetGearEquip(iSvType, igearneeds[2]).count, DataHandler.Goods.gearAwakenStone };
int[] ineedcounts = new int[4] { awaken.buyingCnt1, awaken.buyingCnt2, awaken.buyingCnt3, awaken.AwakenStoneCnt };
nGoods[] goodsneeds = new nGoods[4]
{
new nGoods(iSvType, igearneeds[0], ihavecounts[0]),
new nGoods(iSvType, igearneeds[1], ihavecounts[1]),
new nGoods(iSvType, igearneeds[2], ihavecounts[2]),
new nGoods(cGoods.TCurrency, cGoods.CAwakenStoneGear, ihavecounts[3])
};
GameUIMgr.SOpenPopupItemsUseTo(goodsneeds, new nGoods(iSvType, gear.id, gear.count), AGearAwaken, null,
LocalizationText.GetText("bag_awaken"), LocalizationText.GetText("bag_awakenmsg"), LocalizationText.GetText("all_awakengo"), LocalizationText.GetText(Global.STR_CANCEL));
GameUIMgr.SSetPopupItemsUseToCount(ihavecounts, ineedcounts);
SoundMgr.PlaySfx(SoundName.BtnPress);
iLoading--;
}
// 장비 각성하기.
private void AGearAwaken()
{
if (iLoading > 0)
return;
iLoading++;
CoverCamera.Hold();
string url;
switch (iSvType)
{
case cGoods.TBagArmorCape:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearAwaken), UrlApi.BagCape);
break;
case cGoods.TBagArmorHat:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearAwaken), UrlApi.BagHat);
break;
case cGoods.TBagArmorShoes:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearAwaken), UrlApi.BagShoes);
break;
case cGoods.TBagAcceEar:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearAwaken), UrlApi.BagEar);
break;
case cGoods.TBagAcceNeck:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearAwaken), UrlApi.BagNeck);
break;
case cGoods.TBagAcceRing:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearAwaken), UrlApi.BagRing);
break;
default:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearAwaken), UrlApi.BagWeapon);
break;
}
SvConnectManager.Instance.RequestSvPost(true, 0, url, typeof(nGearAwakenReturn), AGearAwakenSucc, AGearAwakenFail, new nIdCnt(iSelectedId), true);
}
// 장비 각성 통신 실패.
private void AGearAwakenFail(SvError error, object request)
{
CoverCamera.Release();
iLoading--;
}
// 장비 각성 통신 성공.
private void AGearAwakenSucc(object result, object request)
{
nGearAwakenReturn data = result as nGearAwakenReturn;
if (data == null)
{
AGearAwakenFail(new SvError(eErrorCode.NULL_OR_EMPTY), request);
return;
}
DataHandler.SetGoods(data.playCurrency, true);
nIdLvInfo[] playdatas;
switch (iSvType)
{
case cGoods.TBagArmorCape:
playdatas = data.playGearCape;
break;
case cGoods.TBagArmorHat:
playdatas = data.playGearHat;
break;
case cGoods.TBagArmorShoes:
playdatas = data.playGearShoes;
break;
case cGoods.TBagAcceEar:
playdatas = data.playGearEarring;
break;
case cGoods.TBagAcceNeck:
playdatas = data.playGearNecklace;
break;
case cGoods.TBagAcceRing:
playdatas = data.playGearRing;
break;
default:
playdatas = data.playGearWeapon;
break;
}
DataHandler.UpdateGearEquipsPlay(iSvType, playdatas);
escrGear.scroller.RefreshActiveCellViews();
SetLeftGearInfo();
if (groupInfoGearEffectAdd.activeSelf)
{
SetEfcAddList(true);
SetEfcAddCost();
}
btnComposeAll.interactable = DataHandler.IsGearComposable(iSvType);
GameUIMgr.SOpenToast(LocalizationText.GetText("msg_gearawaken"));
CoverCamera.Release();
iLoading--;
}
#endregion Gear Awaken
#region Gear Compose
// 장비 합성.
public void BtnGearCompose()
{
if (iSelectedId < 0)
return;
if (iLoading > 0)
return;
iLoading++;
dGear gear = DataHandler.GetGearEquip(iSvType, iSelectedId);
dGear gearnext = DataHandler.GetGearEquip(iSvType, iSelectedId + 1);
int iunit = DataHandler.Const.gearComposePrice;
iSelectedCount = 1;
GameUIMgr.SOpenPopupItemUseTo(new nGoods(iSvType, gear.id, gear.count), new nGoods(iSvType, gearnext.id, gearnext.count),
AGearComposeSub, AGearComposeAdd, AGearComposeMin, AGearComposeMax, AGearCompose, null,
LocalizationText.GetText("all_compose"), LocalizationText.GetText("all_composedo"), LocalizationText.GetText(Global.STR_CANCEL));
GameUIMgr.SSetPopupItemUseToCount(iSelectedCount, iSelectedCount * iunit, iSelectedCount);
SoundMgr.PlaySfx(SoundName.BtnPress);
iLoading--;
}
// 장비 합성 수 감소.
private void AGearComposeSub()
{
if (iLoading > 0)
return;
iLoading++;
if (iSelectedCount <= 1)
{
iLoading--;
return;
}
iSelectedCount--;
int iunit = DataHandler.Const.gearComposePrice;
GameUIMgr.SSetPopupItemUseToCount(iSelectedCount, iSelectedCount * iunit, iSelectedCount);
iLoading--;
}
// 장비 합성 수 증가.
private void AGearComposeAdd()
{
if (iLoading > 0)
return;
iLoading++;
int iunit = DataHandler.Const.gearComposePrice;
int imaxcount = DataHandler.GetGearEquip(iSvType, iSelectedId).count / iunit;
if (iSelectedCount >= imaxcount)
{
iLoading--;
return;
}
iSelectedCount++;
GameUIMgr.SSetPopupItemUseToCount(iSelectedCount, iSelectedCount * iunit, iSelectedCount);
iLoading--;
}
// 장비 합성 수 최소.
private void AGearComposeMin()
{
if (iLoading > 0)
return;
iLoading++;
if (iSelectedCount <= 1)
{
iLoading--;
return;
}
iSelectedCount = 1;
int iunit = DataHandler.Const.gearComposePrice;
GameUIMgr.SSetPopupItemUseToCount(iSelectedCount, iSelectedCount * iunit, iSelectedCount);
iLoading--;
}
// 장비 합성 수 최대.
private void AGearComposeMax()
{
if (iLoading > 0)
return;
iLoading++;
int iunit = DataHandler.Const.gearComposePrice;
int imaxcount = DataHandler.GetGearEquip(iSvType, iSelectedId).count / iunit;
if (iSelectedCount >= imaxcount)
{
iLoading--;
return;
}
iSelectedCount = imaxcount;
GameUIMgr.SSetPopupItemUseToCount(iSelectedCount, iSelectedCount * iunit, iSelectedCount);
iLoading--;
}
// 장비 합성하기.
private void AGearCompose()
{
if (iLoading > 0)
return;
iLoading++;
CoverCamera.Hold();
string url;
switch (iSvType)
{
case cGoods.TBagArmorCape:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearCompose), UrlApi.BagCape);
break;
case cGoods.TBagArmorHat:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearCompose), UrlApi.BagHat);
break;
case cGoods.TBagArmorShoes:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearCompose), UrlApi.BagShoes);
break;
case cGoods.TBagAcceEar:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearCompose), UrlApi.BagEar);
break;
case cGoods.TBagAcceNeck:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearCompose), UrlApi.BagNeck);
break;
case cGoods.TBagAcceRing:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearCompose), UrlApi.BagRing);
break;
default:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearCompose), UrlApi.BagWeapon);
break;
}
int iunit = DataHandler.Const.gearComposePrice;
nIdCnt data = new nIdCnt(iSelectedId, iSelectedCount * iunit);
SvConnectManager.Instance.RequestSvPost(true, 0, url, typeof(nGearComposeReturn), AGearComposeSucc, AGearComposeFail, data, false);
}
public void PopUpBtnGearComposeAll()
{
SoundMgr.PlaySfx(SoundName.BtnPress);
GameUIMgr.SOpenPopup2Button(LocalizationText.GetText("msg_confirm_all_combine"), BtnGearComposeAll);
}
// 장비 일괄 합성.
public void BtnGearComposeAll()
{
if (iLoading > 0)
return;
iLoading++;
CoverCamera.Hold();
iSelectedCount = 0;
string url;
switch (iSvType)
{
case cGoods.TBagArmorCape:
url = FormatString.StringFormat(UrlApi.GetUrl(UrlApi.BagGearComposeAll), UrlApi.BagCape);
break;
case cGoods.TBagArmorHat:
url = FormatString.StringFormat(UrlApi.GetUrl(UrlApi.BagGearComposeAll), UrlApi.BagHat);
break;
case cGoods.TBagArmorShoes:
url = FormatString.StringFormat(UrlApi.GetUrl(UrlApi.BagGearComposeAll), UrlApi.BagShoes);
break;
case cGoods.TBagAcceEar:
url = FormatString.StringFormat(UrlApi.GetUrl(UrlApi.BagGearComposeAll), UrlApi.BagEar);
break;
case cGoods.TBagAcceNeck:
url = FormatString.StringFormat(UrlApi.GetUrl(UrlApi.BagGearComposeAll), UrlApi.BagNeck);
break;
case cGoods.TBagAcceRing:
url = FormatString.StringFormat(UrlApi.GetUrl(UrlApi.BagGearComposeAll), UrlApi.BagRing);
break;
default:
url = FormatString.StringFormat(UrlApi.GetUrl(UrlApi.BagGearComposeAll), UrlApi.BagWeapon);
break;
}
SvConnectManager.Instance.RequestSvPost(true, 0, url, typeof(nGearComposeReturn), AGearComposeSucc, AGearComposeFail, new nIdCnt(), false);
}
// 장비 합성 통신 실패.
private void AGearComposeFail(SvError error, object request)
{
CoverCamera.Release();
iLoading--;
}
// 장비 합성 통신 성공.
private void AGearComposeSucc(object result, object request)
{
nGearComposeReturn data = result as nGearComposeReturn;
if (data == null)
{
AGearComposeFail(new SvError(eErrorCode.NULL_OR_EMPTY), request);
return;
}
nIdLvInfo[] playdatas;
switch (iSvType)
{
case cGoods.TBagArmorCape:
playdatas = data.playGearCape;
DataHandler.AddRecord(eCondition.EquipComposeArmor, iSelectedCount > 0 ? iSelectedCount : data.composeCnt);
break;
case cGoods.TBagArmorHat:
playdatas = data.playGearHat;
DataHandler.AddRecord(eCondition.EquipComposeArmor, iSelectedCount > 0 ? iSelectedCount : data.composeCnt);
break;
case cGoods.TBagArmorShoes:
playdatas = data.playGearShoes;
DataHandler.AddRecord(eCondition.EquipComposeArmor, iSelectedCount > 0 ? iSelectedCount : data.composeCnt);
break;
case cGoods.TBagAcceEar:
playdatas = data.playGearEarring;
DataHandler.AddRecord(eCondition.EquipComposeAcc, iSelectedCount > 0 ? iSelectedCount : data.composeCnt);
break;
case cGoods.TBagAcceNeck:
playdatas = data.playGearNecklace;
DataHandler.AddRecord(eCondition.EquipComposeAcc, iSelectedCount > 0 ? iSelectedCount : data.composeCnt);
break;
case cGoods.TBagAcceRing:
playdatas = data.playGearRing;
DataHandler.AddRecord(eCondition.EquipComposeAcc, iSelectedCount > 0 ? iSelectedCount : data.composeCnt);
break;
default:
playdatas = data.playGearWeapon;
DataHandler.AddRecord(eCondition.EquipComposeWeapon, iSelectedCount > 0 ? iSelectedCount : data.composeCnt);
break;
}
//DataHandler.GetRecord().Save();
DataHandler.UpdateGearEquipsPlay(iSvType, playdatas);
GameUIMgr.SOpenToast(LocalizationText.GetText("bag_compose"));
if (data.result != null && data.result.Length > 0)
{
DataHandler.AddGoods(data.result, null, true);
GameUIMgr.SOpenPopupGoods(data.result);
}
escrGear.scroller.RefreshActiveCellViews();
SetTotalLvEfc();
if (iSelectedId >= 0)
SetLeftGearInfo();
btnComposeAll.interactable = DataHandler.IsGearComposable(iSvType);
CoverCamera.Release();
iLoading--;
}
#endregion Gear Compose
#region Gear Effect Add
public static void SSetEfcAddCost()
{
curMgr.SetEfcAddCost();
}
// 효과 변경 가격 표시.
private void SetEfcAddCost()
{
int icnt = 0;
for (int i = 0; i < efcAddItems.Length; i++)
{
if (efcAddItems[i].IsChangable())
{
icnt++;
}
}
int iprice = DataHandler.Const.gearExtraChangeStonePrice * icnt;
txtEfcAddPrice.text = FormatString.TextInt(iprice);
btnEfcAdd.interactable = DataHandler.Goods.changeStone >= iprice;
btnEfcAddAuto.interactable = btnEfcAdd.interactable;
txtEfcAddPriceStart.text = txtEfcAddPrice.text;
btnEfcAddAutoStart.interactable = btnEfcAdd.interactable;
}
bool isChange = false;
// 추가 효과 표시.
private void SetEfcAddList(bool breset)
{
dGear gear = DataHandler.GetGearEquip(iSvType, iSelectedId);
if (breset)
{
for (int i = 0; i < efcAddItems.Length; i++)
{
if (i + 1 >= gear.maxAwaken)
{
efcAddItems[i].gameObject.SetActive(false);
continue;
}
efcAddItems[i].gameObject.SetActive(true);
bool bopen = gear.awaken > i + 1;
if (isChange)
{
efcAddItems[i].SetChangeOpen(bopen);
isChange = false;
}
else
{
efcAddItems[i].SetOpen(bopen);
}
if (bopen)
{
efcAddItems[i].SetEffect(gear.extraEffects[i]);
}
}
}
else
{
for (int i = 0; i < efcAddItems.Length; i++)
{
if (i + 1 >= gear.maxAwaken)
{
continue;
}
bool bopen = gear.awaken > i + 1;
if (bopen)
efcAddItems[i].SetEffect(gear.extraEffects[i]);
}
}
}
// 아이템 효과 종류.
public static eEffectType SGetEfcAddAutoType(int index)
{
if (index < 0)
return eEffectType.None;
return curMgr.efcOptions[index];
}
// 아이템 선택 상태.
public static bool SGetEfcAddAutoSelect(int index)
{
if (index < 0)
return false;
return curMgr.bSelectedOptions[index];
}
// 추가 효과 자동 변경 창 열기.
public void BtnEfcAddChangeAuto()
{
if (iLoading > 0)
return;
iLoading++;
txtInfoT.text = LocalizationText.GetText("all_effectadd");
rtrfGoodsInfo.gameObject.SetActive(false);
groupInfoGear.SetActive(false);
goBtnInfoHelp.SetActive(false);
groupOptionAuto.SetActive(true);
// 초기화.
if (bInitNeedOption)
{
bInitNeedOption = false;
Dictionary<eEffectType, int> dicdatas = DataHandler.GetExtraAbilityIds()[0];
SmallList<int> datas = new SmallList<int>();
bSelectedOptions = new bool[dicdatas.Count];
efcOptions = new eEffectType[dicdatas.Count];
int index = 0;
foreach (var item in dicdatas)
{
bSelectedOptions[index] = true;
efcOptions[index] = DataHandler.GetExtraAbility(item.Value).abilityType;
datas.Add(index);
index++;
}
escrEfcAddAuto.SetType(cGoods.TBag);
escrEfcAddAuto.LoadDatas(datas);
}
else
{
escrEfcAddAuto.scroller.RefreshActiveCellViews();
}
SoundMgr.PlaySfx(SoundName.BtnPress);
efcOptionRarties[0].SetToggle();
iLoading--;
}
// 추가 효과 자동 변경 창 닫기.
public void BtnEfcAddAutoClose()
{
if (iLoading > 0)
return;
iLoading++;
txtInfoT.text = LocalizationText.GetText("bag_gearinfo");
rtrfGoodsInfo.gameObject.SetActive(true);
groupInfoGear.SetActive(true);
goBtnInfoHelp.SetActive(true);
groupOptionAuto.SetActive(false);
btnEfcAdd.gameObject.SetActive(true);
btnEfcAddAuto.gameObject.SetActive(true);
groupAutoNow.SetActive(false);
iLoading--;
}
// 추가 효과 토글 변경.
public static void SToggleSelect(int itemid, bool bselect)
{
if (itemid < 0)
{
if (bselect)
{
if (itemid == -1)
{
curMgr.efcOptionRarties[0].SetSelected(true);
curMgr.efcOptionRarties[1].SetSelected(false);
}
else
{
curMgr.efcOptionRarties[0].SetSelected(false);
curMgr.efcOptionRarties[1].SetSelected(true);
}
}
return;
}
curMgr.bSelectedOptions[itemid] = bselect;
curMgr.escrEfcAddAuto.scroller.RefreshActiveCellViews();
}
// 추가 효과 자동 변경 시작.
public void BtnEfcAddChangeAutoStart()
{
if (iLoading > 0)
return;
iLoading++;
bEfcAddAuto = true;
int icheck = CheckEfcAdd(true);
if (icheck > 0)
{
iLoading--;
return;
}
SoundMgr.PlaySfx(SoundName.BtnPress);
AEfcAddChange();
}
// 추가 효과 자동 변경 종료.
public void BtnEfcAddChangeAutoStop()
{
if (!bEfcAddAuto)
return;
ProcessEfcAddAutoStop();
SoundMgr.PlaySfx(SoundName.BtnPress);
// UI 표시 변경. 통신 도중일 경우 Cover 켜기(bEfcAddAuto = false 이므로 통신 종료 후 1회 변경과 같은 처리에서 꺼지게 됨).
if (bEfcAddChanging)
CoverCamera.Hold();
}
// 추가 효과 자동 변경 종료시 처리.
private void ProcessEfcAddAutoStop()
{
bEfcAddAuto = false;
CancelInvoke("IEfcAddChangeAuto");
btnEfcAdd.gameObject.SetActive(true);
btnEfcAddAuto.gameObject.SetActive(true);
groupAutoNow.SetActive(false);
// 장착 장비 추가 효과 적용.
if (iSelectedId == DataHandler.GetEquipedGear(iSvType))
DataHandler.CalcGearEquipExtra(iSvType);
}
// 1회 변경 버튼 클릭.
public void BtnEfcAddChange()
{
if (iLoading > 0)
return;
iLoading++;
bEfcAddAuto = false;
int icheck = CheckEfcAdd(false);
if (icheck > 0)
{
iLoading--;
return;
}
SoundMgr.PlaySfx(SoundName.BtnPress);
AEfcAddChange();
}
// 추가 효과 바꾸기 전 현재 옵션 검사.
private int CheckEfcAdd(bool bauto)
{
iEfcAddSlots = 0;
if (efcAddItems[0].IsChangable())
iEfcAddSlots += 1;
if (efcAddItems[1].IsChangable())
iEfcAddSlots += 2;
if (efcAddItems[2].IsChangable())
iEfcAddSlots += 4;
// 변경 가능한 슬롯이 없습니다.
if (iEfcAddSlots == 0)
{
GameUIMgr.SOpenToast(LocalizationText.GetText("msg_noslotchange"));
return 1;
}
// 자동 설정 효과 선택되었는지.
if (bauto)
{
bool bselectany = false;
for (int k = 0; k < bSelectedOptions.Length; k++)
{
if (bSelectedOptions[k])
{
bselectany = true;
break;
}
}
// 효과를 선택해주세요.
if (!bselectany)
{
GameUIMgr.SOpenToast(LocalizationText.GetText("msg_abilityselect"));
return 2;
}
}
dGear gear = DataHandler.GetGearEquip(iSvType, iSelectedId);
int iraritymin = cGoods.RLegend;
if (bauto && efcOptionRarties[1].IsSelected())
iraritymin = cGoods.RMyth;
bool bhaveefc = false;
bool bheroup = false;
for (int i = 0; i < efcAddItems.Length; i++)
{
if (i + 1 >= gear.maxAwaken)
break;
// 미해금 또는 잠긴 상태.
if (!efcAddItems[i].IsChangable())
continue;
// 현재 효과 없음.
if (gear.extraEffects[i] < 0)
continue;
dExtraAbility ability = DataHandler.GetExtraAbility(gear.extraEffects[i]);
// 자동 설정에 포함된 효과 검사.
if (bauto && !bhaveefc)
{
// 희귀도 조건 만족.
if (ability.rarity >= iraritymin)
{
for (int k = 0; k < efcOptions.Length; k++)
{
// 조건 종류 만족.
if (ability.abilityType == efcOptions[k])
{
// 선택된 조건일 경우.
if (bSelectedOptions[k])
bhaveefc = true;
break;
}
}
}
}
// 높은 등급 효과 검사.
if (ability.rarity >= cGoods.RLegend)
bheroup = true;
}
// 슬롯에 이미 획득한 옵션이 존재합니다.
if (bhaveefc)
{
GameUIMgr.SOpenToast(LocalizationText.GetText("msg_abilityhave"));
return 3;
}
// 높은 희귀도의 옵션이 포함되어있습니다. 변경하시겠습니까?
if (bheroup)
{
GameUIMgr.SOpenPopup2Button(LocalizationText.GetText("msg_highgrade"), AEfcAddChange);
return 4;
}
return 0;
}
// 자동 변경된 추가 효과에 원하는 옵션이 있는지 검사.
private bool CheckEfcAddChanging(int[] extras)
{
int iraritymin = cGoods.RLegend;
if (efcOptionRarties[1].IsSelected())
iraritymin = cGoods.RMyth;
for (int i = 0; i < extras.Length; i++)
{
// 미해금 또는 잠긴 상태.
if (!efcAddItems[i].IsChangable())
continue;
// 현재 효과 없음.
if (extras[i] < 0)
continue;
dExtraAbility ability = DataHandler.GetExtraAbility(extras[i]);
// 희귀도 조건 만족.
if (ability.rarity >= iraritymin)
{
for (int k = 0; k < efcOptions.Length; k++)
{
// 조건 종류 만족.
if (ability.abilityType == efcOptions[k])
{
// 선택된 조건일 경우.
if (bSelectedOptions[k])
return true;
}
}
}
}
return false;
}
// 추가 효과 변경.
private void AEfcAddChange()
{
// 자동 변경일 경우 UI 표시 수정.
if (bEfcAddAuto)
{
txtInfoT.text = LocalizationText.GetText("bag_gearinfo");
rtrfGoodsInfo.gameObject.SetActive(true);
groupInfoGear.SetActive(true);
goBtnInfoHelp.SetActive(true);
groupOptionAuto.SetActive(false);
btnEfcAdd.gameObject.SetActive(false);
btnEfcAddAuto.gameObject.SetActive(false);
groupAutoNow.SetActive(true);
}
else
{
CoverCamera.Hold();
}
string url;
switch (iSvType)
{
case cGoods.TBagArmorCape:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEfcAdd), UrlApi.BagCape);
break;
case cGoods.TBagArmorHat:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEfcAdd), UrlApi.BagHat);
break;
case cGoods.TBagArmorShoes:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEfcAdd), UrlApi.BagShoes);
break;
case cGoods.TBagAcceEar:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEfcAdd), UrlApi.BagEar);
break;
case cGoods.TBagAcceNeck:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEfcAdd), UrlApi.BagNeck);
break;
case cGoods.TBagAcceRing:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEfcAdd), UrlApi.BagRing);
break;
default:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEfcAdd), UrlApi.BagWeapon);
break;
}
nIdSlot data = new nIdSlot(iSelectedId, iEfcAddSlots);
SvConnectManager.Instance.RequestSvPost(false, 0, url, typeof(nGearEfcAddReturn), AEfcAddChangeSucc, AEfcAddChangeFail, data, true);
bEfcAddChanging = true;
}
// 추가 효과 자동 변경. Invoke에서 호출.
private void IEfcAddChangeAuto()
{
if (!bEfcAddAuto)
return;
string url;
switch (iSvType)
{
case cGoods.TBagArmorCape:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEfcAdd), UrlApi.BagCape);
break;
case cGoods.TBagArmorHat:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEfcAdd), UrlApi.BagHat);
break;
case cGoods.TBagArmorShoes:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEfcAdd), UrlApi.BagShoes);
break;
case cGoods.TBagAcceEar:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEfcAdd), UrlApi.BagEar);
break;
case cGoods.TBagAcceNeck:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEfcAdd), UrlApi.BagNeck);
break;
case cGoods.TBagAcceRing:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEfcAdd), UrlApi.BagRing);
break;
default:
url = FormatString.CombineAllString(UrlApi.GetUrl(UrlApi.BagGearEfcAdd), UrlApi.BagWeapon);
break;
}
nIdSlot data = new nIdSlot(iSelectedId, iEfcAddSlots);
SvConnectManager.Instance.RequestSvPost(false, 0, url, typeof(nGearEfcAddReturn), AEfcAddChangeSucc, AEfcAddChangeFail, data, true);
bEfcAddChanging = true;
}
// 추가 효과 변경 통신 실패.
private void AEfcAddChangeFail(SvError error, object request)
{
// 자동 변경 종료.
if (bEfcAddAuto)
{
ProcessEfcAddAutoStop();
}
else
{
CoverCamera.Release();
}
bEfcAddChanging = false;
iLoading--;
}
// 추가 효과 변경 성공.
private void AEfcAddChangeSucc(object result, object request)
{
nGearEfcAddReturn data = result as nGearEfcAddReturn;
if (data == null)
{
AEfcAddChangeFail(new SvError(eErrorCode.NULL_OR_EMPTY), request);
return;
}
DataHandler.SetGoods(data.playCurrency, true);
nIdLvInfo playdata;
switch (iSvType)
{
case cGoods.TBagArmorCape:
playdata = data.playGearCape;
break;
case cGoods.TBagArmorHat:
playdata = data.playGearHat;
break;
case cGoods.TBagArmorShoes:
playdata = data.playGearShoes;
break;
case cGoods.TBagAcceEar:
playdata = data.playGearEarring;
break;
case cGoods.TBagAcceNeck:
playdata = data.playGearNecklace;
break;
case cGoods.TBagAcceRing:
playdata = data.playGearRing;
break;
default:
playdata = data.playGearWeapon;
break;
}
DataHandler.ChangeGearExtras(iSvType, playdata.sid, playdata.extras);
// 자동 변경일 경우.
if (bEfcAddAuto)
{
// 원하는 효과를 얻었으면 종료. 재화가 부족해도 종료.
if (CheckEfcAddChanging(playdata.extras))
{
ProcessEfcAddAutoStop();
// 설정한 추가 효과를 획득하였습니다.
GameUIMgr.SOpenToast(LocalizationText.GetText("msg_abilityget"));
}
else
{
int icnt = 0;
for (int i = 0; i < efcAddItems.Length; i++)
{
if (efcAddItems[i].IsChangable())
icnt++;
}
int iprice = DataHandler.Const.gearExtraChangeStonePrice * icnt;
// 재화가 부족하면 종료.
if (iprice > DataHandler.Goods.changeStone)
{
GameUIMgr.SOpenToast(LocalizationText.GetText("msg_nodice"));
ProcessEfcAddAutoStop();
}
// 원하는 효과가 없는 경우 다시 시도.
else
Invoke("IEfcAddChangeAuto", Time.timeScale > 0f ? 0.5f * Time.timeScale : 0.5f);
}
}
// 자동 변경이 아닐 경우 종료.
else
{
// 장착 장비 추가 효과 적용.
if (iSelectedId == DataHandler.GetEquipedGear(iSvType))
DataHandler.CalcGearEquipExtra(iSvType);
CoverCamera.Release();
}
SetEfcAddList(false);
SetEfcAddCost();
bEfcAddChanging = false;
iLoading--;
}
#endregion Gear Effect Add
#region Treasure Enhance
public static void SOnBtnTreasureEnhanceDown(int key, Action actionSuccess, Action actionFail)
{
curMgr.OnBtnTreasureEnhanceDown(key, actionSuccess, actionFail);
}
// 보물 강화 시작.
public void OnBtnTreasureEnhanceDown(int key, Action actionSuccess, Action actionFail)
{
if (iLoading > 0)
return;
if (bClicking)
return;
iLoading++;
bClicking = true;
coEnhance = StartCoroutine(CTreasureEnhance(key, actionSuccess, actionFail));
}
// 보물 강화 진행.
private IEnumerator CTreasureEnhance(int key, Action actionSuccess, Action actionFail)
{
dTreasure treasure = DataHandler.GetGearTreasure(key);
dataEnhance = new nIdEnhance(key, treasure.level, treasure.count);
while (bClicking)
{
if (dataEnhance.aftCnt <= 0 || dataEnhance.aftLv >= treasure.maxLv)
{
OnBtnTreasureEnhanceUp(key);
yield break;
}
dataEnhance.tryCount++;
dataEnhance.useGoods++;
dataEnhance.aftCnt--;
// 강화 확률적 성공.
if (DataHandler.LvUpGearTreasure(key))
{
dataEnhance.aftLv++;
SoundMgr.PlaySfx(SoundName.BtnPress);
SoundMgr.PlaySfx(SoundName.ReinforceSuccess);
actionSuccess();
}
else
{
SoundMgr.PlaySfx(SoundName.BtnPress);
SoundMgr.PlaySfx(SoundName.ReinforceFailed);
actionFail();
}
escrTreasure.scroller.RefreshActiveCellViews();
yield return YieldInstructionCache.WaitForSeconds(0.1f);
}
coEnhance = null;
}
public static void SOnBtnTreasureEnhanceUp(int key)
{
curMgr.OnBtnTreasureEnhanceUp(key);
}
// 보물 강화 종료.
public void OnBtnTreasureEnhanceUp(int key)
{
if (!bClicking)
return;
CoverCamera.Hold();
if (coEnhance != null)
{
StopCoroutine(coEnhance);
coEnhance = null;
}
bClicking = false;
SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.BagTreasureEnhance), typeof(nTreasureEnhanceReturn), ALvUpTreasureSucc, ALvUpTreasureFail, dataEnhance, true);
}
// 보물 강화 통신 실패.
private void ALvUpTreasureFail(SvError error, object request)
{
DataHandler.UpdateGearTreasure(dataEnhance.sid, dataEnhance.befLv, dataEnhance.befCnt);
dataEnhance = null;
CoverCamera.Release();
iLoading--;
}
// 보물 강화 통신 성공.
private void ALvUpTreasureSucc(object result, object request)
{
nTreasureEnhanceReturn data = result as nTreasureEnhanceReturn;
if (data == null)
{
ALvUpTreasureFail(new SvError(eErrorCode.NULL_OR_EMPTY), request);
return;
}
DataHandler.UpdateGearTreasurePlay(data.playGearTreasure);
escrTreasure.scroller.RefreshActiveCellViews();
dataEnhance = null;
CoverCamera.Release();
iLoading--;
}
#endregion Treasure Enhance
#region Treasure Sell
public static void SSellTreasure(int key)
{
curMgr.SellTreasure(key);
}
// 보물 판매.
private void SellTreasure(int key)
{
if (iLoading > 0)
return;
iLoading++;
CoverCamera.Hold();
nIdCnt data = new nIdCnt(key);
SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.BagTreasureSell), typeof(nTreasureSellReturn), ASellTreasureSucc, ASellTreasureFail, data, true);
}
// 보물 판매 통신 실패.
private void ASellTreasureFail(SvError error, object request)
{
CoverCamera.Release();
iLoading--;
}
// 보물 판매 통신 성공.
private void ASellTreasureSucc(object result, object request)
{
nTreasureSellReturn data = result as nTreasureSellReturn;
if (data == null)
{
ASellTreasureFail(new SvError(eErrorCode.NULL_OR_EMPTY), request);
return;
}
nGoods[] goods = new nGoods[1] { new nGoods(cGoods.TCurrency, cGoods.CDiaF, data.playCurrency.diaFree + data.playCurrency.diaPaid - DataHandler.Goods.Dia) };
DataHandler.SetGoods(data.playCurrency, true);
nIdCnt reqdata = request as nIdCnt;
DataHandler.UpdateGearTreasurePlay(data.playGearTreasure);
escrTreasure.scroller.RefreshActiveCellViews();
GameUIMgr.SOpenPopupGoods(goods);
CoverCamera.Release();
iLoading--;
}
#endregion Treasure Sell
#region Consume
public static int SGetConsumeId(int irow, int icolumn)
{
return curMgr.GetConsumeId(irow, icolumn);
}
// 소모품 번호.
private int GetConsumeId(int irow, int icolumn)
{
int index = irow * 4 + icolumn;
if (index >= consumeIdList.Count)
return -1;
return consumeIdList[index];
}
// 선택된 소모품인지.
public static bool SIsSelectConsume(int idx)
{
return idx == curMgr.iSelectedId;
}
public static void SSelectConsume(int irow, int icolumn)
{
if (curMgr.iLoading > 0)
return;
curMgr.SelectConsume(irow, icolumn);
}
// 소모품 선택.
public void SelectConsume(int irow, int icolumn)
{
iLoading++;
int key = GetConsumeId(irow, icolumn);
iSelectedId = key;
OpenLeftInfo();
escrConsume.scroller.RefreshActiveCellViews();
iLoading--;
}
#endregion Consume
#region Consume Use
// 소모품 사용.
public void BtnUseConsume()
{
if (iSelectedId < 0)
return;
if (iLoading > 0)
return;
iLoading++;
int iunit = 1;//사용갯수//iSelectedId == cGoods.CBoxIris ? DataHandler.Const.irisUsePrice : 1;
iSelectedCount = 1;
GameUIMgr.SOpenPopupItemUse(new nGoods(cGoods.TBox, iSelectedId, DataHandler.GetBoxCount(iSelectedId)),
AUseConsumeSub, AUseConsumeAdd, AUseConsumeMin, AUseConsumeMax, AUseConsume, null,
txtInfoConsumeName.text, LocalizationText.GetText("all_use"),LocalizationText.GetText(Global.STR_CANCEL));
GameUIMgr.SSetPopupItemUseCount(iSelectedCount, iSelectedCount * iunit);
SoundMgr.PlaySfx(SoundName.BtnPress);
iLoading--;
}
// 소모품 사용 수 감소.
private void AUseConsumeSub()
{
if (iLoading > 0)
return;
iLoading++;
if (iSelectedCount <= 1)
{
iLoading--;
return;
}
iSelectedCount--;
int iunit = 1;//iSelectedId == cGoods.CBoxIris ? DataHandler.Const.irisUsePrice : 1;
GameUIMgr.SSetPopupItemUseCount(iSelectedCount, iSelectedCount * iunit);
iLoading--;
}
// 소모품 사용 수 증가.
private void AUseConsumeAdd()
{
if (iLoading > 0)
return;
iLoading++;
int iunit = 1;//iSelectedId == cGoods.CBoxIris ? DataHandler.Const.irisUsePrice : 1;
int imaxcount = DataHandler.GetBoxCount(iSelectedId) / iunit;
if (iSelectedCount >= imaxcount)
{
iLoading--;
return;
}
iSelectedCount++;
GameUIMgr.SSetPopupItemUseCount(iSelectedCount, iSelectedCount * iunit);
iLoading--;
}
// 소모품 사용 수 최소.
private void AUseConsumeMin()
{
if (iLoading > 0)
return;
iLoading++;
if (iSelectedCount <= 1)
{
iLoading--;
return;
}
iSelectedCount = 1;
int iunit = 1;//iSelectedId == cGoods.CBoxIris ? DataHandler.Const.irisUsePrice : 1;
GameUIMgr.SSetPopupItemUseCount(iSelectedCount, iSelectedCount * iunit);
iLoading--;
}
// 소모품 사용 수 최대.
private void AUseConsumeMax()
{
if (iLoading > 0)
return;
iLoading++;
int iunit = 1;// iSelectedId == cGoods.CBoxIris ? DataHandler.Const.irisUsePrice : 1;
int imaxcount = DataHandler.GetBoxCount(iSelectedId) / iunit;
if (iSelectedCount >= imaxcount)
{
iLoading--;
return;
}
iSelectedCount = imaxcount;
GameUIMgr.SSetPopupItemUseCount(iSelectedCount, iSelectedCount * iunit);
iLoading--;
}
// 소모품 사용하기.
private void AUseConsume()
{
if (iLoading > 0)
return;
iLoading++;
CoverCamera.Hold();
// 소모품 사용 전에 상자 수 동기화가 필요할 경우 (이전 저장 이후 상자를 획득한 경우).
if (DataHandler.IsNeedDataSave)
SingleMgr.SaveDataBagConsume();
// 서버에 저장할 필요가 없는 경우는 바로 사용 통신 진행.
else
UseConsumeSv();
}
public static void SUseConsumeSv()
{
curMgr.UseConsumeSv();
}
// 소모품 사용 서버 통신 시도.
private void UseConsumeSv()
{
int iunit = 1;// iSelectedId == cGoods.CBoxIris ? DataHandler.Const.irisUsePrice : 1;
nIdCnt data = new nIdCnt(iSelectedId, iSelectedCount * iunit);
SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.BagConsume), typeof(nGoodsGet), AUseConsumeSucc, AUseConsumeFail, data, true);
}
// 소모품 사용 통신 실패.
private void AUseConsumeFail(SvError error, object request)
{
CoverCamera.Release();
iLoading--;
}
// 소모품 사용 통신 성공.
private void AUseConsumeSucc(object result, object request)
{
nGoodsGet data = result as nGoodsGet;
if (data == null)
{
AUseConsumeFail(new SvError(eErrorCode.NULL_OR_EMPTY), request);
return;
}
nIdCnt reqdata = request as nIdCnt;
DataHandler.SubBox(reqdata.sid, reqdata.cnt);
DataHandler.AddGoods(data.result, data.playCurrency, true);
DataHandler.SaveData();
if (DataHandler.GetBoxCount(reqdata.sid) <= 0)
CloseLeftInfo();
else
OpenLeftInfo();
CheckUpdateConsume();
GameUIMgr.SOpenPopupGoods(data.result);
CoverCamera.Release();
iLoading--;
}
// 상자 오픈 연출
private IEnumerator ShowOpenColorBox(nGoods[] results, bool biris)
{
CoverCamera.Hold();
if (biris)
GameUIMgr.SPlayEfcClrCompose();
else
GameUIMgr.SPlayEfcOpenColorBox();
yield return YieldInstructionCache.WaitForSeconds(0.35f);
GameUIMgr.SOpenPopupGoods(results);
yield return YieldInstructionCache.WaitForSeconds(0.35f);
GameUIMgr.SStopEfcClrCompose();
CoverCamera.Release();
}
#endregion Consume Use
#region Left Info
// 왼쪽 정보창 열기.
private void OpenLeftInfo()
{
if (iSelectedId < 0)
return;
// 장비.
if (iSelectedTab < 3)
{
if (!goPpInfo.activeSelf)
{
groupInfoGear.SetActive(true);
groupInfoConsume.SetActive(false);
goPpInfo.SetActive(true);
txtInfoT.text = LocalizationText.GetText("bag_gearinfo");
rtrfGoodsInfo.gameObject.SetActive(true);
Vector2 v2pos = rtrfGoodsInfo.anchoredPosition;
v2pos.x = F_LeftGoodsLeft;
rtrfGoodsInfo.anchoredPosition = v2pos;
}
if (DataHandler.RemoveGearNew(iSvType, iSelectedId))
SetBadge();
SetLeftGearInfo();
TabLeftEffect();
}
// 소모품.
else
{
if (!goPpInfo.activeSelf)
{
groupInfoGear.SetActive(false);
groupInfoConsume.SetActive(true);
goPpInfo.SetActive(true);
txtInfoT.text = LocalizationText.GetText("bag_iteminfo");
rtrfGoodsInfo.gameObject.SetActive(true);
Vector2 v2pos = rtrfGoodsInfo.anchoredPosition;
v2pos.x = F_LeftGoodsMid;
rtrfGoodsInfo.anchoredPosition = v2pos;
}
int icount = DataHandler.GetBoxCount(iSelectedId);
int iunit = 1;// iSelectedId == cGoods.CBoxIris ? DataHandler.Const.irisUsePrice : 1;
goodsInfo.SetGoods(cGoods.TBox, iSelectedId, icount);
txtInfoConsumeName.text = FormatString.GetGoodsName(cGoods.TBox, iSelectedId);
txtInfoConsumeDesc.text = FormatString.GetGoodsDesc(cGoods.TBox, iSelectedId);
btnInfoConsumeUse.interactable = icount >= iunit;
goBtnInfoHelp.SetActive(false);
if (DataHandler.RemoveBoxNew(iSelectedId))
{
SetBadge();
escrConsume.scroller.RefreshActiveCellViews();
}
}
}
// 왼쪽 정보창 닫기.
public void CloseLeftInfo()
{
if (!goPpInfo.activeSelf)
return;
iSelectedId = -1;
// 장비.
if (iSelectedTab < 3)
{
escrGear.scroller.RefreshActiveCellViews();
}
// 소모품.
else
{
escrConsume.scroller.RefreshActiveCellViews();
}
goPpInfo.SetActive(false);
}
// 왼쪽 정보창 도움말(추가 효과 확률 팝업) 열기.
public void OpenInfoHelp()
{
GameUIMgr.SOpenPopupRarityRate();
SoundMgr.PlaySfx(SoundName.BtnPress);
}
// 왼쪽 정보창 장비 정보 표시.
private void SetLeftGearInfo()
{
dGear gear = DataHandler.GetGearEquip(iSvType, iSelectedId);
int imaxlv = DataHandler.GetGearMaxLv(iSvType, iSelectedId);
goodsInfo.SetGoods(iSvType, iSelectedId, gear.count);
txtInfoName.text = FormatString.GetGoodsName(iSvType, iSelectedId);
txtInfoNameColorSetter.SetColor(gear.rarity.ToString());
txtInfoLv.text = FormatString.TextLvPerMax(gear.have ? gear.level : 0, imaxlv);
btnInfoEquip.interactable = gear.have && iSelectedId != DataHandler.GetEquipedGear(iSvType);
if (gear.have && iSelectedId == DataHandler.GetEquipedGear(iSvType))
{
btnInfoEquip.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_equiping");
}
else if(!gear.have)
{
btnInfoEquip.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_nothave");
}
else
{
btnInfoEquip.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_equip");
}
btnInfoCompose.interactable = gear.count >= DataHandler.Const.gearComposePrice && iSelectedId != DataHandler.GetGearEquipLast(iSvType);
bool bmaxawaken = gear.awaken >= gear.maxAwaken;
bool bmaxlv = gear.level >= imaxlv;
int ilevel = gear.level - 1;
// 최고 레벨이 아니면 강화 버튼 표시.
btnInfoEnhance.gameObject.SetActive(!bmaxlv);
// 최고 레벨에 각성이 가능하면 각성 버튼 표시.
btnInfoAwaken.gameObject.SetActive(bmaxlv && !bmaxawaken);
// 최고 레벨에 각성이 불가능하면 Max 버튼 표시.
goInfoMax.SetActive(bmaxlv && bmaxawaken);
// 각성 가능 장비는 추가 효과 탭 표시.
imgTabInfoLineRight.enabled = gear.maxAwaken > 1;
btnTabInfoEffectAdd.gameObject.SetActive(imgTabInfoLineRight.enabled);
goBtnInfoEfcAddLock.SetActive(imgTabInfoLineRight.enabled && gear.awaken <= 1);
goBtnInfoHelp.SetActive(imgTabInfoLineRight.enabled);
// 미소지.
if (!gear.have)
{
txtInfoEnhance.text = FormatString.S_Hypen;
btnInfoEnhance.interactable = false;
if (gear.abilityType1 == eEffectType.None)
{
txtInfoEfcTs[0].enabled = false;
txtInfoEfcCurs[0].enabled = false;
InfoEfcArrowObjs[0].SetActive(false);
txtInfoEfcNexts[0].enabled = false;
}
else
{
txtInfoEfcTs[0].text = FormatString.TextEffectTitle(gear.abilityType1);
txtInfoEfcCurs[0].text = FormatString.TextEffectValue(gear.abilityType1, 0L);
txtInfoEfcNexts[0].text = FormatString.TextEffectValue(gear.abilityType1, gear.abilityValue1);
txtInfoEfcTs[0].enabled = true;
txtInfoEfcCurs[0].enabled = true;
InfoEfcArrowObjs[0].SetActive(true);
txtInfoEfcNexts[0].enabled = true;
}
if (gear.abilityType2 == eEffectType.None)
{
txtInfoEfcTs[1].enabled = false;
txtInfoEfcCurs[1].enabled = false;
InfoEfcArrowObjs[1].SetActive(false);
txtInfoEfcNexts[1].enabled = false;
}
else
{
txtInfoEfcTs[1].text = FormatString.TextEffectTitle(gear.abilityType2);
txtInfoEfcCurs[1].text = FormatString.TextEffectValue(gear.abilityType2, 0L);
txtInfoEfcNexts[1].text = FormatString.TextEffectValue(gear.abilityType2, gear.abilityValue2);
txtInfoEfcTs[1].enabled = true;
txtInfoEfcCurs[1].enabled = true;
InfoEfcArrowObjs[1].SetActive(true);
txtInfoEfcNexts[1].enabled = true;
}
if (gear.abilityType3 == eEffectType.None)
{
txtInfoEfcTs[2].enabled = false;
txtInfoEfcCurs[2].enabled = false;
InfoEfcArrowObjs[2].SetActive(false);
txtInfoEfcNexts[2].enabled = false;
}
else
{
txtInfoEfcTs[2].text = FormatString.TextEffectTitle(gear.abilityType3);
txtInfoEfcCurs[2].text = FormatString.TextEffectValue(gear.abilityType3, 0L);
txtInfoEfcNexts[2].text = FormatString.TextEffectValue(gear.abilityType3, gear.abilityValue3);
txtInfoEfcTs[2].enabled = true;
txtInfoEfcCurs[2].enabled = true;
InfoEfcArrowObjs[2].SetActive(true);
txtInfoEfcNexts[2].enabled = true;
}
}
// 최고 레벨.
else if (bmaxlv)
{
InfoEfcArrowObjs[0].SetActive(false);
txtInfoEfcNexts[0].enabled = false;
if (gear.abilityType1 == eEffectType.None)
{
txtInfoEfcTs[0].enabled = false;
txtInfoEfcCurs[0].enabled = false;
}
else
{
txtInfoEfcTs[0].text = FormatString.TextEffectTitle(gear.abilityType1);
//txtInfoEfcCurs[0].text = FormatString.TextEffectValue(gear.abilityType1, ilevel * gear.abilityValueInc1 + gear.abilityValue1);
long ivalue = gear.abilityValue1 + ((gear.abilityValue1 * gear.abilityValueInc1 / dConst.RateDivideLong) * ilevel);
txtInfoEfcCurs[0].text = FormatString.TextEffectValue(gear.abilityType1, ivalue);
txtInfoEfcTs[0].enabled = true;
txtInfoEfcCurs[0].enabled = true;
}
InfoEfcArrowObjs[1].SetActive(false);
txtInfoEfcNexts[1].enabled = false;
if (gear.abilityType2 == eEffectType.None)
{
txtInfoEfcTs[1].enabled = false;
txtInfoEfcCurs[1].enabled = false;
}
else
{
txtInfoEfcTs[1].text = FormatString.TextEffectTitle(gear.abilityType2);
//txtInfoEfcCurs[1].text = FormatString.TextEffectValue(gear.abilityType2, ilevel * gear.abilityValueInc2 + gear.abilityValue2);
long ivalue = gear.abilityValue2 + ((gear.abilityValue2 * gear.abilityValueInc2 / dConst.RateDivideLong) * ilevel);
txtInfoEfcCurs[1].text = FormatString.TextEffectValue(gear.abilityType2, ivalue);
txtInfoEfcTs[1].enabled = true;
txtInfoEfcCurs[1].enabled = true;
}
InfoEfcArrowObjs[2].SetActive(false);
txtInfoEfcNexts[2].enabled = false;
if (gear.abilityType3 == eEffectType.None)
{
txtInfoEfcTs[2].enabled = false;
txtInfoEfcCurs[2].enabled = false;
}
else
{
txtInfoEfcTs[2].text = FormatString.TextEffectTitle(gear.abilityType3);
//txtInfoEfcCurs[2].text = FormatString.TextEffectValue(gear.abilityType3, ilevel * gear.abilityValueInc3 + gear.abilityValue3);
long ivalue = gear.abilityValue3 + ((gear.abilityValue3 * gear.abilityValueInc3 / dConst.RateDivideLong) * ilevel);
txtInfoEfcCurs[2].text = FormatString.TextEffectValue(gear.abilityType3, ivalue);
txtInfoEfcTs[2].enabled = true;
txtInfoEfcCurs[2].enabled = true;
}
}
// 최고 레벨 아님.
else
{
BigInteger calcmultiply = BigInteger.Pow(gear.buyingCountInc, ilevel);// dConst.RateDivideInt1;
BigInteger calcdivide = BigInteger.Pow(dConst.RateMaxBi, ilevel);
BigInteger iprice = gear.buyingCount * calcmultiply / calcdivide; //ilevel * gear.buyingCountInc + gear.buyingCount;
txtInfoEnhance.text = FormatString.TextInt((long)iprice);
btnInfoEnhance.interactable = iprice <= DataHandler.Goods.gearReinStone;
int ilevelnext = ilevel + 1;
if (gear.abilityType1 == eEffectType.None)
{
txtInfoEfcTs[0].enabled = false;
txtInfoEfcCurs[0].enabled = false;
InfoEfcArrowObjs[0].SetActive(false);
txtInfoEfcNexts[0].enabled = false;
}
else
{
txtInfoEfcTs[0].text = FormatString.TextEffectTitle(gear.abilityType1);
long ivalue = gear.abilityValue1 + ((gear.abilityValue1 * gear.abilityValueInc1 / dConst.RateDivideLong) * ilevel);
txtInfoEfcCurs[0].text = FormatString.TextEffectValue(gear.abilityType1, ivalue);
ivalue = gear.abilityValue1 + ((gear.abilityValue1 * gear.abilityValueInc1 / dConst.RateDivideLong) * ilevelnext);
txtInfoEfcNexts[0].text = FormatString.TextEffectValue(gear.abilityType1, ivalue);
txtInfoEfcTs[0].enabled = true;
txtInfoEfcCurs[0].enabled = true;
InfoEfcArrowObjs[0].SetActive(true);
txtInfoEfcNexts[0].enabled = true;
}
if (gear.abilityType2 == eEffectType.None)
{
txtInfoEfcTs[1].enabled = false;
txtInfoEfcCurs[1].enabled = false;
InfoEfcArrowObjs[1].SetActive(false);
txtInfoEfcNexts[1].enabled = false;
}
else
{
txtInfoEfcTs[1].text = FormatString.TextEffectTitle(gear.abilityType2);
long ivalue = gear.abilityValue2 + ((gear.abilityValue2 * gear.abilityValueInc2 / dConst.RateDivideLong) * ilevel);
txtInfoEfcCurs[1].text = FormatString.TextEffectValue(gear.abilityType2, ivalue);
ivalue = gear.abilityValue2 + ((gear.abilityValue2 * gear.abilityValueInc2 / dConst.RateDivideLong) * ilevelnext);
txtInfoEfcNexts[1].text = FormatString.TextEffectValue(gear.abilityType2, ivalue);
txtInfoEfcTs[1].enabled = true;
txtInfoEfcCurs[1].enabled = true;
InfoEfcArrowObjs[1].SetActive(true);
txtInfoEfcNexts[1].enabled = true;
}
if (gear.abilityType3 == eEffectType.None)
{
txtInfoEfcTs[2].enabled = false;
txtInfoEfcCurs[2].enabled = false;
InfoEfcArrowObjs[2].SetActive(false);
txtInfoEfcNexts[2].enabled = false;
}
else
{
txtInfoEfcTs[2].text = FormatString.TextEffectTitle(gear.abilityType3);
long ivalue = gear.abilityValue3 + ((gear.abilityValue3 * gear.abilityValueInc3 / dConst.RateDivideLong) * ilevel);
txtInfoEfcCurs[2].text = FormatString.TextEffectValue(gear.abilityType3, ivalue);
ivalue = gear.abilityValue3 + ((gear.abilityValue3 * gear.abilityValueInc3 / dConst.RateDivideLong) * ilevelnext);
txtInfoEfcNexts[2].text = FormatString.TextEffectValue(gear.abilityType3, ivalue);
txtInfoEfcTs[2].enabled = true;
txtInfoEfcCurs[2].enabled = true;
InfoEfcArrowObjs[2].SetActive(true);
txtInfoEfcNexts[2].enabled = true;
}
}
imgBtnInfoEnhance.raycastTarget = btnInfoEnhance.interactable;
}
// 왼쪽 정보창 장비 효과 탭.
public void TabLeftEffect()
{
iLoading++;
btnTabInfoEffect.interactable = false;
btnTabInfoEffectAdd.interactable = true;
groupInfoGearEffect.SetActive(true);
groupInfoGearEffectAdd.SetActive(false);
SoundMgr.PlaySfx(SoundName.BtnPress);
iLoading--;
}
// 왼쪽 정보창 추가 효과 탭.
public void TabLeftEffectAdd()
{
if (goBtnInfoEfcAddLock.activeSelf)
{
GameUIMgr.SOpenToast(LocalizationText.GetText("msg_gearawakenneed"));
SoundMgr.PlaySfx(SoundName.BtnPress);
return;
}
iLoading++;
btnTabInfoEffect.interactable = true;
btnTabInfoEffectAdd.interactable = false;
groupInfoGearEffect.SetActive(false);
groupInfoGearEffectAdd.SetActive(true);
SoundMgr.PlaySfx(SoundName.BtnPress);
SetEfcAddList(true);
SetEfcAddCost();
iLoading--;
}
#endregion Left Info
}