Browse Source

冲突合并1013

pull/211/head
45 2 months ago
parent
commit
160409d5d0
  1. 27
      ColorlessWorld-2024-4-2/Assets/Plugins/Microsoft.CSharp.dll.meta
  2. 7
      ColorlessWorld-2024-4-2/Assets/Resources/WeaponNodePrefab/Enemy/WeaponNode.prefab
  3. 6
      ColorlessWorld-2024-4-2/Assets/Scripts/Card/TurnMaster.cs
  4. 36
      ColorlessWorld-2024-4-2/Assets/Scripts/Enemy/EnemyManager.cs
  5. 4
      ColorlessWorld-2024-4-2/Assets/Scripts/ForgingPoint/ForgintPointManager.cs
  6. 25
      ColorlessWorld-2024-4-2/Assets/Scripts/MapUnity.cs
  7. 146
      ColorlessWorld-2024-4-2/Assets/Scripts/Tool/Name.cs
  8. 11
      ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/Weapon.cs
  9. 271
      ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/WeaponManager.cs
  10. 72
      ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/WeaponNode.cs
  11. 6
      ColorlessWorld-2024-4-2/Assets/Scripts/manager/MapUnityManager.cs

27
ColorlessWorld-2024-4-2/Assets/Plugins/Microsoft.CSharp.dll.meta

@ -0,0 +1,27 @@
fileFormatVersion: 2
guid: a94cf6fef2879da4c91e5ef768aadf4e
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

7
ColorlessWorld-2024-4-2/Assets/Resources/WeaponNodePrefab/Enemy/WeaponNode.prefab

@ -803,10 +803,10 @@ MonoBehaviour:
nameTextGemImage: {fileID: 2883730751354076095}
inforTextGemImage: {fileID: 1836832560778862929}
bagWeaponNode: {fileID: 0}
condition: red>5
result: Volcano
condition:
result:
conditionValue:
resultValue: 2
resultValue:
nodesMark: []
nodesColor: []
extraRedNodeCount: 0
@ -820,6 +820,7 @@ MonoBehaviour:
resultDescription:
conditionDescription:
turnScore: 0
settleCount: 0
isGemImage: 0
time: 0.5
--- !u!1 &6760592358663445303

6
ColorlessWorld-2024-4-2/Assets/Scripts/Card/TurnMaster.cs

@ -130,9 +130,13 @@ public class TurnMaster : Singleton<TurnMaster>
if (settleTurn == 0)
{
MapUnityManager.Instance.switchNodeNum = 0;
MapUnityManager.Instance.switchRedNodeNum = 0;
MapUnityManager.Instance.switchBlueNodeNum = 0;
MapUnityManager.Instance.switchYellowNodeNum = 0;
}
//回合开始重置附魔的各种参数和计数
WeaponManager.Instance.resetNodeScore();
MapUnityManager.Instance.switchNodeNum = 0;
//Ï´ÅÆ--³é¿¨
StartCoroutine(ShuffleWithLosingCards());
//Ï´ÅÆ³é¿¨ÉùÒô

36
ColorlessWorld-2024-4-2/Assets/Scripts/Enemy/EnemyManager.cs

@ -160,16 +160,16 @@ public class EnemyManager : Singleton<EnemyManager>
GameObject gemA = Instantiate(Resources.Load<GameObject>(Name.WeaponNode.EnemyPrefabPath + Name.WeaponNode.PrefabName));
WeaponNode weaponNodeA = gemA.GetComponent<WeaponNode>();
weaponNodeA.result = Name.WeaponNodeFunction.everyHolyNodeAddScore;
weaponNodeA.resultValue = "1";
weaponNodeA.resultValue = "2_1";
weaponNodeA.condition = Name.none;
weaponNodeA.conditionValue = Name.none;
GameObject gemB = Instantiate(Resources.Load<GameObject>(Name.WeaponNode.EnemyPrefabPath + Name.WeaponNode.PrefabName));
WeaponNode weaponNodeB = gemB.GetComponent<WeaponNode>();
weaponNodeB.result = Name.WeaponNodeFunction.everyBelieverAddScore;
weaponNodeB.resultValue = "2";
weaponNodeA.condition = Name.none;
weaponNodeA.conditionValue = Name.none;
weaponNodeB.resultValue = "1_1";
weaponNodeB.condition = Name.none;
weaponNodeB.conditionValue = Name.none;
WeaponManager.Instance.loadEnemyWeaponNode(0, gemA);
@ -181,43 +181,37 @@ public class EnemyManager : Singleton<EnemyManager>
GameObject gemA = Instantiate(Resources.Load<GameObject>(Name.WeaponNode.EnemyPrefabPath + Name.WeaponNode.PrefabName));
WeaponNode weaponNodeA = gemA.GetComponent<WeaponNode>();
weaponNodeA.result = Name.WeaponNodeFunction.addScore;
weaponNodeA.resultValue = "20";
weaponNodeA.resultValue = "10";
weaponNodeA.condition = Name.WeaponNodeCondition.threeColorCountMoreThan;
weaponNodeA.conditionValue = "15";
GameObject gemB = Instantiate(Resources.Load<GameObject>(Name.WeaponNode.EnemyPrefabPath + Name.WeaponNode.PrefabName));
WeaponNode weaponNodeB = gemB.GetComponent<WeaponNode>();
weaponNodeB.result = Name.WeaponNodeFunction.addScore;
weaponNodeB.resultValue = "15";
weaponNodeB.resultValue = "10";
weaponNodeB.condition = Name.WeaponNodeCondition.threeColorDiffMoreThan;
weaponNodeB.conditionValue = "10";
weaponNodeB.conditionValue = "15";
GameObject gemC = Instantiate(Resources.Load<GameObject>(Name.WeaponNode.EnemyPrefabPath + Name.WeaponNode.PrefabName));
WeaponNode weaponNodeC = gemC.GetComponent<WeaponNode>();
weaponNodeC.result = Name.WeaponNodeFunction.addScore;
weaponNodeC.resultValue = "8";
weaponNodeC.resultValue = "5";
weaponNodeC.condition = Name.WeaponNodeCondition.threeColorDiffMoreThan;
weaponNodeC.conditionValue = "5";
weaponNodeC.conditionValue = "8";
GameObject gemD = Instantiate(Resources.Load<GameObject>(Name.WeaponNode.EnemyPrefabPath + Name.WeaponNode.PrefabName));
WeaponNode weaponNodeD = gemD.GetComponent<WeaponNode>();
weaponNodeD.result = Name.WeaponNodeFunction.addScore;
weaponNodeD.resultValue = "5";
weaponNodeD.condition = Name.WeaponNodeCondition.threeColorCountEqual;
weaponNodeD.conditionValue = Name.none;
weaponNodeD.condition = Name.WeaponNodeCondition.threeColorCountMoreThan;
weaponNodeD.conditionValue = "10";
GameObject gemE = Instantiate(Resources.Load<GameObject>(Name.WeaponNode.EnemyPrefabPath + Name.WeaponNode.PrefabName));
WeaponNode weaponNodeE = gemE.GetComponent<WeaponNode>();
weaponNodeE.result = Name.WeaponNodeFunction.threeColorRedistribution;
weaponNodeE.resultValue = Name.none;
weaponNodeE.condition = Name.none;
weaponNodeE.conditionValue = Name.none;
WeaponManager.Instance.loadEnemyWeaponNode(0, gemA);
WeaponManager.Instance.loadEnemyWeaponNode(1, gemB);
WeaponManager.Instance.loadEnemyWeaponNode(2, gemC);
WeaponManager.Instance.loadEnemyWeaponNode(3, gemD);
WeaponManager.Instance.loadEnemyWeaponNode(4, gemE);
WeaponManager.Instance.loadEnemyWeaponNode(1, gemD);
WeaponManager.Instance.loadEnemyWeaponNode(2, gemB);
WeaponManager.Instance.loadEnemyWeaponNode(3, gemC);
}
public void loadCultHierophantWeaponNode()

4
ColorlessWorld-2024-4-2/Assets/Scripts/ForgingPoint/ForgintPointManager.cs

@ -738,7 +738,7 @@ public class ForgintPointManager : Singleton<ForgintPointManager>
for(int i=0;i< conditionOrResultSelectedNodeList .Count;i++)
{
string newlevel = WeaponManager.Instance.getRarityWithLevelDiff(selectWeaponNodeConditionLevel, 1);
conditionOrResultSelectedNodeList[i].weaponNodeDataPair = WeaponManager.Instance.getRandomConditionWithLevel(newlevel);
conditionOrResultSelectedNodeList[i].weaponNodeDataPair = WeaponManager.Instance.getRandomConditionWithLevel(newlevel,Name.none);
conditionOrResultSelectedNodeList[i].isResult = false;
conditionOrResultSelectedNodeList[i].SetUpNode();
}
@ -751,7 +751,7 @@ public class ForgintPointManager : Singleton<ForgintPointManager>
for (int i = 0; i < conditionOrResultSelectedNodeList.Count; i++)
{
string newlevel = WeaponManager.Instance.getRarityWithLevelDiff(selectWeaponNodeConditionLevel, 1);
conditionOrResultSelectedNodeList[i].weaponNodeDataPair = WeaponManager.Instance.getRandomResultWithLevel(newlevel);
conditionOrResultSelectedNodeList[i].weaponNodeDataPair = WeaponManager.Instance.getRandomResultWithLevel(newlevel, Name.none);
conditionOrResultSelectedNodeList[i].isResult = true;
conditionOrResultSelectedNodeList[i].SetUpNode();
}

25
ColorlessWorld-2024-4-2/Assets/Scripts/MapUnity.cs

@ -331,7 +331,18 @@ public class MapUnity : MonoBehaviour
return;
}
MapUnityManager.Instance.switchNodeNum++;
switch (whoColour)
{
case Name.NodeColor.Red:
MapUnityManager.Instance.switchRedNodeNum++;
break;
case Name.NodeColor.Blue:
MapUnityManager.Instance.switchBlueNodeNum++;
break;
case Name.NodeColor.Yellow:
MapUnityManager.Instance.switchYellowNodeNum++;
break;
}
if (whoColour != 6 && whoColour != 10)
{
whoColour = newColor;
@ -428,6 +439,18 @@ public class MapUnity : MonoBehaviour
return;
}
MapUnityManager.Instance.switchNodeNum++;
switch (whoColour)
{
case Name.NodeColor.Red:
MapUnityManager.Instance.switchRedNodeNum++;
break;
case Name.NodeColor.Blue:
MapUnityManager.Instance.switchBlueNodeNum++;
break;
case Name.NodeColor.Yellow:
MapUnityManager.Instance.switchYellowNodeNum++;
break;
}
if (LegacyManager.Instance.isUseful(Name.Legacy.LegacyNode_Filter) && whoColour == Name.NodeColor.Black)
{
Usermanager.Instance.Shield += Usermanager.Instance.ShieldCalculation(1);

146
ColorlessWorld-2024-4-2/Assets/Scripts/Tool/Name.cs

@ -48,7 +48,7 @@ public static class Name
public const string CompulsiveArcanist = "CompulsiveArcanist";
public const string CultHierophant = "CultHierophant";
public static readonly HashSet<string> EnemySet = new HashSet<string> { BlastJester , CultHierophant };
public static readonly HashSet<string> EnemySet = new HashSet<string> { CompulsiveArcanist };
}
public const string value = "value";
@ -566,17 +566,26 @@ public static class Name
sb.Append("至少有" + int.Parse(conditionValue) + "个激活的宝石");
break;
case Name.WeaponNodeCondition.threeColorDiffMoreThan:
sb.Append("蓝红黄地块差值大于" + (int.Parse(conditionValue)));
sb.Append("蓝红黄地块任意两个差值大于" + (int.Parse(conditionValue)));
break;
case Name.WeaponNodeCondition.threeColorCountMoreThan:
sb.Append("蓝红黄地块数量大于" + (int.Parse(conditionValue)));
sb.Append("蓝红黄地块数量大于" + (int.Parse(conditionValue)));
break;
case Name.WeaponNodeCondition.threeColorCountEqual:
sb.Append("蓝红黄地块数量等于" + (int.Parse(conditionValue)));
sb.Append("蓝红黄地块数量等于" + (int.Parse(conditionValue)));
break;
case Name.WeaponNodeCondition.everyNumNodeConvert:
sb.Append("每转化"+ (int.Parse(conditionValue)) + "个地块");
break;
case Name.WeaponNodeCondition.everyRedNodeConvert:
sb.Append("每转化" + (int.Parse(conditionValue)) + "个红色地块");
break;
case Name.WeaponNodeCondition.everyBlueNodeConvert:
sb.Append("每转化" + (int.Parse(conditionValue)) + "个蓝色地块");
break;
case Name.WeaponNodeCondition.everyYellowNodeConvert:
sb.Append("每转化" + (int.Parse(conditionValue)) + "个黄色地块");
break;
case Name.WeaponNodeCondition.bombbomb:
sb.Append("每当有炸弹爆炸");
break;
@ -587,9 +596,110 @@ public static class Name
}
}
return sb.ToString();
return ReplaceColorBlocks(sb.ToString());
}
private static readonly Dictionary<string, int> colorToIdMap = new Dictionary<string, int>
{
{ "黄色", 0 },
{ "白色", 1 },
{ "蓝色", 2 },
{ "红色", 3 },
{ "黑色", 4 }
};
public static string ReplaceColorBlocks(string input)
{
if (string.IsNullOrEmpty(input))
return input;
// 改进后的模式:更准确地匹配颜色组合
string pattern = @"([黄白蓝红黑]+色)+地块";
return System.Text.RegularExpressions.Regex.Replace(input, pattern, match =>
{
string matchedText = match.Value;
// 提取颜色部分(去掉"地块"两个字)
string colorsPart = matchedText.Substring(0, matchedText.Length - 2);
// 分离出各个颜色
List<string> colors = ExtractColors(colorsPart);
// 构建替换字符串
StringBuilder result = new StringBuilder();
foreach (string color in colors)
{
if (colorToIdMap.TryGetValue(color, out int spriteId))
{
result.Append($"<sprite={spriteId}>");
}
else
{
// 如果颜色不在映射中,保留原文本
result.Append(color);
}
}
return result.ToString();
});
}
private static List<string> ExtractColors(string colorsText)
{
List<string> colors = new List<string>();
int index = 0;
while (index < colorsText.Length)
{
// 每个颜色词都是"X色"的形式(2个字符)
if (index + 1 < colorsText.Length)
{
string potentialColor = colorsText.Substring(index, 2);
if (colorToIdMap.ContainsKey(potentialColor))
{
colors.Add(potentialColor);
index += 2; // 移动到下一个颜色
}
else
{
// 如果不是有效颜色,尝试查找单个颜色字符
string singleChar = colorsText[index].ToString();
if (IsColorCharacter(singleChar[0]))
{
// 如果是颜色字符但缺少"色"字,自动补全
string fullColor = singleChar + "色";
if (colorToIdMap.ContainsKey(fullColor))
{
colors.Add(fullColor);
}
}
index++;
}
}
else
{
// 处理最后一个字符的情况
string singleChar = colorsText[index].ToString();
if (IsColorCharacter(singleChar[0]))
{
string fullColor = singleChar + "色";
if (colorToIdMap.ContainsKey(fullColor))
{
colors.Add(fullColor);
}
}
break;
}
}
return colors;
}
private static bool IsColorCharacter(char c)
{
return c == '黄' || c == '白' || c == '蓝' || c == '红' || c == '黑';
}
public static string getGemResultDescription(string result, string resultValue)
{
StringBuilder sb = new StringBuilder();
@ -650,7 +760,7 @@ public static class Name
sb.Append("每有一个炸弹增加" + int.Parse(resultValue) + "点攻击力");
break;
case Name.WeaponNodeFunction.everyBelieverAddScore:
sb.Append("每有一个信徒增加" + int.Parse(resultValue) + "点攻击力");
sb.Append("每有" + resultValue.Split("_")[0] + "个信徒增加" + resultValue.Split("_")[1] + "点攻击力");
break;
case Name.WeaponNodeFunction.threeColorRedistribution:
sb.Append("回合结束蓝红黄地块等比例重新分配");
@ -665,7 +775,7 @@ public static class Name
sb.Append("回合结束在场上增加" + int.Parse(resultValue) + "个酸雨");
break;
}
return sb.ToString();
return ReplaceColorBlocks(sb.ToString());
}
public static string getValForSwage(int cost, string fun, CardForgeRule data)
@ -1047,18 +1157,32 @@ public static class Name
public const string everyNumNodeConvert = "everyNumNodeConvert";
//炸弹爆炸
public const string bombbomb = "bombbomb";
//每转化n的红色地块
public const string everyRedNodeConvert = "everyRedNodeConvert";
//每转化n的蓝色地块
public const string everyBlueNodeConvert = "everyBlueNodeConvert";
//每转化n的黄色地块
public const string everyYellowNodeConvert = "everyYellowNodeConvert";
//每转化n的颜色地块
public const string everyColorNodeConvert = "everyColorNodeConvert";
public static readonly HashSet<string> PlayerConvertSet = new HashSet<string> { everyNumNodeConvert
,everyRedNodeConvert,everyBlueNodeConvert,everyYellowNodeConvert};
public static readonly HashSet<string> PlayerColorConvertSet = new HashSet<string> {
everyRedNodeConvert,everyBlueNodeConvert,everyYellowNodeConvert};
public static readonly HashSet<string> PlayerConditionSet= new HashSet<string> { cardConditionPattern
,node,everyNumNodeConvert};
,node,everyNumNodeConvert,everyColorNodeConvert};
public static readonly HashSet<string> PlayerBasicConditionSet = new HashSet<string> { cardConditionPattern,
node};
node,everyColorNodeConvert};
public static readonly HashSet<string> PlayerElementaryConditionSet = new HashSet<string> { cardConditionPattern
,node,everyNumNodeConvert};
,node,everyNumNodeConvert,everyColorNodeConvert};
public static readonly HashSet<string> PlayerIntermediateConditionSet = new HashSet<string> { cardConditionPattern
,node,everyNumNodeConvert};
,node,everyNumNodeConvert,everyColorNodeConvert};
public static readonly HashSet<string> PlayerAdvancedConditionSet = new HashSet<string> { cardConditionPattern
,node};

11
ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/Weapon.cs

@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.SocialPlatforms.Impl;
using static UnityEngine.Rendering.DebugUI;
@ -108,10 +109,11 @@ public class Weapon : MonoBehaviour
}
}
public void resetNodeScore(Transform playerWeaponNodeList)
{
turnScore = 0;
for (int i = 0; i < playerWeaponNodeList.childCount; i++)
{
Transform weaponSlot = playerWeaponNodeList.GetChild(i);
@ -120,6 +122,13 @@ public class Weapon : MonoBehaviour
Transform weaponNode = weaponSlot.GetChild(0);
WeaponNode node = weaponNode.transform.GetComponent<WeaponNode>();
node.turnScore=0;
node.settleCount=0;
node.extraRedNodeCount = 0;
node.extraBlueNodeCount = 0;
node.extraYellowNodeCount = 0;
node.extraMostNodeCount = 0;
node.extraLeastNodeCount = 0;
node.extraAllNodeCount = 0;
}
}

271
ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/WeaponManager.cs

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using Unity.VisualScripting;
using UnityEngine;
using static Cinemachine.DocumentationSortingAttribute;
@ -81,6 +82,10 @@ public class WeaponManager : Singleton<WeaponManager>
{
playerUsingWeapon.resetNodeScore(playerWeaponNodeList);
enemyUsingWeapon.resetNodeScore(enemyWeaponNodeList);
MapUnityManager.Instance.switchNodeNum = 0;
MapUnityManager.Instance.switchRedNodeNum = 0;
MapUnityManager.Instance.switchBlueNodeNum = 0;
MapUnityManager.Instance.switchYellowNodeNum = 0;
}
public void ResetAllNodeBool()
@ -224,7 +229,7 @@ public class WeaponManager : Singleton<WeaponManager>
return gem;
}
public string getEveryNodeAddScoreValue(string level,string condition)
public string getEveryNodeAddScoreValue(string level)
{
string resultValue = "";
HashSet<string> resultSet = new HashSet<string>();
@ -263,6 +268,64 @@ public class WeaponManager : Singleton<WeaponManager>
}
}
}
public bool checkConditionSetRationality(string result,string firstPart,string op)
{
bool isLegal=true;
if (!op.Equals("<"))
{
}
else
{
switch (result)
{
case Name.WeaponNodeFunction.everyRedNodeAddScore:
case Name.WeaponNodeFunction.redNodeCount:
if (firstPart.Equals(Name.Color.Red))
{
isLegal = false;
}
break;
case Name.WeaponNodeFunction.everyBlueNodeAddScore:
case Name.WeaponNodeFunction.blueNodeCount:
if (firstPart.Equals(Name.Color.Blue))
{
isLegal = false;
}
break;
case Name.WeaponNodeFunction.everyYellowNodeAddScore:
case Name.WeaponNodeFunction.yellowNodeCount:
if (firstPart.Equals(Name.Color.Yellow))
{
isLegal = false;
}
break;
case Name.WeaponNodeFunction.leastNodeCount:
case Name.WeaponNodeFunction.mostNodeCount:
case Name.WeaponNodeFunction.allNodeCount:
isLegal = false;
break;
}
}
return isLegal;
}
public (string,string) getPart1AndOp(string result)
{
HashSet<string> ops = new HashSet<string> { "<", ">" };
HashSet<string> colors = new HashSet<string> { Name.Color.Red, Name.Color.Blue, Name.Color.Yellow };
string color = MathTool.GetRandomElements(colors, 1).ElementAt(0);
string op = MathTool.GetRandomElements(ops, 1).ElementAt(0);
if (checkConditionSetRationality(result, color, op))
{
return (color, op);
}
else
{
return getPart1AndOp(result);
}
}
//屏蔽策略
public void resultBlockingPolicy(string firstPart, ref HashSet<string> set)
{
@ -303,10 +366,10 @@ public class WeaponManager : Singleton<WeaponManager>
break;
}
}
public WeaponNodeDataPair getRandomConditionWithLevel(string level)
public WeaponNodeDataPair getRandomConditionWithLevel(string level,string result)
{
string condition = "";
WeaponNodeDataPair result= new WeaponNodeDataPair();
WeaponNodeDataPair returnResult= new WeaponNodeDataPair();
switch (level)
{
case Name.WeaponNodeLevel.Basic:
@ -326,37 +389,39 @@ public class WeaponManager : Singleton<WeaponManager>
string conditionValue = "";
List<string> nodesMark = new List<string>();
List<string> nodesColor = new List<string>();
conditionValue = getConditionValueWithLevel(level, ref condition, ref nodesMark, ref nodesColor);
result.conditionOrResult = condition;
result.value = conditionValue;
result.nodesMark = nodesMark.ToArray();
result.nodesColor = nodesColor.ToArray();
result.description = Name.getGemConditionDescription(condition, conditionValue, nodesMark.ToArray(), nodesColor.ToArray());
return result;
conditionValue = getConditionValueWithLevelForForge(level, ref condition, ref nodesMark, ref nodesColor,result);
returnResult.conditionOrResult = condition;
returnResult.value = conditionValue;
returnResult.nodesMark = nodesMark.ToArray();
returnResult.nodesColor = nodesColor.ToArray();
returnResult.description = Name.getGemConditionDescription(condition, conditionValue, nodesMark.ToArray(), nodesColor.ToArray());
return returnResult;
}
public WeaponNodeDataPair getRandomResultWithLevel(string level)
public WeaponNodeDataPair getRandomResultWithLevel(string level,string condition)
{
string condition = "";
WeaponNodeDataPair resultData = new WeaponNodeDataPair();
string result = "";
//string result = "";
HashSet<string> resultSet = new HashSet<string>();
switch (level)
{
case Name.WeaponNodeLevel.Basic:
result = MathTool.GetRandomElements(Name.WeaponNodeFunction.PlayerBasicResultSet, 1).ElementAt(0);
resultSet = Name.WeaponNodeFunction.PlayerBasicResultSet;
break;
case Name.WeaponNodeLevel.Elementary:
result = MathTool.GetRandomElements(Name.WeaponNodeFunction.PlayerElementaryResultSet, 1).ElementAt(0);
resultSet = Name.WeaponNodeFunction.PlayerElementaryResultSet;
break;
case Name.WeaponNodeLevel.Intermediate:
result = MathTool.GetRandomElements(Name.WeaponNodeFunction.PlayerIntermediateResultSet, 1).ElementAt(0);
resultSet = Name.WeaponNodeFunction.PlayerIntermediateResultSet;
break;
case Name.WeaponNodeLevel.Advanced:
result = MathTool.GetRandomElements(Name.WeaponNodeFunction.PlayerAdvancedResultSet, 1).ElementAt(0);
resultSet = Name.WeaponNodeFunction.PlayerAdvancedResultSet;
break;
}
string resultValue = getResultValueWithLevel(level, ref result, Name.none, Name.none);
resultData.conditionOrResult = condition;
checkResultSetRationality(ref resultSet, condition);
string result = MathTool.GetRandomElements(resultSet, 1).ElementAt(0);
string resultValue = getResultValueWithLevel(level, ref result, condition, Name.none);
resultData.conditionOrResult = result;
resultData.value = resultValue;
resultData.description = Name.getGemResultDescription(result, resultValue);
return resultData;
@ -740,7 +805,6 @@ public class WeaponManager : Singleton<WeaponManager>
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "3", "4", "5" }, 1).ElementAt(0);
break;
case Name.WeaponNodeCondition.everyNumNodeConvert:
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "7", "8", "9" }, 1).ElementAt(0);
switch (level)
{
case Name.WeaponNodeLevel.Basic:
@ -757,6 +821,24 @@ public class WeaponManager : Singleton<WeaponManager>
break;
}
break;
case Name.WeaponNodeCondition.everyColorNodeConvert:
condition = MathTool.GetRandomElements(Name.WeaponNodeCondition.PlayerColorConvertSet, 1).ElementAt(0);
switch (level)
{
case Name.WeaponNodeLevel.Basic:
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(6, 6), 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Elementary:
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(5, 5), 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Intermediate:
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(4, 4), 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Advanced:
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(3, 3), 1).ElementAt(0);
break;
}
break;
case Name.WeaponNodeCondition.bombbomb:
conditionValue = Name.none;
break;
@ -813,6 +895,135 @@ public class WeaponManager : Singleton<WeaponManager>
return conditionValue;
}
public string getConditionValueWithLevelForForge(string level, ref string condition, ref List<string> nodesMark, ref List<string> nodesColor,string result)
{
string conditionValue = "";
switch (condition)
{
case Name.WeaponNodeCondition.position:
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "0", "1", "2", "3", "4" }, 1).ElementAt(0);
break;
case Name.WeaponNodeCondition.positionUnused:
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "0", "1", "2", "3", "4" }, 1).ElementAt(0);
break;
case Name.WeaponNodeCondition.positionUsed:
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "0", "1", "2", "3", "4" }, 1).ElementAt(0);
break;
case Name.WeaponNodeCondition.diffSettle:
conditionValue = Name.none;
break;
case Name.WeaponNodeCondition.usedCard:
switch (level)
{
case Name.WeaponNodeLevel.Basic:
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "1" }, 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Elementary:
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "2", }, 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Intermediate:
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "3" }, 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Advanced:
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "4" }, 1).ElementAt(0);
break;
}
break;
case Name.WeaponNodeCondition.threeColorDiffMoreThan:
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "3", "4", "5" }, 1).ElementAt(0);
break;
case Name.WeaponNodeCondition.everyNumNodeConvert:
switch (level)
{
case Name.WeaponNodeLevel.Basic:
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(10, 11), 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Elementary:
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(7, 9), 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Intermediate:
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(5, 6), 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Advanced:
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(3, 4), 1).ElementAt(0);
break;
}
break;
case Name.WeaponNodeCondition.everyColorNodeConvert:
condition = MathTool.GetRandomElements(Name.WeaponNodeCondition.PlayerColorConvertSet, 1).ElementAt(0);
switch (level)
{
case Name.WeaponNodeLevel.Basic:
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(6, 6), 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Elementary:
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(5, 5), 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Intermediate:
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(4, 4), 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Advanced:
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(3, 3), 1).ElementAt(0);
break;
}
break;
case Name.WeaponNodeCondition.bombbomb:
conditionValue = Name.none;
break;
case Name.WeaponNodeCondition.node:
conditionValue = Name.none;
HashSet<string> nodesA = new HashSet<string>();
switch (level)
{
case Name.WeaponNodeLevel.Basic:
nodesA = MathTool.GetRandomElements(new HashSet<string> { "1_0", "-1_0", "0_1", "0_-1", "-1_1", "-1_-1" }, 3);
break;
case Name.WeaponNodeLevel.Elementary:
nodesA = MathTool.GetRandomElements(new HashSet<string> { "1_0", "-1_0", "0_1", "0_-1", "-1_1", "-1_-1" }, 4);
break;
case Name.WeaponNodeLevel.Intermediate:
nodesA = MathTool.GetRandomElements(new HashSet<string> { "1_0", "-1_0", "0_1", "0_-1", "-1_1", "-1_-1" }, 5);
break;
case Name.WeaponNodeLevel.Advanced:
nodesA = MathTool.GetRandomElements(new HashSet<string> { "1_0", "-1_0", "0_1", "0_-1", "-1_1", "-1_-1" }, 6);
break;
}
nodesA.Add("0_0");
nodesMark = nodesA.ToList();
for (int i = 0; i < nodesA.Count; i++)
{
nodesColor.Add(MathTool.GetRandomElements(new HashSet<string> { Name.Color.Red, Name.Color.Blue, Name.Color.Yellow }, 1).ElementAt(0));
}
break;
case Name.WeaponNodeCondition.cardConditionPattern:
conditionValue = Name.none;
StringBuilder sb = new StringBuilder();
(string part1, string op) = getPart1AndOp(result);
sb.Append(part1)
.Append(op);
string part3 = "";
switch (level)
{
case Name.WeaponNodeLevel.Basic:
part3 = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(6, 9), 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Elementary:
part3 = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(10, 15), 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Intermediate:
part3 = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(18, 24), 1).ElementAt(0);
break;
case Name.WeaponNodeLevel.Advanced:
part3 = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(35, 45), 1).ElementAt(0);
break;
}
sb.Append(part3);
condition = sb.ToString();
break;
}
return conditionValue;
}
public string getResultValueWithLevel(string level,ref string result, string condition, string conditionValue)
{
string resultValue = "";
@ -905,7 +1116,7 @@ public class WeaponManager : Singleton<WeaponManager>
case Name.WeaponNodeFunction.everyRedNodeAddScore:
case Name.WeaponNodeFunction.everyYellowNodeAddScore:
case Name.WeaponNodeFunction.everyBlueNodeAddScore:
resultValue = getEveryNodeAddScoreValue(level, condition);
resultValue = getEveryNodeAddScoreValue(level);
break;
case Name.NodeItem.Volcano:
switch (level)
@ -933,7 +1144,7 @@ public class WeaponManager : Singleton<WeaponManager>
resultValue = MathTool.GetRandomElements(targets, 1).ElementAt(0);
break;
}
if (condition.Equals(Name.WeaponNodeCondition.everyNumNodeConvert)&&result.Equals(Name.WeaponNodeFunction.addScore))
if (Name.WeaponNodeCondition.PlayerConvertSet.Contains(condition)&&result.Equals(Name.WeaponNodeFunction.addScore))
{
result = Name.WeaponNodeFunction.addScoreThisTurn;
}
@ -1082,6 +1293,11 @@ public class WeaponManager : Singleton<WeaponManager>
{ Name.WeaponNodeLevel.Elementary, MathTool.GenerateIntegerSet(7, 9) },
{ Name.WeaponNodeLevel.Intermediate, MathTool.GenerateIntegerSet(5, 6) },
{ Name.WeaponNodeLevel.Advanced, MathTool.GenerateIntegerSet(3, 4) }};
Dictionary<string, HashSet<string>> everyColorNodeConvertDict = new Dictionary<string, HashSet<string>>
{ { Name.WeaponNodeLevel.Basic, MathTool.GenerateIntegerSet(7, 8) },
{ Name.WeaponNodeLevel.Elementary, MathTool.GenerateIntegerSet(5, 6) },
{ Name.WeaponNodeLevel.Intermediate, MathTool.GenerateIntegerSet(4, 4) },
{ Name.WeaponNodeLevel.Advanced, MathTool.GenerateIntegerSet(3, 3) }};
Dictionary<string, HashSet<string>> cardConditionPatternDict = new Dictionary<string, HashSet<string>>
{ { Name.WeaponNodeLevel.Basic, MathTool.GenerateIntegerSet(3, 5) },
{ Name.WeaponNodeLevel.Elementary, MathTool.GenerateIntegerSet(6, 8) },
@ -1142,6 +1358,17 @@ public class WeaponManager : Singleton<WeaponManager>
}
}
break;
case Name.WeaponNodeCondition.everyRedNodeConvert:
case Name.WeaponNodeCondition.everyBlueNodeConvert:
case Name.WeaponNodeCondition.everyYellowNodeConvert:
foreach (KeyValuePair<string, HashSet<string>> kvp in everyColorNodeConvertDict)
{
if (kvp.Value.Contains(conditionValue))
{
rarity = kvp.Key;
}
}
break;
case Name.WeaponNodeCondition.node:
if (nodesColor.Length == 3)
{

72
ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/WeaponNode.cs

@ -68,6 +68,8 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra
float currentTime;
bool isShow;
bool isOn;
[Header("ÊÇ·ñ¼¤»î")]
public bool isActive = false;
private void Update()
{
//SettleScore();
@ -105,16 +107,11 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra
Debug.Log("结算成功节点1");
//score = 0;
//scoreMul = 0f;
extraRedNodeCount = 0;
extraBlueNodeCount = 0;
extraYellowNodeCount = 0;
extraMostNodeCount = 0;
extraLeastNodeCount = 0;
extraAllNodeCount = 0;
turnScore = 0;
resetCountBeforeSettle();
if (isIgnoreCondition||ConditionCheck(position))
{
Debug.Log("结算成功节点2"+"位置"+position);
isActive = true;
if (isDoubleSettle)
{
SettleFunction(position, result,ref score);
@ -122,13 +119,44 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra
SettleFunction(position, result, ref score);
}
else
else if(!Name.WeaponNodeCondition.PlayerConvertSet.Contains(condition))
{
isActive = false;
}
score += turnScore;
}
public void resetCountBeforeSettle()
{
if (Name.WeaponNodeCondition.PlayerConvertSet.Contains(condition))
{
}
else
{
extraRedNodeCount = 0;
extraBlueNodeCount = 0;
extraYellowNodeCount = 0;
extraMostNodeCount = 0;
extraLeastNodeCount = 0;
extraAllNodeCount = 0;
turnScore = 0;
}
}
public void resetCountPerRound()
{
extraRedNodeCount = 0;
extraBlueNodeCount = 0;
extraYellowNodeCount = 0;
extraMostNodeCount = 0;
extraLeastNodeCount = 0;
extraAllNodeCount = 0;
turnScore = 0;
}
public virtual void SettleWeaponNodeForPlayerTurnEnd(int position)
{
Debug.Log("结算成功节点1");
@ -358,7 +386,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra
believerCount++;
}
}
score += believerCount * int.Parse(resultValue);
score += believerCount / int.Parse(resultValue.Split("_")[0]) * int.Parse(resultValue.Split("_")[1]);
break;
case Name.WeaponNodeFunction.addScoreThisTurn:
turnScore += int.Parse(resultValue);
@ -571,6 +599,30 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra
//MapUnityManager.Instance.switchNodeNum-= int.Parse(conditionValue);
}
break;
case Name.WeaponNodeCondition.everyRedNodeConvert:
if (MapUnityManager.Instance.switchRedNodeNum - settleCount * int.Parse(conditionValue) >= int.Parse(conditionValue))
{
check = true;
settleCount++;
//MapUnityManager.Instance.switchNodeNum-= int.Parse(conditionValue);
}
break;
case Name.WeaponNodeCondition.everyBlueNodeConvert:
if (MapUnityManager.Instance.switchBlueNodeNum - settleCount * int.Parse(conditionValue) >= int.Parse(conditionValue))
{
check = true;
settleCount++;
//MapUnityManager.Instance.switchNodeNum-= int.Parse(conditionValue);
}
break;
case Name.WeaponNodeCondition.everyYellowNodeConvert:
if (MapUnityManager.Instance.switchYellowNodeNum - settleCount * int.Parse(conditionValue) >= int.Parse(conditionValue))
{
check = true;
settleCount++;
//MapUnityManager.Instance.switchNodeNum-= int.Parse(conditionValue);
}
break;
}
}

6
ColorlessWorld-2024-4-2/Assets/Scripts/manager/MapUnityManager.cs

@ -47,6 +47,12 @@ public class MapUnityManager : Singleton<MapUnityManager>
public int switchNodeNum = 0;
public int switchRedNodeNum = 0;
public int switchBlueNodeNum = 0;
public int switchYellowNodeNum = 0;
public bool isMapChange = false;
public string getAdvNode()

Loading…
Cancel
Save