175 lines
4.8 KiB
C#
175 lines
4.8 KiB
C#
using System.Collections.Generic;
|
|
using Cute;
|
|
using UnityEngine;
|
|
|
|
namespace Wizard;
|
|
|
|
internal class AreaSelectClearReward : MonoBehaviour
|
|
{
|
|
private class TextureTransformParam
|
|
{
|
|
public int Width { get; private set; }
|
|
|
|
public int Height { get; private set; }
|
|
|
|
public Vector3 Position { get; private set; }
|
|
|
|
public Quaternion Rotation { get; private set; }
|
|
|
|
public TextureTransformParam(int width, int height, Vector3 position, Quaternion rotation)
|
|
{
|
|
Width = width;
|
|
Height = height;
|
|
Position = position;
|
|
Rotation = rotation;
|
|
}
|
|
}
|
|
|
|
private readonly Dictionary<UserGoods.Type, TextureTransformParam> USERGOODS_TEXTURE_LAYOUT_DICT = new Dictionary<UserGoods.Type, TextureTransformParam>
|
|
{
|
|
{
|
|
UserGoods.Type.Item,
|
|
new TextureTransformParam(80, 80, Vector3.zero, Quaternion.identity)
|
|
},
|
|
{
|
|
UserGoods.Type.Sleeve,
|
|
new TextureTransformParam(80, 108, new Vector3(12f, 12f, 0f), Quaternion.Euler(0f, 0f, -15f))
|
|
},
|
|
{
|
|
UserGoods.Type.Emblem,
|
|
new TextureTransformParam(80, 80, Vector3.zero, Quaternion.identity)
|
|
},
|
|
{
|
|
UserGoods.Type.Degree,
|
|
new TextureTransformParam(169, 43, new Vector3(44f, -10f, 0f), Quaternion.identity)
|
|
},
|
|
{
|
|
UserGoods.Type.Skin,
|
|
new TextureTransformParam(100, 80, Vector3.zero, Quaternion.identity)
|
|
}
|
|
};
|
|
|
|
private readonly Quaternion CARDOBJECT_ROTATION_QUATERNION = new Quaternion(0f, 0f, 0f, 0f);
|
|
|
|
private readonly Color32 ACQUIRED_GRAY_COLOR = new Color32(144, 144, 144, byte.MaxValue);
|
|
|
|
private readonly Vector3 DEFAULT_NUM_POSITION = new Vector3(48f, -25f, 0f);
|
|
|
|
private readonly Vector3 CARD_NUM_POSITION = new Vector3(66f, -25f, 0f);
|
|
|
|
[SerializeField]
|
|
private GameObject _objLayoutCard;
|
|
|
|
[SerializeField]
|
|
private GameObject _objAttachCard;
|
|
|
|
[SerializeField]
|
|
private UISprite _spriteCardAcquiredMask;
|
|
|
|
[SerializeField]
|
|
private GameObject _objLayoutSprite;
|
|
|
|
[SerializeField]
|
|
private UISprite _spriteGoods;
|
|
|
|
[SerializeField]
|
|
private GameObject _objLayoutTexture;
|
|
|
|
[SerializeField]
|
|
private UITexture _textureGoods;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelNum;
|
|
|
|
private List<UIBase_CardManager.CardObjData> _cardObjList;
|
|
|
|
private GameObject _cardObjEvacuationRoot;
|
|
|
|
private GameObject _displayedCardObj;
|
|
|
|
public UserGoods.Type RewardGoodsType { get; private set; }
|
|
|
|
private void HideAllLayout()
|
|
{
|
|
_objLayoutCard.SetActive(value: false);
|
|
_objLayoutSprite.SetActive(value: false);
|
|
_objLayoutTexture.SetActive(value: false);
|
|
}
|
|
|
|
private UIBase_CardManager.CardObjData GetCardObjData(int cardId)
|
|
{
|
|
for (int i = 0; i < _cardObjList.Count; i++)
|
|
{
|
|
UIBase_CardManager.CardObjData cardObjData = _cardObjList[i];
|
|
if (cardObjData != null && cardObjData.ids == cardId)
|
|
{
|
|
return cardObjData;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private void InitializeGoodsTexture(UITexture texture, UserGoods.Type goodsType, long goodsId)
|
|
{
|
|
string text = string.Empty;
|
|
switch (goodsType)
|
|
{
|
|
default:
|
|
return;
|
|
case UserGoods.Type.Sleeve:
|
|
{
|
|
long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(goodsId);
|
|
text = Toolbox.ResourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture, isfetch: true);
|
|
break;
|
|
}
|
|
case UserGoods.Type.Emblem:
|
|
text = Toolbox.ResourcesManager.GetAssetTypePath(goodsId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true);
|
|
break;
|
|
case UserGoods.Type.Degree:
|
|
DegreeHelper.InitializeDegree(texture, goodsId, DegreeHelper.DegreeType.SMALL);
|
|
break;
|
|
case UserGoods.Type.Skin:
|
|
text = Toolbox.ResourcesManager.GetAssetTypePath(goodsId.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail, isfetch: true);
|
|
break;
|
|
case UserGoods.Type.Item:
|
|
{
|
|
Item item = Data.Master.ItemList.Find((Item data) => data.UserGoodsId == goodsId);
|
|
if (item == null)
|
|
{
|
|
return;
|
|
}
|
|
text = Toolbox.ResourcesManager.GetAssetTypePath(item.thumbnail, ResourcesManager.AssetLoadPathType.Item, isfetch: true);
|
|
break;
|
|
}
|
|
case UserGoods.Type.Card:
|
|
case UserGoods.Type.Rupy:
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(text))
|
|
{
|
|
return;
|
|
}
|
|
texture.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(text);
|
|
_textureGoods.material = null;
|
|
_textureGoods.gameObject.SetActive(value: true);
|
|
if (goodsType == UserGoods.Type.Sleeve)
|
|
{
|
|
long existingSleeveId2 = Toolbox.ResourcesManager.GetExistingSleeveId(goodsId);
|
|
Sleeve sleeve = Data.Master.SleeveMgr.Get(existingSleeveId2);
|
|
if (sleeve.IsPremiumSleeve)
|
|
{
|
|
UIManager.GetInstance().getUIBase_CardManager().SetSleeveTexture(_textureGoods, sleeve.sleeve_id);
|
|
}
|
|
}
|
|
}
|
|
|
|
private Color32 GetAcquiredColor(bool isAcquired)
|
|
{
|
|
if (isAcquired)
|
|
{
|
|
return ACQUIRED_GRAY_COLOR;
|
|
}
|
|
return Color.white;
|
|
}
|
|
}
|