先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
138 lines
4.5 KiB
C#
138 lines
4.5 KiB
C#
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)
|
|
{
|
|
rodItemData.isCraftable = playerFishData.CheckUpgrade(_rodAscend);
|
|
}
|
|
else
|
|
{
|
|
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
|
|
{
|
|
|
|
}
|