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.
2657 lines
102 KiB
2657 lines
102 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using IVDataFormat;
|
|
using IVServerFormat;
|
|
using TMPro;
|
|
using EnhancedUI;
|
|
using UnityEngine.UI;
|
|
using Spine.Unity;
|
|
using UnityEngine.ResourceManagement.AsyncOperations;
|
|
using UnityEngine.AddressableAssets;
|
|
using System.Text;
|
|
using Spine;
|
|
|
|
public class GuardianMgr : MonoBehaviour
|
|
{
|
|
#region Const
|
|
private static GuardianMgr curMgr = null;
|
|
#endregion Const
|
|
|
|
#region UI
|
|
[SerializeField]
|
|
TextMeshProUGUI txtMainT;
|
|
[SerializeField]
|
|
Canvas canvasUI;
|
|
[SerializeField]
|
|
Canvas leftWindow;
|
|
|
|
ButtonIV[] btnTabs;
|
|
GameObject[] goTabLocks;
|
|
GameObject[] goTabBadges;
|
|
|
|
GameObject groupSubTab3;
|
|
ButtonIV[] btnSubTabs3;
|
|
TextMeshProUGUI[] txtSubTabs3;
|
|
GameObject[] SubTabsLocks;
|
|
|
|
GameObject guardianDungeon;
|
|
GameObject guardianGrow;
|
|
GameObject guardianAwaken;
|
|
|
|
[SerializeField]
|
|
EfcAddItem[] efcAddItems;
|
|
|
|
[SerializeField]
|
|
EScrController escrGuardianDungeon;
|
|
[SerializeField]
|
|
EScrController escrGuardianGrow;
|
|
|
|
[SerializeField]
|
|
GameObject StatInfoT;
|
|
TextMeshProUGUI[] charInfoNameT;
|
|
TextMeshProUGUI[] charInfoNumberT;
|
|
|
|
[SerializeField]
|
|
GameObject StatInfoB;
|
|
TextMeshProUGUI[] charInfoNameB;
|
|
TextMeshProUGUI[] charInfoNumberB;
|
|
|
|
private Image dungeonPanel;
|
|
private TextMeshProUGUI dungeonName;
|
|
|
|
private TextMeshProUGUI[] txtInfoEfcTs, txtInfoEfcCurs, txtInfoEfcArrows, txtInfoEfcNexts;
|
|
[SerializeField]
|
|
private Vector3[] efcPoses;
|
|
|
|
[SerializeField]
|
|
GameObject goodsItemSet;
|
|
private GoodsGuardianSlotItem[] goodsItems;
|
|
[SerializeField]
|
|
private GameObject objRobot;
|
|
|
|
GameObject leftLock;
|
|
GameObject myInfo;
|
|
Slider expFill;
|
|
Slider expFillPlus;
|
|
[SerializeField]
|
|
Image expFillMeter;
|
|
TextMeshProUGUI txtExp;
|
|
TextMeshProUGUI txtExpNumber;
|
|
TextMeshProUGUI txtExpPNumber;
|
|
TextMeshProUGUI txtname, txtver;
|
|
TextMeshProUGUI txteffect;
|
|
TextMeshProUGUI txtInput;
|
|
[SerializeField]
|
|
TextMeshProUGUI[] txtGrowBtn;
|
|
|
|
TextMeshProUGUI txtT;
|
|
TextMeshProUGUI LtxtT;
|
|
#endregion
|
|
|
|
#region Auto Change UI
|
|
// 추가 효과 자동 변경.
|
|
private GameObject groupOptionAuto;
|
|
private ButtonIV btnEfcAddAutoStart;
|
|
private TextMeshProUGUI txtEfcAddPriceStart;
|
|
private EScrEfcOption[] efcOptionRarties;
|
|
[SerializeField]
|
|
private EScrController escrEfcAddAuto;
|
|
|
|
private ButtonIV btnEfcAdd, btnEfcAddAuto;
|
|
private GameObject groupAutoNow;
|
|
private TextMeshProUGUI txtEfcAddPrice;
|
|
#endregion
|
|
private AsyncOperationHandle<SkeletonDataAsset> skGuardian;
|
|
[SerializeField]
|
|
private SkeletonAnimation skAnimGuardian;
|
|
[SerializeField]
|
|
private SkeletonAnimation skAnimGuardianBack;
|
|
[SerializeField]
|
|
private ParticleSystem ptcExpUp;
|
|
|
|
bool bInitNeed = true;
|
|
private int iLoading = 1;
|
|
private bool bReLocalize = true;
|
|
int iSelectedTab = -1;
|
|
int curLv = -1;
|
|
|
|
int guardianId = 1;
|
|
public static void SetGuardianId(int i)
|
|
{
|
|
curMgr.guardianId = i;
|
|
}
|
|
public static int GetGuardianId()
|
|
{
|
|
return curMgr.guardianId;
|
|
}
|
|
|
|
#region Base
|
|
public static void SLocalize(bool bmain)
|
|
{
|
|
if (curMgr != null)
|
|
curMgr.Localize(bmain);
|
|
//curMgr.Localize(false);
|
|
}
|
|
|
|
private void Localize(bool bmain)
|
|
{
|
|
if (bmain)
|
|
{
|
|
txtMainT.text = LocalizationText.GetText("guardian_title");
|
|
}
|
|
else
|
|
{
|
|
guardianDungeon = canvasUI.transform.Find("GuardianDungeon").gameObject;
|
|
dungeonPanel = guardianDungeon.transform.Find("GuardianDungeonImage").GetChild(0).GetComponent<Image>();
|
|
dungeonName = dungeonPanel.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
|
|
guardianGrow = canvasUI.transform.Find("GuardianGrow").gameObject;
|
|
guardianAwaken = canvasUI.transform.Find("GuardianAwaken").gameObject;
|
|
|
|
txtT = canvasUI.transform.Find("txtT").GetComponent<TextMeshProUGUI>();
|
|
txtT.text = LocalizationText.GetText("guardian_title");
|
|
LtxtT = leftWindow.transform.Find("txtT").GetComponent<TextMeshProUGUI>();
|
|
LtxtT.text = LocalizationText.GetText("guardian_left_top");
|
|
|
|
groupSubTab3 = canvasUI.transform.Find("groupSubTab3").gameObject;
|
|
btnSubTabs3 = groupSubTab3.transform.GetComponentsInChildren<ButtonIV>();
|
|
txtSubTabs3 = new TextMeshProUGUI[btnSubTabs3.Length];
|
|
SubTabsLocks = new GameObject[btnSubTabs3.Length];
|
|
|
|
for (int i = 0; i < btnSubTabs3.Length; i++)
|
|
{
|
|
txtSubTabs3[i] = btnSubTabs3[i].transform.Find("txt").GetComponent<TextMeshProUGUI>();
|
|
SubTabsLocks[i] = btnSubTabs3[i].transform.Find("lock").gameObject;
|
|
}
|
|
|
|
txtSubTabs3[0].text = LocalizationText.GetText("guardian_dungeon");
|
|
txtSubTabs3[1].text = LocalizationText.GetText("guardian_grow");
|
|
txtSubTabs3[2].text = LocalizationText.GetText("guardian_awaken");
|
|
|
|
btnTabs = canvasUI.transform.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;
|
|
}
|
|
|
|
btnTabs[0].transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("guardian_water");
|
|
MeshRenderer meshRenderer = skAnimGuardianBack.transform.GetComponent<MeshRenderer>();
|
|
meshRenderer.sortingOrder = 105;
|
|
|
|
|
|
|
|
isOpenAwaken = true;
|
|
|
|
for (int i = 0; i < efcAddItems.Length; i++)
|
|
{
|
|
efcAddItems[i].Init();
|
|
efcAddItems[i].SetCondition(i + 1);
|
|
}
|
|
|
|
//정보창
|
|
leftLock = leftWindow.transform.Find("lock").gameObject;
|
|
myInfo = leftWindow.transform.Find("MyInfo").gameObject;
|
|
expFill = myInfo.transform.Find("sliderBg").GetComponent<Slider>();
|
|
txtname = myInfo.transform.Find("txtname").GetComponent<TextMeshProUGUI>();
|
|
txtver = myInfo.transform.Find("txtver").GetComponent<TextMeshProUGUI>();
|
|
txteffect = myInfo.transform.Find("btnEfc").GetChild(0).GetComponent<TextMeshProUGUI>();
|
|
txteffect.text = LocalizationText.GetText("guardian_effect");
|
|
expFillPlus = myInfo.transform.Find("sliderBg (1)").GetComponent<Slider>();
|
|
charInfoNameB = new TextMeshProUGUI[15];
|
|
charInfoNumberB = new TextMeshProUGUI[15];
|
|
TextMeshProUGUI[] objListB = StatInfoB.GetComponentsInChildren<TextMeshProUGUI>(true);
|
|
|
|
for (int i = 0; i < objListB.Length; i += 2)
|
|
{
|
|
charInfoNameB[i / 2] = objListB[i];
|
|
charInfoNumberB[i / 2] = objListB[i + 1];
|
|
}
|
|
|
|
// 장비 장착 효과.
|
|
TextMeshProUGUI[] txtefcs = myInfo.transform.Find("groupEffect").GetComponentsInChildren<TextMeshProUGUI>(true);
|
|
|
|
txtInput = guardianGrow.transform.Find("txtInput").GetComponent<TextMeshProUGUI>();
|
|
txtInput.text = LocalizationText.GetText("guardian_grow_insert");
|
|
txtInfoEfcTs = new TextMeshProUGUI[3] { txtefcs[0], txtefcs[1], txtefcs[2] };
|
|
txtInfoEfcCurs = new TextMeshProUGUI[3] { txtefcs[3], txtefcs[4], txtefcs[5] };
|
|
txtInfoEfcArrows = new TextMeshProUGUI[3] { txtefcs[6], txtefcs[7], txtefcs[8] };
|
|
txtInfoEfcNexts = new TextMeshProUGUI[3] { txtefcs[9], txtefcs[10], txtefcs[11] };
|
|
|
|
efcPoses = new Vector3[6] { new Vector2(115,-25), new Vector2(115,-65) , new Vector2(115,-105),
|
|
new Vector2(314,-25), new Vector2(314,-65) , new Vector2(314,-105)};
|
|
|
|
txtExp = myInfo.transform.Find("StatKind").GetComponent<TextMeshProUGUI>();
|
|
txtExpNumber = myInfo.transform.Find("StatNumber").GetComponent<TextMeshProUGUI>();
|
|
txtExpPNumber = txtExpNumber.transform.Find("StatNumber (1)").GetComponent<TextMeshProUGUI>();
|
|
|
|
txtGrowBtn[0].text = LocalizationText.GetText("guardian_grow_reset");
|
|
txtGrowBtn[1].text = LocalizationText.GetText("guardian_grow_auto");
|
|
txtGrowBtn[2].text = LocalizationText.GetText("guardian_grow_confirm");
|
|
|
|
// 추가 효과 자동 변경.
|
|
groupOptionAuto = leftWindow.transform.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.TGuardian);
|
|
efcOptionRarties[1].SetType(cGoods.TGuardian);
|
|
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"));
|
|
|
|
btnEfcAdd = guardianAwaken.transform.Find("btnChange").GetComponent<ButtonIV>();
|
|
txtEfcAddPrice = btnEfcAdd.transform.Find("txtPrice").GetComponent<TextMeshProUGUI>();
|
|
btnEfcAdd.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_changego");
|
|
btnEfcAddAuto = guardianAwaken.transform.Find("btnChangeAuto").GetComponent<ButtonIV>();
|
|
btnEfcAddAuto.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_changeauto");
|
|
groupAutoNow = guardianAwaken.transform.Find("groupAutoNow").gameObject;
|
|
groupAutoNow.transform.Find("txtProgress").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_autoprocessing");
|
|
|
|
|
|
charInfoNameT = new TextMeshProUGUI[2];
|
|
charInfoNumberT = new TextMeshProUGUI[2];
|
|
TextMeshProUGUI[] objListT = StatInfoT.GetComponentsInChildren<TextMeshProUGUI>(true);
|
|
|
|
for (int i = 0; i < objListT.Length; i += 2)
|
|
{
|
|
charInfoNameT[i / 2] = objListT[i];
|
|
charInfoNumberT[i / 2] = objListT[i + 1];
|
|
}
|
|
|
|
goodsItems = goodsItemSet.GetComponentsInChildren<GoodsGuardianSlotItem>(true);
|
|
}
|
|
}
|
|
|
|
// 설정에서 언어 변경 시 처리.
|
|
public static void SReLocalize()
|
|
{
|
|
curMgr.Localize(true);
|
|
curMgr.bReLocalize = true;
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
curMgr = this;
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
iLoading--;
|
|
CalcGuardian();
|
|
}
|
|
#endregion Base
|
|
|
|
void Init()
|
|
{
|
|
bInitNeed = false;
|
|
|
|
Localize(false);
|
|
|
|
if (skGuardian.IsValid())
|
|
{
|
|
skAnimGuardian.skeletonDataAsset.Clear();
|
|
skAnimGuardian.ClearState();
|
|
skAnimGuardian.skeletonDataAsset = null;
|
|
Addressables.Release(skGuardian);
|
|
}
|
|
|
|
OpenGuardianDungeon();
|
|
}
|
|
|
|
#region Guardian UI OnOff
|
|
public void GuardianWindowOn()//구 수호령 열기
|
|
{
|
|
if (iLoading > 0)
|
|
return;
|
|
iLoading++;
|
|
|
|
if (bInitNeed)
|
|
Init();
|
|
if (bReLocalize)
|
|
Localize(false);
|
|
|
|
canvasUI.enabled = true;
|
|
leftWindow.enabled = true;
|
|
GameUIMgr.SRightWindowClose();
|
|
//GameUIMgr.SOpenLeftPanel(true, true, true, false, true, true);
|
|
GameUIMgr.SSetMainUiOn(false);
|
|
BattleMgr.CloseFailScroll();
|
|
GameUIMgr.SCloseMenu();
|
|
|
|
isOpenAwaken = true;
|
|
|
|
SetGrowExpUI();
|
|
|
|
if (DataHandler.GetPlayGuardian(guardianId) == null)//수호령이 하나도 없으면 잠금으로 표기. 있다면 정보를 표기.
|
|
{
|
|
leftWindow.gameObject.SetActive(false);
|
|
leftLock.SetActive(true);
|
|
SubTabsLocks[1].SetActive(true);
|
|
SubTabsLocks[2].SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
leftWindow.gameObject.SetActive(true);
|
|
leftLock.SetActive(false);
|
|
SubTabsLocks[1].SetActive(false);
|
|
SubTabsLocks[2].SetActive(false);
|
|
}
|
|
|
|
FirstOpenGuardianDungeon();
|
|
|
|
|
|
GameUIMgr.SOpenLeftPanel(change: true);
|
|
|
|
if (DataHandler.GetPlayGuardian(1) != null)
|
|
{
|
|
if(curLv != DataHandler.GetPlayGuardian(1).lv)
|
|
Addressables.LoadAssetAsync<SkeletonDataAsset>(FormatString.StringFormat(AddressableMgr.PathGuardian, DataHandler.GetPlayGuardian(1).lv.ToString())).Completed += ALoadGuardianComp;
|
|
}
|
|
|
|
|
|
StartCoroutine(swapTest());
|
|
skAnimGuardianBack.gameObject.SetActive(true);
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
|
|
iLoading--;
|
|
}
|
|
|
|
public static void SGuardianWindowOff()
|
|
{
|
|
if (!curMgr.bInitNeed)
|
|
{
|
|
curMgr.GuardianWindowOff();
|
|
}
|
|
|
|
}
|
|
|
|
public void GuardianWindowOff()//구 수호령닫기
|
|
{
|
|
if (iLoading > 0)
|
|
return;
|
|
iLoading++;
|
|
|
|
curMgr.canvasUI.enabled = false;
|
|
curMgr.leftWindow.enabled = false;
|
|
GameUIMgr.SCloseLeftPanel();
|
|
GameUIMgr.SSetMainUiOn(true);
|
|
MissionMgr.SRefreshMission();
|
|
SAllDelExpGear();
|
|
//if(skGuardian.IsValid())
|
|
// Addressables.Release(skGuardian);
|
|
|
|
skAnimGuardian.gameObject.SetActive(false);
|
|
skAnimGuardianBack.gameObject.SetActive(false);
|
|
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
isOpenAwaken = false;
|
|
|
|
iLoading--;
|
|
}
|
|
#endregion
|
|
|
|
#region Guardian Menu
|
|
void AllGuardianMenuClose()//수호령 상단의 탭 3개 한번에 닫기
|
|
{
|
|
guardianDungeon.SetActive(false);
|
|
guardianAwaken.SetActive(false);
|
|
guardianGrow.SetActive(false);
|
|
|
|
for (int i = 0; i < btnSubTabs3.Length; i++)
|
|
{
|
|
btnSubTabs3[i].interactable = true;
|
|
}
|
|
|
|
btnSubTabs3[iSelectedTab].interactable = false;
|
|
}
|
|
|
|
public void OpenGuardianDungeon()//수호령 탭 중 던전 열기.
|
|
{
|
|
iSelectedTab = 0;
|
|
AllGuardianMenuClose();
|
|
SAllDelExpGear();
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
// 던전 수가 늘어나면 상수에서 바꿔야함
|
|
dungeonPanel.sprite = AddressableMgr.GetDungeonPanel(200);
|
|
dungeonName.text = LocalizationText.GetText("guardian_dungeon");
|
|
|
|
escrGuardianDungeon.scroller.RefreshActiveCellViews();
|
|
|
|
guardianDungeon.SetActive(true);
|
|
}
|
|
|
|
public void OpenGuardianGrow()//수호령 탭 중 성장 열기.
|
|
{
|
|
if (DataHandler.GetPlayGuardian(guardianId) == null)
|
|
{
|
|
GameUIMgr.SOpenToast(LocalizationText.GetText("guardian_grow_lock"));
|
|
return;
|
|
}
|
|
|
|
iSelectedTab = 1;
|
|
guardianGrow.SetActive(true);
|
|
txtInput.gameObject.SetActive(true);
|
|
|
|
AllGuardianMenuClose();
|
|
FirstOpenGuardianGrow();
|
|
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
|
|
}
|
|
|
|
public void OpenGuardianAwaken()//수호령 탭 중 잠재능력 열기
|
|
{
|
|
if (DataHandler.GetPlayGuardian(guardianId) == null)
|
|
{
|
|
GameUIMgr.SOpenToast(LocalizationText.GetText("guardian_grow_lock"));
|
|
return;
|
|
}
|
|
iSelectedTab = 2;
|
|
AllGuardianMenuClose();
|
|
FirstOpenGuardianAwaken();
|
|
SAllDelExpGear();
|
|
|
|
guardianAwaken.SetActive(true);
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
}
|
|
#endregion
|
|
|
|
#region Dungeon
|
|
void FirstOpenGuardianDungeon()//던전을 최초로 열 때. 던전 정보를 받아서 왼쪽 던전 목록에 표기한다.
|
|
{
|
|
myInfo.SetActive(DataHandler.GetPlayGuardian(guardianId) != null);
|
|
groupOptionAuto.SetActive(false);
|
|
|
|
DungeonMgr.SetDungeonKind(DungeonMgr.DungeonKind.GuardianDG);
|
|
|
|
EnhancedUI.SmallList<int> guardianDungeon = new EnhancedUI.SmallList<int>();
|
|
|
|
for (int i = 0; i < DataHandler.GetDungeonTypeInfo(DungeonMgr.DungeonKind.GuardianDG).diffs.Length; i++)
|
|
{
|
|
guardianDungeon.Add(i + 1);
|
|
}
|
|
|
|
guardianId = 1;
|
|
|
|
escrGuardianDungeon.LoadDatas(guardianDungeon);
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
bool firstGrowOpen = true;
|
|
|
|
int[] growGearCount = new int[28];
|
|
|
|
#region Guardian Grow
|
|
void FirstOpenGuardianGrow() //수호령 성장을 처음 열 때. 내가 가지고 있는 최종무장들을 보여준다.
|
|
{
|
|
myInfo.SetActive(true);
|
|
groupOptionAuto.SetActive(false);
|
|
|
|
if (firstGrowOpen)
|
|
{
|
|
SmallList<int> geargrow = new SmallList<int>();
|
|
|
|
for (int i = 0; i < 7; i++)
|
|
{
|
|
geargrow.Add(i);
|
|
}
|
|
|
|
escrGuardianGrow.LoadDatas(geargrow);
|
|
}
|
|
else
|
|
{
|
|
escrGuardianGrow.scroller.RefreshActiveCellViews();
|
|
}
|
|
|
|
int iType = 0;
|
|
|
|
for (int i = 0; i < goodsItems.Length / 4; i++)
|
|
{
|
|
switch (i)
|
|
{
|
|
case 0:
|
|
iType = cGoods.TBagWeapon;
|
|
break;
|
|
case 1:
|
|
iType = cGoods.TBagArmorCape;
|
|
break;
|
|
case 2:
|
|
iType = cGoods.TBagArmorHat;
|
|
break;
|
|
case 3:
|
|
iType = cGoods.TBagArmorShoes;
|
|
break;
|
|
case 4:
|
|
iType = cGoods.TBagAcceEar;
|
|
break;
|
|
case 5:
|
|
iType = cGoods.TBagAcceNeck;
|
|
break;
|
|
case 6:
|
|
iType = cGoods.TBagAcceRing;
|
|
break;
|
|
default:
|
|
iType = cGoods.TBagWeapon;
|
|
break;
|
|
}
|
|
for (int j = 0; j < 4; j++)
|
|
{
|
|
goodsItems[i * 4 + j].SetGoods(iType, 25 + j, growGearCount[i * 4 + j]);
|
|
|
|
goodsItems[i * 4 + j].SetItemId(i * 4 + j);
|
|
goodsItems[i * 4 + j].gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
guardianGrow.SetActive(true);
|
|
}
|
|
|
|
void SetGrowExpUI()//성장 탭 왼쪽에 있는 수호령의 현재 경험치량과 레벨, 그리고 현재 적용되는 스텟 버프를 보여준다.
|
|
{
|
|
if (bInitNeed)
|
|
{
|
|
return;
|
|
}
|
|
if (DataHandler.GetPlayGuardian(guardianId) == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (DataHandler.GetPlayGuardian(guardianId).exp + plusExp > DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].maxExp)
|
|
{
|
|
txtExpPNumber.color = Global.CLR_TextRed;
|
|
//expFillMeter.color = Global.CLR_Title[3];
|
|
}
|
|
else if (plusExp > 0)
|
|
{
|
|
txtExpPNumber.color = Global.CLR_Mint;
|
|
//expFillMeter.color = Global.CLR_Title[3];
|
|
}
|
|
else
|
|
{
|
|
txtExpPNumber.color = Global.CLR_White;
|
|
//expFillMeter.color = Global.CLR_TextYellow;
|
|
}
|
|
|
|
txtname.text = LocalizationText.GetText(FormatString.CombineAll("guardian_name_", guardianId.ToString()));
|
|
txtver.text = FormatString.CombineAll("Ver.", DataHandler.GetPlayGuardian(guardianId).lv);
|
|
|
|
txtExpPNumber.text = FormatString.StringFormat("{0}", DataHandler.GetPlayGuardian(guardianId).exp + plusExp);
|
|
txtExpNumber.text = FormatString.StringFormat(" / {0}", DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].maxExp);
|
|
expFill.value = ((float)(DataHandler.GetPlayGuardian(guardianId).exp) / DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].maxExp);
|
|
expFillPlus.value = ((float)(DataHandler.GetPlayGuardian(guardianId).exp + plusExp) / DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].maxExp);
|
|
|
|
//BuffMgr.Instance.
|
|
|
|
eEffectType efc1 = (eEffectType)DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityType1;
|
|
eEffectType efc2 = (eEffectType)DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityType2;
|
|
eEffectType efc3 = (eEffectType)DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityType3;
|
|
|
|
//효과 표기
|
|
if (efc1 == eEffectType.None)
|
|
{
|
|
txtInfoEfcTs[0].enabled = false;
|
|
txtInfoEfcCurs[0].enabled = false;
|
|
txtInfoEfcArrows[0].enabled = false;
|
|
txtInfoEfcNexts[0].enabled = false;
|
|
}
|
|
else if (plusExp > 0)
|
|
{
|
|
long minvalue = DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityMinValue1;
|
|
long maxvalue = DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityMaxValue1;
|
|
long curvalue = minvalue + (long)((maxvalue - minvalue) * (float)(DataHandler.GetPlayGuardian(guardianId).exp) / DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].maxExp);
|
|
long nextvalue = System.Math.Min(minvalue + (long)((maxvalue - minvalue) * (float)(DataHandler.GetPlayGuardian(guardianId).exp + plusExp) / DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].maxExp), maxvalue);
|
|
|
|
txtInfoEfcTs[0].text = FormatString.TextEffectTitle(efc1);
|
|
txtInfoEfcCurs[0].text = FormatString.TextEffectValue(efc1, curvalue, true, true);
|
|
txtInfoEfcNexts[0].text = FormatString.TextEffectValue(efc1, nextvalue, true, true);
|
|
txtInfoEfcTs[0].enabled = true;
|
|
txtInfoEfcCurs[0].enabled = true;
|
|
txtInfoEfcArrows[0].enabled = true;
|
|
txtInfoEfcNexts[0].enabled = true;
|
|
txtInfoEfcCurs[0].rectTransform.anchoredPosition = efcPoses[0];
|
|
}
|
|
else
|
|
{
|
|
long minvalue = DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityMinValue1;
|
|
long maxvalue = DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityMaxValue1;
|
|
long curvalue = minvalue + (long)((maxvalue - minvalue) * (float)(DataHandler.GetPlayGuardian(guardianId).exp) / DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].maxExp);
|
|
|
|
txtInfoEfcTs[0].text = FormatString.TextEffectTitle(efc1);
|
|
txtInfoEfcCurs[0].text = FormatString.TextEffectValue(efc1, curvalue, true, true);
|
|
//txtInfoEfcNexts[0].text = FormatString.TextEffectValue(efc1, 1000000L);
|
|
txtInfoEfcTs[0].enabled = true;
|
|
txtInfoEfcCurs[0].enabled = true;
|
|
txtInfoEfcArrows[0].enabled = false;
|
|
txtInfoEfcNexts[0].enabled = false;
|
|
txtInfoEfcCurs[0].rectTransform.anchoredPosition = efcPoses[3];
|
|
}
|
|
|
|
if (efc2 == eEffectType.None)
|
|
{
|
|
txtInfoEfcTs[1].enabled = false;
|
|
txtInfoEfcCurs[1].enabled = false;
|
|
txtInfoEfcArrows[1].enabled = false;
|
|
txtInfoEfcNexts[1].enabled = false;
|
|
}
|
|
else if (plusExp > 0)
|
|
{
|
|
long minvalue = DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityMinValue2;
|
|
long maxvalue = DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityMaxValue2;
|
|
long curvalue = minvalue + (long)((maxvalue - minvalue) * (float)(DataHandler.GetPlayGuardian(guardianId).exp) / DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].maxExp);
|
|
long nextvalue = System.Math.Min(minvalue + (long)((maxvalue - minvalue) * (float)(DataHandler.GetPlayGuardian(guardianId).exp + plusExp) / DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].maxExp), maxvalue);
|
|
|
|
txtInfoEfcTs[1].text = FormatString.TextEffectTitle(efc2);
|
|
txtInfoEfcCurs[1].text = FormatString.TextEffectValue(efc2, curvalue, true, true);
|
|
txtInfoEfcNexts[1].text = FormatString.TextEffectValue(efc2, nextvalue, true, true);
|
|
txtInfoEfcTs[1].enabled = true;
|
|
txtInfoEfcCurs[1].enabled = true;
|
|
txtInfoEfcArrows[1].enabled = true;
|
|
txtInfoEfcNexts[1].enabled = true;
|
|
txtInfoEfcCurs[1].rectTransform.anchoredPosition = efcPoses[1];
|
|
}
|
|
else
|
|
{
|
|
long minvalue = DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityMinValue2;
|
|
long maxvalue = DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityMaxValue2;
|
|
long curvalue = minvalue + (long)((maxvalue - minvalue) * (float)(DataHandler.GetPlayGuardian(guardianId).exp) / DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].maxExp);
|
|
|
|
txtInfoEfcTs[1].text = FormatString.TextEffectTitle(efc2);
|
|
txtInfoEfcCurs[1].text = FormatString.TextEffectValue(efc2, curvalue, true, true);
|
|
//txtInfoEfcNexts[0].text = FormatString.TextEffectValue(efc1, 1000000L);
|
|
txtInfoEfcTs[1].enabled = true;
|
|
txtInfoEfcCurs[1].enabled = true;
|
|
txtInfoEfcArrows[1].enabled = false;
|
|
txtInfoEfcNexts[1].enabled = false;
|
|
txtInfoEfcCurs[1].rectTransform.anchoredPosition = efcPoses[4];
|
|
}
|
|
|
|
if (efc3 == eEffectType.None)
|
|
{
|
|
txtInfoEfcTs[2].enabled = false;
|
|
txtInfoEfcCurs[2].enabled = false;
|
|
txtInfoEfcArrows[2].enabled = false;
|
|
txtInfoEfcNexts[2].enabled = false;
|
|
}
|
|
else if (plusExp > 0)
|
|
{
|
|
long minvalue = DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityMinValue3;
|
|
long maxvalue = DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityMaxValue3;
|
|
long curvalue = minvalue + (long)((maxvalue - minvalue) * (float)(DataHandler.GetPlayGuardian(guardianId).exp) / DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].maxExp);
|
|
long nextvalue = System.Math.Min(minvalue + (long)((maxvalue - minvalue) * (float)(DataHandler.GetPlayGuardian(guardianId).exp + plusExp) / DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].maxExp), maxvalue);
|
|
|
|
txtInfoEfcTs[2].text = FormatString.TextEffectTitle(efc3);
|
|
txtInfoEfcCurs[2].text = FormatString.TextEffectValue(efc3, curvalue, true, true);
|
|
txtInfoEfcNexts[2].text = FormatString.TextEffectValue(efc3, nextvalue, true, true);
|
|
txtInfoEfcTs[2].enabled = true;
|
|
txtInfoEfcCurs[2].enabled = true;
|
|
txtInfoEfcArrows[2].enabled = true;
|
|
txtInfoEfcNexts[2].enabled = true;
|
|
txtInfoEfcCurs[2].rectTransform.anchoredPosition = efcPoses[2];
|
|
}
|
|
else
|
|
{
|
|
long minvalue = DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityMinValue3;
|
|
long maxvalue = DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityMaxValue3;
|
|
long curvalue = minvalue + (long)((maxvalue - minvalue) * (float)(DataHandler.GetPlayGuardian(guardianId).exp) / DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].maxExp);
|
|
|
|
txtInfoEfcTs[2].text = FormatString.TextEffectTitle(efc3);
|
|
txtInfoEfcCurs[2].text = FormatString.TextEffectValue(efc3, curvalue, true, true);
|
|
//txtInfoEfcNexts[0].text = FormatString.TextEffectValue(efc3, 1000000L);
|
|
txtInfoEfcTs[2].enabled = true;
|
|
txtInfoEfcCurs[2].enabled = true;
|
|
txtInfoEfcArrows[2].enabled = false;
|
|
txtInfoEfcNexts[2].enabled = false;
|
|
txtInfoEfcCurs[2].rectTransform.anchoredPosition = efcPoses[5];
|
|
}
|
|
|
|
//txtInfoEfcTs[0].text = FormatString.TextEffectTitle((eEffectType)DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityType1);
|
|
//txtInfoEfcCurs[0].text = FormatString.TextEffectValue((eEffectType)DataHandler.GetSysGuardian(guardianId).levels[DataHandler.GetPlayGuardian(guardianId).lv - 1].abilityType1, 1000000L,true,true);
|
|
|
|
//txtInfoEfcNexts[0].text = FormatString.TextEffectValue(gear.abilityType1, gear.abilityValue1);
|
|
}
|
|
|
|
public static void SCalcGuardian()
|
|
{
|
|
curMgr.CalcGuardian();
|
|
}
|
|
|
|
void CalcGuardian() //수호령은 경험치에 정비례해서 스텟 버프가 결정된다. 이 코드는 그 버프량을 계산하는 코드.
|
|
{
|
|
BuffMgr.Instance.GuardianGrowReset();
|
|
|
|
var sysGuardian = DataHandler.GetSysGuardian(guardianId);
|
|
var playGuardian = DataHandler.GetPlayGuardian(sysGuardian.guardianType);
|
|
|
|
if (sysGuardian is null || playGuardian is null) return;
|
|
|
|
int lvIdx = playGuardian.lv - 1;
|
|
|
|
eEffectType[] effectTypes =
|
|
{
|
|
(eEffectType)sysGuardian.levels[lvIdx].abilityType1,
|
|
(eEffectType)sysGuardian.levels[lvIdx].abilityType2,
|
|
(eEffectType)sysGuardian.levels[lvIdx].abilityType3
|
|
};
|
|
|
|
long[] minValues =
|
|
{
|
|
sysGuardian.levels[lvIdx].abilityMinValue1,
|
|
sysGuardian.levels[lvIdx].abilityMinValue2,
|
|
sysGuardian.levels[lvIdx].abilityMinValue3
|
|
};
|
|
|
|
long[] maxValues =
|
|
{
|
|
sysGuardian.levels[lvIdx].abilityMaxValue1,
|
|
sysGuardian.levels[lvIdx].abilityMaxValue2,
|
|
sysGuardian.levels[lvIdx].abilityMaxValue3
|
|
};
|
|
|
|
for (int i = 0; i < 3; ++i)
|
|
{
|
|
long curValue = minValues[i] + (long)((maxValues[i] - minValues[i]) * (float)(playGuardian.exp) / sysGuardian.levels[lvIdx].maxExp);
|
|
BuffMgr.Instance.SetGuardianStat(effectTypes[i], curValue);
|
|
}
|
|
|
|
BuffMgr.Instance.CalcAllStat();
|
|
}
|
|
|
|
public static void plusMinusGear(int isvtype, int irow, int icolumn)
|
|
{
|
|
curMgr.goodsItems[irow * 4 + icolumn].PlusCount();
|
|
}
|
|
|
|
public void SetInsertText()
|
|
{
|
|
for (int i = 0; i < goodsItems.Length; i++)
|
|
{
|
|
if (goodsItems[i].gameObject.activeSelf)
|
|
{
|
|
txtInput.gameObject.SetActive(false);
|
|
return;
|
|
}
|
|
}
|
|
txtInput.gameObject.SetActive(true);
|
|
}
|
|
|
|
//장비를 선택하면 장비의 등급에 따라 경험치가 추가된다.
|
|
int plusExp = 0;
|
|
public static void SetExpGear(int irow, int icolumn, dGear data)
|
|
{
|
|
if (DataHandler.GetPlayGuardian(curMgr.guardianId).exp + curMgr.plusExp >= DataHandler.GetSysGuardian(curMgr.guardianId).levels[DataHandler.GetPlayGuardian(curMgr.guardianId).lv - 1].maxExp)
|
|
{
|
|
GameUIMgr.SOpenToast(LocalizationText.GetText("guardian_grow_no"));
|
|
|
|
data.count += 1;
|
|
return;
|
|
}
|
|
|
|
int index = irow * 4 + icolumn;
|
|
|
|
curMgr.growGearCount[index] += 1;
|
|
|
|
int iType = 0;
|
|
int startRareity = 25;
|
|
switch (irow)
|
|
{
|
|
case 0:
|
|
iType = cGoods.TBagWeapon;
|
|
break;
|
|
case 1:
|
|
iType = cGoods.TBagArmorCape;
|
|
break;
|
|
case 2:
|
|
iType = cGoods.TBagArmorHat;
|
|
break;
|
|
case 3:
|
|
iType = cGoods.TBagArmorShoes;
|
|
break;
|
|
case 4:
|
|
iType = cGoods.TBagAcceEar;
|
|
break;
|
|
case 5:
|
|
iType = cGoods.TBagAcceNeck;
|
|
break;
|
|
case 6:
|
|
iType = cGoods.TBagAcceRing;
|
|
break;
|
|
}
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, icolumn + 1);
|
|
if (iType == cGoods.TBagAcceEar || iType == cGoods.TBagAcceNeck || iType == cGoods.TBagAcceRing)
|
|
{
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, icolumn + 1);
|
|
}
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
|
|
curMgr.goodsItems[index].SetGoods(iType, icolumn + startRareity, curMgr.growGearCount[index]);
|
|
|
|
curMgr.goodsItems[index].gameObject.SetActive(true);
|
|
curMgr.SetInsertText();
|
|
curMgr.escrGuardianGrow.scroller.RefreshActiveCellViews();
|
|
}
|
|
|
|
int leftGear = 0;
|
|
public void CheckAutoOk()
|
|
{
|
|
leftGear = 0;
|
|
dGear data;
|
|
|
|
for(int i = 0; i < 4; i++)
|
|
{
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceEar, 25 + i);
|
|
if (data.count > 0)
|
|
{
|
|
leftGear++;
|
|
}
|
|
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceNeck, 25 + i);
|
|
if (data.count > 0)
|
|
{
|
|
leftGear++;
|
|
}
|
|
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceRing, 25 + i);
|
|
if (data.count > 0)
|
|
{
|
|
leftGear++;
|
|
}
|
|
|
|
data = DataHandler.GetGearEquip(cGoods.TBagWeapon, 25 + i);
|
|
if (data.count > 0)
|
|
{
|
|
leftGear++;
|
|
}
|
|
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorCape, 25 + i);
|
|
if (data.count > 0)
|
|
{
|
|
leftGear++;
|
|
}
|
|
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorHat, 25 + i);
|
|
if (data.count > 0)
|
|
{
|
|
leftGear++;
|
|
}
|
|
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorShoes, 25 + i);
|
|
if (data.count > 0)
|
|
{
|
|
leftGear++;
|
|
}
|
|
|
|
if (leftGear > 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
//자동으로 경험치에 맞춰서 장비를 세팅해주는 부분. 이때 자동 정렬의 기준은 경험치가 높은 순서로 진행된다.
|
|
public static void SetAutoExpGear()
|
|
{
|
|
int leftExp = 0;
|
|
dGear data = null;
|
|
int powNum = 0;//제곱횟수(등급결정)
|
|
int startNum = 24;//장비등급시작수(장비 아이디 결정)
|
|
int leftcount = 0;//남은 횟수
|
|
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
|
|
//경험치가 다 채워졌으면 채워진 알람을 넣는다. 장비가 아예 없을 경우는 아래쪽에 존재.
|
|
if (0 >= DataHandler.GetSysGuardian(curMgr.guardianId).levels[DataHandler.GetPlayGuardian(curMgr.guardianId).lv - 1].maxExp - (DataHandler.GetPlayGuardian(curMgr.guardianId).exp + curMgr.plusExp))
|
|
{
|
|
GameUIMgr.SOpenToast(LocalizationText.GetText("guardian_grow_no"));
|
|
return;
|
|
}
|
|
|
|
//장신구가 2배 더 높은 경험치를 먹기 때문에 경험치가 높은 순으로 계산하기 위해서 장신구와 방어구를 번갈아 돌아간다. 첫 순서는 장신구.
|
|
leftExp = DataHandler.GetSysGuardian(curMgr.guardianId).levels[DataHandler.GetPlayGuardian(curMgr.guardianId).lv - 1].maxExp - (DataHandler.GetPlayGuardian(curMgr.guardianId).exp + curMgr.plusExp);
|
|
powNum = 4;
|
|
leftcount = leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum) * 2);
|
|
for (int i = 0; i < leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum) * 2); i++)
|
|
{
|
|
if (leftcount > 0)
|
|
{
|
|
for (int j = 0; j < 3; j++)
|
|
{
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
switch (j)
|
|
{
|
|
case 0:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceEar, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagAcceEar, startNum + powNum, curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 1:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceNeck, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagAcceNeck, startNum + powNum, curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 2:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceRing, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagAcceRing, startNum + powNum, curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
leftExp = DataHandler.GetSysGuardian(curMgr.guardianId).levels[DataHandler.GetPlayGuardian(curMgr.guardianId).lv - 1].maxExp - (DataHandler.GetPlayGuardian(curMgr.guardianId).exp + curMgr.plusExp);
|
|
//powNum = 4;
|
|
leftcount = leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum));
|
|
for (int i = 0; i < leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum)); i++)
|
|
{
|
|
if (leftcount > 0)
|
|
{
|
|
for (int j = 0; j < 4; j++)
|
|
{
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
switch (j)
|
|
{
|
|
case 0:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagWeapon, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*무기와 방어구 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagWeapon, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 1:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorCape, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagArmorCape, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 2:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorHat, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagArmorHat, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 3:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorShoes, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagArmorShoes, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//별셋 레어도
|
|
leftExp = DataHandler.GetSysGuardian(curMgr.guardianId).levels[DataHandler.GetPlayGuardian(curMgr.guardianId).lv - 1].maxExp - (DataHandler.GetPlayGuardian(curMgr.guardianId).exp + curMgr.plusExp);
|
|
powNum = 3;
|
|
leftcount = leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum) * 2);
|
|
for (int i = 0; i < leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum) * 2); i++)
|
|
{
|
|
if (leftcount > 0)
|
|
{
|
|
for (int j = 0; j < 3; j++)
|
|
{
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
switch (j)
|
|
{
|
|
case 0:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceEar, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagAcceEar, startNum + powNum, curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 1:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceNeck, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagAcceNeck, startNum + powNum, curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 2:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceRing, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagAcceRing, startNum + powNum, curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
leftExp = DataHandler.GetSysGuardian(curMgr.guardianId).levels[DataHandler.GetPlayGuardian(curMgr.guardianId).lv - 1].maxExp - (DataHandler.GetPlayGuardian(curMgr.guardianId).exp + curMgr.plusExp);
|
|
//powNum = 4;
|
|
leftcount = leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum));
|
|
for (int i = 0; i < leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum)); i++)
|
|
{
|
|
if (leftcount > 0)
|
|
{
|
|
for (int j = 0; j < 4; j++)
|
|
{
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
switch (j)
|
|
{
|
|
case 0:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagWeapon, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*무기와 방어구 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagWeapon, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 1:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorCape, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagArmorCape, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 2:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorHat, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagArmorHat, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 3:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorShoes, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagArmorShoes, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//별둘 레어도
|
|
leftExp = DataHandler.GetSysGuardian(curMgr.guardianId).levels[DataHandler.GetPlayGuardian(curMgr.guardianId).lv - 1].maxExp - (DataHandler.GetPlayGuardian(curMgr.guardianId).exp + curMgr.plusExp);
|
|
powNum = 2;
|
|
leftcount = leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum) * 2);
|
|
for (int i = 0; i < leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum) * 2); i++)
|
|
{
|
|
if (leftcount > 0)
|
|
{
|
|
for (int j = 0; j < 3; j++)
|
|
{
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
switch (j)
|
|
{
|
|
case 0:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceEar, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagAcceEar, startNum + powNum, curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 1:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceNeck, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagAcceNeck, startNum + powNum, curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 2:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceRing, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagAcceRing, startNum + powNum, curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
leftExp = DataHandler.GetSysGuardian(curMgr.guardianId).levels[DataHandler.GetPlayGuardian(curMgr.guardianId).lv - 1].maxExp - (DataHandler.GetPlayGuardian(curMgr.guardianId).exp + curMgr.plusExp);
|
|
//powNum = 4;
|
|
leftcount = leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum));
|
|
for (int i = 0; i < leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum)); i++)
|
|
{
|
|
if (leftcount > 0)
|
|
{
|
|
for (int j = 0; j < 4; j++)
|
|
{
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
switch (j)
|
|
{
|
|
case 0:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagWeapon, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*무기와 방어구 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagWeapon, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 1:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorCape, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagArmorCape, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 2:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorHat, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagArmorHat, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 3:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorShoes, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagArmorShoes, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//별하나 레어도
|
|
leftExp = DataHandler.GetSysGuardian(curMgr.guardianId).levels[DataHandler.GetPlayGuardian(curMgr.guardianId).lv - 1].maxExp - (DataHandler.GetPlayGuardian(curMgr.guardianId).exp + curMgr.plusExp);
|
|
powNum = 1;
|
|
leftcount = leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum) * 2);
|
|
for (int i = 0; i < leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum) * 2); i++)
|
|
{
|
|
if (leftcount > 0)
|
|
{
|
|
for (int j = 0; j < 3; j++)
|
|
{
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
switch (j)
|
|
{
|
|
case 0:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceEar, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagAcceEar, startNum + powNum, curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 1:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceNeck, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagAcceNeck, startNum + powNum, curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 2:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagAcceRing, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagAcceRing, startNum + powNum, curMgr.growGearCount[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(4 + j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
leftExp = DataHandler.GetSysGuardian(curMgr.guardianId).levels[DataHandler.GetPlayGuardian(curMgr.guardianId).lv - 1].maxExp - (DataHandler.GetPlayGuardian(curMgr.guardianId).exp + curMgr.plusExp);
|
|
//powNum = 4;
|
|
leftcount = leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum));
|
|
for (int i = 0; i < leftExp / ((int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum)); i++)
|
|
{
|
|
if (leftcount > 0)
|
|
{
|
|
for (int j = 0; j < 4; j++)
|
|
{
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
switch (j)
|
|
{
|
|
case 0:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagWeapon, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*무기와 방어구 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagWeapon, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 1:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorCape, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagArmorCape, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 2:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorHat, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagArmorHat, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 3:
|
|
data = DataHandler.GetGearEquip(cGoods.TBagArmorShoes, startNum + powNum);
|
|
if (data.count > 0)
|
|
{
|
|
data.count -= 1;
|
|
|
|
curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1] += 1;
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp += (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, powNum);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].SetGoods(cGoods.TBagArmorShoes, startNum + powNum, curMgr.growGearCount[(j)/*귀걸이 등등*/ * 4 + powNum - 1]);
|
|
|
|
curMgr.goodsItems[(j)/*귀걸이 등등*/ * 4 + powNum - 1].gameObject.SetActive(true);
|
|
|
|
leftcount--;
|
|
|
|
if (leftcount <= 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
curMgr.CheckAutoOk();
|
|
if (curMgr.leftGear == 0)
|
|
{
|
|
GameUIMgr.SOpenToast(LocalizationText.GetText("guardian_grow_noequip"));
|
|
return;
|
|
}
|
|
|
|
GameUIMgr.SOpenToast(LocalizationText.GetText("guardian_grow_auto_complete"));
|
|
curMgr.SetInsertText();
|
|
curMgr.escrGuardianGrow.scroller.RefreshActiveCellViews();
|
|
}
|
|
|
|
//장비를 빼면 그만큼의 경험치를 뺀다.
|
|
public static void DelExpGear(int id)
|
|
{
|
|
int irow = id / 4;
|
|
int icolumn = id % 4;
|
|
int index = irow * 4 + icolumn;
|
|
|
|
curMgr.growGearCount[index] -= 1;
|
|
|
|
int iType = 0;
|
|
int startRareity = 25;
|
|
switch (irow)
|
|
{
|
|
case 0:
|
|
iType = cGoods.TBagWeapon;
|
|
break;
|
|
case 1:
|
|
iType = cGoods.TBagArmorCape;
|
|
break;
|
|
case 2:
|
|
iType = cGoods.TBagArmorHat;
|
|
break;
|
|
case 3:
|
|
iType = cGoods.TBagArmorShoes;
|
|
break;
|
|
case 4:
|
|
iType = cGoods.TBagAcceEar;
|
|
break;
|
|
case 5:
|
|
iType = cGoods.TBagAcceNeck;
|
|
break;
|
|
case 6:
|
|
iType = cGoods.TBagAcceRing;
|
|
break;
|
|
}
|
|
|
|
dGear data = DataHandler.GetGearEquip(iType, startRareity + icolumn);
|
|
|
|
data.count = data.count + 1;//갯수 추가와 감산
|
|
|
|
//경험치 정산
|
|
curMgr.plusExp -= (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, icolumn + 1);
|
|
if (iType == cGoods.TBagAcceEar || iType == cGoods.TBagAcceNeck || iType == cGoods.TBagAcceRing)
|
|
{
|
|
curMgr.plusExp -= (int)Mathf.Pow(DataHandler.Const.firstGradeEquipExp, icolumn + 1);
|
|
}
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
curMgr.goodsItems[index].SetGoods(iType, icolumn + startRareity, curMgr.growGearCount[index]);
|
|
|
|
curMgr.goodsItems[index].gameObject.SetActive(curMgr.growGearCount[index] > 0);
|
|
curMgr.SetInsertText();
|
|
curMgr.escrGuardianGrow.scroller.RefreshActiveCellViews();
|
|
}
|
|
|
|
//장비 세팅을 취소하면 경험치도 전부 원래대로 돌아간다.
|
|
public void SAllDelExpGear()
|
|
{
|
|
AllDelExpGear();
|
|
//경험치 정산
|
|
curMgr.plusExp = 0;
|
|
|
|
curMgr.SetGrowExpUI();
|
|
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
curMgr.SetInsertText();
|
|
curMgr.escrGuardianGrow.scroller.RefreshActiveCellViews();
|
|
}
|
|
|
|
void AllDelExpGear()//갱신은 밖에서 해줄것
|
|
{
|
|
for (int i = 0; i < curMgr.growGearCount.Length; i++)
|
|
{
|
|
int irow = i / 4;
|
|
int icolumn = i % 4;
|
|
int index = irow * 4 + icolumn;
|
|
|
|
if (curMgr.growGearCount[index] > 0)
|
|
{
|
|
|
|
int iType = 0;
|
|
int startRareity = 25;
|
|
switch (irow)
|
|
{
|
|
case 0:
|
|
iType = cGoods.TBagWeapon;
|
|
break;
|
|
case 1:
|
|
iType = cGoods.TBagArmorCape;
|
|
break;
|
|
case 2:
|
|
iType = cGoods.TBagArmorHat;
|
|
break;
|
|
case 3:
|
|
iType = cGoods.TBagArmorShoes;
|
|
break;
|
|
case 4:
|
|
iType = cGoods.TBagAcceEar;
|
|
break;
|
|
case 5:
|
|
iType = cGoods.TBagAcceNeck;
|
|
break;
|
|
case 6:
|
|
iType = cGoods.TBagAcceRing;
|
|
break;
|
|
}
|
|
|
|
dGear data = DataHandler.GetGearEquip(iType, startRareity + icolumn);
|
|
|
|
data.count = data.count + curMgr.growGearCount[index];//갯수 추가와 감산
|
|
//SetData(itemID);
|
|
|
|
curMgr.growGearCount[index] -= curMgr.growGearCount[index];
|
|
|
|
curMgr.goodsItems[index].SetGoods(iType, icolumn + startRareity, curMgr.growGearCount[index]);
|
|
|
|
curMgr.goodsItems[index].gameObject.SetActive(curMgr.growGearCount[index] > 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void setActiveRobot(bool bactive)
|
|
{
|
|
curMgr.objRobot.SetActive(bactive);
|
|
}
|
|
|
|
nGuardianGrowPost data = null;
|
|
|
|
//최종 장비를 소모하면 계산한 값을 토대로 서버와 통신한다.
|
|
public void STrySVGuardianGrow()
|
|
{
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
|
|
if (DataHandler.GetPlayGuardian(curMgr.guardianId).exp + curMgr.plusExp > DataHandler.GetSysGuardian(curMgr.guardianId).levels[DataHandler.GetPlayGuardian(curMgr.guardianId).lv - 1].maxExp)
|
|
{
|
|
GameUIMgr.SOpenPopup2Button(LocalizationText.GetText("guardian_grow_qus"), TrySVGuardianGrow);
|
|
}
|
|
else
|
|
{
|
|
TrySVGuardianGrow();
|
|
}
|
|
}
|
|
|
|
public void TrySVGuardianGrow()
|
|
{
|
|
int count = 0;
|
|
for (int i = 0; i < growGearCount.Length; i++)
|
|
{
|
|
if (curMgr.growGearCount[i] > 0)
|
|
{
|
|
count++;
|
|
}
|
|
}
|
|
|
|
if (count <= 0)
|
|
{
|
|
GameUIMgr.SOpenToast(LocalizationText.GetText("guardian_grow_noexp"));
|
|
return;
|
|
}
|
|
|
|
data = new nGuardianGrowPost();
|
|
data.guardianType = guardianId;
|
|
data.SetNewInt(count);
|
|
|
|
int listnum = 0;
|
|
|
|
for (int i = 0; i < growGearCount.Length; i++)
|
|
{
|
|
int irow = i / 4;
|
|
int icolumn = i % 4;
|
|
int index = irow * 4 + icolumn;
|
|
|
|
if (curMgr.growGearCount[index] > 0)
|
|
{
|
|
|
|
int iType = 0;
|
|
int startRareity = 25;
|
|
switch (irow)
|
|
{
|
|
case 0:
|
|
iType = cGoods.TBagWeapon;
|
|
break;
|
|
case 1:
|
|
iType = cGoods.TBagArmorCape;
|
|
break;
|
|
case 2:
|
|
iType = cGoods.TBagArmorHat;
|
|
break;
|
|
case 3:
|
|
iType = cGoods.TBagArmorShoes;
|
|
break;
|
|
case 4:
|
|
iType = cGoods.TBagAcceEar;
|
|
break;
|
|
case 5:
|
|
iType = cGoods.TBagAcceNeck;
|
|
break;
|
|
case 6:
|
|
iType = cGoods.TBagAcceRing;
|
|
break;
|
|
}
|
|
|
|
data.propertyTypes[listnum] = iType;
|
|
data.propertyIds[listnum] = startRareity + icolumn;
|
|
data.propertyCnts[listnum] = growGearCount[index];
|
|
|
|
listnum++;
|
|
|
|
//dGear data = DataHandler.GetGearEquip(iType, startRareity + icolumn);
|
|
}
|
|
}
|
|
|
|
SoundMgr.PlaySfx(SoundName.ReinforceSuccess);
|
|
CoverCamera.Hold();
|
|
SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.GuardianGrow), typeof(nGuardianGrowReturn), AGuardianGrowSucc, AGuardianGrowFail, data, true);
|
|
}
|
|
|
|
private void AGuardianGrowFail(IVServerFormat.SvError error, object request)
|
|
{
|
|
CoverCamera.Release();
|
|
|
|
AllDelExpGear();
|
|
data = null;
|
|
|
|
iLoading--;
|
|
}
|
|
|
|
// 레벨 강화 통신 성공.
|
|
private void AGuardianGrowSucc(object result, object request)
|
|
{
|
|
nGuardianGrowReturn data = result as nGuardianGrowReturn;
|
|
if (data == null)
|
|
{
|
|
AGuardianGrowFail(new IVServerFormat.SvError(IVServerFormat.eErrorCode.NULL_OR_EMPTY), request);
|
|
return;
|
|
}
|
|
|
|
GameUIMgr.SOpenToast(LocalizationText.GetText("guardian_grow_success"));
|
|
|
|
for (int i = 0; i < growGearCount.Length; i++)
|
|
{
|
|
SpendExpGear(i);
|
|
}
|
|
|
|
plusExp = 0;
|
|
BattleMgr.SSetGuardian();
|
|
DataHandler.SetPlayGuardian(guardianId, data.playGuardian);
|
|
|
|
curMgr.SetGrowExpUI();
|
|
ptcExpUp.Play();
|
|
SCalcGuardian();
|
|
curMgr.SetInsertText();
|
|
CoverCamera.Release();
|
|
}
|
|
|
|
void SpendExpGear(int id)//갱신은 밖에서 해줄것
|
|
{
|
|
int irow = id / 4;
|
|
int icolumn = id % 4;
|
|
int index = irow * 4 + icolumn;
|
|
|
|
if (curMgr.growGearCount[index] > 0)
|
|
{
|
|
|
|
int iType = 0;
|
|
int startRareity = 25;
|
|
switch (irow)
|
|
{
|
|
case 0:
|
|
iType = cGoods.TBagWeapon;
|
|
break;
|
|
case 1:
|
|
iType = cGoods.TBagArmorCape;
|
|
break;
|
|
case 2:
|
|
iType = cGoods.TBagArmorHat;
|
|
break;
|
|
case 3:
|
|
iType = cGoods.TBagArmorShoes;
|
|
break;
|
|
case 4:
|
|
iType = cGoods.TBagAcceEar;
|
|
break;
|
|
case 5:
|
|
iType = cGoods.TBagAcceNeck;
|
|
break;
|
|
case 6:
|
|
iType = cGoods.TBagAcceRing;
|
|
break;
|
|
}
|
|
|
|
curMgr.growGearCount[index] -= curMgr.growGearCount[index];
|
|
|
|
curMgr.goodsItems[index].SetGoods(iType, icolumn + startRareity, curMgr.growGearCount[index]);
|
|
|
|
curMgr.goodsItems[index].gameObject.SetActive(curMgr.growGearCount[index] > 0);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Guardian Awaken
|
|
|
|
bool isOpenAwaken = false;
|
|
|
|
public static bool GetIsOpenAwaken()
|
|
{
|
|
return curMgr.isOpenAwaken;
|
|
}
|
|
|
|
void FirstOpenGuardianAwaken()//수호령 잠재능력을 처음 열 때.
|
|
{
|
|
myInfo.SetActive(true);
|
|
groupOptionAuto.SetActive(false);
|
|
|
|
SetEfcAddList(true);
|
|
SetEfcAddCost();
|
|
}
|
|
|
|
private void SetEfcAddList(bool breset) //잠재능력 슬롯이 해금되어있는지 아닌지를 분간해서 표시한다.(True 가 아니면 표기만 한다).
|
|
{
|
|
var sysGuardian = DataHandler.GetSysGuardian(guardianId);
|
|
var playGuardian = DataHandler.GetPlayGuardian(guardianId);
|
|
if (sysGuardian is null || playGuardian is null) return;
|
|
|
|
for (int i = 0; i < efcAddItems.Length; ++i)
|
|
{
|
|
int level = playGuardian.lv - 1;
|
|
|
|
if (playGuardian.exp >= sysGuardian.levels[level].maxExp)
|
|
{
|
|
level++;
|
|
}
|
|
|
|
bool bopen = level > i;
|
|
if (bopen)
|
|
{
|
|
efcAddItems[i].SetEffect(playGuardian.extras[i]);
|
|
}
|
|
|
|
if (breset)
|
|
{
|
|
efcAddItems[i].gameObject.SetActive(true);
|
|
efcAddItems[i].SetOpen(bopen);
|
|
}
|
|
}
|
|
}
|
|
|
|
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++;
|
|
}
|
|
if (icnt == 0)
|
|
{
|
|
icnt = 1;
|
|
}
|
|
int iprice = DataHandler.Const.guardianExtraChangeStonePrice * icnt;
|
|
txtEfcAddPrice.text = FormatString.TextInt(iprice);
|
|
btnEfcAdd.interactable = DataHandler.Goods.changeStone >= iprice;
|
|
btnEfcAddAuto.interactable = btnEfcAdd.interactable;
|
|
txtEfcAddPriceStart.text = txtEfcAddPrice.text;
|
|
btnEfcAddAutoStart.interactable = btnEfcAdd.interactable;
|
|
}
|
|
|
|
// 자동 변경인지.
|
|
private bool bEfcAddAuto = false;
|
|
// 변경 통신 중인지.
|
|
private bool bEfcAddChanging = false;
|
|
private int iEfcAddSlots = 0;
|
|
// 자동 변경 옵션 선택.
|
|
private bool[] bSelectedOptions;
|
|
// 자동 변경 옵션.
|
|
private eEffectType[] efcOptions;
|
|
private bool bInitNeedOption = true;
|
|
|
|
|
|
// 추가 효과 자동 변경 창 열기.
|
|
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);
|
|
//myInfo.SetActive(false);
|
|
|
|
// 초기화.
|
|
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.TGuardian);
|
|
escrEfcAddAuto.LoadDatas(datas);
|
|
}
|
|
else
|
|
{
|
|
escrEfcAddAuto.scroller.RefreshActiveCellViews();
|
|
}
|
|
efcOptionRarties[0].SetToggle();
|
|
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
|
|
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);
|
|
myInfo.SetActive(true);
|
|
|
|
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;
|
|
}
|
|
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;
|
|
}
|
|
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 (efcAddItems[3].IsChangable())
|
|
iEfcAddSlots += 8;
|
|
if (efcAddItems[4].IsChangable())
|
|
iEfcAddSlots += 16;
|
|
// 변경 가능한 슬롯이 없습니다.
|
|
if (iEfcAddSlots == 0)
|
|
{
|
|
GameUIMgr.SOpenPopup1Button(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.SOpenPopup1Button(LocalizationText.GetText("msg_abilityselect"));
|
|
return 2;
|
|
}
|
|
}
|
|
|
|
//dGear gear = DataHandler.GetGearEquip(iSvType, iSelectedId);
|
|
cPlayGuardian guardian = DataHandler.GetPlayGuardian(guardianId);
|
|
int iraritymin = cGoods.RHero;
|
|
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 >= guardian.lv)//맥렙이 없음
|
|
// break;
|
|
// 미해금 또는 잠긴 상태.
|
|
if (!efcAddItems[i].IsChangable())
|
|
continue;
|
|
|
|
// 현재 효과 없음.
|
|
if (guardian.extras[i] < 0)
|
|
continue;
|
|
|
|
dExtraAbility ability = DataHandler.GetExtraAbility(guardian.extras[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.RHero)
|
|
bheroup = true;
|
|
}
|
|
|
|
// 슬롯에 이미 획득한 옵션이 존재합니다.
|
|
if (bhaveefc)
|
|
{
|
|
GameUIMgr.SOpenPopup1Button(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.RHero;
|
|
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();
|
|
}
|
|
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
|
|
nIdGuaardianSlot data = new nIdGuaardianSlot(guardianId, iEfcAddSlots);
|
|
SvConnectManager.Instance.RequestSvPost(false, 0, UrlApi.GetUrl(UrlApi.GuardianAwaken), typeof(nGuardianExtraReturn), AEfcAddChangeSucc, AEfcAddChangeFail, data, true);
|
|
bEfcAddChanging = true;
|
|
}
|
|
|
|
// 아이템 효과 종류.
|
|
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];
|
|
}
|
|
|
|
// 추가 효과 변경 통신 실패.
|
|
private void AEfcAddChangeFail(SvError error, object request)
|
|
{
|
|
// 자동 변경 종료.
|
|
if (bEfcAddAuto)
|
|
{
|
|
ProcessEfcAddAutoStop();
|
|
}
|
|
else
|
|
{
|
|
CoverCamera.Release();
|
|
}
|
|
bEfcAddChanging = false;
|
|
iLoading--;
|
|
}
|
|
|
|
// 추가 효과 변경 성공.
|
|
private void AEfcAddChangeSucc(object result, object request)
|
|
{
|
|
nGuardianExtraReturn data = result as nGuardianExtraReturn;
|
|
if (data == null)
|
|
{
|
|
AEfcAddChangeFail(new SvError(eErrorCode.NULL_OR_EMPTY), request);
|
|
return;
|
|
}
|
|
|
|
DataHandler.SetGoods(data.playCurrency, true);
|
|
DataHandler.SetPlayGuardianExtra(guardianId, data.playGuardian.extras);
|
|
|
|
// 자동 변경일 경우.
|
|
if (bEfcAddAuto)
|
|
{
|
|
// 원하는 효과를 얻었으면 종료. 재화가 부족해도 종료.
|
|
if (CheckEfcAddChanging(data.playGuardian.extras))
|
|
{
|
|
ProcessEfcAddAutoStop();
|
|
// 설정한 추가 효과를 획득하였습니다.
|
|
GameUIMgr.SOpenPopup1Button(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)
|
|
ProcessEfcAddAutoStop();
|
|
// 원하는 효과가 없는 경우 다시 시도.
|
|
else
|
|
Invoke("IEfcAddChangeAuto", 1f/*Time.timeScale > 0f ? 0.8f * Time.timeScale : 1f*/);
|
|
}
|
|
}
|
|
// 자동 변경이 아닐 경우 종료.
|
|
else
|
|
{
|
|
BuffMgr.Instance.SetGuardianAwakenStat();
|
|
BuffMgr.Instance.CalcAllStat();
|
|
EnhanceMgr.SCalcMyInfoStat();
|
|
CoverCamera.Release();
|
|
}
|
|
|
|
SetEfcAddList(false);
|
|
SetEfcAddCost();
|
|
bEfcAddChanging = false;
|
|
iLoading--;
|
|
}
|
|
|
|
// 추가 효과 자동 변경. Invoke에서 호출.
|
|
private void IEfcAddChangeAuto()
|
|
{
|
|
if (!bEfcAddAuto)
|
|
return;
|
|
|
|
nIdGuaardianSlot data = new nIdGuaardianSlot(guardianId, iEfcAddSlots);
|
|
SvConnectManager.Instance.RequestSvPost(false, 0, UrlApi.GetUrl(UrlApi.GuardianAwaken), typeof(nGuardianExtraReturn), AEfcAddChangeSucc, AEfcAddChangeFail, data, true);
|
|
bEfcAddChanging = true;
|
|
}
|
|
#endregion
|
|
|
|
private IEnumerator swapTest()
|
|
{
|
|
while (!skGuardian.IsValid())
|
|
yield return YieldInstructionCache.WaitForSeconds(0.1f);
|
|
|
|
skAnimGuardian.gameObject.SetActive(true);
|
|
skAnimGuardian.skeletonDataAsset = skGuardian.Result;
|
|
skAnimGuardian.AnimationState.SetAnimation(0, "idle", true);
|
|
}
|
|
|
|
private void ALoadGuardianComp(AsyncOperationHandle<SkeletonDataAsset> obj)
|
|
{
|
|
MeshRenderer renderer = skAnimGuardian.GetComponent<MeshRenderer>();
|
|
renderer.sortingLayerID = canvasUI.sortingLayerID;
|
|
renderer.sortingOrder = 106;
|
|
skAnimGuardian.skeletonDataAsset = obj.Result;
|
|
skAnimGuardian.Initialize(true);
|
|
skAnimGuardian.UnscaledTime = true;
|
|
skAnimGuardian.AnimationState.SetAnimation(0, "idle", true);
|
|
skGuardian = obj;
|
|
curLv = DataHandler.GetPlayGuardian(1).lv;
|
|
CoverCamera.Release();
|
|
}
|
|
|
|
public void HelpMsg()
|
|
{
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
GameUIMgr.SOpenHelp(LocalizationText.GetText("help_robot"));
|
|
}
|
|
}
|