备份CatanBuilding瘦身独立工程
This commit is contained in:
22
Assets/Scripts/UI/Rod/AttributeTips.cs
Normal file
22
Assets/Scripts/UI/Rod/AttributeTips.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class AttributeTips : MonoBehaviour
|
||||
{
|
||||
public Image icon;
|
||||
public TMP_Text text_name;
|
||||
public TMP_Text text_info;
|
||||
public TMP_Text curValue;
|
||||
public TMP_Text max;
|
||||
public void Reset()
|
||||
{
|
||||
icon = transform.Find($"icon_attribute").GetComponent<Image>();
|
||||
text_name = transform.Find($"text_name").GetComponent<TMP_Text>();
|
||||
text_info = transform.Find($"text_info").GetComponent<TMP_Text>();
|
||||
curValue = transform.Find($"current/text_num").GetComponent<TMP_Text>();
|
||||
max = transform.Find($"max/text_num").GetComponent<TMP_Text>();
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/AttributeTips.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/AttributeTips.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8632c21d2390d8b48be60bbd98370901
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
167
Assets/Scripts/UI/Rod/FishingAppearancePanel.cs
Normal file
167
Assets/Scripts/UI/Rod/FishingAppearancePanel.cs
Normal file
@@ -0,0 +1,167 @@
|
||||
using cfg;
|
||||
using asap.core;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using DG.Tweening;
|
||||
using GameCore;
|
||||
using game;
|
||||
|
||||
public class FishingAppearancePanel : MonoBehaviour
|
||||
{
|
||||
Tables _tables;
|
||||
|
||||
IconRodRoot icon_rod;
|
||||
RawImage rawImageRod;
|
||||
|
||||
GameObject loading;
|
||||
private Dictionary<string, GameObject> rodAvatar = new Dictionary<string, GameObject>();
|
||||
private List<GameObject> rodPrefab = new List<GameObject>();
|
||||
RodData config;
|
||||
RodSkinData skin;
|
||||
|
||||
GameObject currentRod;
|
||||
Rod RodBehaviour;
|
||||
ReviewNewRod reviewNewRod;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("FishingAppearancePanel");
|
||||
|
||||
_tables = GContext.container.Resolve<Tables>();
|
||||
loading = transform.Find("root/loading").gameObject;
|
||||
rawImageRod = transform.Find("root/RawImageRod").GetComponent<RawImage>();
|
||||
icon_rod = transform.Find("root/icon_rod").GetComponent<IconRodRoot>();
|
||||
icon_rod.gameObject.SetActive(true);
|
||||
icon_rod.SetRawImage(rawImageRod);
|
||||
|
||||
reviewNewRod = transform.Find("root/new_rod").GetComponent<ReviewNewRod>();
|
||||
}
|
||||
|
||||
List<int> rodIds;
|
||||
public void ShowNewRod(List<ItemData> itemDatas)
|
||||
{
|
||||
this.rodIds = new List<int>();
|
||||
foreach (var item in itemDatas)
|
||||
{
|
||||
rodIds.Add(item.id);
|
||||
}
|
||||
rodIds.Sort();
|
||||
int id = rodIds[0];
|
||||
rodIds.RemoveAt(0);
|
||||
config = _tables.TbRodData.GetOrDefault(id);
|
||||
skin = _tables.TbRodSkinData.GetOrDefault(config.ID);
|
||||
reviewNewRod.SetCurData(config, NextNewRod);
|
||||
LoadRodAsync(skin.Fbx);
|
||||
}
|
||||
|
||||
public void NextNewRod()
|
||||
{
|
||||
if (rodIds.Count == 0)
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingAppearancePanel);
|
||||
GContext.Publish(new ShowData(RewardType.Destroy));
|
||||
return;
|
||||
}
|
||||
int id = rodIds[0];
|
||||
rodIds.RemoveAt(0);
|
||||
config = _tables.TbRodData.GetOrDefault(id);
|
||||
skin = _tables.TbRodSkinData.GetOrDefault(config.ID);
|
||||
reviewNewRod.gameObject.SetActive(true);
|
||||
reviewNewRod.SetCurData(config);
|
||||
LoadRodAsync(skin.Fbx);
|
||||
}
|
||||
|
||||
async void LoadRodAsync(string fbx)
|
||||
{
|
||||
GameObject _currentRod = null;
|
||||
if (rodAvatar.ContainsKey(fbx))
|
||||
{
|
||||
_currentRod = rodAvatar[fbx];
|
||||
}
|
||||
else
|
||||
{
|
||||
var prefab = await Addressables.LoadAssetAsync<GameObject>(fbx).Task;
|
||||
if (rodAvatar.ContainsKey(fbx) || this == null)
|
||||
{
|
||||
Addressables.Release(prefab);
|
||||
_currentRod = rodAvatar[fbx];
|
||||
}
|
||||
else if (prefab != null)
|
||||
{
|
||||
rodPrefab.Add(prefab);
|
||||
var go = Instantiate(prefab, icon_rod.avatar);
|
||||
rodAvatar.Add(fbx, go);
|
||||
go.SetActive(false);
|
||||
Rod rod = go.GetComponent<Rod>();
|
||||
rod.cCDIK.enabled = false;
|
||||
_currentRod = go;
|
||||
}
|
||||
}
|
||||
if (fbx == skin.Fbx && _currentRod != null)
|
||||
{
|
||||
InitRod(_currentRod, fbx);
|
||||
}
|
||||
}
|
||||
|
||||
void InitRod(GameObject _currentRod, string fbx)
|
||||
{
|
||||
icon_rod.avatar.gameObject.SetActive(false);
|
||||
loading.SetActive(true);
|
||||
if (fbx == skin.Fbx && _currentRod != null)
|
||||
{
|
||||
if (currentRod != null)
|
||||
{
|
||||
currentRod.SetActive(false);
|
||||
}
|
||||
//加载模型完成
|
||||
loading.SetActive(false);
|
||||
icon_rod.avatar.gameObject.SetActive(true);
|
||||
currentRod = _currentRod;
|
||||
currentRod.transform.localPosition = new Vector3(skin.DisplayPosition[0], skin.DisplayPosition[1], skin.DisplayPosition[2]);
|
||||
currentRod.transform.localRotation = Quaternion.Euler(skin.DisplayRotation[0], skin.DisplayRotation[1], skin.DisplayRotation[2]);
|
||||
currentRod.transform.localScale = Vector3.one * skin.DisplayScale;
|
||||
currentRod.SetActive(true);
|
||||
RodBehaviour = currentRod.GetComponent<Rod>();
|
||||
RodBehaviour.rod.GetComponent<Animator>().Play("Show01");
|
||||
for (int i = 0; i < icon_rod.fx_fishingrods.Length; i++)
|
||||
{
|
||||
icon_rod.fx_fishingrods[i].SetActive(config.Quality - 2 == i);
|
||||
}
|
||||
StartDoRotate();
|
||||
}
|
||||
}
|
||||
|
||||
private Transform _rotateTarget;
|
||||
void StartDoRotate()
|
||||
{
|
||||
if (currentRod is null)
|
||||
{
|
||||
Debug.Log($"<color=#9858ad>Empty rod. No rod to rotate.</color>");
|
||||
return;
|
||||
}
|
||||
// Debug.Log($"<color=#9858ad>{currentRod.transform.GetChild(0).name}</color>");
|
||||
if (_rotateTarget != null)
|
||||
{
|
||||
_rotateTarget.DOKill();
|
||||
}
|
||||
_rotateTarget = currentRod.transform.GetChild(0);
|
||||
var endRotation = _rotateTarget.localRotation.eulerAngles + new Vector3(0, 360, 0);
|
||||
_rotateTarget.DOKill();
|
||||
_rotateTarget.DOLocalRotate(endRotation, 10f, RotateMode.FastBeyond360).SetEase(Ease.Linear).SetLoops(-1);
|
||||
/*
|
||||
Debug.Log($"<color=#9858ad>Empty rod.</color>");
|
||||
Debug.Log($"<color=#9858ad>Empty rod.</color>");
|
||||
avatar.DOKill();
|
||||
avatar.DOLocalRotate(Vector3.up * (avatar.localEulerAngles.y + 360), 10f, RotateMode.FastBeyond360).SetEase(Ease.Linear).SetLoops(-1);
|
||||
*/
|
||||
}
|
||||
protected void OnDestroy()
|
||||
{
|
||||
for (int i = 0; i < rodPrefab.Count; i++)
|
||||
{
|
||||
Addressables.Release(rodPrefab[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/FishingAppearancePanel.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/FishingAppearancePanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6543e796a1e949745a33e1ae4639ac40
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
122
Assets/Scripts/UI/Rod/FishingRodAscendPopupPanel.cs
Normal file
122
Assets/Scripts/UI/Rod/FishingRodAscendPopupPanel.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FishingRodAscendPopupPanel : MonoBehaviour
|
||||
{
|
||||
Tables _tables;
|
||||
Button btn_confirm;
|
||||
//星级影响最大等级
|
||||
TMP_Text text_num_before;
|
||||
TMP_Text text_num_after;
|
||||
//
|
||||
RodAttributeInfoRoot rodAttributeInfoRoot;
|
||||
|
||||
Image perk_bg;
|
||||
Image perk_icon;
|
||||
TMP_Text text_level;
|
||||
TMP_Text text_info;
|
||||
RodItem rodItem;
|
||||
RodItemData currentRodItemData;
|
||||
RodAscend curRodAscend;
|
||||
public void Awake()
|
||||
{
|
||||
_tables = GContext.container.Resolve<Tables>();
|
||||
|
||||
text_num_before = transform.Find("root/content/level/num/text_num").GetComponent<TMP_Text>();
|
||||
text_num_after = transform.Find("root/content/level/num/text_after").GetComponent<TMP_Text>();
|
||||
|
||||
rodAttributeInfoRoot = transform.Find("root/content").GetComponent<RodAttributeInfoRoot>();
|
||||
|
||||
text_level = transform.Find("root/content/skill/perk/bg/text_level").GetComponent<TMP_Text>();
|
||||
perk_bg = transform.Find("root/content/skill/perk/bg").GetComponent<Image>();
|
||||
perk_icon = transform.Find("root/content/skill/perk/bg/icon").GetComponent<Image>();
|
||||
text_info = transform.Find("root/content/skill/text_info").GetComponent<TMP_Text>();
|
||||
rodItem = transform.Find("root/content/rod").GetComponent<RodItem>();
|
||||
btn_confirm = transform.Find("root/content/btn_confirm/btn_green").GetComponent<Button>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_confirm.onClick.AddListener(() => { UIManager.Instance.DestroyUI(gameObject.name); });
|
||||
}
|
||||
|
||||
public void SetCurData(RodItemData currentRodItemData, Sprite sprite)
|
||||
{
|
||||
this.currentRodItemData = currentRodItemData;
|
||||
rodItem.Init(currentRodItemData);
|
||||
perk_bg.sprite = sprite;
|
||||
Init();
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
IUIService uiService = GContext.container.Resolve<IUIService>();
|
||||
RodData rodData = currentRodItemData.config;
|
||||
curRodAscend = _tables.TbRodAscend.GetOrDefault(rodData.AscendID);
|
||||
var dataMap = _tables.TbRodBasicStats.DataMap;
|
||||
RodBasicStats rodBasicStats;
|
||||
PlayerFishData playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||||
int star = playerFishData.GetRodPiece(rodData.ID);
|
||||
RodLevelup rodLevelup = _tables.TbRodLevelup.GetOrDefault(rodData.LevelupID);
|
||||
List<int> Millestones = rodLevelup.Millestones;
|
||||
int perkIDListCount = curRodAscend.PerkIDList.Count;
|
||||
int[] lv = playerFishData.GetPerkLevel(perkIDListCount, star, curRodAscend.DefaultPerk, curRodAscend.PerkUnlockOrder);
|
||||
|
||||
int index = curRodAscend.PerkUnlockOrder[star - 1] - 1;
|
||||
int perkID = curRodAscend.PerkIDList[index];
|
||||
var rodEngancePerk = _tables.TbRodAscendPerk.GetOrDefault(perkID);
|
||||
int level = lv[index];
|
||||
text_level.text = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePopupPanel_1", level);
|
||||
|
||||
List<string> PerkDataList = curRodAscend.PerkDataList[index];
|
||||
if (level > PerkDataList.Count)
|
||||
{
|
||||
Debug.LogError($"钓竿ID:{rodData.ID}的{perkID}第{level}阶提升属性不存在");
|
||||
return;
|
||||
}
|
||||
string perkValue = PerkDataList[level - 1];
|
||||
|
||||
text_info.text = PlayerFishData.GetPerkDesc(rodEngancePerk.PerkType, rodEngancePerk.Desc_l10n_key, perkValue);
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(perk_icon, rodEngancePerk.Icon, BasePanel.PanelName);
|
||||
|
||||
text_num_after.gameObject.SetActive(true);
|
||||
if (star == Millestones.Count)
|
||||
{
|
||||
text_num_before.text = Millestones[star - 1].ToString();
|
||||
text_num_after.text = rodLevelup.MaxLevel.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
text_num_before.text = Millestones[star - 1].ToString();
|
||||
text_num_after.text = Millestones[star].ToString();
|
||||
}
|
||||
|
||||
var values = playerFishData.GetRodAttribute(rodData.ID, starAdd: -1);
|
||||
var values2 = playerFishData.GetRodAttribute(rodData.ID);
|
||||
|
||||
for (int i = 0; i < values.Count; i++)
|
||||
{
|
||||
rodBasicStats = dataMap[i + 1];
|
||||
rodAttributeInfoRoot.rodAttributes[i].gameObject.SetActive(true);
|
||||
rodAttributeInfoRoot.rodAttributes[i].icon.sprite = uiService.GetSprite(rodBasicStats.Icon);
|
||||
rodAttributeInfoRoot.rodAttributes[i].text_name.text = LocalizationMgr.GetText(rodBasicStats.Title_l10n_key);
|
||||
|
||||
var curValue = values[i];
|
||||
var nextValue = values2[i];
|
||||
if (curValue != nextValue)
|
||||
{
|
||||
rodAttributeInfoRoot.rodAttributes[i].gameObject.SetActive(true);
|
||||
rodAttributeInfoRoot.rodAttributes[i].text_num.text = curValue.ToString();
|
||||
rodAttributeInfoRoot.rodAttributes[i].text_after.text = nextValue.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
rodAttributeInfoRoot.rodAttributes[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/FishingRodAscendPopupPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/FishingRodAscendPopupPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7942eb774f20aa4fbdcda3536c42d2b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
274
Assets/Scripts/UI/Rod/FishingRodHonorlevelPanel.cs
Normal file
274
Assets/Scripts/UI/Rod/FishingRodHonorlevelPanel.cs
Normal file
@@ -0,0 +1,274 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
/*
|
||||
UI_FishingRodHonorlevelPanel_1 精英荣耀等级 Elite Honor Level
|
||||
UI_FishingRodHonorlevelPanel_2 专家荣耀等级 Expert Honor Level
|
||||
UI_FishingRodHonorlevelPanel_3 大师荣耀等级 Master Honor Level
|
||||
UI_FishingRodHonorlevelPanel_4 精英荣耀属性 Elite Honor Attributes
|
||||
UI_FishingRodHonorlevelPanel_5 专家荣耀属性 Expert Honor Attributes
|
||||
UI_FishingRodHonorlevelPanel_6 大师荣耀属性 Master Honor Attributes
|
||||
UI_FishingRodHonorlevelPanel_7 对所有精英鱼竿生效 Applies to all Elite Rods
|
||||
UI_FishingRodHonorlevelPanel_8 对所有专家鱼竿生效 Applies to all Expert Rods
|
||||
UI_FishingRodHonorlevelPanel_9 对所有大师鱼竿生效 Applies to all Master Rods
|
||||
*/
|
||||
public class FishingRodHonorlevelPanel : MonoBehaviour
|
||||
{
|
||||
RodItem rod;
|
||||
TMP_Text text_level;
|
||||
Image honor;
|
||||
RodAttributeInfo rodAttribute;
|
||||
Button btn_levelup;
|
||||
Button btn_levelup_gray;
|
||||
Button btn_questionmark;
|
||||
GameObject icon_cost_2;
|
||||
TMP_Text icon_cost_1_num;
|
||||
TMP_Text icon_cost_2_num;
|
||||
TMP_Text icon_cost_3_num;
|
||||
Image icon_ticket_2;
|
||||
Image icon_ticket_3;
|
||||
|
||||
TMP_Text text_title;
|
||||
TMP_Text text_info_title;
|
||||
TMP_Text text_info;
|
||||
|
||||
GameObject tips_honorrod;
|
||||
GameObject item_rod;
|
||||
Button btn_close;
|
||||
FishingRodUpSystem upSystem;
|
||||
PlayerFishData playerFishData;
|
||||
Tables _tables;
|
||||
RodItemData data;
|
||||
RodAscend curRodAscend;
|
||||
RodRodLevelPeak rodLevelPeak;
|
||||
GameObject fx_rodpanel_honorlevel_upgrade;
|
||||
RawImage rawImageRod;
|
||||
IUIService uIService;
|
||||
string toastKey = "UI_ToastPanel_66";
|
||||
private void Awake()
|
||||
{
|
||||
uIService = GContext.container.Resolve<IUIService>();
|
||||
rawImageRod = transform.Find("root/RawImageRod").GetComponent<RawImage>();
|
||||
|
||||
_tables = GContext.container.Resolve<Tables>();
|
||||
playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||||
upSystem = GContext.container.Resolve<FishingRodUpSystem>();
|
||||
text_level = transform.Find("root/honor/text_level").GetComponent<TMP_Text>();
|
||||
honor = transform.Find("root/honor").GetComponent<Image>();
|
||||
rodAttribute = transform.Find("root/info/attribute1").GetComponent<RodAttributeInfo>();
|
||||
btn_levelup = transform.Find("root/btn_levelup/btn_green").GetComponent<Button>();
|
||||
btn_levelup_gray = transform.Find("root/btn_levelup_gray/btn_green").GetComponent<Button>();
|
||||
btn_questionmark = transform.Find("root/info/text_info/btn_questionmark").GetComponent<Button>();
|
||||
rod = transform.Find("root/rod").GetComponent<RodItem>();
|
||||
icon_cost_1_num = transform.Find("root/cost/icon_cost_1/text_num").GetComponent<TMP_Text>();
|
||||
icon_cost_2_num = transform.Find("root/cost/icon_cost_2/text_num").GetComponent<TMP_Text>();
|
||||
icon_cost_2 = transform.Find("root/cost/icon_cost_2").gameObject;
|
||||
icon_ticket_2 = transform.Find("root/cost/icon_cost_2/icon_ticket").GetComponent<Image>();
|
||||
icon_cost_3_num = transform.Find("root/cost/icon_cost_3/text_num").GetComponent<TMP_Text>();
|
||||
icon_ticket_3 = transform.Find("root/cost/icon_cost_3/icon_ticket").GetComponent<Image>();
|
||||
tips_honorrod = transform.Find("root/tips_honorrod").gameObject;
|
||||
item_rod = transform.Find("root/tips_honorrod/item_rod").gameObject;
|
||||
btn_close = transform.Find("bottom/btn_close").GetComponent<Button>();
|
||||
item_rod.SetActive(false);
|
||||
fx_rodpanel_honorlevel_upgrade = transform.Find("root/honor/fx_rodpanel_honorlevel_upgrade").gameObject;
|
||||
text_title = transform.Find("top/title/text_title").GetComponent<TMP_Text>();
|
||||
text_info_title = transform.Find("root/info/text_title").GetComponent<TMP_Text>();
|
||||
text_info = transform.Find("root/info/text_info").GetComponent<TMP_Text>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_close.onClick.AddListener(OnClose);
|
||||
btn_levelup.onClick.AddListener(OnClickUp);
|
||||
btn_levelup_gray.onClick.AddListener(OnClickUpGray);
|
||||
btn_questionmark.onClick.AddListener(ShowHonorRod);
|
||||
data = upSystem.GetCurrentRodItemData();
|
||||
rod.Init(data);
|
||||
rawImageRod.gameObject.SetActive(true);
|
||||
rawImageRod.texture = upSystem.bagPanel.rt;
|
||||
RodData rodData = data.config;
|
||||
rodLevelPeak = _tables.TbRodRodLevelPeak.GetOrDefault(rodData.Quality);
|
||||
var dataMap = _tables.TbRodBasicStats.DataMap;
|
||||
|
||||
curRodAscend = _tables.TbRodAscend.GetOrDefault(rodData.AscendID);
|
||||
SetEnhance();
|
||||
|
||||
Item item = _tables.TbItem.GetOrDefault(curRodAscend.FragmentID);
|
||||
icon_ticket_3.sprite = uIService.GetSprite(item.Icon);
|
||||
RodFragmentExchange rodFragmentExchange = _tables.TbRodFragmentExchange.GetOrDefault(data.config.Quality);
|
||||
if (rodFragmentExchange != null)
|
||||
{
|
||||
item = _tables.TbItem.GetOrDefault(rodFragmentExchange.GeneralFragmentID);
|
||||
icon_ticket_2.sprite = uIService.GetSprite(item.Icon);
|
||||
}
|
||||
text_title.text = LocalizationMgr.GetText($"UI_FishingRodHonorlevelPanel_{rodData.Quality - 1}");
|
||||
text_info_title.text = LocalizationMgr.GetText($"UI_FishingRodHonorlevelPanel_{rodData.Quality + 2}");
|
||||
text_info.text = LocalizationMgr.GetText($"UI_FishingRodHonorlevelPanel_{rodData.Quality + 5}");
|
||||
honor.sprite = uIService.GetSprite(rodLevelPeak.Icon);
|
||||
InitHonorRod();
|
||||
}
|
||||
void InitHonorRod()
|
||||
{
|
||||
var idList = upSystem.HasRodID(data.config.Quality);
|
||||
var rodItemDatas = new List<RodItemData>();
|
||||
RodData _rodData;
|
||||
RodAscend _rodAscend;
|
||||
for (int i = 0; i < idList.Count; i++)
|
||||
{
|
||||
_rodData = _tables.TbRodData.DataMap[idList[i]];
|
||||
bool isLock = playerFishData.NotRod(_rodData.ID);
|
||||
_rodAscend = _tables.TbRodAscend.GetOrDefault(_rodData.AscendID);
|
||||
|
||||
int level = playerFishData.GetRodLevel(_rodData.ID);
|
||||
int star = playerFishData.GetRodPiece(_rodData.ID);
|
||||
bool isMax = star >= _rodAscend.MaxAscent;
|
||||
RodItemData rodItemData = new RodItemData()
|
||||
{
|
||||
config = _rodData,
|
||||
isLock = isLock,
|
||||
level = level + 1,
|
||||
star = star,
|
||||
isMax = isMax,
|
||||
};
|
||||
int skindID = playerFishData.GetRodSkin(_rodData.ID);
|
||||
rodItemData.skin = _tables.TbRodSkinData.GetOrDefault(skindID);
|
||||
rodItemData.SetRodPower();
|
||||
rodItemDatas.Add(rodItemData);
|
||||
}
|
||||
rodItemDatas.Sort(RodItemData.Sort);
|
||||
//弹出界面
|
||||
for (int i = 0; i < rodItemDatas.Count; i++)
|
||||
{
|
||||
GameObject go = Instantiate(item_rod, tips_honorrod.transform);
|
||||
go.SetActive(true);
|
||||
go.GetComponent<RodItem>().Init(rodItemDatas[i]);
|
||||
}
|
||||
}
|
||||
void ShowHonorRod()
|
||||
{
|
||||
tips_honorrod.SetActive(!tips_honorrod.activeSelf);
|
||||
}
|
||||
void OnClickUpGray()
|
||||
{
|
||||
ToastPanel.Show(LocalizationMgr.GetText(toastKey));
|
||||
}
|
||||
void OnClickUp()
|
||||
{
|
||||
///判断 材料是否足够
|
||||
playerFishData.HonorLevelUp(data.config);
|
||||
SetEnhance();
|
||||
fx_rodpanel_honorlevel_upgrade.SetActive(false);
|
||||
fx_rodpanel_honorlevel_upgrade.SetActive(true);
|
||||
}
|
||||
void ShowCost()
|
||||
{
|
||||
RodData rodData = data.config;
|
||||
if (rodLevelPeak == null)
|
||||
{
|
||||
Debug.LogError($"[FishingRodHonorlevelPanel]OnClickUpGray: No RodRodLevelPeak data found for Quality {data.config.Quality}");
|
||||
return;
|
||||
}
|
||||
int currentHonorLevel = playerFishData.GetHonorLevel(rodData.Quality);
|
||||
if (currentHonorLevel >= rodLevelPeak.ItemConsume.Count)
|
||||
{
|
||||
currentHonorLevel = rodLevelPeak.ItemConsume.Count - 1;
|
||||
}
|
||||
int requiredItems = rodLevelPeak.ItemConsume[currentHonorLevel];
|
||||
int fragmentItems = rodLevelPeak.FragmentConsume[currentHonorLevel];
|
||||
bool isUp = false;
|
||||
double consumeCount = GContext.container.Resolve<PlayerData>().pearl;
|
||||
if (consumeCount < requiredItems)
|
||||
{
|
||||
toastKey = "UI_ToastPanel_12";
|
||||
icon_cost_1_num.text = $"<color=red>{consumeCount}</color>/{requiredItems}";
|
||||
}
|
||||
else
|
||||
{
|
||||
toastKey = "UI_ToastPanel_66";
|
||||
isUp = true;
|
||||
icon_cost_1_num.text = $"<color=green>{consumeCount}</color>/{requiredItems}";
|
||||
}
|
||||
|
||||
|
||||
int fragment = GContext.container.Resolve<PlayerFishData>().GetRodPiece(curRodAscend.FragmentID);
|
||||
bool fraUp = false;
|
||||
|
||||
if (fragment < fragmentItems)
|
||||
{
|
||||
icon_cost_2.SetActive(true);
|
||||
fragmentItems -= fragment;
|
||||
fragmentItems = ShowCost(fragmentItems);
|
||||
if (fragmentItems <= 0)
|
||||
{
|
||||
fraUp = true;
|
||||
icon_cost_3_num.text = $"<color=green>{fragment}</color>/{fragment}";
|
||||
}
|
||||
else
|
||||
{
|
||||
icon_cost_3_num.text = $"<color=red>{fragment}</color>/{fragment + fragmentItems}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
icon_cost_2.SetActive(false);
|
||||
icon_cost_3_num.text = $"<color=green>{fragment}</color>/{fragmentItems}";
|
||||
fraUp = true;
|
||||
}
|
||||
|
||||
isUp &= fraUp;
|
||||
btn_levelup.gameObject.SetActive(isUp);
|
||||
btn_levelup_gray.gameObject.SetActive(!isUp);
|
||||
}
|
||||
int ShowCost(int rquiredFragments)
|
||||
{
|
||||
RodFragmentExchange rodFragmentExchange = _tables.TbRodFragmentExchange.GetOrDefault(data.config.Quality);
|
||||
int fragment = GContext.container.Resolve<PlayerFishData>().GetRodPiece(rodFragmentExchange.GeneralFragmentID) / rodFragmentExchange.ExchangeRate;
|
||||
if (fragment == 0)
|
||||
{
|
||||
icon_cost_2.SetActive(false);
|
||||
return rquiredFragments;
|
||||
}
|
||||
int count;
|
||||
if (fragment >= rquiredFragments)
|
||||
{
|
||||
count = rquiredFragments * rodFragmentExchange.ExchangeRate;
|
||||
}
|
||||
else
|
||||
{
|
||||
count = fragment * rodFragmentExchange.ExchangeRate;
|
||||
}
|
||||
icon_cost_2_num.text = $"<color=green>{count}</color>/{count}";
|
||||
return rquiredFragments - fragment;
|
||||
}
|
||||
void SetEnhance()
|
||||
{
|
||||
ShowCost();
|
||||
RodData rodData = data.config;
|
||||
text_level.text = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePopupPanel_1", playerFishData.GetHonorLevel(rodData.Quality));
|
||||
var values = playerFishData.GetHonorLevelAttribute(rodData.Quality);
|
||||
var values2 = playerFishData.GetHonorLevelAttribute(rodData.Quality, starAdd: 1);
|
||||
|
||||
var curValue = values;
|
||||
rodAttribute.text_num.text = curValue.ToString();
|
||||
var nextValue = values2;
|
||||
if (curValue != nextValue)
|
||||
{
|
||||
rodAttribute.text_after.text = nextValue.ToString();
|
||||
rodAttribute.text_after.gameObject.SetActive(true);
|
||||
rodAttribute.arrow.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
rodAttribute.text_after.gameObject.SetActive(false);
|
||||
rodAttribute.arrow.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
private async void OnClose()
|
||||
{
|
||||
await UIManager.Instance.ShowUI(UITypes.FishingRodPanel);
|
||||
UIManager.Instance.DestroyUI(gameObject.name);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/FishingRodHonorlevelPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/FishingRodHonorlevelPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ddabeb18ef509d42ad2d1a54d5e89cb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
88
Assets/Scripts/UI/Rod/FishingRodInfoPanel.cs
Normal file
88
Assets/Scripts/UI/Rod/FishingRodInfoPanel.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using DG.Tweening;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FishingRodInfoPanel : MonoBehaviour
|
||||
{
|
||||
Button btn_close;
|
||||
TMP_Text text_special_peaks;
|
||||
TMP_Text text_name;
|
||||
UIDrag uiDrag;
|
||||
RawImage rawImageRod;
|
||||
private Transform _rotateTarget, _avatar;
|
||||
TMP_Text text_info1;
|
||||
TMP_Text text_info2;
|
||||
TMP_Text text_info3;
|
||||
GameObject loading;
|
||||
Image mask_top;
|
||||
string[] sp_rod_top_mask = { "sp_rod_top_mask_blue", "sp_rod_top_mask_blue", "sp_rod_top_mask_purple", "sp_rod_top_mask_yellow" };
|
||||
private void Awake()
|
||||
{
|
||||
uiDrag = transform.Find("root/UIDrag").GetComponent<UIDrag>();
|
||||
btn_close = transform.Find("root/btn_close").GetComponent<Button>();
|
||||
text_special_peaks = transform.Find("root/bg_info/text_special_peaks").GetComponent<TMP_Text>();
|
||||
text_name = transform.Find("root/bg_info/text_special_peaks/text_title").GetComponent<TMP_Text>();
|
||||
rawImageRod = transform.Find("RawImageRod").GetComponent<RawImage>();
|
||||
text_info1 = transform.Find("root/extra_info/text_info1").GetComponent<TMP_Text>();
|
||||
text_info2 = transform.Find("root/extra_info/text_info2").GetComponent<TMP_Text>();
|
||||
text_info3 = transform.Find("root/extra_info/text_info3").GetComponent<TMP_Text>();
|
||||
mask_top = transform.Find("root/mask_top").GetComponent<Image>();
|
||||
loading = transform.Find("root/loading").gameObject;
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_close.onClick.AddListener(() => { UIManager.Instance.HideUI(UITypes.FishingRodInfoPanel); });
|
||||
uiDrag.OnBeginDragCall = OnBeginDragCall;
|
||||
uiDrag.OnDragCall = OnDragRod;
|
||||
uiDrag.OnEndDragCall = StartDoRotate;
|
||||
StartDoRotate();
|
||||
}
|
||||
public void Show(RodSkinData fishRodSkinData, RodData rodData, Transform avatar, Transform rotateTarget, RenderTexture rt, bool isShow)
|
||||
{
|
||||
avatar.DOLocalMove( new Vector3(0.7f, -0.5f, -2.5f),0.5f);
|
||||
rawImageRod.texture = rt;
|
||||
loading.SetActive(isShow);
|
||||
_rotateTarget = rotateTarget;
|
||||
_avatar = avatar;
|
||||
text_name.text = LocalizationMgr.GetText(fishRodSkinData.Name_l10n_key);
|
||||
text_special_peaks.text = LocalizationMgr.GetText(fishRodSkinData.Desc_l10n_key);
|
||||
//string str = LocalizationMgr.GetFormatTextValue("UI_FishingPanel_101009", rodData.Length.ToString("F1"));
|
||||
text_info1.text = $"{LocalizationMgr.GetText("RodConstStats_Length")}: {rodData.Length.ToString("F1")}";
|
||||
text_info2.text = $"{LocalizationMgr.GetText("RodConstStats_Power")}: {rodData.Power}";
|
||||
text_info3.text = $"{LocalizationMgr.GetText("RodConstStats_Action")}: {rodData.Action}";
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(mask_top, sp_rod_top_mask[rodData.Quality - 1], BasePanel.PanelName);
|
||||
}
|
||||
public void SetLoading(bool isShow)
|
||||
{
|
||||
loading.SetActive(isShow);
|
||||
}
|
||||
void StartDoRotate()
|
||||
{
|
||||
if (_rotateTarget is null)
|
||||
return;
|
||||
var endRotation = _rotateTarget.localRotation.eulerAngles + new Vector3(0, 360, 0);
|
||||
_rotateTarget.DOKill();
|
||||
_rotateTarget.DOLocalRotate(endRotation, 10f, RotateMode.FastBeyond360).SetEase(Ease.Linear).SetLoops(-1);
|
||||
}
|
||||
void OnDragRod(PointerEventData eventData)
|
||||
{
|
||||
_rotateTarget?.Rotate(Vector3.up, -eventData.delta.x);
|
||||
}
|
||||
void OnBeginDragCall()
|
||||
{
|
||||
if (_rotateTarget != null)
|
||||
{
|
||||
_rotateTarget.DOKill();
|
||||
}
|
||||
}
|
||||
private void OnDisable()
|
||||
{
|
||||
_avatar.transform.DOKill();
|
||||
_avatar.DOLocalMove(new Vector3(0, 0, 0), 0.5f);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/FishingRodInfoPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/FishingRodInfoPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f64e277316307c46a0773c81071ae21
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
408
Assets/Scripts/UI/Rod/FishingRodPanel.cs
Normal file
408
Assets/Scripts/UI/Rod/FishingRodPanel.cs
Normal file
@@ -0,0 +1,408 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using DG.Tweening;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public partial class FishingRodPanel : BasePanel
|
||||
{
|
||||
Animation ani;
|
||||
Tables _tables;
|
||||
Transform LevelRoot;
|
||||
Transform AscendRoot;
|
||||
GameObject loading;
|
||||
Image mask_bottom;
|
||||
Image mask_top;
|
||||
UIDrag uiDrag;
|
||||
public float speed = 0.5f;
|
||||
public float RodApperXOffset = -0.5f;
|
||||
public float RodAppearTime = 0.2f;
|
||||
private Dictionary<string, GameObject> rodAvatar = new Dictionary<string, GameObject>();
|
||||
private List<GameObject> rodPrefab = new List<GameObject>();
|
||||
GameObject currentRod;
|
||||
Rod RodBehaviour;
|
||||
TMP_Text text_damage_num;
|
||||
TMP_Text text_info;
|
||||
GameObject effect_yugan_shengji;
|
||||
|
||||
//下部列表
|
||||
Button btn_close;
|
||||
|
||||
attributes_tips attributes_tips;
|
||||
Button BtnCloseTips;
|
||||
|
||||
List<RodItemData> rodItemDatas = new List<RodItemData>();
|
||||
private RodItemData data;
|
||||
private RodAscend curRodAscend;
|
||||
RodData config;
|
||||
RodSkinData skin;
|
||||
|
||||
string[] sp_rod_title = { "sp_rod_title_blue", "sp_rod_title_blue", "sp_rod_title_purple", "sp_rod_title_yellow" };
|
||||
string[] sp_rod_level = { "sp_rod_level_blue", "sp_rod_level_blue", "sp_rod_level_purple", "sp_rod_level_yellow" };
|
||||
string[] sp_rod_bottom_mask = { "sp_rod_bottom_mask_blue", "sp_rod_bottom_mask_blue", "sp_rod_bottom_mask_purple", "sp_rod_bottom_mask_yellow" };
|
||||
string[] sp_rod_top_mask = { "sp_rod_top_mask_blue", "sp_rod_top_mask_blue", "sp_rod_top_mask_purple", "sp_rod_top_mask_yellow" };
|
||||
FishingRodInfoPanel fishingRodInfoPanel;
|
||||
PlayerFishData playerFishData;
|
||||
FishingRodUpSystem upSystem;
|
||||
RawImage rawImageRod;
|
||||
//GameObject particle;
|
||||
public Material Rod_black;
|
||||
IUIService uIService;
|
||||
private void Awake()
|
||||
{
|
||||
uIService = GContext.container.Resolve<IUIService>();
|
||||
upSystem = GContext.container.Resolve<FishingRodUpSystem>();
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingShopPanel);
|
||||
_tables = GContext.container.Resolve<Tables>();
|
||||
ani = GetComponent<Animation>();
|
||||
loading = transform.Find("root/loading").gameObject;
|
||||
playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||||
LevelRoot = transform.Find("root/LevelRoot");
|
||||
AscendRoot = transform.Find("root/AscendRoot");
|
||||
rawImageRod = transform.Find("root/RawImageRod").GetComponent<RawImage>();
|
||||
rawImageRod.gameObject.SetActive(true);
|
||||
mask_bottom = transform.Find("root/mask_bottom").GetComponent<Image>();
|
||||
mask_top = transform.Find("root/mask_top").GetComponent<Image>();
|
||||
|
||||
uiDrag = rawImageRod.transform.GetComponent<UIDrag>();
|
||||
text_damage_num = transform.Find("root/attributes_tips/text_info2").GetComponent<TMP_Text>();
|
||||
text_info = transform.Find("root/attributes_tips/text_info3").GetComponent<TMP_Text>();
|
||||
effect_yugan_shengji = transform.Find($"root/effect_yugan_shengji").gameObject;
|
||||
|
||||
btn_close = transform.Find("bottom/btn_close").GetComponent<Button>();
|
||||
|
||||
BtnCloseTips = transform.Find("root/BtnCloseTips").GetComponent<Button>();
|
||||
attributes_tips = transform.Find("root/attributes_tips").GetComponent<attributes_tips>();
|
||||
|
||||
///partial 其他功能初始化
|
||||
InitLevelUpPanel();
|
||||
InitAscendUpPanel();
|
||||
ShowAscendRoot(false);
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
btn_close.onClick.AddListener(OnClickClose);
|
||||
BtnCloseTips.onClick.AddListener(HideAllTips);
|
||||
|
||||
rawImageRod.texture = upSystem.bagPanel.rt;
|
||||
uiDrag.OnBeginDragCall += OnBeginDragCall;
|
||||
uiDrag.OnDragCall += OnDragRod;
|
||||
uiDrag.OnEndDragCall += StartDoRotate;
|
||||
HideAllTips();
|
||||
Init();
|
||||
GuideDataCenter guideDataCenter = GContext.container.Resolve<GuideDataCenter>();
|
||||
bool isGuide = guideDataCenter.InspectTriggerGuide("FishingRodPanel");
|
||||
starItemRoot.ShowStar(data.star, curRodAscend.MaxAscent);
|
||||
}
|
||||
|
||||
void OnClickClose()
|
||||
{
|
||||
if (AscendRoot.gameObject.activeSelf)
|
||||
{
|
||||
ShowAscendRoot(false);
|
||||
starItemRoot.ShowStar(data.star, curRodAscend.MaxAscent);
|
||||
}
|
||||
else
|
||||
{
|
||||
upSystem.Publish(new RefreshRodBagEvent());
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingRodPanel);
|
||||
}
|
||||
}
|
||||
|
||||
void ShowAscendRoot(bool isLevel)
|
||||
{
|
||||
LevelRoot.gameObject.SetActive(!isLevel);
|
||||
AscendRoot.gameObject.SetActive(isLevel);
|
||||
if (isLevel)
|
||||
{
|
||||
ani.Play("FishingRodPanel_show");
|
||||
}
|
||||
else
|
||||
{
|
||||
ani.Play("FishingRodPanel_ascend");
|
||||
}
|
||||
}
|
||||
|
||||
async void ShowFishingRodInfoPanel()
|
||||
{
|
||||
GameObject panel = await UIManager.Instance.ShowUI(UITypes.FishingRodInfoPanel);
|
||||
fishingRodInfoPanel = panel.GetComponent<FishingRodInfoPanel>();
|
||||
int skindID = playerFishData.GetRodSkin(data.config.ID);
|
||||
var fishRodSkinData = _tables.TbRodSkinData.GetOrDefault(skindID);
|
||||
|
||||
fishingRodInfoPanel.Show(fishRodSkinData, data.config, upSystem.bagPanel.avatar, _rotateTarget, upSystem.bagPanel.rt, loading.activeSelf);
|
||||
}
|
||||
void ShowAppearance()
|
||||
{
|
||||
//var go = await UIManager.Instance.ShowUI(UITypes.AppearancePanel);
|
||||
//AppearancePanel appearancePanel = go.GetComponent<AppearancePanel>();
|
||||
//appearancePanel.appearanceOpenType = AppearanceOpenType.FishingRodPanel;
|
||||
//UIManager.Instance.DestroyUI(UITypes.FishingRodPanel);
|
||||
//GContext.Publish(new MapShowEvent() { isShow = true });
|
||||
}
|
||||
|
||||
|
||||
void HideAllTips()
|
||||
{
|
||||
attributes_tips.gameObject.SetActive(false);
|
||||
BtnCloseTips.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void ShowAttributes(int index, Transform trans)
|
||||
{
|
||||
var pos = trans.position;
|
||||
SetPos(pos);
|
||||
BtnCloseTips.gameObject.SetActive(true);
|
||||
attributes_tips.gameObject.SetActive(true);
|
||||
text_damage_num.gameObject.SetActive(index == 0);
|
||||
text_info.gameObject.SetActive(index == 0);
|
||||
attributes_tips.Init(index, data.config);
|
||||
}
|
||||
void SetPos(Vector3 pos)
|
||||
{
|
||||
attributes_tips.transform.position = pos;
|
||||
RectTransform rectTransform = transform.GetComponent<RectTransform>();
|
||||
float limit = (rectTransform.rect.width - 700) / 2;
|
||||
//边界检测
|
||||
var localPosition = attributes_tips.transform.localPosition;
|
||||
if (localPosition.x > limit)
|
||||
{
|
||||
localPosition.x = limit;
|
||||
}
|
||||
else if (localPosition.x < -limit)
|
||||
{
|
||||
localPosition.x = -limit;
|
||||
}
|
||||
attributes_tips.transform.localPosition = localPosition;
|
||||
attributes_tips.arrow.position = new Vector3(pos.x, attributes_tips.arrow.position.y);
|
||||
}
|
||||
public async void ShowPerk(int index, Transform perk, int addLevel = -1)
|
||||
{
|
||||
item_tips _item_tips = await item_tips.Show();
|
||||
if (_item_tips == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_item_tips.ShowPerk(data.config.ID, index, perk.position, addLevel);
|
||||
}
|
||||
|
||||
private Transform _rotateTarget;
|
||||
void StartDoRotate()
|
||||
{
|
||||
if (currentRod is null)
|
||||
{
|
||||
Debug.Log($"<color=#9858ad>Empty rod. No rod to rotate.</color>");
|
||||
return;
|
||||
}
|
||||
_rotateTarget = currentRod.transform.GetChild(0);
|
||||
var endRotation = _rotateTarget.localRotation.eulerAngles + new Vector3(0, 360, 0);
|
||||
_rotateTarget.DOKill();
|
||||
_rotateTarget.DOLocalRotate(endRotation, 10f, RotateMode.FastBeyond360).SetEase(Ease.Linear).SetLoops(-1);
|
||||
|
||||
}
|
||||
void OnDragRod(PointerEventData eventData)
|
||||
{
|
||||
_rotateTarget.Rotate(Vector3.up, -eventData.delta.x * speed);
|
||||
}
|
||||
void OnBeginDragCall()
|
||||
{
|
||||
_rotateTarget.DOKill();
|
||||
}
|
||||
|
||||
void SetPanelData()
|
||||
{
|
||||
curRodAscend = _tables.TbRodAscend.GetOrDefault(data.config.AscendID);
|
||||
TbRodOperatingStats rodOperatingStats = _tables.TbRodOperatingStats;
|
||||
var values = playerFishData.GetRodAttribute(data.config.ID)[0];
|
||||
var minDrawingHP = playerFishData.GetAscendValue(values, rodOperatingStats.MaxDrawingHP) / data.config.DisplayDamageSpeed;
|
||||
|
||||
text_damage_num.text = LocalizationMgr.GetFormatTextValue("RodBasicStatsDesc_DPH", minDrawingHP.ToString("F0"));
|
||||
text_info.text = LocalizationMgr.GetFormatTextValue("RodBasicStatsDesc_ATKSPD", data.config.DisplayDamageSpeed);
|
||||
|
||||
SetLevel();
|
||||
InitPearksData();
|
||||
SetBtnState();
|
||||
}
|
||||
|
||||
|
||||
public void Init()
|
||||
{
|
||||
this.rodItemDatas = upSystem.rodItemDatas;
|
||||
int index = upSystem.SelectIndex;
|
||||
OnClickItem(rodItemDatas[index]);
|
||||
}
|
||||
|
||||
|
||||
void OnClickItem(RodItemData rodItemData)
|
||||
{
|
||||
upSystem.SelectIndex = rodItemData.sort;
|
||||
|
||||
data = rodItemData;
|
||||
if (data.isNew)
|
||||
{
|
||||
data.isNew = false;
|
||||
GContext.container.Resolve<PlayerData>().RewardNewRod(data.config.ID);
|
||||
}
|
||||
skin = data.skin;
|
||||
if (config == null || config.ID != data.config.ID)
|
||||
{
|
||||
//加载鱼竿模型
|
||||
upSystem.bagPanel.avatar.gameObject.SetActive(false);
|
||||
loading.SetActive(false);
|
||||
LoadRodAsync(skin.Fbx);
|
||||
curRodAscend = _tables.TbRodAscend.GetOrDefault(data.config.AscendID);
|
||||
}
|
||||
|
||||
GContext.Publish(new VibrationData(HapticTypes.Selection));
|
||||
|
||||
config = data.config;
|
||||
IUIService uIService = GContext.container.Resolve<IUIService>();
|
||||
|
||||
if (skin != null)
|
||||
{
|
||||
text_name.text = LocalizationMgr.GetText(skin.Name_l10n_key);
|
||||
}
|
||||
|
||||
|
||||
uIService.SetImageSprite(title_image, sp_rod_title[config.Quality - 1], PanelName);
|
||||
|
||||
SetPanelData();
|
||||
SetLevelStar();
|
||||
|
||||
uIService.SetImageSprite(mask_bottom, sp_rod_bottom_mask[config.Quality - 1], PanelName);
|
||||
uIService.SetImageSprite(mask_top, sp_rod_top_mask[config.Quality - 1], PanelName);
|
||||
GameObject[] gameObjects = upSystem.bagPanel.fx_fishingrods;
|
||||
for (int i = 0; i < gameObjects.Length; i++)
|
||||
{
|
||||
gameObjects[i].SetActive(config.Quality - 2 == i);
|
||||
}
|
||||
}
|
||||
void InitRod(GameObject _currentRod, string fbx)
|
||||
{
|
||||
if (fbx == data.skin.Fbx && _currentRod != null)
|
||||
{
|
||||
if (currentRod != null)
|
||||
{
|
||||
currentRod.SetActive(false);
|
||||
}
|
||||
//加载鱼竿模型完成
|
||||
if (fishingRodInfoPanel != null)
|
||||
{
|
||||
fishingRodInfoPanel.SetLoading(false);
|
||||
}
|
||||
loading.SetActive(false);
|
||||
upSystem.bagPanel.avatar.gameObject.SetActive(true);
|
||||
currentRod = _currentRod;
|
||||
currentRod.transform.localPosition = new Vector3(skin.DisplayPosition[0], skin.DisplayPosition[1], skin.DisplayPosition[2]);
|
||||
currentRod.transform.localRotation = Quaternion.Euler(skin.DisplayRotation[0], skin.DisplayRotation[1], skin.DisplayRotation[2]);
|
||||
currentRod.transform.localScale = Vector3.one * skin.DisplayScale;
|
||||
currentRod.SetActive(true);
|
||||
RodBehaviour = currentRod.GetComponent<Rod>();
|
||||
RodBehaviour.rod.GetComponent<Animator>().Play("Show01");
|
||||
StartDoRotate();
|
||||
upSystem.bagPanel.avatar.DOKill();
|
||||
upSystem.bagPanel.avatar.localPosition = new Vector3(RodApperXOffset, 0, 0);
|
||||
upSystem.bagPanel.avatar.DOLocalMove(Vector3.zero, RodAppearTime);
|
||||
}
|
||||
}
|
||||
async void LoadRodAsync(string fbx)
|
||||
{
|
||||
GameObject _currentRod = null;
|
||||
if (rodAvatar.ContainsKey(fbx))
|
||||
{
|
||||
_currentRod = rodAvatar[fbx];
|
||||
}
|
||||
else
|
||||
{
|
||||
var prefab = await Addressables.LoadAssetAsync<GameObject>(fbx).Task;
|
||||
await Awaiters.NextFrame;
|
||||
if (rodAvatar.ContainsKey(fbx) || this == null)
|
||||
{
|
||||
Addressables.Release(prefab);
|
||||
_currentRod = rodAvatar[fbx];
|
||||
}
|
||||
else if (prefab != null)
|
||||
{
|
||||
rodPrefab.Add(prefab);
|
||||
var go = Instantiate(prefab, upSystem.bagPanel.avatar);
|
||||
rodAvatar.Add(fbx, go);
|
||||
go.SetActive(false);
|
||||
Rod rod = go.GetComponent<Rod>();
|
||||
if (data.isLock)
|
||||
{
|
||||
SkinnedMeshRenderer[] smr = rod.rod.GetComponentsInChildren<SkinnedMeshRenderer>();
|
||||
//替换所有材质
|
||||
foreach (var item in smr)
|
||||
{
|
||||
Material[] materials = item.materials;
|
||||
for (int i = 0; i < materials.Length; i++)
|
||||
{
|
||||
materials[i] = Rod_black;
|
||||
}
|
||||
item.materials = materials;
|
||||
}
|
||||
}
|
||||
|
||||
rod.cCDIK.enabled = false;
|
||||
_currentRod = go;
|
||||
}
|
||||
}
|
||||
if (fbx == skin.Fbx && _currentRod != null)
|
||||
{
|
||||
InitRod(_currentRod, fbx);
|
||||
}
|
||||
}
|
||||
|
||||
void SetBtnState()
|
||||
{
|
||||
bool isEquiped = data.config.ID == GContext.container.Resolve<PlayerData>().equipRodID;
|
||||
btn_equip_go.gameObject.SetActive(!isEquiped && !data.isLock);
|
||||
equipped.SetActive(isEquiped);
|
||||
if (data.isLock)
|
||||
{
|
||||
int fragment = GContext.container.Resolve<PlayerFishData>().GetRodPiece(curRodAscend.FragmentID);
|
||||
int rquiredFragments = curRodAscend.AscentTransformed[0];
|
||||
bool isCombine = fragment >= rquiredFragments;
|
||||
if (isCombine)
|
||||
{
|
||||
Item item = _tables.TbItem.GetOrDefault(curRodAscend.FragmentID);
|
||||
icon_ticket_combine.sprite = uIService.GetSprite(item.Icon);
|
||||
icon_cost_num_combine.text = $"{fragment}/{rquiredFragments}";
|
||||
}
|
||||
btn_waytoget_go.SetActive(!isCombine);
|
||||
btn_combine_go.SetActive(isCombine);
|
||||
}
|
||||
else
|
||||
{
|
||||
btn_waytoget_go.SetActive(false);
|
||||
btn_combine_go.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
foreach (var item in rodAvatar)
|
||||
{
|
||||
Destroy(item.Value);
|
||||
}
|
||||
for (int i = 0; i < rodPrefab.Count; i++)
|
||||
{
|
||||
Addressables.Release(rodPrefab[i]);
|
||||
}
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingRodInfoPanel);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/FishingRodPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/FishingRodPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e70522488d7aca64292830c4271589d1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
306
Assets/Scripts/UI/Rod/FishingRodPanel_Ascend.cs
Normal file
306
Assets/Scripts/UI/Rod/FishingRodPanel_Ascend.cs
Normal file
@@ -0,0 +1,306 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public partial class FishingRodPanel : BasePanel
|
||||
{
|
||||
[Header("升阶")]
|
||||
public GameObject perks;
|
||||
public Perk perk_before;
|
||||
public Button btn_perk_before;
|
||||
public Perk perk_after;
|
||||
public Button btn_perk_after;
|
||||
|
||||
RodAttributeInfoRoot ascendRodAttribute;
|
||||
public RodAttributeInfo lvInfo;
|
||||
List<int> ascend_upIndexList = new List<int>();
|
||||
Button ascend_btn_upgrade;
|
||||
Button ascend_btn_upgrade_gray;
|
||||
|
||||
GameObject ascend_cost;
|
||||
GameObject icon_cost_1;
|
||||
TMP_Text icon_cost_1_num;
|
||||
TMP_Text icon_cost_2_num;
|
||||
Image icon_ticket_1;
|
||||
Image icon_ticket_2;
|
||||
int perkIndex;
|
||||
void InitAscendUpPanel()
|
||||
{
|
||||
ascendRodAttribute = AscendRoot.Find("level_info/attribute").GetComponent<RodAttributeInfoRoot>();
|
||||
ascend_btn_upgrade = AscendRoot.Find("btn_all/btn_levelup/btn_green").GetComponent<Button>();
|
||||
ascend_btn_upgrade_gray = AscendRoot.Find("btn_all/btn_levelup_gray/btn_green").GetComponent<Button>();
|
||||
|
||||
ascend_cost = AscendRoot.Find("cost").gameObject;
|
||||
icon_cost_1 = ascend_cost.transform.Find("icon_cost_1").gameObject;
|
||||
icon_cost_1_num = ascend_cost.transform.Find("icon_cost_1/text_num").GetComponent<TMP_Text>();
|
||||
icon_cost_2_num = ascend_cost.transform.Find("icon_cost_2/text_num").GetComponent<TMP_Text>();
|
||||
icon_ticket_1 = ascend_cost.transform.Find("icon_cost_1/icon_ticket").GetComponent<Image>();
|
||||
icon_ticket_2 = ascend_cost.transform.Find("icon_cost_2/icon_ticket").GetComponent<Image>();
|
||||
|
||||
|
||||
ascend_btn_upgrade.onClick.AddListener(OnClickAscendUp);
|
||||
ascend_btn_upgrade_gray.onClick.AddListener(OnClickAscendGray);
|
||||
|
||||
var rodBasicStats = _tables.TbRodBasicStats.DataList;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
ascendRodAttribute.rodAttributes[i].icon.sprite = uIService.GetSprite(rodBasicStats[i].Icon);
|
||||
ascendRodAttribute.rodAttributes[i].text_name.text = LocalizationMgr.GetText(rodBasicStats[i].Title_l10n_key);
|
||||
int index = i;
|
||||
Button btn = ascendRodAttribute.rodAttributes[i].btn;
|
||||
btn.onClick.AddListener(() =>
|
||||
{
|
||||
ShowAttributes(index, btn.transform);
|
||||
});
|
||||
}
|
||||
|
||||
btn_perk_before.onClick.AddListener(() =>
|
||||
{
|
||||
ShowPerk(perkIndex, btn_perk_before.transform, 0);
|
||||
});
|
||||
btn_perk_after.onClick.AddListener(() =>
|
||||
{
|
||||
ShowPerk(perkIndex, btn_perk_after.transform, 1);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void OpenAscendRoot()
|
||||
{
|
||||
InitAscend();
|
||||
}
|
||||
|
||||
|
||||
void OnClickAscendGray()
|
||||
{
|
||||
GContext.Publish(new VibrationData(HapticTypes.Failure));
|
||||
|
||||
//提示材料不足
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_66"));
|
||||
}
|
||||
void OnClickAscendUp()
|
||||
{
|
||||
if (data.isMax)
|
||||
{
|
||||
ShowAscendRoot(false);
|
||||
return;
|
||||
}
|
||||
OnClickUpgrade();
|
||||
ShowFishingRodAscendPopupPanel();
|
||||
SetAscend();
|
||||
}
|
||||
|
||||
public void OnClickUpgrade()
|
||||
{
|
||||
RodAscend _rodAscend = _tables.TbRodAscend.GetOrDefault(data.config.AscendID);
|
||||
bool isLock = playerFishData.NotRod(data.config.ID);
|
||||
//消耗材料升级
|
||||
|
||||
GContext.Publish(new VibrationData(HapticTypes.Selection));
|
||||
|
||||
playerFishData.AscendRod(data.config.ID);
|
||||
int star = playerFishData.GetRodPiece(data.config.ID);
|
||||
if (isLock)
|
||||
{
|
||||
data.isLock = false;
|
||||
}
|
||||
bool isMax = star >= _rodAscend.MaxAscent;
|
||||
data.star = star;
|
||||
data.isMax = isMax;
|
||||
SetLevelStar();
|
||||
SetPanelData();
|
||||
//鱼竿权益积分飞入
|
||||
//PlayUpAni();
|
||||
}
|
||||
async void ShowFishingRodAscendPopupPanel()
|
||||
{
|
||||
GameObject go = await UIManager.Instance.ShowUI(new UIType("FishingRodAscendPopupPanel"));
|
||||
if (go != null)
|
||||
{
|
||||
var panel = go.GetComponent<FishingRodAscendPopupPanel>();
|
||||
panel.SetCurData(data, perk_before.bg.sprite);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Failed to open FishingRodAscendPopupPanel");
|
||||
}
|
||||
}
|
||||
void InitAscend()
|
||||
{
|
||||
ascend_upIndexList.Clear();
|
||||
RodData rodData = data.config;
|
||||
curRodAscend = _tables.TbRodAscend.GetOrDefault(rodData.AscendID);
|
||||
|
||||
Item item = _tables.TbItem.GetOrDefault(curRodAscend.FragmentID);
|
||||
icon_ticket_2.sprite = uIService.GetSprite(item.Icon);
|
||||
RodFragmentExchange rodFragmentExchange = _tables.TbRodFragmentExchange.GetOrDefault(data.config.Quality);
|
||||
if (rodFragmentExchange != null)
|
||||
{
|
||||
item = _tables.TbItem.GetOrDefault(rodFragmentExchange.GeneralFragmentID);
|
||||
icon_ticket_1.sprite = uIService.GetSprite(item.Icon);
|
||||
}
|
||||
|
||||
SetAscend();
|
||||
}
|
||||
|
||||
void SetEP(int star)
|
||||
{
|
||||
int perkIDListCount = curRodAscend.PerkIDList.Count;
|
||||
var perkUnlockOrder = curRodAscend.PerkUnlockOrder;
|
||||
|
||||
int[] lv = playerFishData.GetPerkLevel(perkIDListCount, star, curRodAscend.DefaultPerk, perkUnlockOrder);
|
||||
|
||||
//要升下一级箭头提示
|
||||
perkIndex = -1;
|
||||
if (star < perkUnlockOrder.Count)
|
||||
{
|
||||
perkIndex = perkUnlockOrder[star] - 1;
|
||||
perks.SetActive(true);
|
||||
|
||||
perk_before.SetData(curRodAscend.PerkIDList[perkIndex], lv[perkIndex], config.Quality);
|
||||
perk_after.SetData(curRodAscend.PerkIDList[perkIndex], lv[perkIndex] + 1, config.Quality);
|
||||
}
|
||||
else
|
||||
{
|
||||
perks.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
int ShowCost(int rquiredFragments)
|
||||
{
|
||||
RodFragmentExchange rodFragmentExchange = _tables.TbRodFragmentExchange.GetOrDefault(data.config.Quality);
|
||||
int fragment = GContext.container.Resolve<PlayerFishData>().GetRodPiece(rodFragmentExchange.GeneralFragmentID) / rodFragmentExchange.ExchangeRate;
|
||||
if (fragment == 0)
|
||||
{
|
||||
icon_cost_1.SetActive(false);
|
||||
return rquiredFragments;
|
||||
}
|
||||
int count;
|
||||
if (fragment >= rquiredFragments)
|
||||
{
|
||||
count = rquiredFragments * rodFragmentExchange.ExchangeRate;
|
||||
}
|
||||
else
|
||||
{
|
||||
count = fragment * rodFragmentExchange.ExchangeRate;
|
||||
}
|
||||
icon_cost_1_num.text = $"<color=green>{count}</color>/{count}";
|
||||
return rquiredFragments - fragment;
|
||||
}
|
||||
|
||||
void SetAscendCost(int star)
|
||||
{
|
||||
bool isUp = false;
|
||||
int fragment = GContext.container.Resolve<PlayerFishData>().GetRodPiece(curRodAscend.FragmentID);
|
||||
int rquiredFragments = curRodAscend.AscentTransformed[star + 1];
|
||||
|
||||
if (fragment < rquiredFragments)
|
||||
{
|
||||
icon_cost_1.SetActive(true);
|
||||
rquiredFragments -= fragment;
|
||||
rquiredFragments = ShowCost(rquiredFragments);
|
||||
if (rquiredFragments <= 0)
|
||||
{
|
||||
isUp = true;
|
||||
icon_cost_2_num.text = $"<color=green>{fragment} </color>/{fragment}";
|
||||
}
|
||||
else
|
||||
{
|
||||
icon_cost_2_num.text = $"<color=red>{fragment}</color>/{fragment + rquiredFragments}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
icon_cost_2_num.text = $"<color=green>{fragment} </color>/{rquiredFragments}";
|
||||
isUp = true;
|
||||
icon_cost_1.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
ascend_btn_upgrade.gameObject.SetActive(isUp);
|
||||
ascend_btn_upgrade_gray.gameObject.SetActive(!isUp);
|
||||
}
|
||||
void SetAscend()
|
||||
{
|
||||
RodData rodData = data.config;
|
||||
int star = GContext.container.Resolve<PlayerFishData>().GetRodPiece(rodData.ID);
|
||||
|
||||
ascend_cost.SetActive(!data.isMax);
|
||||
ascend_upIndexList.Clear();
|
||||
SetEP(star);
|
||||
|
||||
if (!data.isMax)
|
||||
{
|
||||
SetAscendCost(star);
|
||||
var values = GContext.container.Resolve<PlayerFishData>().GetRodAttribute(rodData.ID);
|
||||
var values2 = GContext.container.Resolve<PlayerFishData>().GetRodAttribute(rodData.ID, starAdd: 1);
|
||||
|
||||
for (int i = 0; i < values.Count; i++)
|
||||
{
|
||||
RodAttributeInfo rodAttribute = ascendRodAttribute.rodAttributes[i];
|
||||
var curValue = values[i];
|
||||
|
||||
rodAttribute.text_num.text = curValue.ToString();
|
||||
var nextValue = values2[i];
|
||||
|
||||
if (curValue != nextValue)
|
||||
{
|
||||
rodAttribute.text_after.text = nextValue.ToString();
|
||||
rodAttribute.text_after.gameObject.SetActive(true);
|
||||
rodAttribute.arrow.gameObject.SetActive(true);
|
||||
ascend_upIndexList.Add(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
rodAttribute.text_after.gameObject.SetActive(false);
|
||||
rodAttribute.arrow.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ascend_btn_upgrade.gameObject.SetActive(true);
|
||||
ascend_btn_upgrade_gray.gameObject.SetActive(false);
|
||||
var values = GContext.container.Resolve<PlayerFishData>().GetRodAttribute(rodData.ID);
|
||||
for (int i = 0; i < values.Count; i++)
|
||||
{
|
||||
var curValue = values[i];
|
||||
|
||||
RodAttributeInfo rodAttribute = ascendRodAttribute.rodAttributes[i];
|
||||
rodAttribute.text_num.text = curValue.ToString();
|
||||
rodAttribute.text_after.gameObject.SetActive(false);
|
||||
rodAttribute.arrow.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
SetLevelShow(star);
|
||||
}
|
||||
void SetLevelShow(int star)
|
||||
{
|
||||
RodLevelup rodLevelup = _tables.TbRodLevelup.GetOrDefault(data.config.LevelupID);
|
||||
List<int> Millestones = rodLevelup.Millestones;
|
||||
if (star >= Millestones.Count)
|
||||
{
|
||||
lvInfo.text_num.text = Millestones[Millestones.Count - 1].ToString();
|
||||
lvInfo.text_after.gameObject.SetActive(false);
|
||||
lvInfo.arrow.gameObject.SetActive(false);
|
||||
}
|
||||
else if (star == Millestones.Count - 1)
|
||||
{
|
||||
lvInfo.text_num.text = Millestones[star].ToString();
|
||||
lvInfo.text_after.text = rodLevelup.MaxLevel.ToString();
|
||||
lvInfo.text_after.gameObject.SetActive(true);
|
||||
lvInfo.arrow.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
lvInfo.text_num.text = Millestones[star].ToString();
|
||||
lvInfo.text_after.text = Millestones[star + 1].ToString();
|
||||
lvInfo.text_after.gameObject.SetActive(true);
|
||||
lvInfo.arrow.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/FishingRodPanel_Ascend.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/FishingRodPanel_Ascend.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e97d6543cdba2e449fbfdf82e9e04e9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
395
Assets/Scripts/UI/Rod/FishingRodPanel_Level.cs
Normal file
395
Assets/Scripts/UI/Rod/FishingRodPanel_Level.cs
Normal file
@@ -0,0 +1,395 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public partial class FishingRodPanel : BasePanel
|
||||
{
|
||||
|
||||
private readonly List<Perk> _levelPerkList = new List<Perk>();
|
||||
List<Button> level_peark_btns = new List<Button>();
|
||||
Image title_image;
|
||||
TMP_Text text_name;
|
||||
|
||||
StarItemRoot starItemRoot;
|
||||
Button btn_review;
|
||||
Button btn_appearance;
|
||||
Button btn_change_right;
|
||||
Button btn_change_left;
|
||||
|
||||
GameObject btn_equip_go;
|
||||
GameObject equipped;
|
||||
GameObject btn_levelup_gray;
|
||||
GameObject btn_levelup;
|
||||
GameObject btn_promote_go;
|
||||
GameObject btn_waytoget_go;
|
||||
GameObject btn_combine_go;
|
||||
|
||||
[Header("升级")]
|
||||
public RodLevelAttributeRoot rodLevelAttributeRoot;
|
||||
public GameObject fx_rodpanel_upgrade_change;
|
||||
Button btn_upgrade;
|
||||
TMP_Text text_bar;
|
||||
Button btn_upgrade_gray;
|
||||
TMP_Text text_bar_gray;
|
||||
Button btn_equip;
|
||||
Button btn_promote;
|
||||
Button btn_waytoget;
|
||||
Button btn_combine;
|
||||
TMP_Text icon_cost_num_combine;
|
||||
Image icon_ticket_combine;
|
||||
Button btn_ascend;
|
||||
GameObject btn_ascend_locked;
|
||||
GameObject btn_ascend_redpoint;
|
||||
GameObject btn_honorlevel;
|
||||
TMP_Text text_honorlevel;
|
||||
GameObject btn_honorlevel_locked;
|
||||
|
||||
TMP_Text text_level;
|
||||
TMP_Text text_tips;
|
||||
|
||||
int requireNum;
|
||||
string toastPanelString;
|
||||
|
||||
|
||||
void InitLevelUpPanel()
|
||||
{
|
||||
text_level = LevelRoot.Find("level_info/perks/level/text_num").GetComponent<TMP_Text>();
|
||||
btn_upgrade = LevelRoot.Find("btn_all/btn_levelup/btn_green").GetComponent<Button>();
|
||||
text_bar = LevelRoot.Find("btn_all/btn_levelup/icon_cost/text_num").GetComponent<TMP_Text>();
|
||||
|
||||
btn_upgrade_gray = LevelRoot.Find("btn_all/btn_levelup_gray/btn_green").GetComponent<Button>();
|
||||
text_bar_gray = LevelRoot.Find("btn_all/btn_levelup_gray/icon_cost/text_num").GetComponent<TMP_Text>();
|
||||
text_tips = LevelRoot.Find("btn_all/btn_levelup_gray/text_tips").GetComponent<TMP_Text>();
|
||||
|
||||
btn_promote = LevelRoot.Find("btn_all/btn_promote/btn_green").GetComponent<Button>();
|
||||
btn_equip = LevelRoot.Find("btn_all/btn_equip/btn_green").GetComponent<Button>();
|
||||
btn_waytoget = LevelRoot.Find("btn_all/btn_waytoget/btn_green").GetComponent<Button>();
|
||||
btn_combine = LevelRoot.Find("btn_all/btn_combine/btn_green").GetComponent<Button>();
|
||||
btn_combine.onClick.AddListener(Combine);
|
||||
btn_upgrade.onClick.AddListener(OnClickLevelUp);
|
||||
btn_upgrade_gray.onClick.AddListener(OnClickUpgradeGray);
|
||||
|
||||
btn_equip.onClick.AddListener(OnClickEquip);
|
||||
//btn_upgrade_info.onClick.AddListener(OnClickUpgrade);
|
||||
|
||||
btn_ascend = LevelRoot.Find("level_info/perks/btn_ascend").GetComponent<Button>();
|
||||
btn_ascend_locked = LevelRoot.Find("level_info/perks/btn_ascend/locked").gameObject;
|
||||
btn_ascend_redpoint = LevelRoot.Find("level_info/perks/btn_ascend/redpoint").gameObject;
|
||||
btn_ascend.onClick.AddListener(OnClickAscend);
|
||||
|
||||
btn_honorlevel = LevelRoot.Find("level_info/perks/btn_honorlevel").gameObject;
|
||||
text_honorlevel = btn_honorlevel.transform.Find("text_level").GetComponent<TMP_Text>();
|
||||
btn_honorlevel_locked = btn_honorlevel.transform.Find("locked").gameObject;
|
||||
|
||||
var rodBasicStats = _tables.TbRodBasicStats.DataList;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
rodLevelAttributeRoot.rodAttributes[i].icon.sprite = uIService.GetSprite(rodBasicStats[i].Icon);
|
||||
int index = i;
|
||||
Button btn = rodLevelAttributeRoot.rodAttributes[i].button;
|
||||
btn.onClick.AddListener(() =>
|
||||
{
|
||||
ShowAttributes(index, btn.transform);
|
||||
});
|
||||
}
|
||||
|
||||
title_image = LevelRoot.Find("star/bg").GetComponent<Image>();
|
||||
text_name = LevelRoot.Find("star/text_name").GetComponent<TMP_Text>();
|
||||
|
||||
starItemRoot = LevelRoot.Find("star").GetComponent<StarItemRoot>();
|
||||
btn_review = LevelRoot.Find("btn_review").GetComponent<Button>();
|
||||
btn_appearance = LevelRoot.Find("btn_appearance").GetComponent<Button>();
|
||||
|
||||
|
||||
btn_change_right = LevelRoot.Find("btn_change_right").GetComponent<Button>();
|
||||
btn_change_left = LevelRoot.Find("btn_change_left").GetComponent<Button>();
|
||||
|
||||
btn_equip_go = LevelRoot.Find("btn_all/btn_equip").gameObject;
|
||||
equipped = LevelRoot.Find("btn_all/btn_equipped").gameObject;
|
||||
btn_levelup = LevelRoot.Find("btn_all/btn_levelup").gameObject;
|
||||
btn_levelup_gray = LevelRoot.Find("btn_all/btn_levelup_gray").gameObject;
|
||||
btn_promote_go = LevelRoot.Find("btn_all/btn_promote").gameObject;
|
||||
btn_waytoget_go = LevelRoot.Find("btn_all/btn_waytoget").gameObject;
|
||||
btn_combine_go = LevelRoot.Find("btn_all/btn_combine").gameObject;
|
||||
icon_cost_num_combine = LevelRoot.Find("btn_all/btn_combine/cost/icon_cost_1/text_num").GetComponent<TMP_Text>();
|
||||
icon_ticket_combine = LevelRoot.Find("btn_all/btn_combine/cost/icon_cost_1/icon_ticket").GetComponent<Image>();
|
||||
|
||||
Transform perks = LevelRoot.Find("level_info/perks");
|
||||
for (int i = 1; i < 5; i++)
|
||||
{
|
||||
_levelPerkList.Add(perks.Find($"perk{i}").GetComponent<Perk>());
|
||||
level_peark_btns.Add(perks.Find($"perk{i}/bg").GetComponent<Button>());
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < level_peark_btns.Count; i++)
|
||||
{
|
||||
int index = i;
|
||||
level_peark_btns[i].onClick.AddListener(() =>
|
||||
{
|
||||
ShowPerk(index, _levelPerkList[index].transform);
|
||||
});
|
||||
}
|
||||
|
||||
btn_change_left.onClick.AddListener(OnClickLeft);
|
||||
btn_change_right.onClick.AddListener(OnClickRight);
|
||||
|
||||
btn_review.onClick.AddListener(ShowFishingRodInfoPanel);
|
||||
btn_appearance.onClick.AddListener(ShowAppearance);
|
||||
btn_promote.onClick.AddListener(ShowHonorlevel);
|
||||
btn_waytoget.onClick.AddListener(ShowWaytoget);
|
||||
}
|
||||
public void Combine()
|
||||
{
|
||||
OnClickUpgrade();
|
||||
//重新生成鱼竿
|
||||
GameObject rodGo = rodAvatar[skin.Fbx];
|
||||
if (rodGo != null)
|
||||
{
|
||||
Destroy(rodGo);
|
||||
}
|
||||
rodAvatar.Remove(skin.Fbx);
|
||||
LoadRodAsync(skin.Fbx);
|
||||
}
|
||||
void ShowWaytoget()
|
||||
{
|
||||
if (GContext.container.Resolve<PlayerShopData>().IsShopOpen)
|
||||
{
|
||||
UIManager.Instance.ShowUI(new UIType("FishingRodWaytogetPopupPanel"));
|
||||
}
|
||||
else
|
||||
{
|
||||
var t = _tables.TbFishingEvent.GetOrDefault(GContext.container.Resolve<PlayerShopData>().shopTipforUnlocked);
|
||||
var param = t.ConditionList[0].Param[0];
|
||||
ToastPanel.Show(LocalizationMgr.GetFormatTextValue("UI_FishingRodPanel_Advanced_45", param));
|
||||
}
|
||||
}
|
||||
async void ShowHonorlevel()
|
||||
{
|
||||
await UIManager.Instance.ShowUI(new UIType("FishingRodHonorlevelPanel"));
|
||||
UIManager.Instance.DestroyUI(gameObject.name);
|
||||
}
|
||||
|
||||
void SetLevelStar()
|
||||
{
|
||||
RodData _rodData = data.config;
|
||||
int star = GContext.container.Resolve<PlayerFishData>().GetRodPiece(_rodData.ID);
|
||||
starItemRoot.SetStar(star, curRodAscend.MaxAscent);
|
||||
}
|
||||
void OnClickLeft()
|
||||
{
|
||||
int index = data.sort;
|
||||
index--;
|
||||
if (index < 0)
|
||||
{
|
||||
index = rodItemDatas.Count - 1;
|
||||
}
|
||||
Debug.Log("OnClickLeft" + index);
|
||||
PlayAni(index);
|
||||
}
|
||||
void OnClickRight()
|
||||
{
|
||||
int index = data.sort;
|
||||
index++;
|
||||
if (index >= rodItemDatas.Count)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
Debug.Log("OnClickRight" + index);
|
||||
PlayAni(index);
|
||||
}
|
||||
void PlayAni(int index)
|
||||
{
|
||||
OnClickItem(rodItemDatas[index]);
|
||||
ani.Play("FishingRodPanel_switch");
|
||||
AnimationState animationState = ani["FishingRodPanel_switch"];
|
||||
// 将动画时间设置为 0,即从头开始
|
||||
animationState.time = 0f;
|
||||
starItemRoot.ShowStar(data.star, curRodAscend.MaxAscent);
|
||||
}
|
||||
void OnClickAscend()
|
||||
{
|
||||
if (data.isLock)
|
||||
{
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_111"));
|
||||
return;
|
||||
}
|
||||
ShowAscendRoot(true);
|
||||
OpenAscendRoot();
|
||||
effect_yugan_shengji.SetActive(false);
|
||||
fx_rodpanel_upgrade_change.SetActive(false);
|
||||
}
|
||||
|
||||
void OnClickEquip()
|
||||
{
|
||||
if (data.config.ID == GContext.container.Resolve<PlayerData>().equipRodID || data.isLock)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (loading.activeSelf)
|
||||
{
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_26"));
|
||||
return;
|
||||
}
|
||||
GContext.container.Resolve<PlayerData>().SetEquipRodID(data.config.ID);
|
||||
btn_equip_go.gameObject.SetActive(false);
|
||||
equipped.SetActive(true);
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_11"));
|
||||
GContext.Publish(new VibrationData(HapticTypes.Success));
|
||||
}
|
||||
|
||||
void OnClickUpgradeGray()
|
||||
{
|
||||
GContext.Publish(new VibrationData(HapticTypes.Failure));
|
||||
|
||||
ToastPanel.Show(toastPanelString);
|
||||
}
|
||||
void OnClickLevelUp()
|
||||
{
|
||||
effect_yugan_shengji.SetActive(false);
|
||||
fx_rodpanel_upgrade_change.SetActive(false);
|
||||
effect_yugan_shengji.SetActive(true);
|
||||
fx_rodpanel_upgrade_change.SetActive(true);
|
||||
data.level++;
|
||||
|
||||
GContext.container.Resolve<PlayerFishData>().RodLevelUp(data.config.ID, requireNum);
|
||||
SetPanelData();
|
||||
}
|
||||
|
||||
void SetLevel()
|
||||
{
|
||||
RodData rodData = data.config;
|
||||
RodLevelup rodLevelup = _tables.TbRodLevelup.GetOrDefault(rodData.LevelupID);
|
||||
bool isMax = rodLevelup.MaxLevel <= data.level;
|
||||
btn_levelup.SetActive(!isMax && !data.isLock);
|
||||
btn_levelup_gray.SetActive(false);
|
||||
|
||||
btn_promote_go.SetActive(isMax);
|
||||
btn_ascend.gameObject.SetActive(!data.isMax);
|
||||
btn_ascend_redpoint.SetActive(!data.isMax && playerFishData.CheckUpgrade(rodData));
|
||||
btn_honorlevel.SetActive(data.isMax);
|
||||
btn_ascend_locked.gameObject.SetActive(data.isLock);
|
||||
btn_honorlevel_locked.gameObject.SetActive(!isMax);
|
||||
|
||||
text_level.text = data.level.ToString();
|
||||
if (!isMax)
|
||||
{
|
||||
var fragment = GContext.container.Resolve<PlayerData>().pearl;
|
||||
requireNum = rodLevelup.LevelupConsume[data.level];
|
||||
string progressText = $"<color=green>{fragment}</color>/{requireNum}";
|
||||
text_bar.text = progressText;
|
||||
var values = playerFishData.GetRodAttribute(rodData.ID);
|
||||
int curValue;
|
||||
for (int i = 0; i < values.Count; i++)
|
||||
{
|
||||
curValue = values[i];
|
||||
|
||||
rodLevelAttributeRoot.rodAttributes[i].value.text = curValue.ToString();
|
||||
}
|
||||
|
||||
int star = playerFishData.GetRodPiece(rodData.ID);
|
||||
|
||||
List<int> Millestones = rodLevelup.Millestones;
|
||||
int maxLevel = data.level + 1;
|
||||
|
||||
for (int i = 0; i < Millestones.Count; i++)
|
||||
{
|
||||
if (i == star)
|
||||
{
|
||||
maxLevel = Millestones[i];
|
||||
}
|
||||
}
|
||||
if (maxLevel <= data.level)
|
||||
{
|
||||
btn_levelup.SetActive(false);
|
||||
btn_levelup_gray.SetActive(!data.isLock);
|
||||
text_bar_gray.transform.parent.gameObject.SetActive(false);
|
||||
text_tips.gameObject.SetActive(true);
|
||||
if (star == 0)
|
||||
{
|
||||
toastPanelString = LocalizationMgr.GetFormatTextValue("UI_ToastPanel_109", star + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
toastPanelString = LocalizationMgr.GetFormatTextValue("UI_ToastPanel_110", star + 1);
|
||||
}
|
||||
text_tips.text = LocalizationMgr.GetFormatTextValue("UI_FishingRodPanel_Advanced_28", star + 1); ;
|
||||
return;
|
||||
}
|
||||
if (fragment < requireNum)
|
||||
{
|
||||
btn_levelup.SetActive(false);
|
||||
btn_levelup_gray.SetActive(!data.isLock);
|
||||
text_bar_gray.transform.parent.gameObject.SetActive(true);
|
||||
text_tips.gameObject.SetActive(false);
|
||||
progressText = $"<color=red>{fragment}</color>/{requireNum}";
|
||||
text_bar_gray.text = progressText;
|
||||
toastPanelString = LocalizationMgr.GetText("UI_ToastPanel_12");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var values = playerFishData.GetRodAttribute(rodData.ID);
|
||||
for (int i = 0; i < values.Count; i++)
|
||||
{
|
||||
var curValue = values[i];
|
||||
|
||||
rodLevelAttributeRoot.rodAttributes[i].value.text = curValue.ToString();
|
||||
}
|
||||
}
|
||||
SetHonorlevel();
|
||||
}
|
||||
|
||||
void InitPearksData()
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
RodData rodData = data.config;
|
||||
|
||||
int perkIDListCount = curRodAscend.PerkIDList.Count;
|
||||
int star = playerFishData.GetRodPiece(rodData.ID);
|
||||
var perkUnlockOrder = curRodAscend.PerkUnlockOrder;
|
||||
|
||||
int[] lv = playerFishData.GetPerkLevel(perkIDListCount, star, curRodAscend.DefaultPerk, perkUnlockOrder);
|
||||
|
||||
for (int i = 0; i < _levelPerkList.Count; i++)
|
||||
{
|
||||
if (i < perkIDListCount)
|
||||
{
|
||||
_levelPerkList[i].gameObject.SetActive(true);
|
||||
_levelPerkList[i].SetData(curRodAscend.PerkIDList[i], lv[i], config.Quality);
|
||||
}
|
||||
else
|
||||
{
|
||||
_levelPerkList[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* var values = playerFishData.GetHonorLevelAttribute(rodData.Quality);
|
||||
int count = infoRodAttribute.rodAttributes.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (i < values.Count && values[i] > 0)
|
||||
{
|
||||
infoRodAttribute.rodAttributes[i].text_hornor_add.text = $"/+{values[i]}";
|
||||
}
|
||||
else
|
||||
{
|
||||
infoRodAttribute.rodAttributes[i].text_hornor_add.text = "";
|
||||
}
|
||||
}
|
||||
* */
|
||||
void SetHonorlevel()
|
||||
{
|
||||
text_honorlevel.text = playerFishData.GetHonorLevel(data.config.Quality).ToString();
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/FishingRodPanel_Level.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/FishingRodPanel_Level.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15b6e92238eb0754a9b65aa869a010b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
89
Assets/Scripts/UI/Rod/FishingRodRewardPopupPanel.cs
Normal file
89
Assets/Scripts/UI/Rod/FishingRodRewardPopupPanel.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using System.Collections.Generic;
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FishingRodRewardPopupPanel : MonoBehaviour
|
||||
{
|
||||
Button btn_close;
|
||||
Button btn_mask;
|
||||
private TMP_Text textLevel;
|
||||
private TMP_Text text_bar;
|
||||
private Image image_bar;
|
||||
|
||||
private List<RodLevelupStats> dataList;
|
||||
GameObject change;
|
||||
TMP_Text text_num_before;
|
||||
TMP_Text text_num_after;
|
||||
GameObject max;
|
||||
TMP_Text text_num_max;
|
||||
private void Awake()
|
||||
{
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
btn_mask = transform.Find("mask").GetComponent<Button>();
|
||||
textLevel = transform.Find("root/bg_level/text_level").GetComponent<TMP_Text>();
|
||||
text_bar = transform.Find("root/bg_bar/text_bar").GetComponent<TMP_Text>();
|
||||
image_bar = transform.Find("root/bg_bar/bar").GetComponent<Image>();
|
||||
change = transform.Find("root/enhace/change").gameObject;
|
||||
text_num_before = transform.Find("root/enhace/change/text_num_before").GetComponent<TMP_Text>();
|
||||
text_num_after = transform.Find("root/enhace/change/text_num_after").GetComponent<TMP_Text>();
|
||||
max = transform.Find("root/enhace/max").gameObject;
|
||||
text_num_max = transform.Find("root/enhace/max/text_num_max").GetComponent<TMP_Text>();
|
||||
dataList = GContext.container.Resolve<Tables>().TbRodLevelupStats.DataList;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
btn_close.onClick.AddListener(() => { UIManager.Instance.HideUI(UITypes.FishingRodRewardPopupPanel); });
|
||||
btn_mask.onClick.AddListener(() => { UIManager.Instance.HideUI(UITypes.FishingRodRewardPopupPanel); });
|
||||
}
|
||||
void SetScore()
|
||||
{
|
||||
int allScore = GContext.container.Resolve<PlayerFishData>().GetRodAllScore();
|
||||
|
||||
int count = dataList.Count;
|
||||
var data = dataList[^1];
|
||||
int level = count;
|
||||
float PointBonus = 0;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (allScore < dataList[i].Count)
|
||||
{
|
||||
data = dataList[i];
|
||||
level = i;
|
||||
break;
|
||||
}
|
||||
PointBonus += dataList[i].PointBonus;
|
||||
}
|
||||
|
||||
text_num_before.text = PointBonus.ToPercentageString();
|
||||
change.gameObject.SetActive(level != count);
|
||||
max.gameObject.SetActive(level == count);
|
||||
textLevel.text = level.ToString();
|
||||
if (level == count)
|
||||
{
|
||||
text_bar.text = $"{data.Count}/{data.Count}";
|
||||
image_bar.fillAmount = 1;
|
||||
text_num_max.text = PointBonus.ToPercentageString();
|
||||
}
|
||||
else
|
||||
{
|
||||
text_bar.text = $"{allScore}/{data.Count}";
|
||||
image_bar.fillAmount = (float)allScore / data.Count;
|
||||
text_num_after.text = (PointBonus + data.PointBonus).ToPercentageString();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
SetScore();
|
||||
GContext.Publish(new OnEventTriggerGuide(GetType().Name));
|
||||
}
|
||||
private void OnDisable()
|
||||
{
|
||||
GContext.Publish(new OnEventTriggerGuide(GetType().Name));
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/FishingRodRewardPopupPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/FishingRodRewardPopupPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24df457f4ab2e1b40b81c05fdca08e8d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,55 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FishingRodRewardSettlementPopupPanel : MonoBehaviour
|
||||
{
|
||||
TMP_Text level_text_num_before;
|
||||
TMP_Text level_text_num_after;
|
||||
|
||||
TMP_Text text_num_before;
|
||||
TMP_Text text_num_after;
|
||||
Button btn_close;
|
||||
private void Awake()
|
||||
{
|
||||
level_text_num_before = transform.Find("root/bg_title/leve_change/text_num_before").GetComponent<TMP_Text>();
|
||||
level_text_num_after = transform.Find("root/bg_title/leve_change/text_num_after").GetComponent<TMP_Text>();
|
||||
text_num_before = transform.Find("root/bg_info/change/text_num_before").GetComponent<TMP_Text>();
|
||||
text_num_after = transform.Find("root/bg_info/change/text_num_after").GetComponent<TMP_Text>();
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_close.onClick.AddListener(() => { UIManager.Instance.DestroyUI(UITypes.FishingRodRewardSettlementPopupPanel); });
|
||||
}
|
||||
public void Show(int oldLevel)
|
||||
{
|
||||
int allScore = GContext.container.Resolve<PlayerFishData>().GetRodAllScore();
|
||||
var dataList = GContext.container.Resolve<Tables>().TbRodLevelupStats.DataList;
|
||||
int count = dataList.Count;
|
||||
int level = count;
|
||||
float PointBonus = 0;
|
||||
float oldPointBonus = 0;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (allScore < dataList[i].Count)
|
||||
{
|
||||
level = i;
|
||||
break;
|
||||
}
|
||||
PointBonus += dataList[i].PointBonus;
|
||||
if (i < oldLevel)
|
||||
{
|
||||
oldPointBonus += dataList[i].PointBonus;
|
||||
}
|
||||
}
|
||||
|
||||
text_num_before.text = oldPointBonus.ToPercentageString();
|
||||
text_num_after.text = PointBonus.ToPercentageString();
|
||||
level_text_num_before.text = oldLevel.ToString();
|
||||
level_text_num_after.text = level.ToString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15499a205af6c3745a04daffdc071c6a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
61
Assets/Scripts/UI/Rod/FishingRodWaytogetPopupPanel.cs
Normal file
61
Assets/Scripts/UI/Rod/FishingRodWaytogetPopupPanel.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FishingRodWaytogetPopupPanel : MonoBehaviour
|
||||
{
|
||||
public GameObject[] gameObjects;
|
||||
public Image[] images;
|
||||
public TMP_Text[] tMP_Texts;
|
||||
public Button[] buttons;
|
||||
Button btn_close;
|
||||
FishingRodUpSystem upSystem;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
upSystem = GContext.container.Resolve<FishingRodUpSystem>();
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
for (int i = 0; i < buttons.Length; i++)
|
||||
{
|
||||
buttons[i].onClick.AddListener(OnClickGo);
|
||||
}
|
||||
btn_close.onClick.AddListener(OnClickClose);
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
var data = upSystem.GetCurrentRodItemData();
|
||||
cfg.RodData rodData = data.config;
|
||||
List<int> GetFromFishingBox = rodData.GetFromFishingBox;
|
||||
|
||||
for (int i = 0; i < gameObjects.Length; i++)
|
||||
{
|
||||
if (i < GetFromFishingBox.Count)
|
||||
{
|
||||
cfg.Item item = GContext.container.Resolve<Tables>().GetItemData(GetFromFishingBox[i]);
|
||||
tMP_Texts[i].text = LocalizationMgr.GetText(item.Name_l10n_key);
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(images[i], item.Icon, BasePanel.PanelName);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObjects[i].SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
private async void OnClickGo()
|
||||
{
|
||||
await UIManager.Instance.ShowUI(UITypes.FishingShopPanel);
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingRodBagPanel);
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingRodPanel);
|
||||
GContext.Publish(new LackOfResourceConfirmEvent() { state = 1 });
|
||||
OnClickClose();
|
||||
}
|
||||
private void OnClickClose()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(gameObject.name);
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/FishingRodWaytogetPopupPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/FishingRodWaytogetPopupPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19bed55b19755354e9d7931bc1fa3595
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
39
Assets/Scripts/UI/Rod/IconRodRoot.cs
Normal file
39
Assets/Scripts/UI/Rod/IconRodRoot.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class IconRodRoot : MonoBehaviour
|
||||
{
|
||||
public Camera rodCamera;
|
||||
public GameObject[] fx_fishingrods;
|
||||
public RenderTexture rt;
|
||||
//模型存放节点
|
||||
public Transform avatar;
|
||||
private void Awake()
|
||||
{
|
||||
transform.localScale = Vector3.one / transform.lossyScale.x;
|
||||
transform.position = new Vector3(10000, 0, 0);
|
||||
}
|
||||
public void SetRawImage(RawImage rawImageRod)
|
||||
{
|
||||
RectTransform rectTransform = rawImageRod.GetComponent<RectTransform>();
|
||||
rt = new RenderTexture((int)rectTransform.rect.width, (int)rectTransform.rect.height, 24, RenderTextureFormat.ARGB32);
|
||||
rodCamera.targetTexture = rt;
|
||||
rodCamera.Render();
|
||||
float fovRad = 30 * Mathf.Deg2Rad;
|
||||
float aspectRatio = Screen.width / (float)Screen.height;
|
||||
aspectRatio = Mathf.Clamp(aspectRatio, 0, 0.5625f) * 2340 / 1080;
|
||||
rodCamera.fieldOfView = 2 * Mathf.Atan(Mathf.Tan(fovRad) * aspectRatio) * Mathf.Rad2Deg;
|
||||
rawImageRod.texture = rt;
|
||||
rawImageRod.gameObject.SetActive(true);
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
rodCamera.targetTexture = null;
|
||||
if (rt != null)
|
||||
{
|
||||
rt.Release();
|
||||
Destroy(rt);
|
||||
rt = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/IconRodRoot.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/IconRodRoot.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6fce2675262f1941a1fca0397a98dab
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
17
Assets/Scripts/UI/Rod/LevelAttribute.cs
Normal file
17
Assets/Scripts/UI/Rod/LevelAttribute.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LevelAttribute : MonoBehaviour
|
||||
{
|
||||
public Image icon;
|
||||
public TMP_Text value;
|
||||
public Button button;
|
||||
private void Reset()
|
||||
{
|
||||
icon = transform.Find("text_num/icon").GetComponent<Image>();
|
||||
value = transform.Find("text_num").GetComponent<TMP_Text>();
|
||||
button = transform.Find("text_num/icon").GetComponent<Button>();
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/LevelAttribute.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/LevelAttribute.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3be0d34b5df5e6842bb63aa43f689a26
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
46
Assets/Scripts/UI/Rod/PeakItem.cs
Normal file
46
Assets/Scripts/UI/Rod/PeakItem.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using GameCore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
class PeakItem : PanelItemBase<PeakItemData>
|
||||
{
|
||||
public Button btn_item;
|
||||
public Perk perk;
|
||||
private void Awake()
|
||||
{
|
||||
btn_item = transform.GetComponent<Button>();
|
||||
perk = transform.GetComponent<Perk>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_item.onClick.AddListener(OnBtnItem);
|
||||
}
|
||||
|
||||
|
||||
public override void OnInit()
|
||||
{
|
||||
transform.localScale = Vector3.one * 0.75f;
|
||||
|
||||
}
|
||||
|
||||
public override void OffsetX(float _offsetX, float width)
|
||||
{
|
||||
transform.localScale = Vector3.one * Mathf.Clamp(1 - Mathf.Abs(_offsetX) / width * 0.2f, 0.75f, 1);
|
||||
float offset;
|
||||
if (transform.localScale.x < 0.8f)
|
||||
{
|
||||
offset = (0.8f - transform.localScale.x) * width * 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
transform.GetChild(0).localPosition = _offsetX > 0 ? Vector3.left * offset : Vector3.right * offset;
|
||||
}
|
||||
}
|
||||
|
||||
public class PeakItemData
|
||||
{
|
||||
public int id;
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/PeakItem.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/PeakItem.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9795c7b40dfb77c46bc12c00bbb15f57
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
57
Assets/Scripts/UI/Rod/Perk.cs
Normal file
57
Assets/Scripts/UI/Rod/Perk.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Perk : MonoBehaviour
|
||||
{
|
||||
public Image bg;
|
||||
public Image icon;
|
||||
public GameObject lockIcon;
|
||||
public TMP_Text text_level;
|
||||
public TMP_Text text_lock;
|
||||
public Transform kuang_duel;
|
||||
public Transform tag_duel;
|
||||
public TMP_Text perk_text_name;
|
||||
public static string[] peak_bg = { "sp_rod_buff_white", "sp_rod_buff_blue", "sp_rod_buff_purple", "sp_rod_buff_yellow", "sp_rod_buff_yellow" };
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
bg = transform.Find("bg").GetComponent<Image>();
|
||||
icon = transform.Find("bg/icon").GetComponent<Image>();
|
||||
text_level = transform.Find("bg/text_level").GetComponent<TMP_Text>();
|
||||
text_lock = transform.Find("empty/text_lock").GetComponent<TMP_Text>();
|
||||
lockIcon = transform.Find("empty").gameObject;
|
||||
}
|
||||
|
||||
public void SetData(int id, int level, int quality)
|
||||
{
|
||||
text_level.gameObject.SetActive(level > 0);
|
||||
lockIcon.SetActive(level == 0);
|
||||
text_level.text = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePopupPanel_1", level);
|
||||
RodAscendPerk data = GContext.container.Resolve<Tables>().TbRodAscendPerk.GetOrDefault(id);
|
||||
if (data == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string peakBgName = peak_bg[quality - 1];
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(bg, peakBgName, BasePanel.PanelName);
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(icon, data.Icon, BasePanel.PanelName);
|
||||
kuang_duel = transform.Find("bg/kuang_duel");
|
||||
tag_duel = transform.Find("bg/tag_duel");
|
||||
if (kuang_duel != null)
|
||||
{
|
||||
kuang_duel.gameObject.SetActive(data.DuelPerk);
|
||||
}
|
||||
if (tag_duel != null)
|
||||
{
|
||||
tag_duel.gameObject.SetActive(data.DuelPerk);
|
||||
}
|
||||
if (perk_text_name != null)
|
||||
{
|
||||
perk_text_name.text = LocalizationMgr.GetText(data.Title_l10n_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/Perk.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/Perk.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71b0d07248558fd4a91a368a5673ee70
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
147
Assets/Scripts/UI/Rod/ReviewNewRod.cs
Normal file
147
Assets/Scripts/UI/Rod/ReviewNewRod.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using game;
|
||||
using GameCore;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ReviewNewRod : MonoBehaviour
|
||||
{
|
||||
Tables _tables;
|
||||
IUIService uIService;
|
||||
//PlayerFishData playerFishData;
|
||||
RodAscend curRodAscend;
|
||||
RodData config;
|
||||
Image icon_tag;
|
||||
Image title_image;
|
||||
TMP_Text text_name;
|
||||
|
||||
string[] sp_rod_title = { "sp_rod_title_blue", "sp_rod_title_blue", "sp_rod_title_purple", "sp_rod_title_yellow" };
|
||||
|
||||
Button nextButton;
|
||||
Button btn_equip;
|
||||
List<Button> peark_btns = new List<Button>();
|
||||
private readonly List<Perk> _perkList = new List<Perk>();
|
||||
Action NextNewRod;
|
||||
private void Awake()
|
||||
{
|
||||
uIService = GContext.container.Resolve<IUIService>();
|
||||
_tables = GContext.container.Resolve<Tables>();
|
||||
nextButton = transform.Find("nextButton").GetComponent<Button>();
|
||||
btn_equip = transform.Find("btn_equip/btn_green").GetComponent<Button>();
|
||||
//playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||||
title_image = transform.Find("bg_name").GetComponent<Image>();
|
||||
icon_tag = transform.Find("text_name/icon_tag").GetComponent<Image>();
|
||||
text_name = transform.Find("text_name").GetComponent<TMP_Text>();
|
||||
Transform perks = transform.Find("pearks");
|
||||
int count = perks.childCount;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
_perkList.Add(perks.GetChild(i).GetComponent<Perk>());
|
||||
peark_btns.Add(perks.GetChild(i).Find("bg").GetComponent<Button>());
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
for (int i = 0; i < peark_btns.Count; i++)
|
||||
{
|
||||
int index = i;
|
||||
peark_btns[i].onClick.AddListener(() =>
|
||||
{
|
||||
ShowPeark(index);
|
||||
});
|
||||
}
|
||||
nextButton.onClick.AddListener(ClickNextNewRod);
|
||||
btn_equip.onClick.AddListener(OnClickEquip);
|
||||
}
|
||||
void ClickNextNewRod()
|
||||
{
|
||||
if (NextNewRod != null)
|
||||
{
|
||||
NextNewRod?.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingAppearancePanel);
|
||||
}
|
||||
}
|
||||
|
||||
async void ShowPeark(int index)
|
||||
{
|
||||
item_tips _item_tips = await item_tips.Show();
|
||||
if (_item_tips == null /*|| trans.gameObject.GetInstanceID() == _item_tips.clickInstanceID*/)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_item_tips.ShowPerk(config.ID, index, peark_btns[index].transform.position);
|
||||
}
|
||||
|
||||
public void SetCurData(RodData config, Action nextNewRod)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
NextNewRod = nextNewRod;
|
||||
SetCurData(config);
|
||||
}
|
||||
|
||||
|
||||
public void SetCurData(RodData config)
|
||||
{
|
||||
StartCoroutine(ShowNextButton());
|
||||
this.config = config;
|
||||
curRodAscend = _tables.TbRodAscend.GetOrDefault(config.AscendID);
|
||||
|
||||
//int skindID = playerFishData.GetRodSkin(config.ID);
|
||||
RodSkinData fishRodSkinData = _tables.TbRodSkinData.GetOrDefault(config.ID);
|
||||
if (fishRodSkinData != null)
|
||||
{
|
||||
text_name.text = LocalizationMgr.GetText(fishRodSkinData.Name_l10n_key);
|
||||
}
|
||||
uIService.SetImageSprite(title_image, sp_rod_title[config.Quality - 1], BasePanel.PanelName);
|
||||
|
||||
uIService.SetImageSprite(icon_tag, $"icon_rod_tag_{config.Quality - 1}", BasePanel.PanelName);
|
||||
InitPearksData();
|
||||
}
|
||||
|
||||
IEnumerator ShowNextButton()
|
||||
{
|
||||
nextButton.gameObject.SetActive(false);
|
||||
yield return new WaitForSeconds(1);
|
||||
nextButton.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
void InitPearksData()
|
||||
{
|
||||
PlayerFishData playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||||
int perkIDListCount = curRodAscend.PerkIDList.Count;
|
||||
int star = playerFishData.GetRodPiece(config.ID);
|
||||
var perkUnlockOrder = curRodAscend.PerkUnlockOrder;
|
||||
int[] lv = playerFishData.GetPerkLevel(perkIDListCount, star, curRodAscend.DefaultPerk, perkUnlockOrder);
|
||||
|
||||
for (int i = 0; i < _perkList.Count; i++)
|
||||
{
|
||||
if (i < perkIDListCount)
|
||||
{
|
||||
_perkList[i].gameObject.SetActive(true);
|
||||
_perkList[i].SetData(curRodAscend.PerkIDList[i], lv[i], config.Quality);
|
||||
}
|
||||
else
|
||||
{
|
||||
_perkList[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async void OnClickEquip()
|
||||
{
|
||||
GContext.container.Resolve<PlayerFishData>().RodSelectedInPack = config.ID;
|
||||
await UIManager.Instance.ShowUI(UITypes.FishingRodBagPanel);
|
||||
GContext.Publish(new ShowData(RewardType.Destroy));
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingAppearancePanel);
|
||||
GContext.container.Resolve<PlayerFishData>().RodSelectedInPack = 0;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/ReviewNewRod.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/ReviewNewRod.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f319530095f4fa04fb0cf6abe5cedd66
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
23
Assets/Scripts/UI/Rod/RodAttributeInfo.cs
Normal file
23
Assets/Scripts/UI/Rod/RodAttributeInfo.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RodAttributeInfo : MonoBehaviour
|
||||
{
|
||||
public Image icon;
|
||||
public TMP_Text text_name;
|
||||
public TMP_Text text_num;
|
||||
public GameObject arrow;
|
||||
public TMP_Text text_after;
|
||||
public Button btn;
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
icon = transform.Find("icon").GetComponent<Image>();
|
||||
btn = icon.GetComponent<Button>();
|
||||
text_name = transform.Find("text_attribute").GetComponent<TMP_Text>();
|
||||
text_num = transform.Find("num/text_num").GetComponent<TMP_Text>();
|
||||
arrow = transform.Find("num/arrow")?.gameObject;
|
||||
text_after = transform.Find("num/text_after")?.GetComponent<TMP_Text>();
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/RodAttributeInfo.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/RodAttributeInfo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68b24021d9217d04f9c52da55f56747c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
7
Assets/Scripts/UI/Rod/RodAttributeInfoRoot.cs
Normal file
7
Assets/Scripts/UI/Rod/RodAttributeInfoRoot.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class RodAttributeInfoRoot : MonoBehaviour
|
||||
{
|
||||
public List<RodAttributeInfo> rodAttributes = new List<RodAttributeInfo>();
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/RodAttributeInfoRoot.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/RodAttributeInfoRoot.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c7714662b29081449b0549cdede1868
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/UI/Rod/RodBag.meta
Normal file
8
Assets/Scripts/UI/Rod/RodBag.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f80f406b4bfdd1478f868972f8b9548
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
206
Assets/Scripts/UI/Rod/RodBag/FishingRodBagPanel.cs
Normal file
206
Assets/Scripts/UI/Rod/RodBag/FishingRodBagPanel.cs
Normal file
@@ -0,0 +1,206 @@
|
||||
using asap.core;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using DG.Tweening;
|
||||
public class AvatarEvent
|
||||
{
|
||||
public Transform avatar;
|
||||
public GameObject[] fx_fishingrods;
|
||||
public RenderTexture rt;
|
||||
}
|
||||
public class FishingRodBagPanel : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
List<TMP_Text> text_num;
|
||||
Button btn_close;
|
||||
GameObject item;
|
||||
Transform Content;
|
||||
List<RodBagItem> rodItems = new List<RodBagItem>();
|
||||
private RodBagItem currentEqRodItem;
|
||||
PlayerFishData playerFishData;
|
||||
IDisposable disposable;
|
||||
FishingRodUpSystem upSystem;
|
||||
Transform guidance;
|
||||
RodBagImprove rodBagImprove;
|
||||
|
||||
public AnimationCurve easeCurve;
|
||||
public AnimationCurve FadeEaseCurve;
|
||||
[SerializeField]
|
||||
private CanvasGroup cg;
|
||||
public IconRodRoot iconRod;
|
||||
public RawImage rawImageRod;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
GContext.container.Unregister<FishingRodUpSystem>();
|
||||
upSystem = new FishingRodUpSystem();
|
||||
UIManager.Instance.panelStack.Push(UITypes.FishingRodBagPanel);
|
||||
GContext.container.RegisterInstance(upSystem);
|
||||
btn_close = transform.Find("bottom/btn_close").GetComponent<Button>();
|
||||
Content = transform.Find("root/ScrollView/Viewport/Content");
|
||||
item = transform.Find("root/ScrollView/Viewport/Content/Item").gameObject;
|
||||
item.SetActive(false);
|
||||
playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||||
disposable = upSystem.Subscribe<RefreshRodBagEvent>(Refresh);
|
||||
guidance = transform.Find("root/Guidance");
|
||||
rodBagImprove = transform.Find("root/benifit").GetComponent<RodBagImprove>();
|
||||
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
iconRod.SetRawImage(rawImageRod);
|
||||
|
||||
AvatarEvent avatarEvent = new AvatarEvent();
|
||||
avatarEvent.avatar = iconRod.avatar;
|
||||
avatarEvent.fx_fishingrods = iconRod.fx_fishingrods;
|
||||
avatarEvent.rt = iconRod.rt;
|
||||
upSystem.bagPanel = avatarEvent;
|
||||
GContext.Publish(new InGradeAquariumEvent());
|
||||
|
||||
GContext.Publish(new HideHomePanelEvent());
|
||||
btn_close.onClick.AddListener(async () =>
|
||||
{
|
||||
if (UIManager.Instance.panelStack.Count > 0)
|
||||
{
|
||||
UIManager.Instance.panelStack.Pop();
|
||||
}
|
||||
if (UIManager.Instance.panelStack.Count > 0)
|
||||
{
|
||||
UIType topUI = UIManager.Instance.panelStack.Pop();
|
||||
await UIManager.Instance.ShowUI(topUI);
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingRodBagPanel);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingRodBagPanel);
|
||||
GContext.Publish(new RestartShowHomeUIEvent());
|
||||
}
|
||||
GContext.Publish(new ActChangeRodDataEvent(currentEqRodItem.data.config.ID));
|
||||
});
|
||||
InitRodList();
|
||||
SetSelect();
|
||||
}
|
||||
/// <summary>
|
||||
/// 新手引导,但现在没有选中态,延时选中
|
||||
/// </summary>
|
||||
async void SetSelect()
|
||||
{
|
||||
int index = currentEqRodItem.data.sort;
|
||||
GuideDataCenter guideDataCenter = GContext.container.Resolve<GuideDataCenter>();
|
||||
bool isGuide = guideDataCenter.InspectTriggerGuide("FishingRodBagPanel");
|
||||
RodItemData rodItemData;
|
||||
int shopSelectId = playerFishData.RodSelectedInPack;
|
||||
if (isGuide)
|
||||
{
|
||||
GroupName guideName = guideDataCenter.curGroupDefine.groupName;
|
||||
shopSelectId = 30003;
|
||||
if (guideName == GroupName.BuyPack01)
|
||||
{
|
||||
shopSelectId = 40001;
|
||||
}
|
||||
}
|
||||
if (shopSelectId > 0)
|
||||
{
|
||||
for (int i = 0; i < upSystem.rodItemDatas.Count; i++)
|
||||
{
|
||||
rodItemData = upSystem.rodItemDatas[i];
|
||||
if (rodItemData.config.ID == shopSelectId)
|
||||
{
|
||||
index = rodItemData.sort;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
await Awaiters.Seconds(0.4f);
|
||||
guidance.position = rodItems[index].transform.position;
|
||||
}
|
||||
void Refresh(RefreshRodBagEvent refreshRodBagEvent)
|
||||
{
|
||||
rodBagImprove.UpLevel();
|
||||
InitRodList();
|
||||
}
|
||||
void InitRodList()
|
||||
{
|
||||
GameObject[] gameObjects = iconRod.fx_fishingrods;
|
||||
for (int i = 0; i < gameObjects.Length; i++)
|
||||
{
|
||||
gameObjects[i].SetActive(i == 2);
|
||||
}
|
||||
upSystem.InitRodList();
|
||||
for (int i = 0; i < text_num.Count; i++)
|
||||
{
|
||||
int hasCount = upSystem.hasRodID.TryGetValue(i + upSystem.StartQuality, out List<int> rodIDs) ? rodIDs.Count : 0;
|
||||
text_num[i].text = $"{hasCount}/{upSystem.allCount[i + upSystem.StartQuality]}";
|
||||
}
|
||||
Show();
|
||||
}
|
||||
void Show()
|
||||
{
|
||||
for (int i = 0; i < upSystem.rodItemDatas.Count; i++)
|
||||
{
|
||||
RodItemData rodItemData = upSystem.rodItemDatas[i];
|
||||
rodItemData.sort = i;
|
||||
|
||||
RodBagItem rodItem;
|
||||
if (i < rodItems.Count)
|
||||
{
|
||||
rodItem = rodItems[i];
|
||||
rodItem.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject go = Instantiate(item, Content);
|
||||
rodItem = go.GetComponent<RodBagItem>();
|
||||
rodItems.Add(rodItem);
|
||||
}
|
||||
rodItem.Init(rodItemData, playerFishData.CheckUpgrade(rodItemData.config) || playerFishData.CheckRodUpLevel(rodItemData.config));
|
||||
rodItem.onClick = OnRodItemClick;
|
||||
if (rodItemData.config.ID == GContext.container.Resolve<PlayerData>().equipRodID)
|
||||
{
|
||||
currentEqRodItem = rodItem;
|
||||
currentEqRodItem.SetEquipped(playerFishData.CheckRodUpLevel(rodItemData.config));
|
||||
}
|
||||
}
|
||||
StartCoroutine(ShowFish());
|
||||
}
|
||||
Tween fadeTween;
|
||||
IEnumerator ShowFish()
|
||||
{
|
||||
fadeTween.Kill();
|
||||
cg.alpha = 0f;
|
||||
fadeTween = cg.DOFadeAlpha(1f, 0.5f).SetEase(FadeEaseCurve);
|
||||
|
||||
for (int i = 0; i < rodItems.Count; i++)
|
||||
{
|
||||
rodItems[i].gameObject.SetActive(true);
|
||||
|
||||
rodItems[i].transform.localScale = Vector3.zero;
|
||||
rodItems[i].transform.DOScale(Vector3.one, 0.2f).SetEase(easeCurve);
|
||||
|
||||
if (i <= 3)
|
||||
{
|
||||
yield return new WaitForSeconds(0.01f * i);
|
||||
}
|
||||
else
|
||||
yield return new WaitForSeconds(0.04f);
|
||||
}
|
||||
}
|
||||
async void OnRodItemClick(RodBagItem rodItem)
|
||||
{
|
||||
upSystem.SelectIndex = rodItem.data.sort;
|
||||
await UIManager.Instance.ShowUI(UITypes.FishingRodPanel);
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
disposable?.Dispose();
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingRodRewardPopupPanel);
|
||||
GContext.container.Unregister<FishingRodUpSystem>();
|
||||
GContext.Publish(new InGradeAquariumEvent() { type = 1 });
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/RodBag/FishingRodBagPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/RodBag/FishingRodBagPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d26330961a127643920f9386c75dac5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
133
Assets/Scripts/UI/Rod/RodBag/FishingRodUpSystem.cs
Normal file
133
Assets/Scripts/UI/Rod/RodBag/FishingRodUpSystem.cs
Normal file
@@ -0,0 +1,133 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
|
||||
public class FishingRodUpSystem
|
||||
{
|
||||
public IEventAggregator eventAggregator;
|
||||
|
||||
public List<RodItemData> rodItemDatas = new List<RodItemData>();
|
||||
public Dictionary<int, int> allCount = new Dictionary<int, int>();
|
||||
public Dictionary<int, List<int>> hasRodID;
|
||||
|
||||
PlayerFishData playerFishData;
|
||||
Tables _tables;
|
||||
public int SelectIndex = 0;
|
||||
public int StartQuality => 2;
|
||||
int EndQuality => 4;
|
||||
public AvatarEvent bagPanel;
|
||||
|
||||
public FishingRodUpSystem()
|
||||
{
|
||||
playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||||
_tables = GContext.container.Resolve<Tables>();
|
||||
eventAggregator = new EventAggregator();
|
||||
var dataList = _tables.TbRodData.DataList;
|
||||
|
||||
for (int i = StartQuality; i <= EndQuality; i++)
|
||||
{
|
||||
allCount[i] = dataList.Where(x => x.Quality == i).Count();
|
||||
}
|
||||
}
|
||||
public List<int> HasRodID(int quality)
|
||||
{
|
||||
return hasRodID.TryGetValue(quality, out List<int> rodIDs) ? rodIDs : new List<int>();
|
||||
}
|
||||
public void InitRodList()
|
||||
{
|
||||
rodItemDatas.Clear();
|
||||
hasRodID = new Dictionary<int, List<int>>();
|
||||
var dataList = _tables.TbRodData.DataList;
|
||||
int count = dataList.Count;
|
||||
RodData _rodData;
|
||||
RodAscend _rodAscend;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
_rodData = dataList[i];
|
||||
bool isLock = playerFishData.NotRod(_rodData.ID);
|
||||
if (!isLock)
|
||||
{
|
||||
if (!hasRodID.TryGetValue(_rodData.Quality, out List<int> rodIDs))
|
||||
{
|
||||
hasRodID[_rodData.Quality] = rodIDs = new List<int>();
|
||||
}
|
||||
rodIDs.Add(_rodData.ID);
|
||||
}
|
||||
|
||||
_rodData = dataList[i];
|
||||
_rodAscend = _tables.TbRodAscend.GetOrDefault(_rodData.AscendID);
|
||||
|
||||
int level = playerFishData.GetRodLevel(_rodData.ID);
|
||||
int star = playerFishData.GetRodPiece(_rodData.ID);
|
||||
bool isMax = star >= _rodAscend.MaxAscent;
|
||||
RodItemData rodItemData = new RodItemData()
|
||||
{
|
||||
config = dataList[i],
|
||||
isLock = isLock,
|
||||
level = level + 1,
|
||||
star = star,
|
||||
isNew = GContext.container.Resolve<PlayerData>().IsNewRod(dataList[i].ID),
|
||||
isMax = isMax,
|
||||
isEquip = dataList[i].ID == GContext.container.Resolve<PlayerData>().equipRodID
|
||||
};
|
||||
if (!isLock)
|
||||
{
|
||||
GetDuelPerk(rodItemData);
|
||||
}
|
||||
int skindID = playerFishData.GetRodSkin(_rodData.ID);
|
||||
rodItemData.skin = _tables.TbRodSkinData.GetOrDefault(skindID);
|
||||
if (rodItemData.skin == null)
|
||||
{
|
||||
Debug.LogError($"No SkinID {skindID} in RodID {rodItemData.config.ID}");
|
||||
continue;
|
||||
}
|
||||
rodItemData.SetRodPower();
|
||||
rodItemDatas.Add(rodItemData);
|
||||
}
|
||||
rodItemDatas.Sort(RodItemData.Sort);
|
||||
}
|
||||
void GetDuelPerk(RodItemData rodItemData)
|
||||
{
|
||||
var playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||||
Dictionary<int, string> RodPerkList = playerFishData.GetRodDuelPerk(rodItemData.config.ID, rodItemData.star);
|
||||
//float power = rodItemData.config.DuelPower[rodItemData.level - 1];
|
||||
//float param = 1;
|
||||
foreach (var perk in RodPerkList)
|
||||
{
|
||||
//var rodEngancePerk = _tables.TbRodAscendPerk.GetOrDefault(perk.Key);
|
||||
rodItemData.traitIDs.Add(perk.Key);
|
||||
rodItemData.noactions.Add(true);
|
||||
//string value = perk.Value;
|
||||
//if (!string.IsNullOrEmpty(value) && !value.Contains('|'))
|
||||
//{
|
||||
// param += float.Parse(value) * _tables.TbRodAscendPerk.GetOrDefault(perk.Key)?.DuelPowerParam ?? 0;
|
||||
//}
|
||||
}
|
||||
//power *= param;
|
||||
//rodItemData.DuelPower = (int)power;
|
||||
}
|
||||
public RodItemData GetCurrentRodItemData()
|
||||
{
|
||||
return rodItemDatas[SelectIndex];
|
||||
}
|
||||
|
||||
public IDisposable Subscribe<T>(Action<T> eventAction)
|
||||
{
|
||||
return eventAggregator.GetEvent<T>().Subscribe(eventAction);
|
||||
}
|
||||
|
||||
public void Publish<T>(T evt)
|
||||
{
|
||||
if (eventAggregator != null)
|
||||
eventAggregator.Publish(evt);
|
||||
}
|
||||
}
|
||||
public struct RefreshRodBagEvent
|
||||
{
|
||||
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/RodBag/FishingRodUpSystem.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/RodBag/FishingRodUpSystem.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 014fdb79693f06f48a7be739b5a66a1a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
173
Assets/Scripts/UI/Rod/RodBag/RodBagImprove.cs
Normal file
173
Assets/Scripts/UI/Rod/RodBag/RodBagImprove.cs
Normal file
@@ -0,0 +1,173 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using Coffee.UIExtensions;
|
||||
using DG.Tweening;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RodBagImprove : MonoBehaviour
|
||||
{
|
||||
public TMP_Text btn_improve_text;
|
||||
public Button btn_improve;
|
||||
public Image up_bar;
|
||||
public TMP_Text bar_text;
|
||||
public GameObject max_text;
|
||||
public GameObject fx;
|
||||
public CanvasGroup canvasGroup;
|
||||
|
||||
public UIParticleAttractor uIParticleAttractor;
|
||||
private List<RodLevelupStats> dataList;
|
||||
PlayerFishData playerFishData;
|
||||
int allScore = 0;
|
||||
bool isMax = false;
|
||||
int level = 0;
|
||||
private void Awake()
|
||||
{
|
||||
playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||||
var _tables = GContext.container.Resolve<Tables>();
|
||||
dataList = _tables.TbRodLevelupStats.DataList;
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_improve.onClick.AddListener(() =>
|
||||
{
|
||||
_ = UIManager.Instance.ShowUI(UITypes.FishingRodRewardPopupPanel);
|
||||
});
|
||||
InitLevel();
|
||||
}
|
||||
void InitLevel()
|
||||
{
|
||||
allScore = playerFishData.GetRodAllScore();
|
||||
int count = dataList.Count;
|
||||
var data = dataList[^1];
|
||||
level = count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (allScore < dataList[i].Count)
|
||||
{
|
||||
data = dataList[i];
|
||||
level = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
isMax = level == count;
|
||||
max_text.SetActive(isMax);
|
||||
bar_text.gameObject.SetActive(!max_text.activeSelf);
|
||||
if (isMax)
|
||||
{
|
||||
up_bar.fillAmount = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bar_text.text = $"{allScore}/{data.Count}";
|
||||
float fillAmount = (float)allScore / data.Count;
|
||||
up_bar.fillAmount = fillAmount;
|
||||
}
|
||||
btn_improve_text.text = level.ToString();
|
||||
}
|
||||
|
||||
public async void UpLevel()
|
||||
{
|
||||
int newScore = playerFishData.GetRodAllScore();
|
||||
if (isMax || newScore == allScore)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int count = dataList.Count;
|
||||
var newdata = dataList[^1];
|
||||
int newlevel = count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (newScore < dataList[i].Count)
|
||||
{
|
||||
newdata = dataList[i];
|
||||
newlevel = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
canvasGroup.blocksRaycasts = false;
|
||||
ParticleAttractor(newScore - allScore);
|
||||
await Awaiters.Seconds(1f);
|
||||
if (up_bar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (level != newlevel)
|
||||
{
|
||||
int oldlevel = level;
|
||||
var data = dataList[level];
|
||||
level = newlevel;
|
||||
isMax = level == count;
|
||||
up_bar.DOKill();
|
||||
up_bar.DOFillAmount(1, 0.5f).OnUpdate(() =>
|
||||
{
|
||||
bar_text.text = $"{(int)(data.Count * up_bar.fillAmount)}/{data.Count}";
|
||||
}).OnComplete(async () =>
|
||||
{
|
||||
btn_improve_text.text = level.ToString();
|
||||
bar_text.text = $"{data.Count}/{data.Count}";
|
||||
max_text.SetActive(isMax);
|
||||
bar_text.gameObject.SetActive(!max_text.activeSelf);
|
||||
GameObject go = await UIManager.Instance.ShowUI(UITypes.FishingRodRewardSettlementPopupPanel);
|
||||
if (go != null)
|
||||
{
|
||||
var panel = go.GetComponent<FishingRodRewardSettlementPopupPanel>();
|
||||
panel.Show(oldlevel);
|
||||
}
|
||||
});
|
||||
if (isMax)
|
||||
{
|
||||
return;
|
||||
}
|
||||
await Awaiters.Seconds(0.5f);
|
||||
}
|
||||
if (up_bar==null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
up_bar.DOKill();
|
||||
bar_text.text = $"{allScore}/{newdata.Count}";
|
||||
float fillAmount = (float)allScore / newdata.Count;
|
||||
up_bar.fillAmount = fillAmount;
|
||||
//新进度条
|
||||
allScore = newScore;
|
||||
fillAmount = (float)allScore / newdata.Count;
|
||||
up_bar.DOFillAmount(fillAmount, 0.5f).OnUpdate(() =>
|
||||
{
|
||||
bar_text.text = $"{(int)(allScore * up_bar.fillAmount)}/{newdata.Count}";
|
||||
}).OnComplete(() =>
|
||||
{
|
||||
bar_text.text = $"{allScore}/{newdata.Count}";
|
||||
});
|
||||
canvasGroup.blocksRaycasts = true;
|
||||
}
|
||||
/// <summary>
|
||||
/// 资源飞入
|
||||
/// </summary>
|
||||
/// <param name="classification"></param>
|
||||
/// <returns></returns>
|
||||
public async System.Threading.Tasks.Task ParticleAttractor(int showCount)
|
||||
{
|
||||
ParticleSystem particleSystem = fx.transform.Find("Scale/quan03").GetComponent<ParticleSystem>();
|
||||
if (particleSystem != null)
|
||||
{
|
||||
particleSystem.Clear();
|
||||
|
||||
var main = particleSystem.main;
|
||||
int maxCount = main.maxParticles;
|
||||
if (showCount < maxCount)
|
||||
{
|
||||
int addCount = (int)showCount;
|
||||
main.maxParticles = addCount;
|
||||
}
|
||||
fx.SetActive(true);
|
||||
uIParticleAttractor.enabled = true;
|
||||
await Awaiters.Seconds(1.8f);
|
||||
fx.SetActive(false);
|
||||
uIParticleAttractor.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/RodBag/RodBagImprove.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/RodBag/RodBagImprove.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5374e56e12ef22646bd8361588d57c5c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
46
Assets/Scripts/UI/Rod/RodBag/RodBagItem.cs
Normal file
46
Assets/Scripts/UI/Rod/RodBag/RodBagItem.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using asap.core;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RodBagItem : MonoBehaviour
|
||||
{
|
||||
public RodItem rodItem;
|
||||
public Button btn_item;
|
||||
public GameObject equipped;
|
||||
public GameObject redpoint;
|
||||
public Action<RodBagItem> onClick;
|
||||
public bool isUp;
|
||||
public RodItemData data => rodItem?.data;
|
||||
private void Reset()
|
||||
{
|
||||
btn_item = GetComponent<Button>();
|
||||
rodItem = transform.Find("rod").GetComponent<RodItem>();
|
||||
equipped = transform.Find("rod/equipped").gameObject;
|
||||
redpoint = transform.Find("rod/redpoint").gameObject;
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_item.onClick.AddListener(OnBtnItem);
|
||||
}
|
||||
void OnBtnItem()
|
||||
{
|
||||
onClick?.Invoke(this);
|
||||
}
|
||||
public void Init(RodItemData _data, bool isUp)
|
||||
{
|
||||
rodItem.Init(_data);
|
||||
equipped.SetActive(false);
|
||||
redpoint.SetActive(isUp);
|
||||
this.isUp = isUp;
|
||||
}
|
||||
public void SetEquipped(bool isUpLevel)
|
||||
{
|
||||
equipped.SetActive(true);
|
||||
//if (isUpLevel)
|
||||
//{
|
||||
// isUp = true;
|
||||
// redpoint.SetActive(isUpLevel);
|
||||
//}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/RodBag/RodBagItem.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/RodBag/RodBagItem.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 36a62a5031774d943afbf6a8b8de7088
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
136
Assets/Scripts/UI/Rod/RodBag/RodItem.cs
Normal file
136
Assets/Scripts/UI/Rod/RodBag/RodItem.cs
Normal file
@@ -0,0 +1,136 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RodItem : MonoBehaviour
|
||||
{
|
||||
public Trait[] traits;
|
||||
public Image bg;
|
||||
public Image img_icon;
|
||||
public GameObject mask_empty;
|
||||
public TMP_Text text_level;
|
||||
public StarItemRoot starRoot;
|
||||
public RodItemData data;
|
||||
private void Reset()
|
||||
{
|
||||
bg = transform.Find("bg").GetComponent<Image>();
|
||||
img_icon = transform.Find("img_map").GetComponent<Image>();
|
||||
mask_empty = transform.Find("mask_empty").gameObject;
|
||||
text_level = transform.Find("text_level").GetComponent<TMP_Text>();
|
||||
starRoot = transform.Find("star").GetComponent<StarItemRoot>();
|
||||
}
|
||||
|
||||
public void Init(RodItemData _data)
|
||||
{
|
||||
IUIService uIService = GContext.container.Resolve<IUIService>();
|
||||
data = _data;
|
||||
mask_empty.SetActive(data.isLock);
|
||||
text_level.gameObject.SetActive(!data.isLock);
|
||||
starRoot.gameObject.SetActive(!data.isLock);
|
||||
if (!data.isLock)
|
||||
{
|
||||
SetLevel();
|
||||
SetStar();
|
||||
}
|
||||
uIService.SetImageSprite(bg, Define.sp_rod_card[data.config.Quality - 1], BasePanel.PanelName);
|
||||
uIService.SetImageSprite(img_icon, data.skin.Avatar, BasePanel.PanelName);
|
||||
if (traits != null && _data.traitIDs != null)
|
||||
{
|
||||
for (int i = 0; i < traits.Length; i++)
|
||||
{
|
||||
if (i < _data.traitIDs.Count)
|
||||
{
|
||||
traits[i].Init(_data.traitIDs[i], _data.noactions[i], _data.config.Quality);
|
||||
}
|
||||
else
|
||||
{
|
||||
traits[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetLevel()
|
||||
{
|
||||
text_level.gameObject.SetActive(!data.isLock);
|
||||
text_level.text = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePanel_2", data.level);
|
||||
}
|
||||
void SetStar()
|
||||
{
|
||||
int star = data.star;
|
||||
var curRodAscend = GContext.container.Resolve<Tables>().TbRodAscend.GetOrDefault(data.config.AscendID);
|
||||
starRoot.SetStar(star, curRodAscend.MaxAscent);
|
||||
}
|
||||
}
|
||||
|
||||
public class RodItemData
|
||||
{
|
||||
public int sort;
|
||||
public int level;//展示用比数据多一级
|
||||
public int star;
|
||||
public RodData config;
|
||||
public RodSkinData skin;
|
||||
public bool isNew;
|
||||
public bool isLock;
|
||||
public bool isMax;
|
||||
public bool isEquip;
|
||||
public List<int> traitIDs = new List<int>();
|
||||
public List<bool> noactions = new List<bool>();
|
||||
public int RodPower;
|
||||
public void SetRodPower()
|
||||
{
|
||||
if (isLock)
|
||||
{
|
||||
RodPower = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
RodRodLevelPeak rodLevelPeak = GContext.container.Resolve<Tables>().TbRodRodLevelPeak.GetOrDefault(config.Quality);
|
||||
RodPower = config.DuelPowerLevel[level - 1] + config.DuelPowerAscend[star];
|
||||
//巅峰等级
|
||||
//星级对属性的加成 某几个属性加多少加到多少星
|
||||
int honorLevel = GContext.container.Resolve<PlayerFishData>().GetHonorLevel(config.Quality);
|
||||
if (rodLevelPeak != null && honorLevel > 0)
|
||||
{
|
||||
List<int> duelPowerLevelPeak = rodLevelPeak.DuelPowerLevelPeak;
|
||||
int value;
|
||||
int count = duelPowerLevelPeak.Count;
|
||||
if (honorLevel > count)
|
||||
{
|
||||
value = duelPowerLevelPeak[count - 1];
|
||||
value += (honorLevel - count) * (duelPowerLevelPeak[count - 1] - duelPowerLevelPeak[count - 2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = duelPowerLevelPeak[honorLevel - 1];
|
||||
}
|
||||
RodPower += value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static int Sort(RodItemData a, RodItemData b)
|
||||
{
|
||||
int levelA = a.isLock ? -1 : a.RodPower;
|
||||
int levelB = b.isLock ? -1 : b.RodPower;
|
||||
levelA *= a.isEquip ? 100 : 1;
|
||||
levelB *= b.isEquip ? 100 : 1;
|
||||
if (levelA == levelB)
|
||||
{
|
||||
levelA = a.level;
|
||||
levelB = b.level;
|
||||
if (levelA == levelB)
|
||||
{
|
||||
if (b.config.Quality == a.config.Quality)
|
||||
{
|
||||
return b.star.CompareTo(a.star);
|
||||
}
|
||||
return b.config.Quality.CompareTo(a.config.Quality);
|
||||
}
|
||||
}
|
||||
return levelB.CompareTo(levelA);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/RodBag/RodItem.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/RodBag/RodItem.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 236e01ee0ebf0f2438f64b1a561a70a8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
7
Assets/Scripts/UI/Rod/RodLevelAttributeRoot.cs
Normal file
7
Assets/Scripts/UI/Rod/RodLevelAttributeRoot.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class RodLevelAttributeRoot : MonoBehaviour
|
||||
{
|
||||
public List<LevelAttribute> rodAttributes = new List<LevelAttribute>();
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/RodLevelAttributeRoot.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/RodLevelAttributeRoot.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6653c3c35d88324f9274e482f7ec766
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
64
Assets/Scripts/UI/Rod/StarItem.cs
Normal file
64
Assets/Scripts/UI/Rod/StarItem.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class StarItem : MonoBehaviour
|
||||
{
|
||||
public Image[] Star;
|
||||
public Animation ani;
|
||||
//private void Reset()
|
||||
//{
|
||||
// Awake();
|
||||
//}
|
||||
private void Awake()
|
||||
{
|
||||
ani = GetComponent<Animation>();
|
||||
int count = transform.childCount;
|
||||
Star = new Image[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Star[i] = transform.GetChild(i).GetComponent<Image>();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetStar(int index)
|
||||
{
|
||||
for (int i = 0; i < Star.Length; i++)
|
||||
{
|
||||
Star[i].gameObject.SetActive(index == i + 1);
|
||||
}
|
||||
}
|
||||
public void PlayAni()
|
||||
{
|
||||
if (ani)
|
||||
{
|
||||
ani.Play("star_enhance");
|
||||
}
|
||||
}
|
||||
public void Hide()
|
||||
{
|
||||
CanvasGroup cg = GetComponent<CanvasGroup>();
|
||||
if (cg)
|
||||
{
|
||||
cg.alpha = 0;
|
||||
}
|
||||
}
|
||||
public void PlayShow()
|
||||
{
|
||||
CanvasGroup cg = GetComponent<CanvasGroup>();
|
||||
if (cg)
|
||||
{
|
||||
cg.alpha = 1;
|
||||
}
|
||||
if (ani)
|
||||
{
|
||||
ani.Play("star_show");
|
||||
}
|
||||
}
|
||||
public void PlayHuXi()
|
||||
{
|
||||
if (ani)
|
||||
{
|
||||
ani.Play("star_huxi");
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/StarItem.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/StarItem.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0f07d79c8291af48bbb843105454eab
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
57
Assets/Scripts/UI/Rod/StarItemRoot.cs
Normal file
57
Assets/Scripts/UI/Rod/StarItemRoot.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using GameCore;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class StarItemRoot : MonoBehaviour
|
||||
{
|
||||
public List<GameObject> enhance_star_empty_list = new List<GameObject>();
|
||||
public List<Image> enhance_star_empty_image = new List<Image>();
|
||||
public List<StarItem> enhance_starList = new List<StarItem>();
|
||||
private void Reset()
|
||||
{
|
||||
for (int i = 1; i <= 5; i++)
|
||||
{
|
||||
enhance_starList.Add(transform.Find($"star/star{i}").GetComponent<StarItem>());
|
||||
enhance_star_empty_list.Add(transform.Find($"star_empty/star{i}").gameObject);
|
||||
enhance_star_empty_image.Add(transform.Find($"star_empty/star{i}/star").GetComponent<Image>());
|
||||
}
|
||||
}
|
||||
public void SetStar(int star, int maxAscent, bool isUp = false)
|
||||
{
|
||||
PlayerFishData.SetRodStar(star, maxAscent,
|
||||
enhance_star_empty_list,
|
||||
enhance_star_empty_image,
|
||||
enhance_starList,
|
||||
isUp);
|
||||
}
|
||||
public void ShowStar(int star, int maxAscent)
|
||||
{
|
||||
int max = maxAscent / 3;
|
||||
if (max > 5)
|
||||
{
|
||||
max = 5;
|
||||
Debug.LogError($"钓竿最大强化星级不能超过15星");
|
||||
}
|
||||
int count = star % max;
|
||||
if (star >= maxAscent)
|
||||
{
|
||||
count = max;
|
||||
}
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(ShowStar(count));
|
||||
}
|
||||
IEnumerator ShowStar(int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
enhance_starList[i].Hide();
|
||||
}
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
enhance_starList[i].PlayShow();
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/StarItemRoot.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/StarItemRoot.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf0645233da99d44ba543fa38106827f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/Scripts/UI/Rod/Trait.cs
Normal file
32
Assets/Scripts/UI/Rod/Trait.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Trait : MonoBehaviour
|
||||
{
|
||||
public Image bg;
|
||||
public Image icon;
|
||||
public GameObject lockIcon;
|
||||
public int id;
|
||||
public int level;
|
||||
private void Reset()
|
||||
{
|
||||
bg = transform.Find("bg").GetComponent<Image>();
|
||||
icon = transform.Find("icon").GetComponent<Image>();
|
||||
lockIcon = transform.Find("noactive").gameObject;
|
||||
}
|
||||
|
||||
public void Init(int id,bool open,int q)
|
||||
{
|
||||
RodAscendPerk data = GContext.container.Resolve<Tables>().TbRodAscendPerk.GetOrDefault(id);
|
||||
if (data == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(icon, data.Icon, BasePanel.PanelName);
|
||||
lockIcon.SetActive(!open);
|
||||
string bgName = Perk.peak_bg[Mathf.Clamp(q - 1, 0, Perk.peak_bg.Length - 1)];
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(bg, bgName, BasePanel.PanelName);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/Trait.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/Trait.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc2300b818a8d8a4e9e578ada11a0a24
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
74
Assets/Scripts/UI/Rod/attributes_tips.cs
Normal file
74
Assets/Scripts/UI/Rod/attributes_tips.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class attributes_tips : MonoBehaviour
|
||||
{
|
||||
public TMP_Text text_name;
|
||||
public TMP_Text text_num;
|
||||
public TMP_Text basic_text;
|
||||
public TMP_Text level_text;
|
||||
public GameObject levelGo;
|
||||
public TMP_Text ascend_text;
|
||||
public GameObject ascendGo;
|
||||
public TMP_Text honorle_text;
|
||||
public GameObject honorleGo;
|
||||
public Transform arrow;
|
||||
public TMP_Text text_info1;
|
||||
public void Init(int index, RodData rodData)
|
||||
{
|
||||
var _tables = GContext.container.Resolve<Tables>();
|
||||
var playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||||
RodAscend rodAscend = _tables.TbRodAscend.GetOrDefault(rodData.AscendID);
|
||||
RodLevelup rodLevelup = _tables.TbRodLevelup.GetOrDefault(rodData.LevelupID);
|
||||
int star = playerFishData.GetRodPiece(rodData.ID);
|
||||
int level = playerFishData.GetRodLevel(rodData.ID);
|
||||
int basicValue = rodData.InitialBasicStats[index];
|
||||
basic_text.text = basicValue.ToString();
|
||||
//等级对属性的加成 每个属性升到多少级
|
||||
int levelValue = 0;
|
||||
var levelupBasicStats = rodLevelup.LevelupBasicStats;
|
||||
|
||||
levelValue += levelupBasicStats[index][level];
|
||||
|
||||
level_text.text = levelValue.ToString();
|
||||
levelGo.SetActive(levelValue > 0);
|
||||
//星级对属性的加成 某几个属性加多少加到多少星
|
||||
int ascendValue = 0;
|
||||
var AscentBasicStats = rodAscend.AscentBasicStat;
|
||||
var AscentBasicStatList = rodAscend.AscentBasicStatList;
|
||||
for (int i = star - 1; i >= 0; i--)
|
||||
{
|
||||
var AscentBasicStat = AscentBasicStats[i];
|
||||
int count = AscentBasicStat.Count;
|
||||
for (int j = 0; j < count; j++)
|
||||
{
|
||||
//InitialBasicStats 中第 AscentBasicStat[j] 个值加 i 星的值 累加
|
||||
if (index == AscentBasicStat[j] - 1)
|
||||
{
|
||||
ascendValue = AscentBasicStatList[i][j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ascendValue > 0) break;
|
||||
}
|
||||
this.ascend_text.text = ascendValue.ToString();
|
||||
ascendGo.SetActive(ascendValue > 0);
|
||||
|
||||
//星级对属性的加成 某几个属性加多少加到多少星
|
||||
int honorValue = 0;
|
||||
if (index == 0)
|
||||
{
|
||||
honorValue = playerFishData.GetHonorLevelAttribute(rodData.Quality);
|
||||
}
|
||||
|
||||
this.honorle_text.text = honorValue.ToString();
|
||||
honorleGo.SetActive(honorValue > 0);
|
||||
var rodBasicStats = _tables.TbRodBasicStats.DataList;
|
||||
text_num.text = (basicValue + levelValue + ascendValue + honorValue).ToString();
|
||||
text_name.text = LocalizationMgr.GetText(rodBasicStats[index].Title_l10n_key);
|
||||
text_info1.text = LocalizationMgr.GetText(_tables.TbRodBasicStats.DataList[index].Desc_l10n_key);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/attributes_tips.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/attributes_tips.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b2176bfa54c0a024393ede4ff6cea3dc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/Scripts/UI/Rod/attributes_tips2.cs
Normal file
10
Assets/Scripts/UI/Rod/attributes_tips2.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class attributes_tips2 : MonoBehaviour
|
||||
{
|
||||
public AttributeTips tips;
|
||||
private void Awake()
|
||||
{
|
||||
tips = transform.Find("GameObject/attribute").GetComponent<AttributeTips>();
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/attributes_tips2.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/attributes_tips2.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 656449d1b095cac42a6fe2bacd68121b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
132
Assets/Scripts/UI/Rod/item_perk.cs
Normal file
132
Assets/Scripts/UI/Rod/item_perk.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using com.fpnn;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class item_perk : MonoBehaviour
|
||||
{
|
||||
public Perk perk;
|
||||
public TMP_Text text_name;
|
||||
public TMP_Text text_type;
|
||||
public GameObject text_actived;
|
||||
public GameObject text_current;
|
||||
public GameObject text_notactived;
|
||||
public GameObject info_notactived;
|
||||
List<GameObject> _list = new List<GameObject>();
|
||||
|
||||
public void Show(int rodID, int index, int addLevel)
|
||||
{
|
||||
for (int i = 0; i < _list.Count; i++)
|
||||
{
|
||||
Destroy(_list[i]);
|
||||
}
|
||||
_list.Clear();
|
||||
Tables _tables = GContext.container.Resolve<Tables>();
|
||||
RodData rodData = _tables.TbRodData.GetOrDefault(rodID);
|
||||
RodAscend rodAscend = _tables.TbRodAscend.GetOrDefault(rodData.AscendID);
|
||||
|
||||
var unlockstars = rodAscend.PerkUnlockOrder;
|
||||
int star = GContext.container.Resolve<PlayerFishData>().GetRodPiece(rodData.ID);
|
||||
int perkID = rodAscend.PerkIDList[index];
|
||||
RodAscendPerk rodEngancePerk = _tables.TbRodAscendPerk.GetOrDefault(perkID);
|
||||
text_name.text = LocalizationMgr.GetText(rodEngancePerk.Title_l10n_key);
|
||||
text_type.gameObject.SetActive(rodEngancePerk.DuelPerk);
|
||||
|
||||
int curLv = 0;
|
||||
List<int> starList = new List<int>();
|
||||
for (int i = 0; i < rodAscend.DefaultPerk.Count; i++)
|
||||
{
|
||||
if (rodAscend.DefaultPerk[i] == index + 1)
|
||||
{
|
||||
curLv++;
|
||||
starList.Add(0);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < unlockstars.Count; i++)
|
||||
{
|
||||
if (unlockstars[i] == index + 1)
|
||||
{
|
||||
starList.Add(i + 1);
|
||||
if (i < star)
|
||||
{
|
||||
curLv++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (addLevel >= 0)
|
||||
{
|
||||
curLv += addLevel;
|
||||
List<string> PerkDataList = rodAscend.PerkDataList[index];
|
||||
|
||||
string perkValue = PerkDataList[curLv - 1];
|
||||
string text_level = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePopupPanel_1", curLv);
|
||||
string text_info = PlayerFishData.GetPerkDesc(rodEngancePerk.PerkType, rodEngancePerk.Desc_l10n_key, perkValue);
|
||||
GameObject text_go = Instantiate(text_current, transform);
|
||||
|
||||
text_go.SetActive(true);
|
||||
text_go.GetComponent<TMP_Text>().text = $"{text_level}: {text_info}";
|
||||
_list.Add(text_go);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowList(curLv, index, starList, rodData, rodAscend, rodEngancePerk);
|
||||
}
|
||||
perk.SetData(perkID, curLv, rodData.Quality);
|
||||
}
|
||||
void ShowList(int curLv, int index, List<int> starList, RodData rodData, RodAscend rodAscend, RodAscendPerk rodEngancePerk)
|
||||
{
|
||||
if (curLv == 0)
|
||||
{
|
||||
string perkValue = rodAscend.PerkDataList[index][0];
|
||||
string text_level = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePopupPanel_1", 1);
|
||||
string text_info = PlayerFishData.GetPerkDesc(rodEngancePerk.PerkType, rodEngancePerk.Desc_l10n_key, perkValue);
|
||||
GameObject text_go = Instantiate(text_notactived, transform);
|
||||
GameObject info_go = Instantiate(info_notactived, transform);
|
||||
info_go.SetActive(true);
|
||||
StarItemRoot starItemRoot = info_go.transform.Find("conditions/text_info/star").GetComponent<StarItemRoot>();
|
||||
starItemRoot.SetStar(starList[0], rodAscend.MaxAscent);
|
||||
_list.Add(info_go);
|
||||
text_go.SetActive(true);
|
||||
text_go.GetComponent<TMP_Text>().text = $"{text_level}:{text_info}";
|
||||
_list.Add(text_go);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = curLv - 1; i < starList.Count && i < curLv + 1; i++)
|
||||
{
|
||||
List<string> PerkDataList = rodAscend.PerkDataList[index];
|
||||
if (i >= PerkDataList.Count)
|
||||
{
|
||||
Debug.LogError($"钓竿ID:{rodData.ID}的{rodEngancePerk.ID}第{i + 1}阶提升属性不存在");
|
||||
break;
|
||||
}
|
||||
string perkValue = PerkDataList[i];
|
||||
string text_level = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePopupPanel_1", i + 1);
|
||||
string text_info = PlayerFishData.GetPerkDesc(rodEngancePerk.PerkType, rodEngancePerk.Desc_l10n_key, perkValue);
|
||||
GameObject text_go = null;
|
||||
if (i == curLv - 1)
|
||||
{
|
||||
//当前
|
||||
text_go = Instantiate(text_current, transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
//未拥有
|
||||
text_go = Instantiate(text_notactived, transform);
|
||||
GameObject info_go = Instantiate(info_notactived, transform);
|
||||
info_go.SetActive(true);
|
||||
StarItemRoot starItemRoot = info_go.transform.Find("conditions/text_info/star").GetComponent<StarItemRoot>();
|
||||
starItemRoot.SetStar(starList[i], rodAscend.MaxAscent);
|
||||
_list.Add(info_go);
|
||||
}
|
||||
text_go.SetActive(true);
|
||||
text_go.GetComponent<TMP_Text>().text = $"{text_level}: {text_info}";
|
||||
_list.Add(text_go);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Rod/item_perk.cs.meta
Normal file
11
Assets/Scripts/UI/Rod/item_perk.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e7b15d2b728a34459bfe380e05c6358
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user