【建造】更换解锁方式

iOS_release
zhangaotian 2024-07-29 16:01:29 +08:00
parent ef7996465a
commit 61eaa99fa6
9 changed files with 141 additions and 77 deletions

View File

@ -7,23 +7,28 @@
"unlockInfos": [
{
"condition": 1,
"conditionGroup": 5
"conditionGroup": 5,
"preGroup": 0
},
{
"condition": 25,
"conditionGroup": 1
"conditionGroup": 1,
"preGroup": 5
},
{
"condition": 50,
"conditionGroup": 3
"conditionGroup": 3,
"preGroup": 1
},
{
"condition": 75,
"conditionGroup": 4
"conditionGroup": 4,
"preGroup": 3
},
{
"condition": 95,
"conditionGroup": 2
"conditionGroup": 2,
"preGroup": 4
}
],
"nodeInfos": [

View File

@ -61,7 +61,7 @@
"GuideNote": "点击岛屿",
"GuideDesKey": "Guide_106",
"GuideType": 0,
"GuideParams": "BuildRoot/Node5/Option1/Normal",
"GuideParams": "BuildRoot/Node5/Btn",
"GuideCompleteType": 0,
"GuideCompleteParams": "BuildBoot/BuildUIRoot/UIMainBuild/UI_LiuHaiBottom/Build_Bar"
},

View File

@ -392,8 +392,8 @@
{
"ID": 166,
"Key": "Guide_106",
"Value": "点击岛屿",
"Value_En": "Click island"
"Value": "点击泡泡按钮",
"Value_En": "Click bubble button"
},
{
"ID": 167,

View File

@ -55,6 +55,12 @@ public class BuildBoot : MonoBehaviour
/// </summary>
public void OptionDisplay(Option option)
{
if (option == null)
{
CloseAllOptionButBubble(true);
return;
}
foreach (var optionInfo in Options.Values)
{
optionInfo.SetOptionActive(option);
@ -94,6 +100,12 @@ public class BuildBoot : MonoBehaviour
public void SetOptionActive(Option option)
{
if (option == null)
{
OptionObj.SetActive(false);
return;
}
OptionObj.SetActive(Name.Equals(option.Name));
}
@ -314,6 +326,7 @@ public class BuildBoot : MonoBehaviour
CurCondition = BuildManager.Instance.ReachCondition < 0
? CurCondition
: BuildManager.Instance.ReachCondition;
var nextLockNode = BuildManager.Instance.GetNextLockNode(CurCondition);
if (string.IsNullOrEmpty(nextLockNode))
{
@ -328,28 +341,26 @@ public class BuildBoot : MonoBehaviour
}
else
{
foreach (var chooseNode in chooseNodeInfo)
foreach (var node in _nodes)
{
if (_nodes.TryGetValue(chooseNode.Key, out var node))
if (!chooseNodeInfo.TryGetValue(node.Key, out var unlockNode)) return;
//已选择节点
if (!string.IsNullOrEmpty(unlockNode))
{
var option = node.GetOption(chooseNode.Value);
var condition = BuildManager.Instance.GetCondition(chooseNode.Key);
if (CurCondition >= condition)
{
node.OptionDisplay(option);
}
else
{
if (node.Name.Equals(nextLockNode))
{
_curBubble = node.BubbleObj;
node.CloseAllOptionButBubble(true);
}
else
{
node.CloseAllOptionButBubble(false);
}
}
var option = node.Value.GetOption(unlockNode);
node.Value.OptionDisplay(option);
}
//需解锁节点
else if (node.Key.Equals(nextLockNode) && string.IsNullOrEmpty(unlockNode))
{
_curBubble = node.Value.BubbleObj;
node.Value.CloseAllOptionButBubble(true);
}
//未解锁
else if (!node.Key.Equals(nextLockNode) && string.IsNullOrEmpty(unlockNode))
{
node.Value.CloseAllOptionButBubble(false);
}
}
}
@ -421,7 +432,7 @@ public class BuildBoot : MonoBehaviour
{
//选择时UI
var otherRoot = GameObject.Find("OtherRoot").gameObject;
_mask =otherRoot.transform.Find("Mask").gameObject;
_mask = otherRoot.transform.Find("Mask").gameObject;
_pickItem = GameObject.Find("OtherRoot/PickItem").gameObject;
_pickSpriteRenderer = _pickItem.GetComponent<SpriteRenderer>();
@ -491,7 +502,7 @@ public class BuildBoot : MonoBehaviour
EventManager.Instance.Send(EventManager.EventName.ShowMainUI);
//放弃修改
if (_curNode == null || _curOption == null) return;
if (_curNode == null) return;
_curNode.OptionDisplay(_curOption);
_curNode = null;
_curOption = null;
@ -507,7 +518,7 @@ public class BuildBoot : MonoBehaviour
_mask.SetActive(false);
_pickItem.SetActive(false);
_buildBar.Close();
EventManager.Instance.Send(EventManager.EventName.CloseUI);
EventManager.Instance.Send(EventManager.EventName.ShowMainUI);
@ -516,11 +527,13 @@ public class BuildBoot : MonoBehaviour
_curBubble.SetActive(true);
return;
}
//DebugUtil.LogError("保存更改,当前节点:{0},当前选项:{1}", _curNode.Name, _newOption.Name);
BuildManager.Instance.SaveNodeInfo(_curNode.Name, _newOption.Name);
_curNode = null;
_curOption = null;
_newOption = null;
UpdateBuildDisplay();
}
private void ShowUI()
@ -595,9 +608,11 @@ public class BuildBoot : MonoBehaviour
obj.SetActive(false);
var nodeName = obj.transform.parent.name;
EventManager.Instance.Send(EventManager.EventName.HideMainUI);
if (_nodes.TryGetValue(nodeName, out var node))
{
var condition = BuildManager.Instance.GetCondition(nodeName);
_curNode = node;
_buildBar.Open(node, BuildIconClick, BuildLockIconClick, CurCondition, condition);
EventManager.Instance.Send(EventManager.EventName.OpenUI);

View File

@ -47,6 +47,8 @@ namespace Framework.Manager
//主题 or 挂点
[LabelText("对应组")] public int conditionGroup;
[LabelText("前置组")] public int preGroup;
}
[Serializable]
@ -84,6 +86,9 @@ namespace Framework.Manager
//按挂点解锁条件
public int Condition;
//前置解锁组
public string PreGroup;
public string IconPath;
public OptionInfo GetOptionInfo(string optionID = null)
@ -104,6 +109,9 @@ namespace Framework.Manager
//按主题解锁条件
public int Condition;
//前置主题
public string PreThematic;
}
/// <summary>
@ -150,6 +158,8 @@ namespace Framework.Manager
public Dictionary<string, NodeInfo> NodeInfos;
public NodeInfo CurIUnlockNodeInfo;
public bool IsChanging = false;
//玩家存盘选择信息
@ -266,17 +276,14 @@ namespace Framework.Manager
continue;
}
var optionInfo = nodeInfo.Value.GetOptionInfo();
/*var optionInfo = nodeInfo.Value.GetOptionInfo();
if (optionInfo == null) return;
_userBuildInfo.ChooseNodeInfo.TryAdd(nodeInfo.Key, optionInfo.Name);
_userBuildInfo.ChooseNodeInfo.TryAdd(nodeInfo.Key, optionInfo.Name);*/
_userBuildInfo.ChooseNodeInfo.TryAdd(nodeInfo.Key, "");
}
//打印Debug玩家Build信息
/*foreach (var infos in _userBuildInfo.ChooseNodeInfo)
{
DebugUtil.LogError("节点 {0} 选择的的是 {1}", infos.Key, infos.Value);
}*/
//DebugUserChooseNode();
}
catch (Exception e)
{
@ -301,7 +308,9 @@ namespace Framework.Manager
if (NodeInfos.TryGetValue(nodeName, out var nodeInfo))
{
nodeInfo.Condition = unlockInfo.condition;
//DebugUtil.LogError("挂点解锁:节点{0}的解锁条件是:{1}", nodeInfo.Name, unlockInfo.condition);
var nextNode = string.Format(NodeName, unlockInfo.preGroup);
nodeInfo.PreGroup = nextNode;
//DebugUtil.LogError("挂点解锁:节点{0}的解锁条件是: {1}, 前置解锁组是: {2}", nodeInfo.Name, unlockInfo.condition, nextNode);
}
}
@ -317,8 +326,12 @@ namespace Framework.Manager
if (nodeInfo.Options.TryGetValue(optionName, out var optionInfo))
{
optionInfo.Condition = unlockInfo.condition;
DebugUtil.LogError("主题解锁:节点{0}的选项{1}的解锁条件是:{2}", nodeInfo.Name, optionInfo.Name,
unlockInfo.condition);
var nextOption = string.Format(OptionName, unlockInfo.preGroup);
optionInfo.PreThematic = nextOption;
DebugUtil.LogError("主题解锁:节点{0}的选项{1}的解锁条件是:{2}, 前置解锁主题是: {3}", nodeInfo.Name,
optionInfo.Name,
unlockInfo.condition, nextOption);
}
}
}
@ -438,33 +451,34 @@ namespace Framework.Manager
StorageManager.Instance.SaveWithoutUpdate();
}
public string GetNextLockNode(int condition)
{
DebugUtil.LogWarning("当前达到条件:{0}", condition);
string nodeName = null;
switch (_curBuildData.unlockType)
{
case UnlockType.ForGroup:
{
var nodeList = NodeInfos.Values.Where(node => node.Condition > condition).ToList();
if (nodeList.Count <= 0)
return null;
nodeName = nodeList[0].Name;
int minCondition = nodeList[0].Condition;
foreach (var nodeInfo in nodeList)
foreach (var node in NodeInfos)
{
if (nodeInfo.Condition < minCondition)
if (_userBuildInfo.ChooseNodeInfo.TryGetValue(node.Key, out var curNode) &&
_userBuildInfo.ChooseNodeInfo.TryGetValue(node.Value.PreGroup, out var preNode))
{
nodeName = nodeInfo.Name;
minCondition = nodeInfo.Condition;
//当前节点位选择且前置节点已选择
if (string.IsNullOrEmpty(curNode) && !string.IsNullOrEmpty(preNode))
{
//DebugUtil.LogError("下一个节点是{0}", node.Key);
return node.Key;
}
}
}
break;
var firstNode = NodeInfos
.OrderBy(kv => kv.Value.Condition)
.FirstOrDefault();
return firstNode.Key;
}
//TODO 按主题解锁
default:
@ -491,6 +505,29 @@ namespace Framework.Manager
StorageManager.Instance.SyncForce = true;
}
/// <summary>
/// Debug 清楚玩家所有选择
/// </summary>
public void ClearOption()
{
foreach (var node in NodeInfos)
{
if (_userBuildInfo.ChooseNodeInfo.TryGetValue(node.Key, out var option))
_userBuildInfo.ChooseNodeInfo[node.Key] = "";
}
DebugUserChooseNode();
StorageManager.Instance.SyncForce = true;
}
private void DebugUserChooseNode()
{
foreach (var infos in _userBuildInfo.ChooseNodeInfo)
{
DebugUtil.LogError("节点 {0} 选择的的是 {1}", infos.Key, infos.Value);
}
}
public void Release()
{
}

View File

@ -3,6 +3,7 @@ using Framework.Constants;
using LC.Newtonsoft.Json;
using Gameplay.Manager;
using Framework.Event;
using Framework.Manager;
using Gameplay.Level;
using Framework.UI;
using PhxhSDK;
@ -76,6 +77,12 @@ public partial class SROptions
{
LevelSelectManager.Instance.ClearFile();
}
[Category("存档相关"), DisplayName("清除当前所有选择节点")]
public void ClearBuildOption()
{
BuildManager.Instance.ClearOption();
}
[Category("道具相关"), DisplayName("增加开孔道具")]
public void AddUndoProp()

View File

@ -1,26 +1,26 @@
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/ad_adconfig.json,A36B3A44ABABA2DDE095849E3626C9,1094,1721894399796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/guide_guideconfig.json,1B942B12FE474D85AEF5EEA69A52434,2523,1721894399796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/prop_propconfig.json,7C02F583533F144939CBFF8C7E18473,880,1721894399796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/stringcfg_stringconfig.json,343DBBC697FCB77685E7338FC24EA1DA,8511,1721894399796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/AD/ADConfig.cs,A4C9CBC6BD55B1C14634FD73C748ACA,1928,1721894399796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/AD/ADType.cs,F6A7395BDA6D1E7D1EF51E344CB045,603,1721894399793
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/AD/DataAD.cs,7F68864C5AB693111C5C3250967FB782,3417,1721894399793
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/BI/Event.cs,9BC756F4D9E749FBCEF49BF6929557,6506,1721894399796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/BI/EventFirst.cs,72E992B782D0734B64364E4777CA3B35,2964,1721894399793
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Guide/DataGuide.cs,A23BB4F3F93B395441BB83D74E59B6F,4292,1721894399796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Guide/GuideConfig.cs,B1779443C4E6B0FD80A8B0CAE418015,2003,1721894399793
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Guide/GuideStepType.cs,BEB85D16C8FEBFBE0679C7F9C9F9A8,606,1721894399793
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Guide/StepCompleteType.cs,C360B48BE0179D52C15D41892A4B,1008,1721894399793
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Prop/DataProp.cs,B1E5165AD7B7B28F863BF25E9581BF7B,4385,1721894399796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Prop/PropConfig.cs,263DA0E1E0FA37A6401A432E49E8,2040,1721894399796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Prop/PropType.cs,56DDB93BC3D6491F012DAE849526897,757,1721894399793
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/StringCfg/DataString.cs,1613DCE5B077AE52BB90193DD949348,2327,1721894399793
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/StringCfg/StringConfig.cs,90AC6ED26EAF4A66498B4816B635F47,2080,1721894399793
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Tables.cs,16F3D2F3A20B0D35793F8A5A8194E59,2303,1721894399793
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/ad_adconfig.json,A36B3A44ABABA2DDE095849E3626C9,1094,1722237804796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/guide_guideconfig.json,691B15CC18B4441293DFB6BEAE8965,2512,1722237804796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/prop_propconfig.json,7C02F583533F144939CBFF8C7E18473,880,1722237804796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/stringcfg_stringconfig.json,F8D8B4B06DC867925B8F57951291E16C,8524,1722237804796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/AD/ADConfig.cs,A4C9CBC6BD55B1C14634FD73C748ACA,1928,1722237804796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/AD/ADType.cs,F6A7395BDA6D1E7D1EF51E344CB045,603,1722237804795
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/AD/DataAD.cs,7F68864C5AB693111C5C3250967FB782,3417,1722237804795
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/BI/Event.cs,9BC756F4D9E749FBCEF49BF6929557,6506,1722237804796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/BI/EventFirst.cs,72E992B782D0734B64364E4777CA3B35,2964,1722237804795
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Guide/DataGuide.cs,A23BB4F3F93B395441BB83D74E59B6F,4292,1722237804796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Guide/GuideConfig.cs,B1779443C4E6B0FD80A8B0CAE418015,2003,1722237804795
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Guide/GuideStepType.cs,BEB85D16C8FEBFBE0679C7F9C9F9A8,606,1722237804795
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Guide/StepCompleteType.cs,C360B48BE0179D52C15D41892A4B,1008,1722237804795
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Prop/DataProp.cs,B1E5165AD7B7B28F863BF25E9581BF7B,4385,1722237804796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Prop/PropConfig.cs,263DA0E1E0FA37A6401A432E49E8,2040,1722237804795
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Prop/PropType.cs,56DDB93BC3D6491F012DAE849526897,757,1722237804795
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/StringCfg/DataString.cs,1613DCE5B077AE52BB90193DD949348,2327,1722237804795
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/StringCfg/StringConfig.cs,90AC6ED26EAF4A66498B4816B635F47,2080,1722237804796
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Tables.cs,16F3D2F3A20B0D35793F8A5A8194E59,2303,1722237804795
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/__beans__.xlsx,FBF2DDFEE7FB39A727F2C3ACA7E228E,11821,1718685908733
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/__enums__.xlsx,BB1B7B4C814680E15D54B12E0C4BAD5,12703,1721893666572
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/__tables__.xlsx,CA2D48B6B6FAC5A9F046ACE375EA6A5B,11099,1721709912370
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/AD.xlsx,D49DD4C2226B1AED21398727B2144A9,9832,1721801067448
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/Guide.xlsx,6D35E0C2CC6D8396CB1A676530EAD2,10493,1721894375600
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/Guide.xlsx,6D5F7C64D1471860B08AE8329061BF22,10476,1722237740607
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/Prop.xlsx,518794514E27F37BF9D0B6BA712533A5,10050,1718685908733
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/StringConfig.xlsx,F82F5C747CBB6CE963F76A2625312A,13521,1721893669630
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/StringConfig.xlsx,62DA844EBD5C633CDE4C4826863712,13506,1722237783694

Binary file not shown.

Binary file not shown.