From 1302e2f0e32ef64cf5dc7f27293ef51f4e570e3e Mon Sep 17 00:00:00 2001 From: yjm484 <171359351@qq.com> Date: Mon, 21 Jul 2025 17:35:44 +0800 Subject: [PATCH] =?UTF-8?q?0721=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NewChangeMaterials/AnimNewChangeMap.mat | 2 +- .../MapNodePrefab/PictureMapUnity.prefab | 14 +- .../Assets/Scenes/SampleScene.unity | 376 +++++++++++++++++- .../Assets/Scripts/Card/CardPictureManager.cs | 2 +- .../Assets/Scripts/Card/TurnMaster.cs | 9 +- .../Assets/Scripts/Tool/Name.cs | 100 +++++ .../Assets/Scripts/Tool/getNodeTools.cs | 2 +- .../Assets/Scripts/Weapon/WeaponNode.cs | 12 + .../Assets/Scripts/manager/CardManager.cs | 111 ++++++ 9 files changed, 612 insertions(+), 16 deletions(-) diff --git a/ColorlessWorld-2024-4-2/Assets/Materials/Map/NewChangeMaterials/AnimNewChangeMap.mat b/ColorlessWorld-2024-4-2/Assets/Materials/Map/NewChangeMaterials/AnimNewChangeMap.mat index 501ce0e7..af086289 100644 --- a/ColorlessWorld-2024-4-2/Assets/Materials/Map/NewChangeMaterials/AnimNewChangeMap.mat +++ b/ColorlessWorld-2024-4-2/Assets/Materials/Map/NewChangeMaterials/AnimNewChangeMap.mat @@ -17,7 +17,7 @@ Material: m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 - m_CustomRenderQueue: 3001 + m_CustomRenderQueue: 2001 stringTagMap: {} disabledShaderPasses: [] m_LockedProperties: diff --git a/ColorlessWorld-2024-4-2/Assets/Prefab/MapNodePrefab/PictureMapUnity.prefab b/ColorlessWorld-2024-4-2/Assets/Prefab/MapNodePrefab/PictureMapUnity.prefab index af06df91..5b23fd66 100644 --- a/ColorlessWorld-2024-4-2/Assets/Prefab/MapNodePrefab/PictureMapUnity.prefab +++ b/ColorlessWorld-2024-4-2/Assets/Prefab/MapNodePrefab/PictureMapUnity.prefab @@ -342,12 +342,12 @@ MonoBehaviour: blackColour: - {fileID: 2800000, guid: 0d190d4d18121de46b55424cb52155f4, type: 3} whiteColour: - - {fileID: 2800000, guid: 9f64915678c4dcb43b1266e49700146c, type: 3} - - {fileID: 2800000, guid: fe69528fd92aa7f4b8c2529bef7a3ac4, type: 3} - - {fileID: 2800000, guid: 8229454afa686f34da83af9f5f955628, type: 3} - - {fileID: 2800000, guid: 58c17d73353b4fc4785669248cd48d99, type: 3} - - {fileID: 2800000, guid: e689cad2509d7bc4bba7defbba41a822, type: 3} - - {fileID: 2800000, guid: 042cf53df8df4314ca996a86ade12388, type: 3} + - {fileID: 2800000, guid: 174158a9ca1149747bbd00cf376bb9b6, type: 3} + - {fileID: 2800000, guid: acb404899dfdae946a7a481a7b7a64ac, type: 3} + - {fileID: 2800000, guid: cfc596b438638b5428fa359bdcf0498c, type: 3} + - {fileID: 2800000, guid: 2579ee4163173fd4da71cfb0e0d53990, type: 3} + - {fileID: 2800000, guid: cf40d5d917d1d544b8599d165fe451b0, type: 3} + - {fileID: 2800000, guid: 395bf285fd0db4d4aa71e74c2dbc0926, type: 3} metalColour: - {fileID: 2800000, guid: efe04a796da1abd42a9622451d56a1f1, type: 3} colourGameObject: {fileID: 7818877686521749494} @@ -2210,9 +2210,9 @@ RectTransform: - {fileID: 7231599482135577161} - {fileID: 7733531765337128758} - {fileID: 4343181389262309683} - - {fileID: 1923089709642351595} - {fileID: 2939303564605795931} - {fileID: 7008995088658298980} + - {fileID: 1923089709642351595} m_Father: {fileID: 2919289406578669922} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} diff --git a/ColorlessWorld-2024-4-2/Assets/Scenes/SampleScene.unity b/ColorlessWorld-2024-4-2/Assets/Scenes/SampleScene.unity index 365a5c58..be74e63f 100644 --- a/ColorlessWorld-2024-4-2/Assets/Scenes/SampleScene.unity +++ b/ColorlessWorld-2024-4-2/Assets/Scenes/SampleScene.unity @@ -3534,7 +3534,6 @@ MonoBehaviour: isMapChange: 0 playerWeaponNodeList: {fileID: 2109090871} enemyWeaponNodeList: {fileID: 1930541759} - isMapChange: 1 --- !u!1 &142863955 GameObject: m_ObjectHideFlags: 0 @@ -17328,6 +17327,9 @@ MonoBehaviour: extraAllNodeCount: 0 isIgnoreCondition: 0 isDoubleSettle: 0 + resultDescription: + conditionDescription: + gemImage: {fileID: 0} --- !u!114 &457398706 MonoBehaviour: m_ObjectHideFlags: 0 @@ -27474,7 +27476,8 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: -0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 851291880} m_Father: {fileID: 2109090871} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} @@ -29337,6 +29340,126 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 849144528} m_CullTransparentMesh: 1 +--- !u!1 &851291879 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 851291880} + - component: {fileID: 851291884} + - component: {fileID: 851291883} + - component: {fileID: 851291882} + - component: {fileID: 851291881} + m_Layer: 5 + m_Name: WeaponNode + m_TagString: WeaponDragPanel + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &851291880 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 851291879} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -0.00003882618} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 801073709} + 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: 87.999985} + m_SizeDelta: {x: -8, y: -8} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!225 &851291881 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 851291879} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!114 &851291882 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 851291879} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f2fbc27b744afba46a8f18f6c09eed3f, type: 3} + m_Name: + m_EditorClassIdentifier: + score: 0 + scoreMul: 0 + condition: usedCard + result: isIgnoreCondition + conditionValue: 2 + resultValue: 3 + nodesMark: [] + nodesColor: [] + extraRedNodeCount: 0 + extraBlueNodeCount: 0 + extraYellowNodeCount: 0 + extraMostNodeCount: 0 + extraLeastNodeCount: 0 + extraAllNodeCount: 0 + isIgnoreCondition: 0 + isDoubleSettle: 0 + resultDescription: + conditionDescription: + gemImage: {fileID: 0} +--- !u!114 &851291883 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 851291879} + 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 &851291884 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 851291879} + m_CullTransparentMesh: 1 --- !u!1 &854898562 GameObject: m_ObjectHideFlags: 0 @@ -32509,6 +32632,126 @@ MonoBehaviour: prepareHandCard: [] newPointList: [] drawMoveSpeed: 4 +--- !u!1 &960521311 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 960521312} + - component: {fileID: 960521316} + - component: {fileID: 960521315} + - component: {fileID: 960521314} + - component: {fileID: 960521313} + m_Layer: 5 + m_Name: WeaponNode + m_TagString: WeaponDragPanel + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &960521312 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 960521311} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -0.00003882618} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1429520562} + 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: 181} + m_SizeDelta: {x: -8, y: -8} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!225 &960521313 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 960521311} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!114 &960521314 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 960521311} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f2fbc27b744afba46a8f18f6c09eed3f, type: 3} + m_Name: + m_EditorClassIdentifier: + score: 0 + scoreMul: 0 + condition: red>100 + result: Volcano + conditionValue: + resultValue: 1 + nodesMark: [] + nodesColor: [] + extraRedNodeCount: 0 + extraBlueNodeCount: 0 + extraYellowNodeCount: 0 + extraMostNodeCount: 0 + extraLeastNodeCount: 0 + extraAllNodeCount: 0 + isIgnoreCondition: 0 + isDoubleSettle: 0 + resultDescription: + conditionDescription: + gemImage: {fileID: 0} +--- !u!114 &960521315 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 960521311} + 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 &960521316 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 960521311} + m_CullTransparentMesh: 1 --- !u!1 &967334092 GameObject: m_ObjectHideFlags: 0 @@ -38582,6 +38825,126 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1165267332} m_CullTransparentMesh: 1 +--- !u!1 &1165580013 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1165580014} + - component: {fileID: 1165580018} + - component: {fileID: 1165580017} + - component: {fileID: 1165580016} + - component: {fileID: 1165580015} + m_Layer: 5 + m_Name: WeaponNode + m_TagString: WeaponDragPanel + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1165580014 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1165580013} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -0.00003882618} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1328831582} + 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: 272} + m_SizeDelta: {x: -8, y: -8} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!225 &1165580015 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1165580013} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!114 &1165580016 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1165580013} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f2fbc27b744afba46a8f18f6c09eed3f, type: 3} + m_Name: + m_EditorClassIdentifier: + score: 0 + scoreMul: 0 + condition: red>100 + result: mulScore + conditionValue: + resultValue: 1.0 + nodesMark: [] + nodesColor: [] + extraRedNodeCount: 0 + extraBlueNodeCount: 0 + extraYellowNodeCount: 0 + extraMostNodeCount: 0 + extraLeastNodeCount: 0 + extraAllNodeCount: 0 + isIgnoreCondition: 0 + isDoubleSettle: 0 + resultDescription: + conditionDescription: + gemImage: {fileID: 0} +--- !u!114 &1165580017 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1165580013} + 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 &1165580018 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1165580013} + m_CullTransparentMesh: 1 --- !u!1 &1166023162 GameObject: m_ObjectHideFlags: 0 @@ -42904,7 +43267,8 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 1165580014} m_Father: {fileID: 2109090871} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} @@ -45839,7 +46203,8 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 960521312} m_Father: {fileID: 2109090871} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} @@ -59443,6 +59808,9 @@ MonoBehaviour: extraAllNodeCount: 0 isIgnoreCondition: 0 isDoubleSettle: 0 + resultDescription: + conditionDescription: + gemImage: {fileID: 0} --- !u!1 &1715971502 GameObject: m_ObjectHideFlags: 0 diff --git a/ColorlessWorld-2024-4-2/Assets/Scripts/Card/CardPictureManager.cs b/ColorlessWorld-2024-4-2/Assets/Scripts/Card/CardPictureManager.cs index 99b82363..35003a3a 100644 --- a/ColorlessWorld-2024-4-2/Assets/Scripts/Card/CardPictureManager.cs +++ b/ColorlessWorld-2024-4-2/Assets/Scripts/Card/CardPictureManager.cs @@ -29,7 +29,7 @@ public class CardPictureManager : Singleton yield return StartCoroutine(TransformMapUnityForTool()); yield return StartCoroutine(SetUpMapUnityForTool()); yield return StartCoroutine(SetUpMapUnityForCubeForTool()); - createCameraAboveObject(ToolX[3].Y[3].gameObject, 10.0f, 0); + createCameraAboveObject(ToolX[5].Y[5].gameObject, 10.0f, 0); //CardManager.createCardImageMap(); } IEnumerator MapGenerateTest() diff --git a/ColorlessWorld-2024-4-2/Assets/Scripts/Card/TurnMaster.cs b/ColorlessWorld-2024-4-2/Assets/Scripts/Card/TurnMaster.cs index f302da66..82098284 100644 --- a/ColorlessWorld-2024-4-2/Assets/Scripts/Card/TurnMaster.cs +++ b/ColorlessWorld-2024-4-2/Assets/Scripts/Card/TurnMaster.cs @@ -104,7 +104,7 @@ public class TurnMaster : Singleton //敌人动作如移动,涂色 //EnemyManager.Instance.EnemyTurn_Observer(); - + getNodeTools.RandomPollute(getNodeTools.getAllNotBlackNodes(), 8); turn = Turn.turnStop; turn = Turn.enemyTurnEnd; } @@ -241,7 +241,12 @@ public class TurnMaster : Singleton { LegacyManager.Instance.tryResetCount(Name.Legacy.LegacyNode_LightningBoots); } - + + public void RandomPollute() + { + + } + //老吊写的函数 public void restoreResource(int settleTurn) { diff --git a/ColorlessWorld-2024-4-2/Assets/Scripts/Tool/Name.cs b/ColorlessWorld-2024-4-2/Assets/Scripts/Tool/Name.cs index 36dbb7f4..e32bc8f7 100644 --- a/ColorlessWorld-2024-4-2/Assets/Scripts/Tool/Name.cs +++ b/ColorlessWorld-2024-4-2/Assets/Scripts/Tool/Name.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; +using static UnityEngine.InputSystem.InputControlScheme.MatchResult; +using Match = System.Text.RegularExpressions.Match; public static class Name { @@ -522,6 +524,102 @@ public static class Name } } + public static string getGemConditionDescription(string condition, string conditionValue, string[] nodesMark, string[] nodesColor) + { + StringBuilder sb = new StringBuilder(); + Match match = System.Text.RegularExpressions.Regex.Match(condition, Name.Regex.cardConditionPattern); + if (match.Success) + { + string firstPart = match.Groups[1].Value; // 第一部分(red) + string op = match.Groups[2].Value; // 运算符部分 + string secondPart = match.Groups[3].Value; // 第二部分 + } + else + { + switch (condition) + { + case Name.WeaponNodeCondition.position: + sb.Append("在位置" + (int.Parse(conditionValue) + 1)); + break; + case Name.WeaponNodeCondition.positionUnused: + sb.Append("位置" + (int.Parse(conditionValue) + 1) + "的宝石没有激活"); + break; + case Name.WeaponNodeCondition.positionUsed: + sb.Append("位置" + (int.Parse(conditionValue) + 1) + "的宝石激活了"); + break; + case Name.WeaponNodeCondition.diffSettle: + sb.Append("与上次成功激活时位置不同"); + break; + case Name.WeaponNodeCondition.usedCard: + sb.Append("至少有" + int.Parse(conditionValue) + "个激活的宝石"); + break; + case Name.WeaponNodeCondition.node: + break; + case Name.none: + break; + } + } + + return sb.ToString(); + } + + public static string getGemResultDescription(string result, string resultValue, string[] nodesMark, string[] nodesColor) + { + StringBuilder sb = new StringBuilder(); + switch (result) + { + case Name.WeaponNodeFunction.addScore: + sb.Append("攻击力+" + int.Parse(resultValue)); + break; + case Name.WeaponNodeFunction.mulScore: + sb.Append("攻击力*" + (1+float.Parse(resultValue))); + break; + case Name.WeaponNodeFunction.repetWeaponNode: + sb.Append("重复位置" + (int.Parse(resultValue) + 1) +"宝石的效果"); + break; + case Name.WeaponNodeFunction.doubleWeaponNode: + sb.Append("位置" + (int.Parse(resultValue) + 1) + "宝石的效果翻倍"); + break; + case Name.WeaponNodeFunction.redNodeCount: + sb.Append("红色地块的数量+" + int.Parse(resultValue)); + break; + case Name.WeaponNodeFunction.blueNodeCount: + sb.Append("蓝色地块的数量+" + int.Parse(resultValue)); + break; + case Name.WeaponNodeFunction.yellowNodeCount: + sb.Append("黄色地块的数量+" + int.Parse(resultValue)); + break; + case Name.WeaponNodeFunction.mostNodeCount: + sb.Append("数量最多的玩家地块数量+" + int.Parse(resultValue)); + break; + case Name.WeaponNodeFunction.leastNodeCount: + sb.Append("数量最少的玩家地块数量+" + int.Parse(resultValue)); + break; + case Name.WeaponNodeFunction.allNodeCount: + sb.Append("所有玩家的地块的数量+" + int.Parse(resultValue)); + break; + case Name.WeaponNodeFunction.drawCard: + sb.Append("下回合多抽" + int.Parse(resultValue)+"张牌"); + break; + case Name.WeaponNodeFunction.everyRedNodeAddScore: + sb.Append("每有一个红色地块增加" + int.Parse(resultValue) + "点攻击力"); + break; + case Name.WeaponNodeFunction.everyYellowNodeAddScore: + sb.Append("每有一个黄色地块增加" + int.Parse(resultValue) + "点攻击力"); + break; + case Name.WeaponNodeFunction.everyBlueNodeAddScore: + sb.Append("每有一个蓝色地块增加" + int.Parse(resultValue) + "点攻击力"); + break; + case Name.NodeItem.Volcano: + sb.Append("回合结束在场上增加" + int.Parse(resultValue) + "个火山"); + break; + case Name.NodeItem.AcidRain: + sb.Append("回合结束在场上增加" + int.Parse(resultValue) + "个酸雨"); + break; + } + return sb.ToString(); + } + public static string getValForSwage(int cost, string fun, CardForgeRule data) { string result = ""; @@ -603,6 +701,8 @@ public static class Name public const string Throw = "Throw"; } + + public static readonly List BasicCardId = new() { "1001","1002","1003" }; diff --git a/ColorlessWorld-2024-4-2/Assets/Scripts/Tool/getNodeTools.cs b/ColorlessWorld-2024-4-2/Assets/Scripts/Tool/getNodeTools.cs index 962a2924..156ad62c 100644 --- a/ColorlessWorld-2024-4-2/Assets/Scripts/Tool/getNodeTools.cs +++ b/ColorlessWorld-2024-4-2/Assets/Scripts/Tool/getNodeTools.cs @@ -74,7 +74,7 @@ public class getNodeTools HashSet randomNodes = MathTool.GetRandomElements(set, num); foreach (var node in randomNodes) { - //node.whoColour = MapUnity.WhoColour.enemyColour; + node.switchColor(Name.NodeColor.Black); } GameManager.Instance.SyncColourCountUI(); } diff --git a/ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/WeaponNode.cs b/ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/WeaponNode.cs index ad5d1780..7f84f1cd 100644 --- a/ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/WeaponNode.cs +++ b/ColorlessWorld-2024-4-2/Assets/Scripts/Weapon/WeaponNode.cs @@ -7,6 +7,7 @@ using UnityEngine.EventSystems; using UnityEngine.UI; using UnityEngine.UIElements; using static UnityEngine.InputSystem.InputControlScheme.MatchResult; +using Image = UnityEngine.UI.Image; using Match = System.Text.RegularExpressions.Match; public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDragHandler @@ -34,11 +35,22 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra public int extraAllNodeCount = 0; public bool isIgnoreCondition=false; public bool isDoubleSettle = false; + public string resultDescription; + public string conditionDescription; + + public Sprite gemImage; private void Update() { //SettleScore(); } + + private void Start() + { + resultDescription = Name.getGemResultDescription(result, resultValue, nodesMark, nodesColor); + conditionDescription = Name.getGemConditionDescription(condition, conditionValue, nodesMark, nodesColor); + + } public virtual void SettleWeaponNode(int position) { Debug.Log("结算成功节点1"); diff --git a/ColorlessWorld-2024-4-2/Assets/Scripts/manager/CardManager.cs b/ColorlessWorld-2024-4-2/Assets/Scripts/manager/CardManager.cs index 37c32455..a431b47e 100644 --- a/ColorlessWorld-2024-4-2/Assets/Scripts/manager/CardManager.cs +++ b/ColorlessWorld-2024-4-2/Assets/Scripts/manager/CardManager.cs @@ -446,6 +446,117 @@ public class CardManager : Singleton } + public Sprite createGemImageByToolX(string[] nodesMark, string[] nodesColor) + { + MapUnity currentNode = CardPictureManager.Instance.ToolX[4].Y[4]; + return CardManager.createGemImage(nodesMark, nodesColor, currentNode); + } + + public static Sprite createGemImage(string[] nodesMark, string[] nodesColor, MapUnity currentNode) + { + for (int i = 0; i < CardPictureManager.Instance.ToolX.Count; i++) + { + for (int j = 0; j < CardPictureManager.Instance.ToolX[i].Y.Count; j++) + { + CardPictureManager.Instance.ToolX[i].Y[j].switchColorWithoutFX(Name.NodeColor.White); + //CardPictureManager.Instance.ToolX[i].Y[j].gameObject.SetActive(false); + } + } + List<(int, int, int)> cubeList = new List<(int, int, int)>(); + int intEuler = (int)90; + Debug.Log("euler是" + intEuler); + for (int i = 0; i < nodesMark.Length; i++) + { + + try + { + string[] marks = nodesMark[i].Split("_"); + (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)>(); + for (int i = 0; i < cubeList.Count; i++) + { + Debug.Log("cubeList的Q是" + cubeList[i].Item1 + "cubeList的S是" + cubeList[i].Item2 + "cubeList的R是" + cubeList[i].Item3); + } + rotatedCubeList = MathTool.RotateCoordinates(cubeList, intEuler); + for (int i = 0; i < rotatedCubeList.Count; i++) + { + Debug.Log("rotatedCube的Q是" + rotatedCubeList[i].Item1 + "rotatedCube的S是" + rotatedCubeList[i].Item2 + "rotatedCube的R是" + rotatedCubeList[i].Item3); + } + List<(int, int, int)> trueCubeList = new List<(int, int, int)>(); + Debug.Log("坐标中心是X:" + currentNode.locationX + "Y:" + currentNode.locationY); + trueCubeList = MathTool.TranslateHexesToNewOrigin(rotatedCubeList, (currentNode.cubeQ, currentNode.cubeS, currentNode.cubeR)); + List endNodeList = new List(); + for (int i = 0; i < trueCubeList.Count; i++) + { + MapUnity endNode = new MapUnity(); + Debug.Log("endNode的Q是" + trueCubeList[i].Item1 + "endNode的S是" + trueCubeList[i].Item2 + "endNode的R是" + trueCubeList[i].Item3); + endNode = getNodeTools.getToolNodeWithCube(trueCubeList[i].Item1, trueCubeList[i].Item2, trueCubeList[i].Item3); + if (endNode != null) + { + Debug.Log("染色成功" + nodesColor[i]); + endNode.switchColorWithoutFX(Name.stringColorToint(nodesColor[i])); + endNode.gameObject.SetActive(true); + endNodeList.Add(endNode); + //endNode.influenced = true; + } + } + // 分别提取横纵坐标 + var xCoords = nodesMark.Select(coord => int.Parse(coord.Split('_')[0])).ToArray(); + var yCoords = nodesMark.Select(coord => int.Parse(coord.Split('_')[1])).ToArray(); + + // 计算横纵坐标的最大差值 + int maxXDiff = xCoords.Max() - xCoords.Min(); + int maxYDiff = yCoords.Max() - yCoords.Min(); + + //直接计算图形的几何中心 + Vector3 sum = Vector3.zero; + foreach (MapUnity mapUnity in endNodeList) + { + Vector3 targetPosition = mapUnity.transform.position; + sum += mapUnity.transform.position; + } + Vector3 target = sum / endNodeList.Count; + // 计算 q, r, s 坐标的平均值 + int count = trueCubeList.Count; + int sumQ = trueCubeList.Sum(p => p.Item1); + int sumS = trueCubeList.Sum(p => p.Item2); + int sumR = trueCubeList.Sum(p => p.Item3); + double divisionAveQ = sumQ / count; + double divisionAveS = sumS / count; + double divisionAveR = sumR / count; + int aveQ = (int)Math.Round(divisionAveQ); + int aveS = (int)Math.Round(divisionAveS); + int aveR = (int)Math.Round(divisionAveR); + Debug.Log("QSRCOUNT是" + count); + // 比较最大差值 + int maxDiff = Math.Max(maxXDiff, maxYDiff); + + RenderTexture renderTexture = new RenderTexture(512, 512, 24); + Camera renderCamera = CardPictureManager.Instance.cameraObject.GetComponent(); + renderCamera.targetTexture = renderTexture; + Texture2D texture = new Texture2D(renderTexture.width, renderTexture.height, TextureFormat.ARGB32, false); + Debug.Log("相机中心是Q:" + aveQ + "S:" + aveS + "R:" + aveR); + MapUnity camearNode = changeCameraCenter(aveQ, aveS, aveR); + //cameraAdjust(maxDiff, renderCamera, camearNode); + cameraAdjustTest(maxDiff, renderCamera, target); + RenderTexture.active = renderCamera.targetTexture; + renderCamera.Render(); + texture.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0); + texture.Apply(); + RenderTexture.active = null; + // Material material = new Material(Shader.Find("Standard")); + // material.mainTexture = renderTexture; + Sprite sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)); + + return sprite; + + } + public static MapUnity changeCameraCenter(int q,int s,int r) { GameObject camera = CardPictureManager.Instance.cameraObject;