61 changed files with 7458 additions and 10444 deletions
@ -0,0 +1,8 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: b439fe2f9c5b3cb4d9aeecd0d8d7f241 |
||||
|
folderAsset: yes |
||||
|
DefaultImporter: |
||||
|
externalObjects: {} |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
||||
|
After Width: | Height: | Size: 91 KiB |
@ -0,0 +1,127 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: a5636c1df48dec14c8deca2ee3dfcf33 |
||||
|
TextureImporter: |
||||
|
internalIDToNameTable: [] |
||||
|
externalObjects: {} |
||||
|
serializedVersion: 12 |
||||
|
mipmaps: |
||||
|
mipMapMode: 0 |
||||
|
enableMipMap: 0 |
||||
|
sRGBTexture: 1 |
||||
|
linearTexture: 0 |
||||
|
fadeOut: 0 |
||||
|
borderMipMap: 0 |
||||
|
mipMapsPreserveCoverage: 0 |
||||
|
alphaTestReferenceValue: 0.5 |
||||
|
mipMapFadeDistanceStart: 1 |
||||
|
mipMapFadeDistanceEnd: 3 |
||||
|
bumpmap: |
||||
|
convertToNormalMap: 0 |
||||
|
externalNormalMap: 0 |
||||
|
heightScale: 0.25 |
||||
|
normalMapFilter: 0 |
||||
|
flipGreenChannel: 0 |
||||
|
isReadable: 0 |
||||
|
streamingMipmaps: 0 |
||||
|
streamingMipmapsPriority: 0 |
||||
|
vTOnly: 0 |
||||
|
ignoreMipmapLimit: 0 |
||||
|
grayScaleToAlpha: 0 |
||||
|
generateCubemap: 6 |
||||
|
cubemapConvolution: 0 |
||||
|
seamlessCubemap: 0 |
||||
|
textureFormat: 1 |
||||
|
maxTextureSize: 2048 |
||||
|
textureSettings: |
||||
|
serializedVersion: 2 |
||||
|
filterMode: 1 |
||||
|
aniso: 1 |
||||
|
mipBias: 0 |
||||
|
wrapU: 1 |
||||
|
wrapV: 1 |
||||
|
wrapW: 0 |
||||
|
nPOTScale: 0 |
||||
|
lightmap: 0 |
||||
|
compressionQuality: 50 |
||||
|
spriteMode: 1 |
||||
|
spriteExtrude: 1 |
||||
|
spriteMeshType: 1 |
||||
|
alignment: 0 |
||||
|
spritePivot: {x: 0.5, y: 0.5} |
||||
|
spritePixelsToUnits: 100 |
||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
||||
|
spriteGenerateFallbackPhysicsShape: 1 |
||||
|
alphaUsage: 1 |
||||
|
alphaIsTransparency: 1 |
||||
|
spriteTessellationDetail: -1 |
||||
|
textureType: 8 |
||||
|
textureShape: 1 |
||||
|
singleChannelComponent: 0 |
||||
|
flipbookRows: 1 |
||||
|
flipbookColumns: 1 |
||||
|
maxTextureSizeSet: 0 |
||||
|
compressionQualitySet: 0 |
||||
|
textureFormatSet: 0 |
||||
|
ignorePngGamma: 0 |
||||
|
applyGammaDecoding: 0 |
||||
|
swizzle: 50462976 |
||||
|
cookieLightType: 0 |
||||
|
platformSettings: |
||||
|
- serializedVersion: 3 |
||||
|
buildTarget: DefaultTexturePlatform |
||||
|
maxTextureSize: 512 |
||||
|
resizeAlgorithm: 0 |
||||
|
textureFormat: -1 |
||||
|
textureCompression: 1 |
||||
|
compressionQuality: 50 |
||||
|
crunchedCompression: 0 |
||||
|
allowsAlphaSplitting: 0 |
||||
|
overridden: 0 |
||||
|
ignorePlatformSupport: 0 |
||||
|
androidETC2FallbackOverride: 0 |
||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0 |
||||
|
- serializedVersion: 3 |
||||
|
buildTarget: Standalone |
||||
|
maxTextureSize: 2048 |
||||
|
resizeAlgorithm: 0 |
||||
|
textureFormat: -1 |
||||
|
textureCompression: 1 |
||||
|
compressionQuality: 50 |
||||
|
crunchedCompression: 0 |
||||
|
allowsAlphaSplitting: 0 |
||||
|
overridden: 0 |
||||
|
ignorePlatformSupport: 0 |
||||
|
androidETC2FallbackOverride: 0 |
||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0 |
||||
|
- serializedVersion: 3 |
||||
|
buildTarget: Server |
||||
|
maxTextureSize: 2048 |
||||
|
resizeAlgorithm: 0 |
||||
|
textureFormat: -1 |
||||
|
textureCompression: 1 |
||||
|
compressionQuality: 50 |
||||
|
crunchedCompression: 0 |
||||
|
allowsAlphaSplitting: 0 |
||||
|
overridden: 0 |
||||
|
ignorePlatformSupport: 0 |
||||
|
androidETC2FallbackOverride: 0 |
||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0 |
||||
|
spriteSheet: |
||||
|
serializedVersion: 2 |
||||
|
sprites: [] |
||||
|
outline: [] |
||||
|
physicsShape: [] |
||||
|
bones: [] |
||||
|
spriteID: 5e97eb03825dee720800000000000000 |
||||
|
internalID: 0 |
||||
|
vertices: [] |
||||
|
indices: |
||||
|
edges: [] |
||||
|
weights: [] |
||||
|
secondaryTextures: [] |
||||
|
nameFileIdTable: {} |
||||
|
mipmapLimitGroupName: |
||||
|
pSDRemoveMatte: 0 |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
||||
@ -0,0 +1,525 @@ |
|||||
|
using System; |
||||
|
using System.Collections; |
||||
|
using System.Collections.Generic; |
||||
|
using Unity.VisualScripting; |
||||
|
using UnityEngine; |
||||
|
using UnityEngine.UI; |
||||
|
using UnityEngine.EventSystems; |
||||
|
using UnityEngine.InputSystem; |
||||
|
|
||||
|
public class CardEntity_OldSave : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler |
||||
|
{ |
||||
|
public CardOriginalData cardOriginalData; |
||||
|
//public CardOriginalData cardData;
|
||||
|
|
||||
|
public int cardId; |
||||
|
public int CardId |
||||
|
{ |
||||
|
get { return cardId; } |
||||
|
set { cardId = value; } |
||||
|
} |
||||
|
|
||||
|
// public Vector3 OriginTransform;
|
||||
|
//private Vector3 EndTransform;
|
||||
|
[Header("拖拽参数")] |
||||
|
public Transform originalParent; |
||||
|
public Vector3 originalpoint; |
||||
|
|
||||
|
bool canUse = true;//决定卡牌是否可以释放
|
||||
|
bool choosed;//标识卡牌是否被选中
|
||||
|
|
||||
|
[Header("贝塞尔曲线瞄准")] |
||||
|
public GameObject ainPanle; |
||||
|
|
||||
|
[Header("影响格参数")] |
||||
|
public MapUnity currentNode;//瞄准的格子
|
||||
|
public List<MapUnity> influencePreviewPool;//卡牌的影响范围
|
||||
|
|
||||
|
[Header("卡牌拖拽状态")] |
||||
|
public CardDragState dragState; |
||||
|
public enum CardDragState |
||||
|
{ |
||||
|
onBeginDrag, |
||||
|
onDrag, |
||||
|
onEndDrag, |
||||
|
noDrag |
||||
|
} |
||||
|
public EventSystem eventSystem; |
||||
|
PointerEventData eventData; |
||||
|
List<RaycastResult> result = new List<RaycastResult>(); |
||||
|
|
||||
|
public void Start() |
||||
|
{ |
||||
|
//cardData = GetComponent<CardOriginalData>();
|
||||
|
eventSystem = GameObject.FindObjectOfType<EventSystem>(); |
||||
|
eventData = new PointerEventData(eventSystem); |
||||
|
} |
||||
|
private void Update() |
||||
|
{ |
||||
|
//右键取消释放
|
||||
|
if (choosed && Mouse.current.rightButton.wasPressedThisFrame) |
||||
|
{ |
||||
|
Debug.Log("1"); |
||||
|
dragState = CardDragState.noDrag; |
||||
|
canUse = false;//取消释放
|
||||
|
ainPanle.SetActive(false); |
||||
|
//遍历范围预览池消除影响色
|
||||
|
for (int i = 0; i < GameManager.Instance.player.influencePreviewPool.Count; i++) |
||||
|
{ |
||||
|
GameManager.Instance.player.influencePreviewPool[i].influenced = false; |
||||
|
} |
||||
|
GameManager.Instance.player.influencePreviewPool.Clear(); |
||||
|
//遍历影响池变色
|
||||
|
for (int i = 0; i < influencePreviewPool.Count; i++) |
||||
|
{ |
||||
|
influencePreviewPool[i].influenced = false; |
||||
|
} |
||||
|
influencePreviewPool.Clear(); |
||||
|
|
||||
|
|
||||
|
//其他位置都归位
|
||||
|
transform.SetParent(originalParent); |
||||
|
transform.localPosition = originalpoint; |
||||
|
GetComponent<CanvasGroup>().blocksRaycasts = true; |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (dragState != CardDragState.noDrag && dragState != CardDragState.onDrag) |
||||
|
{ |
||||
|
//UI射线检测
|
||||
|
|
||||
|
eventData.position = Mouse.current.position.value; |
||||
|
|
||||
|
eventSystem.RaycastAll(eventData, result); |
||||
|
if (result.Count > 0) |
||||
|
{ |
||||
|
Debug.Log(result[0].gameObject.name); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
switch (dragState) |
||||
|
{ |
||||
|
case CardDragState.onBeginDrag: |
||||
|
TurnMaster.Instance.playerAction = TurnMaster.PlayerAction.useCard; |
||||
|
CardChoose(eventData); |
||||
|
dragState = CardDragState.onDrag; |
||||
|
break; |
||||
|
case CardDragState.onDrag: |
||||
|
CardFollow(); |
||||
|
if (Mouse.current.leftButton.wasReleasedThisFrame) |
||||
|
{ |
||||
|
dragState = CardDragState.onEndDrag; |
||||
|
} |
||||
|
break; |
||||
|
case CardDragState.onEndDrag: |
||||
|
TurnMaster.Instance.playerAction = TurnMaster.PlayerAction.none; |
||||
|
CardUse(); |
||||
|
break; |
||||
|
case CardDragState.noDrag: |
||||
|
if (Mouse.current.leftButton.wasReleasedThisFrame) |
||||
|
{ |
||||
|
eventData.position = Mouse.current.position.value; |
||||
|
|
||||
|
eventSystem.RaycastAll(eventData, result); |
||||
|
if (result.Count > 0) |
||||
|
{ |
||||
|
Debug.Log(result[0].gameObject.name); |
||||
|
if (result[0].gameObject == this.gameObject) |
||||
|
{ |
||||
|
dragState = CardDragState.onBeginDrag; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void createCard(int cardId) |
||||
|
{ |
||||
|
this.cardId = cardId; |
||||
|
Debug.Log(cardId + "-" + CardOriginalDataList.Instance.cardOriginalDataList[cardId]); |
||||
|
cardOriginalData = CardOriginalDataList.Instance.cardOriginalDataList[cardId]; |
||||
|
settleForStart(SettlementManager.settleTurn); |
||||
|
} |
||||
|
|
||||
|
//不应该为void,返回值为作用的地块
|
||||
|
public void use() |
||||
|
{ |
||||
|
settle(0); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
//卡牌效果的结算
|
||||
|
public void settle(int settleTurn) |
||||
|
{ |
||||
|
for (int i = 0; i < cardOriginalData.Function.Length; i++) |
||||
|
{ |
||||
|
switch (cardOriginalData.Function[i]) |
||||
|
{ |
||||
|
case CardFunction.cardDamage: |
||||
|
damageWork(int.Parse(cardOriginalData.FunctionVal[i])); |
||||
|
break; |
||||
|
case CardFunction.cardShield: |
||||
|
Usermanager.Instance.Shield = Usermanager.Instance.Shield + int.Parse(cardOriginalData.FunctionVal[i]); |
||||
|
break; |
||||
|
case CardFunction.posion: |
||||
|
case CardFunction.weak: |
||||
|
case CardFunction.coma: |
||||
|
case CardFunction.disarm: |
||||
|
case CardFunction.sleep: |
||||
|
case CardFunction.bleed: |
||||
|
case CardFunction.thorn: |
||||
|
abnormalConditionWork(cardOriginalData.Function[i], int.Parse(cardOriginalData.FunctionVal[i])); |
||||
|
break; |
||||
|
case CardFunction.costRestore: |
||||
|
break; |
||||
|
case CardFunction.dyeing: |
||||
|
Debug.Log("功能是:" + cardOriginalData.Function[1]); |
||||
|
dyeingWork(); |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void abnormalConditionWork(string condition, int stackVak) |
||||
|
{ |
||||
|
for (int i = 0; i < influencePreviewPool.Count; i++) |
||||
|
{ |
||||
|
//施加负面
|
||||
|
if (influencePreviewPool[i].enemyNode != null) |
||||
|
{ |
||||
|
influencePreviewPool[i].enemyNode.sufferAbnormalCondition(condition, stackVak); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void damageWork(int damageVal) |
||||
|
{ |
||||
|
for (int i = 0; i < influencePreviewPool.Count; i++) |
||||
|
{ |
||||
|
//造成伤害
|
||||
|
if (influencePreviewPool[i].enemyNode != null) |
||||
|
{ |
||||
|
influencePreviewPool[i].enemyNode.sufferDamage(damageVal); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void dyeingWork() |
||||
|
{ |
||||
|
Debug.Log(influencePreviewPool.Count); |
||||
|
for (int i = 0; i < influencePreviewPool.Count; i++) |
||||
|
{ |
||||
|
influencePreviewPool[i].whoColour = MapUnity.WhoColour.playerColour; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void dyeing() |
||||
|
{ |
||||
|
//遍历影响池变色
|
||||
|
for (int i = 0; i < influencePreviewPool.Count; i++) |
||||
|
{ |
||||
|
influencePreviewPool[i].influenced = true; |
||||
|
influencePreviewPool[i].choossedMark.GetComponent<Renderer>().material = influencePreviewPool[i].yellow; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//生成卡牌时候遗物的结算
|
||||
|
public void settleForStart(int settleTurn) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
//卡牌效果结束之后结算
|
||||
|
public void settleForEnd(int settleTurn) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void OnBeginDrag(PointerEventData eventData) |
||||
|
{ |
||||
|
dragState = CardDragState.onBeginDrag; |
||||
|
} |
||||
|
|
||||
|
public void OnDrag(PointerEventData eventData) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private void ainPanleWork() |
||||
|
{ |
||||
|
//射线检测瞄准的地图节点,判断是否可放置和改变放置影响区
|
||||
|
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.value); |
||||
|
|
||||
|
if (Physics.Raycast(ray, out RaycastHit raycastHit)) |
||||
|
{ |
||||
|
Debug.Log(raycastHit.collider.gameObject.name); |
||||
|
//检测到跟上次瞄准地方不同,更新
|
||||
|
if (currentNode == null || raycastHit.collider.transform.gameObject != currentNode.gameObject) |
||||
|
{ |
||||
|
for (int i = 0; i < influencePreviewPool.Count; i++) |
||||
|
{ |
||||
|
influencePreviewPool[i].influenced = false; |
||||
|
} |
||||
|
influencePreviewPool.Clear(); |
||||
|
currentNode = raycastHit.collider.transform.GetComponent<MapUnity>(); |
||||
|
|
||||
|
//重新调用范围预览
|
||||
|
GameManager.Instance.player.StepPreviewInfluencedNode(cardOriginalData.CastingRange); |
||||
|
Debug.Log(cardOriginalData.CastingRange); |
||||
|
//预览影响范围
|
||||
|
if (currentNode.influenced) |
||||
|
{ |
||||
|
//根据卡牌属性改变影响池
|
||||
|
influencePreviewPool.Add(currentNode); |
||||
|
Vector3 face = currentNode.transform.position - GameManager.Instance.playerOn.transform.position; |
||||
|
float euler = Vector3.SignedAngle(-GameManager.Instance.playerOn.transform.forward, face, GameManager.Instance.playerOn.transform.up) + 180; |
||||
|
Debug.Log(euler); |
||||
|
if (euler > 0 && euler < 45) |
||||
|
{ |
||||
|
if (currentNode.unitPool[0] != null) |
||||
|
influencePreviewPool.Add(currentNode.unitPool[0]); |
||||
|
if (currentNode.unitPool[4] != null) |
||||
|
influencePreviewPool.Add(currentNode.unitPool[4]); |
||||
|
} |
||||
|
else if (euler > 45 && euler < 135) |
||||
|
{ |
||||
|
if (currentNode.unitPool[1] != null) |
||||
|
influencePreviewPool.Add(currentNode.unitPool[1]); |
||||
|
if (currentNode.unitPool[5] != null) |
||||
|
influencePreviewPool.Add(currentNode.unitPool[5]); |
||||
|
} |
||||
|
else if (euler > 135 && euler < 180) |
||||
|
{ |
||||
|
if (currentNode.unitPool[2] != null) |
||||
|
influencePreviewPool.Add(currentNode.unitPool[2]); |
||||
|
if (currentNode.unitPool[0] != null) |
||||
|
influencePreviewPool.Add(currentNode.unitPool[0]); |
||||
|
} |
||||
|
else if (euler > 180 && euler < 225) |
||||
|
{ |
||||
|
if (currentNode.unitPool[1] != null) |
||||
|
influencePreviewPool.Add(currentNode.unitPool[1]); |
||||
|
if (currentNode.unitPool[3] != null) |
||||
|
influencePreviewPool.Add(currentNode.unitPool[3]); |
||||
|
} |
||||
|
else if (euler > 225 && euler < 315) |
||||
|
{ |
||||
|
if (currentNode.unitPool[2] != null) |
||||
|
influencePreviewPool.Add(currentNode.unitPool[2]); |
||||
|
if (currentNode.unitPool[4] != null) |
||||
|
influencePreviewPool.Add(currentNode.unitPool[4]); |
||||
|
} |
||||
|
else if (euler > 315 && euler < 360) |
||||
|
{ |
||||
|
if (currentNode.unitPool[3] != null) |
||||
|
influencePreviewPool.Add(currentNode.unitPool[3]); |
||||
|
if (currentNode.unitPool[5] != null) |
||||
|
influencePreviewPool.Add(currentNode.unitPool[5]); |
||||
|
} |
||||
|
//influencePreviewPool.Add(currentNode);
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
Debug.Log("结束影响数值" + influencePreviewPool.Count); |
||||
|
} |
||||
|
|
||||
|
private void noAinPanleWork(PointerEventData eventData) |
||||
|
{ |
||||
|
|
||||
|
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.value); |
||||
|
if (eventData.pointerCurrentRaycast.gameObject != null) |
||||
|
{ |
||||
|
if (Physics.Raycast(ray, out RaycastHit raycastHit)) |
||||
|
{ |
||||
|
currentNode = raycastHit.collider.transform.GetComponent<MapUnity>(); |
||||
|
influencePreviewPool.Add(currentNode); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public void OnEndDrag(PointerEventData eventData) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
//卡片动作
|
||||
|
//开始选中
|
||||
|
public void CardChoose(PointerEventData eventData) |
||||
|
{ |
||||
|
// if (GameObject.Find("CardPanel") != null)
|
||||
|
// graphicRaycaster = GameObject.Find("CardPanel").GetComponent<GraphicRaycaster>();
|
||||
|
choosed = true; |
||||
|
|
||||
|
GetComponent<CanvasGroup>().blocksRaycasts = false; |
||||
|
|
||||
|
originalParent = this.gameObject.transform.parent; |
||||
|
originalpoint = this.transform.localPosition; |
||||
|
|
||||
|
transform.SetParent(transform.parent.parent); |
||||
|
transform.position = eventData.position; |
||||
|
|
||||
|
//根据卡牌数据决定是否调用曲线
|
||||
|
if (cardOriginalData.CastingRange != 0) |
||||
|
{ |
||||
|
//释放范围为0则不需要调用曲线
|
||||
|
ainPanle.SetActive(true); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
ainPanle.SetActive(false); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
//todo-统一确定锚点位置
|
||||
|
|
||||
|
//重新调用范围预览--以后要写到卡牌效果里,现在默认影响1格
|
||||
|
//GameManager.Instance.player.StepPreviewInfluencedNode(1);
|
||||
|
} |
||||
|
|
||||
|
//拖拽中
|
||||
|
public void CardFollow() |
||||
|
{ |
||||
|
if (cardOriginalData.CastingRange != 0) |
||||
|
{ |
||||
|
ainPanleWork(); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
//没有范围不需要射线吧,因为不需要指定目标点?
|
||||
|
// noAinPanleWork(eventData);
|
||||
|
} |
||||
|
dyeing(); |
||||
|
} |
||||
|
|
||||
|
//卡牌释放
|
||||
|
public void CardUse() |
||||
|
{ |
||||
|
choosed = false; |
||||
|
if (canUse) |
||||
|
{ |
||||
|
Debug.Log("进入影响数值" + influencePreviewPool.Count); |
||||
|
if (result.Count > 0) |
||||
|
{ |
||||
|
if (result[0].gameObject.tag == "Card") |
||||
|
{ |
||||
|
choosed = true; |
||||
|
dragState = CardDragState.onDrag; |
||||
|
TurnMaster.Instance.playerAction = TurnMaster.PlayerAction.useCard; |
||||
|
/* |
||||
|
GetComponent<CanvasGroup>().blocksRaycasts = true; |
||||
|
|
||||
|
ainPanle.SetActive(false);//关闭贝塞尔曲线
|
||||
|
//遍历范围预览池消除影响色
|
||||
|
for (int i = 0; i < GameManager.Instance.player.influencePreviewPool.Count; i++) |
||||
|
{ |
||||
|
GameManager.Instance.player.influencePreviewPool[i].influenced = false; |
||||
|
} |
||||
|
//GameManager.Instance.player.influencePreviewPool.Clear();
|
||||
|
*/ |
||||
|
return; |
||||
|
} |
||||
|
else if (result[0].gameObject.name == "cardSlot") |
||||
|
{ |
||||
|
choosed = true; |
||||
|
dragState = CardDragState.onDrag; |
||||
|
TurnMaster.Instance.playerAction = TurnMaster.PlayerAction.useCard; |
||||
|
/* |
||||
|
transform.SetParent(result[0].gameObject.transform); |
||||
|
transform.position = result [0].gameObject.transform.position; |
||||
|
GetComponent<CanvasGroup>().blocksRaycasts = true; |
||||
|
|
||||
|
ainPanle.SetActive(false);//关闭贝塞尔曲线
|
||||
|
//遍历范围预览池消除影响色
|
||||
|
for (int i = 0; i < GameManager.Instance.player.influencePreviewPool.Count; i++) |
||||
|
{ |
||||
|
GameManager.Instance.player.influencePreviewPool[i].influenced = false; |
||||
|
} |
||||
|
//GameManager.Instance.player.influencePreviewPool.Clear();
|
||||
|
*/ |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
if (ainPanle.activeSelf) |
||||
|
{ |
||||
|
ainPanle.SetActive(false);//关闭贝塞尔曲线
|
||||
|
} |
||||
|
|
||||
|
//先判断该卡牌的类型是否是需要范围
|
||||
|
if (cardOriginalData.CastingRange != 0) |
||||
|
{ |
||||
|
//检测碰撞的地图节点是否被影响(可释放)
|
||||
|
if (currentNode == null || currentNode.influenced == false) |
||||
|
{ |
||||
|
//遍历范围预览池消除影响色(红色,卡牌的释放范围)
|
||||
|
for (int i = 0; i < GameManager.Instance.player.influencePreviewPool.Count; i++) |
||||
|
{ |
||||
|
GameManager.Instance.player.influencePreviewPool[i].influenced = false; |
||||
|
} |
||||
|
//GameManager.Instance.player.influencePreviewPool.Clear();
|
||||
|
} |
||||
|
else if (currentNode.influenced) |
||||
|
{ |
||||
|
|
||||
|
//卡牌释放效果
|
||||
|
use(); |
||||
|
Debug.Log("玩家盾量:" + Usermanager.Instance.Shield); |
||||
|
|
||||
|
//临时效果--将其加入墓地并销毁实体
|
||||
|
TurnMaster.Instance.usedCard.usedCardList.Add(this.gameObject.GetComponent<CardEntity>().CardId); |
||||
|
Destroy(this.gameObject); |
||||
|
} |
||||
|
//遍历范围预览池消除影响色
|
||||
|
for (int i = 0; i < GameManager.Instance.player.influencePreviewPool.Count; i++) |
||||
|
{ |
||||
|
GameManager.Instance.player.influencePreviewPool[i].influenced = false; |
||||
|
} |
||||
|
GameManager.Instance.player.influencePreviewPool.Clear(); |
||||
|
//遍历影响池变色
|
||||
|
for (int i = 0; i < influencePreviewPool.Count; i++) |
||||
|
{ |
||||
|
influencePreviewPool[i].influenced = false; |
||||
|
} |
||||
|
influencePreviewPool.Clear(); |
||||
|
GetComponent<CanvasGroup>().blocksRaycasts = true; |
||||
|
|
||||
|
//其他位置都归位
|
||||
|
transform.SetParent(originalParent); |
||||
|
transform.localPosition = originalpoint; |
||||
|
return; |
||||
|
}//范围类,需要指定被影响的节点才能释放
|
||||
|
else |
||||
|
{ |
||||
|
//卡牌释放效果
|
||||
|
use(); |
||||
|
Debug.Log("玩家盾量:" + Usermanager.Instance.Shield); |
||||
|
|
||||
|
//临时效果--将其加入墓地并销毁实体
|
||||
|
TurnMaster.Instance.usedCard.usedCardList.Add(this.gameObject.GetComponent<CardEntity>().CardId); |
||||
|
Destroy(this.gameObject); |
||||
|
|
||||
|
return; |
||||
|
|
||||
|
}//无范围类,直接释放
|
||||
|
|
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
canUse = true; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: 7831439f6bbbdf14b8546fd1ac26d312 |
||||
|
MonoImporter: |
||||
|
externalObjects: {} |
||||
|
serializedVersion: 2 |
||||
|
defaultReferences: [] |
||||
|
executionOrder: 0 |
||||
|
icon: {instanceID: 0} |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
||||
@ -0,0 +1,42 @@ |
|||||
|
using System.Collections; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using UnityEngine; |
||||
|
|
||||
|
public class MathTool |
||||
|
{ |
||||
|
// Start is called before the first frame update
|
||||
|
public static List<int> GetRandomNumbers(int max, int count) |
||||
|
{ |
||||
|
System.Random rand = new System.Random(); |
||||
|
List<int> numbers = new List<int>(); |
||||
|
|
||||
|
// 如果请求的数量大于最大值范围,限制返回的数字为最大范围内的所有数字
|
||||
|
if (count > max) |
||||
|
{ |
||||
|
numbers = Enumerable.Range(0, max).ToList(); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
HashSet<int> uniqueNumbers = new HashSet<int>(); |
||||
|
while (uniqueNumbers.Count < count) |
||||
|
{ |
||||
|
uniqueNumbers.Add(rand.Next(max)); |
||||
|
} |
||||
|
numbers = uniqueNumbers.ToList(); |
||||
|
} |
||||
|
|
||||
|
// 随机打乱数字列表
|
||||
|
int n = numbers.Count; |
||||
|
while (n > 1) |
||||
|
{ |
||||
|
n--; |
||||
|
int k = rand.Next(n + 1); |
||||
|
int value = numbers[k]; |
||||
|
numbers[k] = numbers[n]; |
||||
|
numbers[n] = value; |
||||
|
} |
||||
|
|
||||
|
return numbers; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: 7601e2bd77b970649b4d3b9a4bc8a028 |
||||
|
MonoImporter: |
||||
|
externalObjects: {} |
||||
|
serializedVersion: 2 |
||||
|
defaultReferences: [] |
||||
|
executionOrder: 0 |
||||
|
icon: {instanceID: 0} |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
||||
@ -0,0 +1,21 @@ |
|||||
|
using System.Collections; |
||||
|
using System.Collections.Generic; |
||||
|
using UnityEngine; |
||||
|
using System; |
||||
|
|
||||
|
public static class randomTool |
||||
|
{ |
||||
|
public static void Shuffle<T>(this List<T> list) |
||||
|
{ |
||||
|
System.Random rng = new System.Random(); |
||||
|
int n = list.Count; |
||||
|
while (n > 1) |
||||
|
{ |
||||
|
n--; |
||||
|
int k = rng.Next(n + 1); |
||||
|
T value = list[k]; |
||||
|
list[k] = list[n]; |
||||
|
list[n] = value; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: fb10e9750fcfdc746a918442ddc09fb4 |
||||
|
MonoImporter: |
||||
|
externalObjects: {} |
||||
|
serializedVersion: 2 |
||||
|
defaultReferences: [] |
||||
|
executionOrder: 0 |
||||
|
icon: {instanceID: 0} |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
||||
@ -0,0 +1,30 @@ |
|||||
|
using System.Collections; |
||||
|
using System.Collections.Generic; |
||||
|
using UnityEngine; |
||||
|
|
||||
|
public class DestructionManager : Singleton<DestructionManager> |
||||
|
{ |
||||
|
// Start is called before the first frame update
|
||||
|
public IEnumerator destoryAndUseCard(GameObject target, CardOriginalData cardOriginalData, List<MapUnity> influencePreviewPool, int cardIndex) |
||||
|
{ |
||||
|
if (!cardOriginalData.IsDisposable) |
||||
|
{ |
||||
|
TurnMaster.Instance.usedCard.usedCardList.Add(target.GetComponent<CardEntity>().CardId); |
||||
|
} |
||||
|
Destroy(target); |
||||
|
Debug.Log("½øÈëÅÅÐò"); |
||||
|
StartCoroutine(TurnMaster.Instance.MoveCards()); |
||||
|
yield return new WaitForEndOfFrame(); |
||||
|
Debug.Log("½øÈë¿¨ÅÆ½áËã"); |
||||
|
StartCoroutine(SettlementManager.Instance.settle(cardOriginalData, influencePreviewPool, cardIndex)); |
||||
|
Debug.Log("½áÊø"); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void startDestoryAndUseCard(GameObject target, CardOriginalData cardOriginalData, List<MapUnity> influencePreviewPool, int cardIndex) |
||||
|
{ |
||||
|
StartCoroutine(destoryAndUseCard(target, cardOriginalData, influencePreviewPool, cardIndex)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: 9b57ba76da093b84dad1f0100bb05537 |
||||
|
MonoImporter: |
||||
|
externalObjects: {} |
||||
|
serializedVersion: 2 |
||||
|
defaultReferences: [] |
||||
|
executionOrder: 0 |
||||
|
icon: {instanceID: 0} |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -1,10 +1,10 @@ |
|||||
{ "pid": 35942, "tid": -1, "ph": "M", "name": "process_name", "args": { "name": "netcorerun.dll" } }, |
{ "pid": 35942, "tid": -1, "ph": "M", "name": "process_name", "args": { "name": "netcorerun.dll" } }, |
||||
{ "pid": 35942, "tid": -1, "ph": "M", "name": "process_sort_index", "args": { "sort_index": "-1" } }, |
{ "pid": 35942, "tid": -1, "ph": "M", "name": "process_sort_index", "args": { "sort_index": "-1" } }, |
||||
{ "pid": 35942, "tid": 1, "ph": "M", "name": "thread_name", "args": { "name": "" } }, |
{ "pid": 35942, "tid": 1, "ph": "M", "name": "thread_name", "args": { "name": "" } }, |
||||
{ "pid": 35942, "tid": 1, "ts": 1718391993309466, "dur": 1123035, "ph": "X", "name": "BuildProgram", "args": {} }, |
{ "pid": 35942, "tid": 1, "ts": 1718670784064538, "dur": 455050, "ph": "X", "name": "BuildProgram", "args": {} }, |
||||
{ "pid": 35942, "tid": 1, "ts": 1718391993310890, "dur": 434610, "ph": "X", "name": "BuildProgramContextConstructor", "args": {} }, |
{ "pid": 35942, "tid": 1, "ts": 1718670784065642, "dur": 57635, "ph": "X", "name": "BuildProgramContextConstructor", "args": {} }, |
||||
{ "pid": 35942, "tid": 1, "ts": 1718391994359003, "dur": 6459, "ph": "X", "name": "OutputData.Write", "args": {} }, |
{ "pid": 35942, "tid": 1, "ts": 1718670784454926, "dur": 4725, "ph": "X", "name": "OutputData.Write", "args": {} }, |
||||
{ "pid": 35942, "tid": 1, "ts": 1718391994365465, "dur": 67019, "ph": "X", "name": "Backend.Write", "args": {} }, |
{ "pid": 35942, "tid": 1, "ts": 1718670784459654, "dur": 59921, "ph": "X", "name": "Backend.Write", "args": {} }, |
||||
{ "pid": 35942, "tid": 1, "ts": 1718391994367466, "dur": 40760, "ph": "X", "name": "JsonToString", "args": {} }, |
{ "pid": 35942, "tid": 1, "ts": 1718670784461329, "dur": 40397, "ph": "X", "name": "JsonToString", "args": {} }, |
||||
{ "pid": 35942, "tid": 1, "ts": 1718391994441390, "dur": 1635, "ph": "X", "name": "", "args": {} }, |
{ "pid": 35942, "tid": 1, "ts": 1718670784527265, "dur": 1444, "ph": "X", "name": "", "args": {} }, |
||||
{ "pid": 35942, "tid": 1, "ts": 1718391994440749, "dur": 2509, "ph": "X", "name": "Write chrome-trace events", "args": {} }, |
{ "pid": 35942, "tid": 1, "ts": 1718670784526748, "dur": 2240, "ph": "X", "name": "Write chrome-trace events", "args": {} }, |
||||
|
|||||
File diff suppressed because it is too large
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@ |
|||||
{"m_ScrollY":0.0,"m_ExpandedPrefabGameObjectFileIDs":[3410471369990512392,55742390230665598,5461942460596251060,2649362224241662458,1267054625817446498,1959932590596737920,6592263620250946689],"m_LastClickedFileID":55742390230665598} |
{"m_ScrollY":0.0,"m_ExpandedPrefabGameObjectFileIDs":[3410471369990512392,55742390230665598,5461942460596251060,2649362224241662458,1267054625817446498,1959932590596737920,6592263620250946689],"m_LastClickedFileID":3410471369990512392} |
||||
@ -1 +1 @@ |
|||||
{"cameraMode":{"drawMode":0,"name":"Shaded","section":"Shading Mode"},"sceneLighting":true,"audioPlay":false,"sceneViewState":{"m_AlwaysRefresh":false,"showFog":true,"showSkybox":true,"showFlares":true,"showImageEffects":true,"showParticleSystems":true,"showVisualEffectGraphs":true,"m_FxEnabled":true},"in2DMode":false,"pivot":{"x":3.999392509460449,"y":-1.338151454925537,"z":2.8440005779266359},"rotation":{"x":0.5858413577079773,"y":0.0018278908682987095,"z":-0.0016127827111631632,"w":0.8106403350830078},"size":6.8409423828125,"orthographic":false} |
{"cameraMode":{"drawMode":0,"name":"Shaded","section":"Shading Mode"},"sceneLighting":true,"audioPlay":false,"sceneViewState":{"m_AlwaysRefresh":false,"showFog":true,"showSkybox":true,"showFlares":true,"showImageEffects":true,"showParticleSystems":true,"showVisualEffectGraphs":true,"m_FxEnabled":true},"in2DMode":false,"pivot":{"x":0.0,"y":0.0,"z":0.0},"rotation":{"x":0.5858413577079773,"y":0.0018278908682987095,"z":-0.0016127827111631632,"w":0.8106403350830078},"size":0.8660253882408142,"orthographic":false} |
||||
@ -1 +1 @@ |
|||||
14260 |
26712 |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
Binary file not shown.
Loading…
Reference in new issue