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.
860 lines
26 KiB
860 lines
26 KiB
using DG.Tweening;
|
|
using IVDataFormat;
|
|
using IVServerFormat;
|
|
using Spine;
|
|
using Spine.Unity.AttachmentTools;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
// 커스터마이징 매니저.
|
|
public class CustomizeMgr : MonoBehaviour
|
|
{
|
|
#region Const
|
|
private static CustomizeMgr curMgr = null;
|
|
|
|
// 스파인 애니메이션에서 지정되어있는 이름들.
|
|
private const string SkinName = "default";
|
|
private const string SlotName = "weapon";
|
|
private const string AtchName = "weapon";
|
|
|
|
private const int I_ColorX = 251;
|
|
#endregion Const
|
|
|
|
#region Spine
|
|
[SerializeField]
|
|
private IVCharSimple ivChar;
|
|
// 캐릭터 기본 애니메이션에서 사용하는 머테리얼.
|
|
[SerializeField]
|
|
private Material matBase;
|
|
#endregion Battle
|
|
|
|
#region UI
|
|
[SerializeField]
|
|
private TextMeshProUGUI txtMainT;
|
|
|
|
[SerializeField]
|
|
private Canvas canvasUI;
|
|
private GameObject goBtnInfo;
|
|
private Button btnApply, btnCompose;
|
|
private TextMeshProUGUI txtName, txtEfcInfoT, txtInfo, txtComposeCnt;
|
|
private ButtonIV[] btnTabs;
|
|
private GameObject[] groupTabs;
|
|
|
|
[SerializeField]
|
|
private EScrController escrCloth, escrWeapon;
|
|
[SerializeField]
|
|
private EScrController[] escrClrs;
|
|
|
|
// 슬롯 선택 연출.
|
|
private GameObject goSelectEfc;
|
|
private RectTransform rtrfSelectBorder, rtrfPresetSelect;
|
|
private GameObject[] goPresetSelects;
|
|
private RectTransform[][] rtrfClrPresets;
|
|
private Image[][] imgClrPresets;
|
|
private GameObject[][] goClrPresetEmptys;
|
|
private GameObject[][] goClrPresetLocks;
|
|
|
|
//GameObject dust;
|
|
[SerializeField]
|
|
Canvas leftCanvasUI;
|
|
TextMeshProUGUI leftTitle;
|
|
#endregion UI
|
|
|
|
#region Variables
|
|
private int iLoading = 1;
|
|
private bool bReLocalize = true;
|
|
private bool bReLocalizeCloth, bReLocalizeWeapon = false;
|
|
private bool bInitNeed = true;
|
|
private bool bInitNeedCloth = true;
|
|
private bool bInitNeedWeapon = true;
|
|
private bool bInitNeedClr = true;
|
|
|
|
// 변경됨.
|
|
private bool bChange = false;
|
|
// 선택된 메인 탭. 0:의상, 1:무기, 2:색상.
|
|
private int iSelectedTab = -1;
|
|
// 슬롯에서 선택된 인덱스.
|
|
private int[] iSelectedSlotIndexs = new int[3] { -1, -1, -1 };
|
|
// 색상 목록에서 선택됨.
|
|
private bool bSelectedColor = false;
|
|
// 색상 목록에서 선택된 종류. 0:헤어, 1:꼭지, 2:눈.
|
|
private int iSelectedClrType = -1;
|
|
// 목록에서 선택되었는지.
|
|
private bool[] bSelectedLists = new bool[3];
|
|
// 목록에서 선택된 색상 번호.
|
|
private int[] iSelectedListIds = new int[3] { 0, 0, 0 };
|
|
// 보기에 적용된 색상 번호.
|
|
private int[] iSelectedClr = new int[3] { 0, 0, 0 };
|
|
// 색상을 변경하려는 슬롯 인덱스.
|
|
private int iChangeSlotIndex = -1;
|
|
|
|
// 보유 색상 목록.
|
|
private EnhancedUI.SmallList<int>[] haveClrRows;
|
|
private List<int>[] haveClrLists;
|
|
private bool[] bUpdateClrs = new bool[3];
|
|
|
|
// 보기에 적용된(선택중인) 의상 번호.
|
|
private int iSelectedCloth = -1;
|
|
// 보기에 적용된(선택중인) 무기 번호.
|
|
private int iSelectedWeapon = -1;
|
|
|
|
private int iSlotIndexWp = 0;
|
|
private Skeleton skeleton;
|
|
private Skin skinCustom = null;
|
|
private Attachment atchWeaponBase = null;
|
|
private Attachment atchWeapon = null;
|
|
|
|
private int iLoadCos = 0;
|
|
private Texture2D tx2dSelectedCloth = null;
|
|
#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("cos_title");
|
|
}
|
|
else
|
|
{
|
|
bReLocalize = false;
|
|
canvasUI.transform.Find("txtT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("cos_title");
|
|
|
|
btnTabs[0].transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("cos_cloth");
|
|
btnTabs[1].transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("cos_weapon");
|
|
btnTabs[2].transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("cos_dyeing");
|
|
|
|
groupTabs[2].transform.Find("groupHair").Find("txtGroupT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("cos_hair");
|
|
groupTabs[2].transform.Find("groupTop").Find("txtGroupT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("cos_hairtop");
|
|
groupTabs[2].transform.Find("groupEye").Find("txtGroupT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("cos_eye");
|
|
|
|
groupTabs[2].transform.Find("groupHair").Find("txtPresetT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("cos_apply_color");
|
|
groupTabs[2].transform.Find("groupTop").Find("txtPresetT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("cos_apply_color");
|
|
groupTabs[2].transform.Find("groupEye").Find("txtPresetT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("cos_apply_color");
|
|
|
|
groupTabs[2].transform.Find("groupHair").Find("txtHaveT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("cos_have_color");
|
|
groupTabs[2].transform.Find("groupTop").Find("txtHaveT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("cos_have_color");
|
|
groupTabs[2].transform.Find("groupEye").Find("txtHaveT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("cos_have_color");
|
|
|
|
btnApply.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("cos_apply");
|
|
|
|
btnCompose.transform.Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_compose");
|
|
|
|
if (iSelectedTab < 0)
|
|
{
|
|
}
|
|
// 염색.
|
|
else if (iSelectedTab >= 2)
|
|
{
|
|
txtEfcInfoT.text = LocalizationText.GetText("all_tip");
|
|
}
|
|
// 의상, 무기.
|
|
else
|
|
{
|
|
txtEfcInfoT.text = LocalizationText.GetText("own_effect_title");
|
|
}
|
|
|
|
leftTitle = leftCanvasUI.transform.Find("txtT").GetComponent<TextMeshProUGUI>();
|
|
leftTitle.text = LocalizationText.GetText("cos_info");
|
|
}
|
|
}
|
|
|
|
// 설정에서 언어 변경 시 처리.
|
|
public static void SReLocalize()
|
|
{
|
|
curMgr.Localize(true);
|
|
curMgr.bReLocalize = true;
|
|
curMgr.bReLocalizeCloth = true;
|
|
curMgr.bReLocalizeWeapon = true;
|
|
}
|
|
|
|
// 백버튼 처리.
|
|
public static bool SCloseMenu()
|
|
{
|
|
return curMgr.CloseMenu();
|
|
}
|
|
|
|
private bool CloseMenu()
|
|
{
|
|
// 게임 시작 후 열린적 없음.
|
|
if (bInitNeed)
|
|
return false;
|
|
|
|
if (canvasUI.enabled)
|
|
{
|
|
CloseCustomize();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
curMgr = this;
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
iLoading--;
|
|
}
|
|
#endregion Base
|
|
|
|
#region Init
|
|
public static void SInitSkin(Skeleton sk) => curMgr?.InitSkin(sk);
|
|
|
|
// 게임 처음 시작 시 BattleMgr에서 코스튬 정보 획득을 위해 초기화 호출.
|
|
private void InitSkin(Skeleton sk)
|
|
{
|
|
bInitNeed = true;
|
|
iSelectedCloth = DataHandler.PlayEquipCostume.outfitId;
|
|
iSelectedWeapon = DataHandler.PlayEquipCostume.weaponId;
|
|
iSelectedClr[0] = DataHandler.PlayEquipCostume.hairColor;
|
|
iSelectedClr[1] = DataHandler.PlayEquipCostume.topColor;
|
|
iSelectedClr[2] = DataHandler.PlayEquipCostume.eyeColor;
|
|
|
|
skeleton = sk;
|
|
AddressableMgr.InitWeaponSkin(sk, matBase);
|
|
}
|
|
|
|
// 창을 열 때 창의 의상/무기 세팅.
|
|
private IEnumerator LoadCostume()
|
|
{
|
|
RectTransform rtrfchar = ivChar.GetComponent<RectTransform>();
|
|
Vector3 v3pos = rtrfchar.anchoredPosition3D;
|
|
v3pos.z = -10000f;
|
|
rtrfchar.anchoredPosition3D = v3pos;
|
|
|
|
iLoadCos += 2;
|
|
CoverCamera.Hold();
|
|
CoverCamera.Hold();
|
|
AddressableMgr.LoadClothSpine(iSelectedCloth, ALoadCloth);
|
|
AddressableMgr.LoadWeaponSpine(iSelectedWeapon, ALoadWeapon);
|
|
|
|
while (iLoadCos > 0)
|
|
yield return null;
|
|
yield return null;
|
|
yield return null;
|
|
|
|
ivChar.SetCostume(tx2dSelectedCloth);
|
|
|
|
v3pos.z = -0f;
|
|
rtrfchar.anchoredPosition3D = v3pos;
|
|
}
|
|
|
|
public static void SReleaseCostume()
|
|
{
|
|
curMgr.ReleaseCostume();
|
|
}
|
|
|
|
// 창 닫을 때 의상/무기 리소스 해제.
|
|
private void ReleaseCostume()
|
|
{
|
|
tx2dSelectedCloth = null;
|
|
AddressableMgr.ReleaseClothSpine(iSelectedCloth);
|
|
AddressableMgr.ReleaseWeaponSpine(iSelectedWeapon);
|
|
|
|
iSelectedCloth = DataHandler.PlayEquipCostume.outfitId;
|
|
iSelectedWeapon = DataHandler.PlayEquipCostume.weaponId;
|
|
|
|
iSelectedClrType = -1;
|
|
for (int i = 0; i < iSelectedListIds.Length; i++)
|
|
{
|
|
iSelectedListIds[i] = 0;
|
|
bSelectedLists[i] = false;
|
|
}
|
|
escrClrs[0].scroller.RefreshActiveCellViews();
|
|
escrClrs[1].scroller.RefreshActiveCellViews();
|
|
escrClrs[2].scroller.RefreshActiveCellViews();
|
|
|
|
iSelectedClr[0] = DataHandler.PlayEquipCostume.hairColor;
|
|
iSelectedClr[1] = DataHandler.PlayEquipCostume.topColor;
|
|
iSelectedClr[2] = DataHandler.PlayEquipCostume.eyeColor;
|
|
|
|
btnApply.interactable = false;
|
|
}
|
|
|
|
private void Init()
|
|
{
|
|
btnTabs = canvasUI.transform.Find("tabWrapTop").GetComponentsInChildren<ButtonIV>(true);
|
|
|
|
groupTabs = new GameObject[btnTabs.Length];
|
|
groupTabs[0] = canvasUI.transform.Find("SvCloth").gameObject;
|
|
groupTabs[1] = canvasUI.transform.Find("SvWeapon").gameObject;
|
|
groupTabs[2] = canvasUI.transform.Find("groupColor").gameObject;
|
|
|
|
txtName = ivChar.transform.parent.Find("txtName").GetComponent<TextMeshProUGUI>();
|
|
goBtnInfo = canvasUI.transform.Find("btnInfo").gameObject;
|
|
btnApply = ivChar.transform.parent.Find("btnApply").GetComponent<Button>();
|
|
|
|
txtEfcInfoT = leftCanvasUI.transform.Find("EfcInfo").Find("txtEfcInfoT").GetComponent<TextMeshProUGUI>();
|
|
txtInfo = txtEfcInfoT.transform.parent.Find("txtInfo").GetComponent<TextMeshProUGUI>();
|
|
btnCompose = txtEfcInfoT.transform.parent.Find("btnCompose").GetComponent<Button>();
|
|
txtComposeCnt = btnCompose.transform.Find("txtCount").GetComponent<TextMeshProUGUI>();
|
|
|
|
//dust = canvasUI.transform.Find("all_dust").gameObject;
|
|
}
|
|
#endregion Init
|
|
|
|
#region UI
|
|
// 커스터마이즈 메뉴 열기.
|
|
public void OpenCustomize()
|
|
{
|
|
if (iLoading > 0)
|
|
return;
|
|
iLoading++;
|
|
|
|
canvasUI.enabled = true;
|
|
leftCanvasUI.enabled = true;
|
|
ivChar.gameObject.SetActive(true);
|
|
|
|
if (bInitNeed)
|
|
{
|
|
bInitNeed = false;
|
|
Init();
|
|
ivChar.Init();
|
|
}
|
|
if (bReLocalize)
|
|
Localize(false);
|
|
StartCoroutine(nameof(LoadCostume));
|
|
|
|
if (iSelectedTab < 0)
|
|
{
|
|
TabCloth();
|
|
}
|
|
else if (iSelectedTab == 0)
|
|
{
|
|
if (bReLocalizeCloth)
|
|
{
|
|
bReLocalizeCloth = false;
|
|
escrCloth.Localize();
|
|
}
|
|
escrCloth.scroller.RefreshActiveCellViews();
|
|
SetCosNameEffect(DataHandler.GetCosCloth(iSelectedCloth));
|
|
}
|
|
else if (iSelectedTab == 1)
|
|
{
|
|
if (bReLocalizeWeapon)
|
|
{
|
|
bReLocalizeWeapon = false;
|
|
escrWeapon.Localize();
|
|
}
|
|
escrWeapon.scroller.RefreshActiveCellViews();
|
|
SetCosNameEffect(DataHandler.GetCosWeapon(iSelectedWeapon));
|
|
}
|
|
|
|
GameUIMgr.SRightWindowClose();
|
|
GameUIMgr.SOpenLeftPanel(dia: true);
|
|
GameUIMgr.SSetMainUiOn(false);
|
|
//BattleMgr.SSetBattleUiOn(false);
|
|
//BattleMgr.SSetClearFailUiOn(false);
|
|
//BattleMgr.SSetCameraOn(false);
|
|
|
|
bChange = false;
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
|
|
//dust.SetActive(true);
|
|
iLoading--;
|
|
}
|
|
|
|
// 커스터마이즈 메뉴 닫기.
|
|
public void CloseCustomize()
|
|
{
|
|
if (!canvasUI.enabled)
|
|
return;
|
|
if (iLoading > 0)
|
|
return;
|
|
iLoading++;
|
|
|
|
ReleaseCostume();
|
|
|
|
DataHandler.CheckAchivement(eContent.Etc);
|
|
ivChar.gameObject.SetActive(false);
|
|
canvasUI.enabled = false;
|
|
leftCanvasUI.enabled = false;
|
|
GameUIMgr.SCloseUpPanel();
|
|
GameUIMgr.SSetMainUiOn(true);
|
|
BattleMgr.SRefreshCharCloth();
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
|
|
//dust.SetActive(false);
|
|
iLoading--;
|
|
}
|
|
|
|
// 색상 갱신 필요.
|
|
public static void SSetUpdateColor(int iclrtype)
|
|
{
|
|
curMgr.bUpdateClrs[iclrtype] = true;
|
|
}
|
|
|
|
// 전체 효과 정보 보기.
|
|
public void OpenCostumeInfo()
|
|
{
|
|
if (iLoading > 0)
|
|
return;
|
|
iLoading++;
|
|
|
|
GameUIMgr.SOpenPopupHaveEfc(LocalizationText.GetText("all_effecttotalhave"), BuffMgr.Instance.GetCostumeEfcs());
|
|
iLoading--;
|
|
}
|
|
#endregion UI
|
|
|
|
|
|
#region Tab
|
|
// 의상 탭.
|
|
public void TabCloth()
|
|
{
|
|
if (iSelectedTab == 0)
|
|
return;
|
|
|
|
// 선택이 변경되었을 경우(적용은 하지 않음) 실제 적용된 항목으로 선택 되돌리기.
|
|
if (bChange)
|
|
ResetCustomize();
|
|
|
|
if (iSelectedTab >= 0)
|
|
{
|
|
btnTabs[iSelectedTab].interactable = true;
|
|
groupTabs[iSelectedTab].SetActive(false);
|
|
}
|
|
|
|
iSelectedTab = 0;
|
|
btnTabs[iSelectedTab].interactable = false;
|
|
groupTabs[iSelectedTab].SetActive(true);
|
|
|
|
// 초기화.
|
|
if (bInitNeedCloth)
|
|
{
|
|
bInitNeedCloth = false;
|
|
iSelectedCloth = DataHandler.PlayEquipCostume.outfitId;
|
|
|
|
Dictionary<int, dCostumeSet> datas = DataHandler.GetCosClothSets();
|
|
EnhancedUI.SmallList<int> cossets = new EnhancedUI.SmallList<int>();
|
|
foreach (var item in datas)
|
|
{
|
|
cossets.Add(item.Key);
|
|
}
|
|
escrCloth.SetType(0);
|
|
escrCloth.LoadDatas(cossets);
|
|
}
|
|
else
|
|
{
|
|
escrCloth.scroller.RefreshActiveCellViews();
|
|
}
|
|
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
|
|
txtEfcInfoT.text = LocalizationText.GetText("own_effect_title");
|
|
goBtnInfo.SetActive(true);
|
|
btnCompose.gameObject.SetActive(false);
|
|
|
|
btnApply.interactable = false;
|
|
SetCosNameEffect(DataHandler.GetCosCloth(iSelectedCloth));
|
|
|
|
if (bReLocalizeCloth)
|
|
{
|
|
bReLocalizeCloth = false;
|
|
escrCloth.Localize();
|
|
}
|
|
}
|
|
|
|
// 무기 탭.
|
|
public void TabWeapon()
|
|
{
|
|
if (iSelectedTab == 1)
|
|
return;
|
|
|
|
// 선택이 변경되었을 경우(적용은 하지 않음) 실제 적용된 항목으로 선택 되돌리기.
|
|
if (bChange)
|
|
ResetCustomize();
|
|
|
|
if (iSelectedTab >= 0)
|
|
{
|
|
btnTabs[iSelectedTab].interactable = true;
|
|
groupTabs[iSelectedTab].SetActive(false);
|
|
}
|
|
|
|
iSelectedTab = 1;
|
|
btnTabs[iSelectedTab].interactable = false;
|
|
groupTabs[iSelectedTab].SetActive(true);
|
|
|
|
// 초기화.
|
|
if (bInitNeedWeapon)
|
|
{
|
|
bInitNeedWeapon = false;
|
|
iSelectedWeapon = DataHandler.PlayEquipCostume.weaponId;
|
|
|
|
Dictionary<int, dCostumeSet> datas = DataHandler.GetCosWeaponSets();
|
|
EnhancedUI.SmallList<int> cossets = new EnhancedUI.SmallList<int>();
|
|
foreach (var item in datas)
|
|
{
|
|
cossets.Add(item.Key);
|
|
}
|
|
escrWeapon.SetType(1);
|
|
escrWeapon.LoadDatas(cossets);
|
|
}
|
|
else
|
|
{
|
|
escrWeapon.scroller.RefreshActiveCellViews();
|
|
}
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
|
|
txtEfcInfoT.text = LocalizationText.GetText("own_effect_title");
|
|
goBtnInfo.SetActive(true);
|
|
btnCompose.gameObject.SetActive(false);
|
|
|
|
btnApply.interactable = false;
|
|
SetCosNameEffect(DataHandler.GetCosWeapon(iSelectedWeapon));
|
|
|
|
if (bReLocalizeWeapon)
|
|
{
|
|
bReLocalizeWeapon = false;
|
|
escrWeapon.Localize();
|
|
}
|
|
}
|
|
#endregion Tab
|
|
|
|
|
|
#region Reset & Apply
|
|
// 적용하기 버튼 활성화 상태 변경.
|
|
private void SetBtnApply()
|
|
{
|
|
// 의상.
|
|
if (iSelectedTab == 0)
|
|
{
|
|
// 현재 장착중이 아니면서 소지했을 경우에만 적용 가능.
|
|
btnApply.interactable = DataHandler.IsCosClothHave(iSelectedCloth) && iSelectedCloth != DataHandler.PlayEquipCostume.outfitId;
|
|
}
|
|
// 무기.
|
|
else if (iSelectedTab == 1)
|
|
{
|
|
// 현재 장착중이 아니면서 소지했을 경우에만 적용 가능.
|
|
btnApply.interactable = DataHandler.IsCosWeaponHave(iSelectedWeapon) && iSelectedWeapon != DataHandler.PlayEquipCostume.weaponId;
|
|
}
|
|
// 염색.
|
|
else
|
|
{
|
|
btnApply.interactable = !bSelectedLists[0] && !bSelectedLists[1] && !bSelectedLists[2];
|
|
}
|
|
}
|
|
|
|
// 실제 적용되어있는 항목으로 선택 되돌리기.
|
|
public void ResetCustomize()
|
|
{
|
|
SelectCloth(DataHandler.PlayEquipCostume.outfitId);
|
|
SelectWeapon(DataHandler.PlayEquipCostume.weaponId);
|
|
|
|
iSelectedClrType = -1;
|
|
for (int i = 0; i < iSelectedListIds.Length; i++)
|
|
{
|
|
iSelectedListIds[i] = 0;
|
|
bSelectedLists[i] = false;
|
|
}
|
|
escrClrs[0].scroller.RefreshActiveCellViews();
|
|
escrClrs[1].scroller.RefreshActiveCellViews();
|
|
escrClrs[2].scroller.RefreshActiveCellViews();
|
|
|
|
btnApply.interactable = false;
|
|
}
|
|
|
|
// 선택한 항목을 적용.
|
|
public void ApplyCustomize()
|
|
{
|
|
if (!bChange)
|
|
return;
|
|
if (iLoading > 0)
|
|
return;
|
|
iLoading++;
|
|
CoverCamera.Hold();
|
|
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
|
|
// 의상.
|
|
if (iSelectedTab == 0)
|
|
{
|
|
bool bchangecloth = iSelectedCloth != DataHandler.PlayEquipCostume.outfitId;
|
|
if (bchangecloth)
|
|
{
|
|
SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.CosClothEquip), typeof(nCostumeReturn), AClothEquipSucc, AClothEquipFail, new nIdCnt(iSelectedCloth), false);
|
|
}
|
|
else
|
|
{
|
|
btnApply.interactable = false;
|
|
bChange = false;
|
|
CoverCamera.Release();
|
|
iLoading--;
|
|
}
|
|
}
|
|
// 무기.
|
|
else if (iSelectedTab == 1)
|
|
{
|
|
bool bchangeweapon = iSelectedWeapon != DataHandler.PlayEquipCostume.weaponId;
|
|
if (bchangeweapon)
|
|
{
|
|
SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.CosWeaponEquip), typeof(nCostumeReturn), AWeaponEquipSucc, AWeaponEquipFail, new nIdCnt(iSelectedWeapon), false);
|
|
}
|
|
else
|
|
{
|
|
btnApply.interactable = false;
|
|
bChange = false;
|
|
CoverCamera.Release();
|
|
iLoading--;
|
|
}
|
|
}
|
|
// 염색.
|
|
else
|
|
{
|
|
bool bchangeclrhair = iSelectedClr[0] != DataHandler.PlayEquipCostume.hairColor;
|
|
bool bchangeclrtop = iSelectedClr[1] != DataHandler.PlayEquipCostume.topColor;
|
|
bool bchangeclreye = iSelectedClr[2] != DataHandler.PlayEquipCostume.eyeColor;
|
|
|
|
if (bchangeclrhair || bchangeclrtop || bchangeclreye)
|
|
{
|
|
nColorSet data = new nColorSet();
|
|
data.hairColor = iSelectedClr[0];
|
|
data.topColor = iSelectedClr[1];
|
|
data.eyeColor = iSelectedClr[2];
|
|
SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.ColorSet), typeof(nCostumeReturn), AColorSetSucc, AColorSetFail, data, false);
|
|
}
|
|
else
|
|
{
|
|
btnApply.interactable = false;
|
|
bChange = false;
|
|
CoverCamera.Release();
|
|
iLoading--;
|
|
}
|
|
}
|
|
}
|
|
|
|
// 의상 장착 통신 실패.
|
|
private void AClothEquipFail(SvError error, object request)
|
|
{
|
|
CoverCamera.Release();
|
|
iLoading--;
|
|
}
|
|
|
|
// 의상 장착 통신 성공.
|
|
private void AClothEquipSucc(object result, object request)
|
|
{
|
|
nCostumeReturn data = result as nCostumeReturn;
|
|
if (data == null)
|
|
{
|
|
AClothEquipFail(new SvError(eErrorCode.NULL_OR_EMPTY), request);
|
|
return;
|
|
}
|
|
|
|
DataHandler.ChangeCustomize(iSelectedCloth, iSelectedWeapon, iSelectedClr[0], iSelectedClr[1], iSelectedClr[2]);
|
|
BattleMgr.SSetCharCostume();
|
|
|
|
GameUIMgr.SOpenToast(LocalizationText.GetText(Global.STR_Saved));
|
|
escrCloth.scroller.RefreshActiveCellViews();
|
|
btnApply.interactable = false;
|
|
bChange = false;
|
|
|
|
CoverCamera.Release();
|
|
iLoading--;
|
|
}
|
|
|
|
// 무기 장착 통신 실패.
|
|
private void AWeaponEquipFail(SvError error, object request)
|
|
{
|
|
CoverCamera.Release();
|
|
iLoading--;
|
|
}
|
|
|
|
// 무기 장착 통신 성공.
|
|
private void AWeaponEquipSucc(object result, object request)
|
|
{
|
|
nCostumeReturn data = result as nCostumeReturn;
|
|
if (data == null)
|
|
{
|
|
AWeaponEquipFail(new SvError(eErrorCode.NULL_OR_EMPTY), request);
|
|
return;
|
|
}
|
|
|
|
DataHandler.ChangeCustomize(iSelectedCloth, iSelectedWeapon, iSelectedClr[0], iSelectedClr[1], iSelectedClr[2]);
|
|
BattleMgr.SSetCharCostume();
|
|
|
|
GameUIMgr.SOpenToast(LocalizationText.GetText(Global.STR_Saved));
|
|
escrWeapon.scroller.RefreshActiveCellViews();
|
|
btnApply.interactable = false;
|
|
bChange = false;
|
|
|
|
CoverCamera.Release();
|
|
iLoading--;
|
|
}
|
|
|
|
// 염색 적용 통신 실패.
|
|
private void AColorSetFail(SvError error, object request)
|
|
{
|
|
CoverCamera.Release();
|
|
iLoading--;
|
|
}
|
|
|
|
// 염색 적용 통신 성공.
|
|
private void AColorSetSucc(object result, object request)
|
|
{
|
|
nCostumeReturn data = result as nCostumeReturn;
|
|
if (data == null)
|
|
{
|
|
AColorSetFail(new SvError(eErrorCode.NULL_OR_EMPTY), request);
|
|
return;
|
|
}
|
|
|
|
DataHandler.ChangeCustomize(iSelectedCloth, iSelectedWeapon, iSelectedClr[0], iSelectedClr[1], iSelectedClr[2]);
|
|
BattleMgr.SSetCharCostume();
|
|
|
|
GameUIMgr.SOpenToast(LocalizationText.GetText(Global.STR_Saved));
|
|
btnApply.interactable = false;
|
|
bChange = false;
|
|
|
|
CoverCamera.Release();
|
|
iLoading--;
|
|
}
|
|
#endregion Reset & Apply
|
|
|
|
|
|
public void HiddenCostume()
|
|
{
|
|
RectTransform rtrfchar = curMgr.ivChar.GetComponent<RectTransform>();
|
|
Vector3 v3pos = rtrfchar.anchoredPosition3D;
|
|
v3pos.z = -10000f;
|
|
|
|
//v3pos.z = -0f;
|
|
rtrfchar.anchoredPosition3D = v3pos;
|
|
}
|
|
|
|
public void PopCostume()
|
|
{
|
|
RectTransform rtrfchar = curMgr.ivChar.GetComponent<RectTransform>();
|
|
Vector3 v3pos = rtrfchar.anchoredPosition3D;
|
|
v3pos.z = -0f;
|
|
rtrfchar.anchoredPosition3D = v3pos;
|
|
}
|
|
|
|
#region Select Costume
|
|
// 선택된 코스튬인지.
|
|
public static bool SIsSelectCostume(int itype, int idx)
|
|
{
|
|
if (itype == 0)
|
|
return idx == curMgr.iSelectedCloth;
|
|
else
|
|
return idx == curMgr.iSelectedWeapon;
|
|
}
|
|
|
|
public static void SSelectCostume(int itype, int isetid, int ichildindex)
|
|
{
|
|
if (itype == 0)
|
|
curMgr.SelectCloth(DataHandler.GetCosClothId(isetid, ichildindex));
|
|
else
|
|
curMgr.SelectWeapon(DataHandler.GetCosWeaponId(isetid, ichildindex));
|
|
}
|
|
|
|
// 의상 선택.
|
|
public void SelectCloth(int key)
|
|
{
|
|
if (iLoadCos > 0 || iSelectedCloth == key)
|
|
return;
|
|
iLoadCos++;
|
|
iLoading++;
|
|
CoverCamera.Hold();
|
|
|
|
int iclothprev = iSelectedCloth;
|
|
iSelectedCloth = key;
|
|
bChange = true;
|
|
escrCloth.scroller.RefreshActiveCellViews();
|
|
SetBtnApply();
|
|
SetCosNameEffect(DataHandler.GetCosCloth(key));
|
|
|
|
HiddenCostume();
|
|
|
|
AddressableMgr.LoadClothSpine(iSelectedCloth, ALoadClothChange);
|
|
AddressableMgr.ReleaseClothSpine(iclothprev);
|
|
}
|
|
|
|
// 무기 선택.
|
|
public void SelectWeapon(int key)
|
|
{
|
|
if (iLoadCos > 0 || iSelectedWeapon == key)
|
|
return;
|
|
iLoadCos++;
|
|
iLoading++;
|
|
CoverCamera.Hold();
|
|
|
|
int iwpprev = iSelectedWeapon;
|
|
iSelectedWeapon = key;
|
|
bChange = true;
|
|
escrWeapon.scroller.RefreshActiveCellViews();
|
|
SetBtnApply();
|
|
SetCosNameEffect(DataHandler.GetCosWeapon(key));
|
|
|
|
AddressableMgr.LoadWeaponSpine(iSelectedWeapon, ALoadWeaponChange);
|
|
AddressableMgr.ReleaseWeaponSpine(iwpprev);
|
|
}
|
|
#endregion Select Costume
|
|
|
|
#region Addressable
|
|
private void ALoadCloth(Texture2D obj)
|
|
{
|
|
tx2dSelectedCloth = obj;
|
|
|
|
PopCostume();
|
|
CoverCamera.Release();
|
|
iLoadCos--;
|
|
}
|
|
|
|
private void ALoadWeapon(Skin obj)
|
|
{
|
|
ivChar.SetWeapon(obj);
|
|
|
|
if (tx2dSelectedCloth != null)
|
|
ivChar.SetCostume(tx2dSelectedCloth);
|
|
|
|
CoverCamera.Release();
|
|
iLoadCos--;
|
|
}
|
|
|
|
private void ALoadClothChange(Texture2D obj)
|
|
{
|
|
tx2dSelectedCloth = obj;
|
|
ivChar.SetCostume(tx2dSelectedCloth);
|
|
|
|
PopCostume();
|
|
|
|
CoverCamera.Release();
|
|
iLoading--;
|
|
iLoadCos--;
|
|
}
|
|
|
|
private void ALoadWeaponChange(Skin obj)
|
|
{
|
|
ivChar.SetWeapon(obj);
|
|
|
|
if (tx2dSelectedCloth != null)
|
|
ivChar.SetCostume(tx2dSelectedCloth);
|
|
|
|
CoverCamera.Release();
|
|
iLoading--;
|
|
iLoadCos--;
|
|
}
|
|
#endregion Addressable
|
|
|
|
#region Name & Effect Text
|
|
private void SetCosNameEffect(dCostume data)
|
|
{
|
|
if (data == null)
|
|
return;
|
|
|
|
txtName.text = FormatString.GetGoodsName(iSelectedTab == 0 ? cGoods.TCosCloth : cGoods.TCosWeapon, data.id);
|
|
txtInfo.text = FormatString.TextEffectTitleValuesBreakline(data.abilityType1, data.abilityValue1, data.abilityType2, data.abilityValue2);
|
|
}
|
|
#endregion Name & Effect Text
|
|
}
|