|
|
@ -1,8 +1,12 @@ |
|
|
using System; |
|
|
using System; |
|
|
|
|
|
using System.Collections; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using Unity.VisualScripting; |
|
|
using Unity.VisualScripting; |
|
|
using UnityEngine; |
|
|
using UnityEngine; |
|
|
|
|
|
using UnityEngine.UIElements; |
|
|
|
|
|
using static UnityEditor.Experimental.AssetDatabaseExperimental.AssetDatabaseCounters; |
|
|
|
|
|
using static UnityEditor.FilePathAttribute; |
|
|
|
|
|
|
|
|
public class getNodeTools |
|
|
public class getNodeTools |
|
|
{ |
|
|
{ |
|
|
@ -107,6 +111,21 @@ public class getNodeTools |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static MapUnity getNodeWithCube(int q, int s,int r) |
|
|
|
|
|
{ |
|
|
|
|
|
//计算立方坐标
|
|
|
|
|
|
(int x, int y) = MathTool.CubeToAxial(q,s,r); |
|
|
|
|
|
MapUnity result = GameManager.Instance.X[y].Y[x]; |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static MapUnity getToolNodeWithCube(int q, int s, int r) |
|
|
|
|
|
{ |
|
|
|
|
|
//计算立方坐标
|
|
|
|
|
|
(int x, int y) = MathTool.CubeToAxial(q, s, r); |
|
|
|
|
|
MapUnity result = GameManager.Instance.ToolX[y].Y[x]; |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
public static HashSet<MapUnity> getAllNodes() |
|
|
public static HashSet<MapUnity> getAllNodes() |
|
|
{ |
|
|
{ |
|
|
HashSet<MapUnity> set = new HashSet<MapUnity>(); |
|
|
HashSet<MapUnity> set = new HashSet<MapUnity>(); |
|
|
@ -618,6 +637,86 @@ public class getNodeTools |
|
|
}*/ |
|
|
}*/ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void setEffectRangePreviewTest(CardOriginalData cardOriginalData, float euler, MapUnity currentNode, CardEntity cardEntity) |
|
|
|
|
|
{ |
|
|
|
|
|
List<(int, int, int)> cubeList = new List<(int, int, int)>(); |
|
|
|
|
|
int intEuler=(int)euler; |
|
|
|
|
|
//Debug.Log("euler是" + intEuler);
|
|
|
|
|
|
for (int i = 0; i < cardOriginalData.nodesMark.Length; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
string[] marks = cardOriginalData.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)>(); |
|
|
|
|
|
rotatedCubeList = MathTool.RotateCoordinates(cubeList, intEuler); |
|
|
|
|
|
List<(int, int, int)> trueCubeList = new List<(int, int, int)>(); |
|
|
|
|
|
trueCubeList = MathTool.TranslateHexesToNewOrigin(rotatedCubeList, (currentNode.cubeQ, currentNode.cubeS, currentNode.cubeR)); |
|
|
|
|
|
foreach (var tuple in trueCubeList) |
|
|
|
|
|
{ |
|
|
|
|
|
MapUnity endNode = new MapUnity(); |
|
|
|
|
|
endNode = getNodeWithCube(tuple.Item1, tuple.Item2, tuple.Item3); |
|
|
|
|
|
if (endNode != null) |
|
|
|
|
|
{ |
|
|
|
|
|
cardEntity.influencePreviewPool.Add(endNode); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void setCardImageTest(CardOriginalData cardOriginalData, float euler, MapUnity currentNode,CardEntity cardEntity) |
|
|
|
|
|
{ |
|
|
|
|
|
List<(int, int, int)> cubeList = new List<(int, int, int)>(); |
|
|
|
|
|
int intEuler = (int)euler; |
|
|
|
|
|
Debug.Log("euler是" + intEuler); |
|
|
|
|
|
for (int i = 0; i < cardOriginalData.nodesMark.Length; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
string[] marks = cardOriginalData.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)>(); |
|
|
|
|
|
rotatedCubeList = MathTool.RotateCoordinates(cubeList, intEuler); |
|
|
|
|
|
List<(int, int, int)> trueCubeList = new List<(int, int, int)>(); |
|
|
|
|
|
trueCubeList = MathTool.TranslateHexesToNewOrigin(rotatedCubeList, (currentNode.cubeQ, currentNode.cubeS, currentNode.cubeR)); |
|
|
|
|
|
for (int i = 0; i < trueCubeList.Count; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
MapUnity endNode = new MapUnity(); |
|
|
|
|
|
endNode = getToolNodeWithCube(trueCubeList[i].Item1, trueCubeList[i].Item2, trueCubeList[i].Item3); |
|
|
|
|
|
if (endNode != null) |
|
|
|
|
|
{ |
|
|
|
|
|
Debug.Log("染色成功"+ cardOriginalData.nodesColor[i]); |
|
|
|
|
|
endNode.switchColor(Name.stringColorToint(cardOriginalData.nodesColor[i])); |
|
|
|
|
|
//endNode.influenced = true;
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
RenderTexture renderTexture = new RenderTexture(512, 512, 24); |
|
|
|
|
|
Camera renderCamera = MapManager.Instance.cameraObject.GetComponent<Camera>(); |
|
|
|
|
|
renderCamera.targetTexture = renderTexture; |
|
|
|
|
|
Texture2D texture = new Texture2D(renderTexture.width, renderTexture.height, TextureFormat.ARGB32, false); |
|
|
|
|
|
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; |
|
|
|
|
|
cardEntity.cardImage.sprite= Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static HashSet<MapUnity> setEffectRangePreviewNoCard(string effectRange, float euler, MapUnity currentNode) |
|
|
public static HashSet<MapUnity> setEffectRangePreviewNoCard(string effectRange, float euler, MapUnity currentNode) |
|
|
{ |
|
|
{ |
|
|
MapUnity playerOnNode = GameManager.Instance.playerOn.transform.GetComponent<MapUnity>(); |
|
|
MapUnity playerOnNode = GameManager.Instance.playerOn.transform.GetComponent<MapUnity>(); |
|
|
|