Browse Source

Merge pull request '0713提交' (#143) from dev-0703-0713 into dev45-0703NewVer

Reviewed-on: #143
remotes/checkIfPRContentChanged-1752730301603610417/tmp_dev45-0703NewVer
yjm484 5 months ago
parent
commit
0fa1dbf266
  1. 12
      ColorlessWorld-2024-4-2/Assets/GameDate/cardDeckList.asset
  2. 170
      ColorlessWorld-2024-4-2/Assets/Scenes/SampleScene.unity
  3. 2
      ColorlessWorld-2024-4-2/Assets/Scripts/AttackScore/AttackScorManager.cs
  4. 14
      ColorlessWorld-2024-4-2/Assets/Scripts/Card/CardEntity.cs
  5. 6
      ColorlessWorld-2024-4-2/Assets/Scripts/Card/TurnMaster.cs
  6. 8
      ColorlessWorld-2024-4-2/Assets/Scripts/MapUnity.cs
  7. 24
      ColorlessWorld-2024-4-2/Assets/Scripts/MapUnity/Domain.cs
  8. 11
      ColorlessWorld-2024-4-2/Assets/Scripts/MapUnity/Domain.cs.meta
  9. 10
      ColorlessWorld-2024-4-2/Assets/Scripts/Tool/Name.cs
  10. 129
      ColorlessWorld-2024-4-2/Assets/Scripts/Tool/getNodeTools.cs
  11. 20
      ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/Weapon.cs
  12. 11
      ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/Weapon.cs.meta
  13. 23
      ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/WeaponManager.cs
  14. 256
      ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/WeaponNode.cs
  15. 11
      ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/WeaponNodeChild/Enemy/WeaponNode_2001.cs
  16. 11
      ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/WeaponNodeChild/Player/WeaponNode_1001.cs
  17. 95
      ColorlessWorld-2024-4-2/Assets/Scripts/manager/DomainManager.cs
  18. 11
      ColorlessWorld-2024-4-2/Assets/Scripts/manager/DomainManager.cs.meta
  19. 2
      ColorlessWorld-2024-4-2/Assets/StreamingAssets/card_data_5.csv

12
ColorlessWorld-2024-4-2/Assets/GameDate/cardDeckList.asset

@ -20,9 +20,9 @@ MonoBehaviour:
- 1001
- 1001
- 1001
- 2002
- 2001
- 2001
- 2001
- 2001
- 2001
- 1012
- 1012
- 1012
- 1012
- 1012
- 1012

170
ColorlessWorld-2024-4-2/Assets/Scenes/SampleScene.unity

@ -2954,10 +2954,11 @@ MonoBehaviour:
m_EditorClassIdentifier:
weaponNodeList:
- {fileID: 457398705}
- {fileID: 1713025708}
- {fileID: 0}
enemyWeaponNodeList:
- {fileID: 1008343837}
- {fileID: 0}
playerUsingWeapon: {fileID: 0}
--- !u!1 &142863955
GameObject:
m_ObjectHideFlags: 0
@ -3080,6 +3081,51 @@ MonoBehaviour:
cardEntityList: []
cardPanle: {fileID: 959299391}
maxHandCard: 0
--- !u!1 &169318230
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 169318231}
- component: {fileID: 169318232}
m_Layer: 0
m_Name: DomainManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &169318231
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 169318230}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 348176937}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &169318232
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 169318230}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1f7ddafd2949a0042bfa9a1cdaf1dee3, type: 3}
m_Name:
m_EditorClassIdentifier:
domainScore: 0
--- !u!1 &169521353
GameObject:
m_ObjectHideFlags: 0
@ -12089,6 +12135,7 @@ Transform:
- {fileID: 430040821}
- {fileID: 1607756701}
- {fileID: 940772628}
- {fileID: 169318231}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &348555339
@ -14239,6 +14286,16 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
score: 0
condition: node
result: score+5
nodesMark:
- 0_0
- 1_0
- 0_1
nodesColor:
- white
- red
- blue
--- !u!114 &457398706
MonoBehaviour:
m_ObjectHideFlags: 0
@ -27566,6 +27623,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
score: 0
condition:
result:
nodesMark: []
nodesColor: []
--- !u!1 &1009332616
GameObject:
m_ObjectHideFlags: 0
@ -33557,8 +33618,6 @@ MonoBehaviour:
- Y: []
- Y: []
character: 0
playerOn: {fileID: 0}
lastPlayerOn: {fileID: 0}
lastWhoColor: 0
playerState: {fileID: 0}
onDrag: 0
@ -46498,8 +46557,7 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: -0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1713025703}
m_Children: []
m_Father: {fileID: 2109090871}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
@ -47159,108 +47217,6 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &1713025702
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1713025703}
- component: {fileID: 1713025706}
- component: {fileID: 1713025705}
- component: {fileID: 1713025708}
- component: {fileID: 1713025707}
m_Layer: 5
m_Name: WeaponNode
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1713025703
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1713025702}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1674521218}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -8, y: -8}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1713025705
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1713025702}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.36209506, g: 0.5976993, b: 0.9716981, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1713025706
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1713025702}
m_CullTransparentMesh: 1
--- !u!225 &1713025707
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1713025702}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!114 &1713025708
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1713025702}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f2fbc27b744afba46a8f18f6c09eed3f, type: 3}
m_Name:
m_EditorClassIdentifier:
score: 0
--- !u!1 &1715971502
GameObject:
m_ObjectHideFlags: 0

2
ColorlessWorld-2024-4-2/Assets/Scripts/AttackScore/AttackScorManager.cs

@ -95,7 +95,7 @@ public class AttackScorManager : Singleton<AttackScorManager>
}
}
GetScore();
//GetScore();
}
public void GetScore()//临时方法,给玩家和怪物一个临时分

14
ColorlessWorld-2024-4-2/Assets/Scripts/Card/CardEntity.cs

@ -861,16 +861,16 @@ public class CardEntity : MonoBehaviour
}
/*for (int i = 0; i < cardOriginalData.conditionAndFunctionVal.Count; i++)
{
bool isAllMatch=true;
List<bool> matchList=new List<bool>();
bool isAllMatch = true;
List<bool> matchList = new List<bool>();
KeyValuePair<string, Tuple<string, string>> kvp = cardOriginalData.conditionAndFunctionVal.ElementAt(i);
string[] keys= kvp.Key.Split("_");
string[] keys = kvp.Key.Split("_");
//Debug.Log("cardIdÊÇ" + cardOriginalData.CardId + "keyÊÇ" + keys);
//string[] functions = kvp.Value.Item1.Split("_");
//string[] vals = kvp.Value.Item2.Split("_");
for (int j = 0; j < keys.Length; j++)
{
if (keys[j].Equals(Name.Condition.None))
{
//cardFunToLose.Remove(keys[j]);
@ -885,7 +885,7 @@ public class CardEntity : MonoBehaviour
{
if (!matchList[k])
{
isAllMatch=false;
isAllMatch = false;
}
}
@ -904,8 +904,8 @@ public class CardEntity : MonoBehaviour
}
string[] fun = cardOriginalData.conditionAndFunctionVal.ElementAt(exclusiveConditionIndex).Value.Item1.Split("_");
string[] vals = cardOriginalData.conditionAndFunctionVal.ElementAt(exclusiveConditionIndex).Value.Item2.Split("_");*/
//resultsScreenCal(cardDataSummary);
}

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

@ -137,7 +137,8 @@ public class TurnMaster : Singleton<TurnMaster>
restoreResource(settleTurn);
//重置遗物计数
ResetLegacy();
//领域的回合开始
DomainManager.Instance.startTurnDomainScoreReset(settleTurn);
//恢复体力
GameManager.Instance.playerState.currentStepRange = Usermanager.Instance.StepRangeCalculation(GameManager.Instance.playerState.maxStepRange);
GameManager.Instance.isPlayerMoved = false;
@ -166,6 +167,9 @@ public class TurnMaster : Singleton<TurnMaster>
//临时添加,随机赋值分数
AttackScorManager.Instance.SettleScore();
//领域的回合结束
DomainManager.Instance.endTurnDomainListRemove();
//阶段流转
StartCoroutine(WaitEndPlayerTurn());
}

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

@ -20,6 +20,8 @@ public class MapUnity : MonoBehaviour
public bool canChange=true;
public Dictionary<string,bool> isCaledDictionary=new Dictionary<string, bool>();
public bool compalte;//标识已完成
[Header("UI效果范围控件")]
@ -226,6 +228,12 @@ public class MapUnity : MonoBehaviour
public void switchColor(int newColor)
{
Debug.Log("switchColor");
WeaponManager.Instance.isMapChange = true;
isCaledDictionary.Keys.ToList().ForEach(key =>
{
isCaledDictionary[key] = false;
});
if (canChange==false)
{
return;

24
ColorlessWorld-2024-4-2/Assets/Scripts/MapUnity/Domain.cs

@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Domain
{
public string targetNodeMark;
public string[] nodesMark;
public string[] nodesColor;
public string result;
public bool isUsed;
public bool isUsedThisTurn;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

11
ColorlessWorld-2024-4-2/Assets/Scripts/MapUnity/Domain.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 00e6312de459e454f93af4ff15b94d13
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

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

@ -784,7 +784,7 @@ public static class Name
//2***
public const string pattern2xxx = @"^2\d{3}$";
//¿¨ÅÆÌõ¼þ
public const string cardConditionPattern = @"(\w+)([><=])(\d+)";
public const string cardConditionPattern = @"(\w+)([><=+])(\d+)";
}
public static class CardFunctionString
@ -845,6 +845,7 @@ public static class Name
public static class Condition
{
public const string None = "none";
public const string Node = "node";
}
public static class EnemyPool
@ -862,4 +863,11 @@ public static class Name
public const string PartTwo = "PartTwo";
public const string Condition = "Condition";
}
public static class WeaponNodeFunction
{
//¼Ó·Ö
public const string score = "score";
}
}

129
ColorlessWorld-2024-4-2/Assets/Scripts/Tool/getNodeTools.cs

@ -930,4 +930,133 @@ public class getNodeTools
}
return mapUnities;
}
public static bool CheckDomainColorForSingleNode(string[] nodesMark, string[] nodesColor, MapUnity targetNode)
{
bool result=true;
//Vector3 face = targetNode.transform.position - GameManager.Instance.playerOn.transform.position;
float euler = 90.0f;
//Debug.Log("currentNode的X是" + targetNode.locationX + "currentNode的Y是" + targetNode.locationY);
//Debug.Log("currentNode的Q是" + currentNode.cubeQ + "currentNode的S是" + currentNode.cubeS + "currentNode的R是" + currentNode.cubeR);
List<(int, int, int)> cubeList = new List<(int, int, int)>();
int intEuler = (int)euler;
//Debug.Log("euler是" + intEuler);
for (int i = 0; i < nodesMark.Length; i++)
{
try
{
string[] marks = nodesMark[i].Split("_");
Debug.Log("AxialToCube的X是" + int.Parse(marks[0]) + "AxialToCube的Y是" + int.Parse(marks[1]));
(int q, int s, int y) = MathTool.AxialToCube(int.Parse(marks[0]), int.Parse(marks[1]));
cubeList.Add((q, s, y));
}
catch (Exception e)
{ }
}
List<(int, int, int)> rotatedCubeList = new List<(int, int, int)>();
rotatedCubeList = MathTool.RotateCoordinates(cubeList, intEuler);
foreach (var tuple in rotatedCubeList)
{
MapUnity endNode = null;
endNode = getNodeTools.getNodeWithCube(tuple.Item1, tuple.Item2, tuple.Item3);
// Debug.Log("rotatedNode的X是" + endNode.locationX + "rotatedNode的Y是" + endNode.locationY);
//Debug.Log("rotatedNode的Q是" + tuple.Item1 + "rotatedNode的S是" + tuple.Item2 + "rotatedNode的R是" + tuple.Item3);
}
List<(int, int, int)> trueCubeList = new List<(int, int, int)>();
trueCubeList = MathTool.TranslateHexesToNewOrigin(rotatedCubeList, (targetNode.cubeQ, targetNode.cubeS, targetNode.cubeR));
Debug.Log("入口4"+trueCubeList.Count);
for (int i = 0; i < trueCubeList.Count; i++)
{
MapUnity endNode = null;
endNode = getNodeTools.getNodeWithCube(trueCubeList[i].Item1, trueCubeList[i].Item2, trueCubeList[i].Item3);
// Debug.Log("endNode的X是" + endNode.locationX + "endNode的Y是" + endNode.locationY);
//Debug.Log("endNode的Q是"+endNode.cubeQ+ "endNode的S是" + endNode.cubeS+ "endNode的R是" + endNode.cubeR);
if (endNode != null)
{
Debug.Log("endNode颜色是"+Name.intColorTostring(endNode.whoColour));
if (!endNode.whoColour.Equals(Name.stringColorToint(nodesColor[i])))
{
result=false;
return result;
}
}
}
return result;
}
public static bool CheckWeaponConditionColorForSingleNode(string[] nodesMark, string[] nodesColor, MapUnity targetNode,string tag)
{
/* if (targetNode.isCaledDictionary.TryGetValue(tag, out bool isChecked))
{
if (isChecked)
{
return false;
}
}
else
{
}*/
//targetNode.isCaledDictionary.TryAdd(tag, true);
Debug.Log("check中");
bool result = true;
//Vector3 face = targetNode.transform.position - GameManager.Instance.playerOn.transform.position;
float euler = 90.0f;
//Debug.Log("currentNode的X是" + targetNode.locationX + "currentNode的Y是" + targetNode.locationY);
//Debug.Log("currentNode的Q是" + currentNode.cubeQ + "currentNode的S是" + currentNode.cubeS + "currentNode的R是" + currentNode.cubeR);
List<(int, int, int)> cubeList = new List<(int, int, int)>();
int intEuler = (int)euler;
//Debug.Log("euler是" + intEuler);
for (int i = 0; i < nodesMark.Length; i++)
{
try
{
string[] marks = nodesMark[i].Split("_");
Debug.Log("AxialToCube的X是" + int.Parse(marks[0]) + "AxialToCube的Y是" + int.Parse(marks[1]));
(int q, int s, int y) = MathTool.AxialToCube(int.Parse(marks[0]), int.Parse(marks[1]));
cubeList.Add((q, s, y));
}
catch (Exception e)
{ }
}
List<(int, int, int)> rotatedCubeList = new List<(int, int, int)>();
rotatedCubeList = MathTool.RotateCoordinates(cubeList, intEuler);
foreach (var tuple in rotatedCubeList)
{
MapUnity endNode = null;
endNode = getNodeTools.getNodeWithCube(tuple.Item1, tuple.Item2, tuple.Item3);
// Debug.Log("rotatedNode的X是" + endNode.locationX + "rotatedNode的Y是" + endNode.locationY);
//Debug.Log("rotatedNode的Q是" + tuple.Item1 + "rotatedNode的S是" + tuple.Item2 + "rotatedNode的R是" + tuple.Item3);
}
List<(int, int, int)> trueCubeList = new List<(int, int, int)>();
trueCubeList = MathTool.TranslateHexesToNewOrigin(rotatedCubeList, (targetNode.cubeQ, targetNode.cubeS, targetNode.cubeR));
Debug.Log("入口4" + trueCubeList.Count);
for (int i = 0; i < trueCubeList.Count; i++)
{
MapUnity endNode = null;
endNode = getNodeTools.getNodeWithCube(trueCubeList[i].Item1, trueCubeList[i].Item2, trueCubeList[i].Item3);
// Debug.Log("endNode的X是" + endNode.locationX + "endNode的Y是" + endNode.locationY);
//Debug.Log("endNode的Q是"+endNode.cubeQ+ "endNode的S是" + endNode.cubeS+ "endNode的R是" + endNode.cubeR);
if (endNode != null)
{
Debug.Log("endNode颜色是" + Name.intColorTostring(endNode.whoColour));
if (!endNode.whoColour.Equals(Name.stringColorToint(nodesColor[i])))
{
result = false;
return result;
}
}
else
{
result = false;
return result;
}
}
return result;
}
}

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

@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SocialPlatforms.Impl;
using static UnityEngine.Rendering.DebugUI;
public class Weapon : MonoBehaviour
{
public virtual void Settle()
{
for (int i = 0; i < WeaponManager.Instance.weaponNodeList.Count; i++)
{
if (WeaponManager.Instance.weaponNodeList[i] != null)
{
WeaponManager.Instance.weaponNodeList[i].SettleWeaponNode(i);
}
}
}
}

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

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 45d70fbf8aae73d47a5274afa26936d0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

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

@ -10,8 +10,30 @@ public class WeaponManager : Singleton<WeaponManager>
//怪物武器节点
public List<WeaponNode> enemyWeaponNodeList = new List<WeaponNode>();
public Weapon playerUsingWeapon;
public bool isMapChange=true;
private void Start()
{
playerUsingWeapon = new Weapon();
}
private void Update()
{
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
stopwatch.Start();
if (isMapChange)
{
playerUsingWeapon.Settle();
isMapChange = false;
}
stopwatch.Stop();
Debug.LogWarning($"ĐÔÄÜžŻ¸ćŁĄşÄĘą {stopwatch.ElapsedMilliseconds}ms");
SettleWeaponNode();
SettleEnemyWeaponNode();
}
@ -26,6 +48,7 @@ public class WeaponManager : Singleton<WeaponManager>
}
}
score += DomainManager.Instance.domainScore;
AttackScorManager .Instance .playerScore = score;
}
public void SettleEnemyWeaponNode()

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

@ -1,7 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.EventSystems;
using static UnityEngine.InputSystem.InputControlScheme.MatchResult;
using Match = System.Text.RegularExpressions.Match;
public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDragHandler
{
@ -13,15 +17,261 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra
Vector3 mousePositionOnScreen;//获取到点击屏幕的屏幕坐标
Vector3 mousePositionInWorld;//将点击屏幕的屏幕坐标转换为世界坐标
public string condition;
public string result;
public string[] nodesMark;
public string[] nodesColor;
private void Update()
{
SettleScore();
//SettleScore();
}
public virtual void SettleScore()
public virtual void SettleWeaponNode(int position)
{
score =2;
Debug.Log("结算成功节点1");
if (ConditionCheck(position))
{
Debug.Log("结算成功节点2");
SettleFunction(position, result);
}
else
{
score = 0;
}
}
public virtual void SettleFunction(int position,string result)
{
Debug.Log("结算成功节点3");
string[] keys = result.Split("_");
for (int j = 0; j < keys.Length; j++)
{
SingleFunctionSettle(keys[j]);
}
}
public virtual bool ConditionCheck(int position)
{
bool result = true;
string[] keys = condition.Split("_");
List<bool> matchList = new List<bool>();
for (int j = 0; j < keys.Length; j++)
{
if (keys[j].Equals(Name.Condition.None))
{
//cardFunToLose.Remove(keys[j]);
matchList.Add(true);
}
else
{
matchList.Add(SingleConditionCheck(keys[j]));
}
}
for (int k = 0; k < matchList.Count; k++)
{
Debug.Log("matchList是" + matchList[k]);
if (!matchList[k])
{
result = false;
}
}
return result;
}
public void SingleFunctionSettle(string result)
{
//Debug.Log("结算成功节点4");
Match match = Regex.Match(result, Name.Regex.cardConditionPattern);
if (match.Success)
{
string firstPart = match.Groups[1].Value; // 第一部分
string op = match.Groups[2].Value; // 运算符部分
string secondPart = match.Groups[3].Value; // 第二部分
//Debug.Log("结算成功节点10:" + secondPart);
if (firstPart.Equals(Name.WeaponNodeFunction.score))
{
//Debug.Log("结算成功节点5");
score =int.Parse(secondPart);
}
}
else
//不需要运算符号的结算
{
}
}
public bool SingleConditionCheck(string condition)
{
bool check = false;
//cardOriginalData.originFunctionVal.Clear();
//Debug.Log("外面condition是" + kvp.Key);
Match match = Regex.Match(condition, Name.Regex.cardConditionPattern);
if (match.Success)
{
Debug.Log("结算成功节点6");
string firstPart = match.Groups[1].Value; // 第一部分
string op = match.Groups[2].Value; // 运算符部分
string secondPart = match.Groups[3].Value; // 第二部分
int firstPartCount = CardManager.Instance.evaluateExpression(firstPart);
int secondPartCount = CardManager.Instance.evaluateExpression(secondPart);
int thresholdShift = 0;
Debug.Log("结算成功节点8:"+firstPart + op + secondPart);
Debug.Log("结算成功节点9:" + firstPartCount + op + secondPartCount);
if (performComparison(firstPartCount, op, secondPartCount, thresholdShift))
{
Debug.Log("结算成功节点7");
check = true;
}
else
{
//MathTool.AddOrUpdateDictionary(cardFunToLose, kvp.Value.Item1, kvp.Value.Item2);
/*Image condition = conditionList[conditionListindex].GetComponent<Image>();
cardFunToLose.TryAdd(conditon, tuple);*/
//MathTool.SubtractOrUpdateDictionary(cardOriginalData.originFunctionVal, kvp.Value.Item1, kvp.Value.Item2);
}
}
else if (condition.Equals(Name.Condition.Node))
{
check = checkConditionNode(nodesMark, nodesColor);
}
return check;
}
public bool checkConditionNode(string[] nodesMark, string[] nodesColor)
{
bool result = false;
if (basicCheck(nodesColor))
{
if (primeCheck(nodesMark, nodesColor))
{
result = true;
}
}
else
{
return result;
}
return result;
}
public bool primeCheck(string[] nodesMark, string[] nodesColor)
{
bool result = false;
bool haveOrigin=false;
HashSet <MapUnity> targetNodes= new HashSet <MapUnity>();
for (int i = 0; i < nodesMark.Length; i++)
{
if (nodesMark[i].Equals("0_0"))
{
Debug.Log("haveOrigin");
haveOrigin= true;
targetNodes =getNodeTools.getNodesWithColor(nodesColor[i]);
}
}
if (!haveOrigin)
{
targetNodes = getNodeTools.getAllNodes();
}
string nodesMarkCsv = string.Join(",", nodesMark);
string nodesColorCsv = string.Join(",", nodesColor);
char[] buffer = new char[nodesMarkCsv.Length + nodesColorCsv.Length];
nodesMarkCsv.CopyTo(0, buffer, 0, nodesMarkCsv.Length);
nodesColorCsv.CopyTo(0, buffer, nodesMarkCsv.Length, nodesColorCsv.Length);
string onlyTapForWeaponNode = new string(buffer);
Debug.Log("onlyTapForWeaponNode是" + onlyTapForWeaponNode);
foreach (MapUnity mapUnity in targetNodes)
{
if (mapUnity.isCaledDictionary.TryGetValue(onlyTapForWeaponNode, out bool isChecked))
{
Debug.Log("isChecked是"+ isChecked+"x是"+mapUnity.locationX+"y是"+mapUnity.locationY);
if (!isChecked)
{
Debug.Log("false进行check");
mapUnity.isCaledDictionary[onlyTapForWeaponNode] = true;
if (getNodeTools.CheckWeaponConditionColorForSingleNode(nodesMark, nodesColor, mapUnity, onlyTapForWeaponNode))
{
Debug.Log("check成功");
result = true;
mapUnity.isCaledDictionary[onlyTapForWeaponNode]=false;
return result;
}
}
}
else
{
Debug.Log("add了true");
mapUnity.isCaledDictionary[onlyTapForWeaponNode]=true;
if (getNodeTools.CheckWeaponConditionColorForSingleNode(nodesMark, nodesColor, mapUnity, onlyTapForWeaponNode))
{
result = true;
return result;
}
}
}
return result;
}
public bool basicCheck(string[] nodesColor)
{
bool result = false;
int redNodeCount = 0;
int blueNodeCount = 0;
int greenNodeCount = 0;
int whiteNodeCount = 0;
int blackNodeCount = 0;
int yellowNodeCount = 0;
for (int i = 0; i < nodesColor.Length; i++)
{
switch (nodesColor[i])
{
case Name.Color.White:
whiteNodeCount++;
break;
case Name.Color.Red:
redNodeCount++;
break;
case Name.Color.Black:
blackNodeCount++;
break;
case Name.Color.Yellow:
yellowNodeCount++;
break;
case Name.Color.Blue:
blueNodeCount++;
break;
case Name.Color.Green:
greenNodeCount++;
break;
}
if(whiteNodeCount>MapUnityManager.Instance.whiteNodeCount|| redNodeCount > MapUnityManager.Instance.redNodeCount || blackNodeCount > MapUnityManager.Instance.blackNodeCount || yellowNodeCount > MapUnityManager.Instance.yellowNodeCount || blueNodeCount > MapUnityManager.Instance.blueNodeCount|| greenNodeCount > MapUnityManager.Instance.greenNodeCount)
{
return result;
}
else
{
result = true;
}
}
return result;
}
private bool performComparison(int colorValue, string op, int number, int thresholdShift)
{
return op switch
{
">" => colorValue > number - thresholdShift,
"<" => colorValue < number + thresholdShift,
"=" => colorValue == number,
_ => false
};
}
public void OnBeginDrag(PointerEventData eventData)
{
originParent = transform.parent;

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

@ -4,15 +4,4 @@ using UnityEngine;
public class WeaponNode_2001 : WeaponNode
{
public override void SettleScore()
{
if (MapUnityManager.Instance.blackNodeCount > 15)
{
score = 7;
}
else
{
score = 0;
}
}
}

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

@ -4,15 +4,4 @@ using UnityEngine;
public class WeaponNode_1001 : WeaponNode
{
public override void SettleScore()
{
if (MapUnityManager.Instance.whiteNodeCount>10)
{
score = 5;
}
else
{
score = 0;
}
}
}

95
ColorlessWorld-2024-4-2/Assets/Scripts/manager/DomainManager.cs

@ -0,0 +1,95 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.SocialPlatforms.Impl;
public class DomainManager : Singleton<DomainManager>
{
public List<Domain> DomainList;
public int domainScore;
// Start is called before the first frame update
void Start()
{
Domain domain = new Domain();
domain.targetNodeMark = "3_3";
domain.nodesMark = new string[] { "0_0"};
domain.nodesColor = new string[] { "white" };
domain.result = "score+5";
domain.isUsed = false;
domain.isUsedThisTurn = false;
DomainList =new List<Domain> { domain };
}
// Update is called once per frame
void Update()
{
foreach (Domain domain in DomainList)
{
if (domain != null&&domain.isUsedThisTurn == false)
{
if (checkDomain(domain))
{
domain.isUsedThisTurn = true;
settleDomainResult(domain);
}
}
}
Debug.Log("domainScore是"+ domainScore);
}
public void endTurnDomainListRemove()
{
foreach (Domain domain in DomainList.ToList())
{
if (domain.isUsedThisTurn == true)
{
DomainList.Remove(domain);
}
}
}
public void startTurnDomainScoreReset(int settleTurn)
{
if (settleTurn != 0)
{
domainScore = 0;
}
}
public bool checkDomain(Domain domain)
{
bool result=false;
string[] targetNodeMark = domain.targetNodeMark.Split("_");
result = getNodeTools.CheckDomainColorForSingleNode(domain.nodesMark, domain.nodesColor, getNodeTools.LocationToGetNode(int.Parse(targetNodeMark[0]) , int.Parse(targetNodeMark[1])));
return result;
}
public void settleDomainResult(Domain domain)
{
Debug.Log("结算成功节点4");
Match match = Regex.Match(domain.result, Name.Regex.cardConditionPattern);
if (match.Success)
{
string firstPart = match.Groups[1].Value; // 第一部分
string op = match.Groups[2].Value; // 运算符部分
string secondPart = match.Groups[3].Value; // 第二部分
Debug.Log("结算成功节点10:" + secondPart);
if (firstPart.Equals(Name.WeaponNodeFunction.score))
{
Debug.Log("结算成功节点5");
domainScore += int.Parse(secondPart);
}
}
}
}

11
ColorlessWorld-2024-4-2/Assets/Scripts/manager/DomainManager.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1f7ddafd2949a0042bfa9a1cdaf1dee3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

2
ColorlessWorld-2024-4-2/Assets/StreamingAssets/card_data_5.csv

@ -8,7 +8,7 @@
1009,1,1,1,3_1,none,23,1,0_0;1_0;2_0,green;green;green,CardIcon/1016,突刺,2
1010,1,1,1,3_1,none,19,2,0_0;1_0;2_0;1_1;1_-1,blue;blue;blue;blue;blue,CardIcon/1017,重锤,1
1011,1,1,1,3_1,none,5,1,0_0;1_0;2_0;3_0;4_0,blue;blue;blue;blue;blue,CardIcon/1018,长鞭,2
1012,1,0,1,3_1,none,none,none,0_0;1_0;0_1,yellow;red;blue,CardIcon/1019,彩球,1
1012,1,0,1,3_1,none,none,none,0_0;1_0;0_1,white;red;blue,CardIcon/1019,彩球,1
1013,1,1,1,3_1,none,13;2,1;8,1_0;0_-1;0_1;2_0;1_-1;1_1;3_0;2_1;2_-1,red;red;red;blue;blue;blue;yellow;yellow;yellow,CardIcon/1020,九宫格,2
1014,1,1,1,3_1,none,1,5,1_0;2_0;3_0;-1_1;-1_2;-2_3;-1_-1;-1_-2;-2_-3,red;red;red;yellow;yellow;yellow;blue;blue;blue,CardIcon/1021,三色线,2
1016,1,1,1,3_1,none,53,2&3,0_0;1_0;2_0;0_1;0_-1;1_2;1_-2,red;red;red;red;red;red;red,CardIcon/1021,散射,1

1 ID 费用类型 费用 施法范围 作用范围 条件 功能 数值 地块标记 地块颜色 图片路径 名称 稀有度
8 1009 1 1 1 3_1 none 23 1 0_0;1_0;2_0 green;green;green CardIcon/1016 突刺 2
9 1010 1 1 1 3_1 none 19 2 0_0;1_0;2_0;1_1;1_-1 blue;blue;blue;blue;blue CardIcon/1017 重锤 1
10 1011 1 1 1 3_1 none 5 1 0_0;1_0;2_0;3_0;4_0 blue;blue;blue;blue;blue CardIcon/1018 长鞭 2
11 1012 1 0 1 3_1 none none none 0_0;1_0;0_1 yellow;red;blue white;red;blue CardIcon/1019 彩球 1
12 1013 1 1 1 3_1 none 13;2 1;8 1_0;0_-1;0_1;2_0;1_-1;1_1;3_0;2_1;2_-1 red;red;red;blue;blue;blue;yellow;yellow;yellow CardIcon/1020 九宫格 2
13 1014 1 1 1 3_1 none 1 5 1_0;2_0;3_0;-1_1;-1_2;-2_3;-1_-1;-1_-2;-2_-3 red;red;red;yellow;yellow;yellow;blue;blue;blue CardIcon/1021 三色线 2
14 1016 1 1 1 3_1 none 53 2&3 0_0;1_0;2_0;0_1;0_-1;1_2;1_-2 red;red;red;red;red;red;red CardIcon/1021 散射 1
Loading…
Cancel
Save