|
|
|
@ -3,11 +3,13 @@ using System.Collections; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Drawing.Imaging; |
|
|
|
using System.Linq; |
|
|
|
using System.Text; |
|
|
|
using System.Text.RegularExpressions; |
|
|
|
using TMPro; |
|
|
|
using Unity.VisualScripting; |
|
|
|
using UnityEngine; |
|
|
|
using UnityEngine.EventSystems; |
|
|
|
using UnityEngine.SocialPlatforms.Impl; |
|
|
|
using UnityEngine.UI; |
|
|
|
using UnityEngine.UIElements; |
|
|
|
using static TMPro.SpriteAssetUtilities.TexturePacker_JsonArray; |
|
|
|
@ -15,7 +17,7 @@ using static UnityEngine.InputSystem.InputControlScheme.MatchResult; |
|
|
|
using Image = UnityEngine.UI.Image; |
|
|
|
using Match = System.Text.RegularExpressions.Match; |
|
|
|
|
|
|
|
public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDragHandler,IPointerExitHandler ,IPointerEnterHandler |
|
|
|
public class WeaponNode : MonoBehaviour, IDragHandler, IBeginDragHandler, IEndDragHandler, IPointerExitHandler, IPointerEnterHandler |
|
|
|
{ |
|
|
|
[Header("图标")] |
|
|
|
public Image nodeImage; |
|
|
|
@ -52,7 +54,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
public int extraMostNodeCount = 0; |
|
|
|
public int extraLeastNodeCount = 0; |
|
|
|
public int extraAllNodeCount = 0; |
|
|
|
public bool isIgnoreCondition=false; |
|
|
|
public bool isIgnoreCondition = false; |
|
|
|
public bool isDoubleSettle = false; |
|
|
|
public string resultDescription; |
|
|
|
public string conditionDescription; |
|
|
|
@ -64,7 +66,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
//public Sprite gemImage;
|
|
|
|
public bool isGemImage;//标志是否是领域类型宝石
|
|
|
|
[Header("信息板计时器")] |
|
|
|
public float time =0.5f; |
|
|
|
public float time = 0.5f; |
|
|
|
float currentTime; |
|
|
|
bool isShow; |
|
|
|
bool isOn; |
|
|
|
@ -73,7 +75,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
private void Update() |
|
|
|
{ |
|
|
|
//SettleScore();
|
|
|
|
if(isOn &&isShow ==false ) |
|
|
|
if (isOn && isShow == false) |
|
|
|
{ |
|
|
|
if (currentTime > 0) |
|
|
|
{ |
|
|
|
@ -92,9 +94,9 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
isShow = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void Start() |
|
|
|
{ |
|
|
|
currentTime = time; |
|
|
|
@ -108,18 +110,18 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
//score = 0;
|
|
|
|
//scoreMul = 0f;
|
|
|
|
resetCountBeforeSettle(); |
|
|
|
if (isIgnoreCondition||ConditionCheck(position)) |
|
|
|
if (isIgnoreCondition || ConditionCheck(position)) |
|
|
|
{ |
|
|
|
Debug.Log("结算成功节点2"+"位置"+position); |
|
|
|
Debug.Log("结算成功节点2" + "位置" + position); |
|
|
|
isActive = true; |
|
|
|
if (isDoubleSettle) |
|
|
|
if (isDoubleSettle) |
|
|
|
{ |
|
|
|
SettleFunction(position, result,ref score); |
|
|
|
SettleFunction(position, result, ref score); |
|
|
|
} |
|
|
|
|
|
|
|
SettleFunction(position, result, ref score); |
|
|
|
} |
|
|
|
else if(!Name.WeaponNodeCondition.PlayerConvertSet.Contains(condition)) |
|
|
|
else if (!Name.WeaponNodeCondition.PlayerConvertSet.Contains(condition)) |
|
|
|
{ |
|
|
|
isActive = false; |
|
|
|
} |
|
|
|
@ -178,15 +180,15 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void SettleFunction(int position,string result, ref int score) |
|
|
|
public virtual void SettleFunction(int position, string result, ref int score) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
Debug.Log("结算成功节点3"); |
|
|
|
string[] keys = result.Split("_"); |
|
|
|
for (int j = 0; j < keys.Length; j++) |
|
|
|
{ |
|
|
|
|
|
|
|
SingleFunctionSettle(keys[j],resultValue,ref score); |
|
|
|
SingleFunctionSettle(keys[j], resultValue, ref score); |
|
|
|
Debug.Log("score是" + score); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -222,7 +224,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
} |
|
|
|
for (int k = 0; k < matchList.Count; k++) |
|
|
|
{ |
|
|
|
Debug.Log("matchList是" + matchList[k]+"位置" + position); |
|
|
|
Debug.Log("matchList是" + matchList[k] + "位置" + position); |
|
|
|
if (!matchList[k]) |
|
|
|
{ |
|
|
|
result = false; |
|
|
|
@ -235,26 +237,26 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
public void SingleFunctionSettleForPlayerTurnEnd(string result,string resultValue) |
|
|
|
public void SingleFunctionSettleForPlayerTurnEnd(string result, string resultValue) |
|
|
|
{ |
|
|
|
switch (result) |
|
|
|
{ |
|
|
|
case Name.NodeItem.Volcano: |
|
|
|
Usermanager.Instance.SufferPlayerAbnormalCondition(AbnormalCondition.Volcano, int.Parse(resultValue)); |
|
|
|
Debug.Log("加入了"+ result+ resultValue); |
|
|
|
Debug.Log("加入了" + result + resultValue); |
|
|
|
break; |
|
|
|
case Name.NodeItem.AcidRain: |
|
|
|
Usermanager.Instance.SufferPlayerAbnormalCondition(AbnormalCondition.AcidRain, int.Parse(resultValue)); |
|
|
|
Debug.Log("加入了" + result + resultValue); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.threeColorRedistribution: |
|
|
|
HashSet<MapUnity> targetNodes= new HashSet<MapUnity>(); |
|
|
|
HashSet<MapUnity> targetNodes = new HashSet<MapUnity>(); |
|
|
|
//targetNodes
|
|
|
|
MathTool.AddRange(targetNodes,getNodeTools.getNodesWithColor(Name.Color.Blue), getNodeTools.getNodesWithColor(Name.Color.Red), |
|
|
|
getNodeTools.getNodesWithColor(Name.Color.Yellow)); |
|
|
|
int allCount=targetNodes.Count; |
|
|
|
MathTool.AddRange(targetNodes, getNodeTools.getNodesWithColor(Name.Color.Blue), getNodeTools.getNodesWithColor(Name.Color.Red), |
|
|
|
getNodeTools.getNodesWithColor(Name.Color.Yellow)); |
|
|
|
int allCount = targetNodes.Count; |
|
|
|
List<List<MapUnity>> parts = MathTool.SplitHashSet(targetNodes, 3); |
|
|
|
for (int i = 0;i< parts.Count; i++) |
|
|
|
for (int i = 0; i < parts.Count; i++) |
|
|
|
{ |
|
|
|
switch (i) |
|
|
|
{ |
|
|
|
@ -277,28 +279,28 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void SingleFunctionSettle(string result, string resultValue,ref int score) |
|
|
|
public void SingleFunctionSettle(string result, string resultValue, ref int score) |
|
|
|
{ |
|
|
|
//score += turnScore;
|
|
|
|
/* if (condition.Equals(Name.WeaponNodeCondition.everyNumNodeConvert)) |
|
|
|
{ |
|
|
|
for (int i = 0; i < MapUnityManager.Instance.switchNodeNum / int.Parse(conditionValue); i++) |
|
|
|
{ |
|
|
|
BasicSingleFunctionSettle(result, resultValue,ref score); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
/* if (condition.Equals(Name.WeaponNodeCondition.everyNumNodeConvert)) |
|
|
|
{ |
|
|
|
for (int i = 0; i < MapUnityManager.Instance.switchNodeNum / int.Parse(conditionValue); i++) |
|
|
|
{ |
|
|
|
BasicSingleFunctionSettle(result, resultValue,ref score); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
//else
|
|
|
|
//{
|
|
|
|
BasicSingleFunctionSettle(result, resultValue, ref score); |
|
|
|
BasicSingleFunctionSettle(result, resultValue, ref score); |
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@ -403,6 +405,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
|
|
|
|
public void SingleFunctionSettleForAwake() |
|
|
|
{ |
|
|
|
settleCount++; |
|
|
|
switch (result) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeFunction.addScoreThisTurn: |
|
|
|
@ -414,7 +417,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
|
|
|
|
public void addPlayerMostNodeCount() |
|
|
|
{ |
|
|
|
string mostNode= getNodeTools.getMostPlayerNodeName(); |
|
|
|
string mostNode = getNodeTools.getMostPlayerNodeName(); |
|
|
|
switch (mostNode) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeFunction.redNodeCount: |
|
|
|
@ -445,7 +448,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
public bool SingleConditionCheck(string condition,int position) |
|
|
|
public bool SingleConditionCheck(string condition, int position) |
|
|
|
{ |
|
|
|
bool check = false; |
|
|
|
//cardOriginalData.originFunctionVal.Clear();
|
|
|
|
@ -513,7 +516,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
check = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
if (weaponSlotA.childCount>0) |
|
|
|
if (weaponSlotA.childCount > 0) |
|
|
|
{ |
|
|
|
Transform weaponANode = weaponSlotA.GetChild(0); |
|
|
|
WeaponNode nodeA = weaponANode.transform.GetComponent<WeaponNode>(); |
|
|
|
@ -537,13 +540,13 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
check = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.positionUsed: |
|
|
|
Transform weaponSlotB = WeaponManager.Instance.playerWeaponNodeList.GetChild(int.Parse(conditionValue)); |
|
|
|
if (weaponSlotB == null) |
|
|
|
{ |
|
|
|
check=false; |
|
|
|
check = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
if (weaponSlotB.childCount > 0) |
|
|
|
@ -570,15 +573,15 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
check = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.node: |
|
|
|
check = checkConditionNode(nodesMark, nodesColor); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.threeColorCountMoreThan: |
|
|
|
if(getNodeTools.getNodesCount(Name.Color.Blue)> int.Parse(conditionValue) && getNodeTools.getNodesCount(Name.Color.Yellow) > int.Parse(conditionValue) && getNodeTools.getNodesCount(Name.Color.Red) > int.Parse(conditionValue)) |
|
|
|
if (getNodeTools.getNodesCount(Name.Color.Blue) > int.Parse(conditionValue) && getNodeTools.getNodesCount(Name.Color.Yellow) > int.Parse(conditionValue) && getNodeTools.getNodesCount(Name.Color.Red) > int.Parse(conditionValue)) |
|
|
|
{ |
|
|
|
check=true; |
|
|
|
check = true; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
@ -592,9 +595,9 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
check = MathTool.IsMaxDifferenceGreaterThan(getNodeTools.getNodesCount(Name.Color.Blue), getNodeTools.getNodesCount(Name.Color.Yellow), getNodeTools.getNodesCount(Name.Color.Red), 0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.everyNumNodeConvert: |
|
|
|
if(MapUnityManager.Instance.switchNodeNum- settleCount* int.Parse(conditionValue) >= int.Parse(conditionValue)) |
|
|
|
if (MapUnityManager.Instance.switchNodeNum - settleCount * int.Parse(conditionValue) >= int.Parse(conditionValue)) |
|
|
|
{ |
|
|
|
check=true; |
|
|
|
check = true; |
|
|
|
settleCount++; |
|
|
|
//MapUnityManager.Instance.switchNodeNum-= int.Parse(conditionValue);
|
|
|
|
} |
|
|
|
@ -626,8 +629,8 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return check; |
|
|
|
} |
|
|
|
|
|
|
|
@ -637,7 +640,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
if (basicCheck(nodesColor)) |
|
|
|
{ |
|
|
|
Debug.Log("通过basicCheck"); |
|
|
|
bool primeCheckRusult=false; |
|
|
|
bool primeCheckRusult = false; |
|
|
|
//StartCoroutine(primeCheck(nodesMark, nodesColor, output => { primeCheckRusult = output; }));
|
|
|
|
if (primeCheck(nodesMark, nodesColor)) |
|
|
|
{ |
|
|
|
@ -653,18 +656,18 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public bool primeCheck(string[] nodesMark, string[] nodesColor) |
|
|
|
public bool primeCheck(string[] nodesMark, string[] nodesColor) |
|
|
|
{ |
|
|
|
bool result = false; |
|
|
|
bool haveOrigin=false; |
|
|
|
HashSet <MapUnity> targetNodes= new HashSet <MapUnity>(); |
|
|
|
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]); |
|
|
|
haveOrigin = true; |
|
|
|
targetNodes = getNodeTools.getNodesWithColor(nodesColor[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!haveOrigin) |
|
|
|
@ -683,7 +686,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
int processed = 0; |
|
|
|
if (mapUnity.isCaledDictionary.TryGetValue(onlyTapForWeaponNode, out BoolPair boolPair)) |
|
|
|
{ |
|
|
|
Debug.Log("isChecked是"+ boolPair.isChecked +"x是"+mapUnity.locationX+"y是"+mapUnity.locationY); |
|
|
|
Debug.Log("isChecked是" + boolPair.isChecked + "x是" + mapUnity.locationX + "y是" + mapUnity.locationY); |
|
|
|
if (!boolPair.isChecked) |
|
|
|
{ |
|
|
|
Debug.Log("false进行check"); |
|
|
|
@ -699,7 +702,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
else if(boolPair.checkResult) |
|
|
|
else if (boolPair.checkResult) |
|
|
|
{ |
|
|
|
result = true; |
|
|
|
return result; |
|
|
|
@ -707,7 +710,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Debug.Log("add了true"); |
|
|
|
Debug.Log("add了true"); |
|
|
|
mapUnity.isCaledDictionary.Add(onlyTapForWeaponNode, new BoolPair { isChecked = true }); |
|
|
|
if (getNodeTools.CheckWeaponConditionColorForSingleNode(nodesMark, nodesColor, mapUnity, onlyTapForWeaponNode)) |
|
|
|
{ |
|
|
|
@ -743,7 +746,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
int yellowNodeCount = 0; |
|
|
|
for (int i = 0; i < nodesColor.Length; i++) |
|
|
|
{ |
|
|
|
switch (nodesColor[i]) |
|
|
|
switch (nodesColor[i]) |
|
|
|
{ |
|
|
|
case Name.Color.White: |
|
|
|
whiteNodeCount++; |
|
|
|
@ -771,7 +774,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
Debug.Log("blueNodeCount数量是" + blueNodeCount + MapUnityManager.Instance.blueNodeCount); |
|
|
|
if (whiteNodeCount > MapUnityManager.Instance.whiteNodeCount || redNodeCount > MapUnityManager.Instance.redNodeCount || yellowNodeCount > MapUnityManager.Instance.yellowNodeCount || blueNodeCount > MapUnityManager.Instance.blueNodeCount) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
else |
|
|
|
@ -814,16 +817,16 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
GetComponent<CanvasGroup>().blocksRaycasts = false; |
|
|
|
inforPanel.SetActive(false); |
|
|
|
|
|
|
|
GameObject beginDragVFX= Instantiate(onBeginDargVFX, PlayerStatusUIManager.Instance.playerUICanvas.transform); |
|
|
|
GameObject beginDragVFX = Instantiate(onBeginDargVFX, PlayerStatusUIManager.Instance.playerUICanvas.transform); |
|
|
|
beginDragVFX.transform.position = originParent.position; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void OnDrag(PointerEventData eventData) |
|
|
|
{ |
|
|
|
GameObject targetObj = eventData.pointerCurrentRaycast.gameObject; |
|
|
|
if(targetObj != null && targetObj.CompareTag("WeaponDragPanel")) |
|
|
|
if (targetObj != null && targetObj.CompareTag("WeaponDragPanel")) |
|
|
|
{ |
|
|
|
//获取鼠标在相机中(世界中)的位置,转换为屏幕坐标;
|
|
|
|
screenPosition = Camera.main.WorldToScreenPoint(transform.position); |
|
|
|
@ -840,7 +843,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
onDragVFX.SetActive(true); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void OnEndDrag(PointerEventData eventData) |
|
|
|
@ -853,18 +856,18 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
{ |
|
|
|
transform.SetParent(targetObj.transform); |
|
|
|
transform.localPosition = Vector3.zero; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if(targetObj != null && targetObj .name == "WeaponNode(Clone)") |
|
|
|
else if (targetObj != null && targetObj.name == "WeaponNode(Clone)") |
|
|
|
{ |
|
|
|
if(targetObj.transform .parent.parent.name != "BagPlayerWeaponPanel")//不在背包内才能调换
|
|
|
|
if (targetObj.transform.parent.parent.name != "BagPlayerWeaponPanel")//不在背包内才能调换
|
|
|
|
{ |
|
|
|
//子集有物体,这不是空位,需要置换
|
|
|
|
Transform targetFather = targetObj.transform.parent; |
|
|
|
Transform targetChild = targetObj.transform; |
|
|
|
WeaponNode targetNode = targetChild.transform.GetComponent<WeaponNode>(); |
|
|
|
targetChild.SetParent(originParent); |
|
|
|
targetChild.localPosition = Vector3.zero; |
|
|
|
targetChild.localPosition = Vector3.zero; |
|
|
|
transform.SetParent(targetFather); |
|
|
|
transform.localPosition = Vector3.zero; |
|
|
|
//targetNode.ResetBool();
|
|
|
|
@ -873,17 +876,17 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
{ |
|
|
|
BackPosition(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else//其他位置归位
|
|
|
|
{ |
|
|
|
if(BagManager .Instance .labelButtonList[1].associatePage .activeInHierarchy ==false ) |
|
|
|
if (BagManager.Instance.labelButtonList[1].associatePage.activeInHierarchy == false) |
|
|
|
{ |
|
|
|
BackPosition(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if(targetObj == null ||targetObj.name == "BagPlayerWeaponPanel") |
|
|
|
if (targetObj == null || targetObj.name == "BagPlayerWeaponPanel") |
|
|
|
{ |
|
|
|
BackPosition(); |
|
|
|
} |
|
|
|
@ -912,11 +915,16 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
{ |
|
|
|
isIgnoreCondition = false; |
|
|
|
isDoubleSettle = false; |
|
|
|
WeaponManager.Instance.isWeaponNodeChange= true; |
|
|
|
WeaponManager.Instance.isWeaponNodeChange = true; |
|
|
|
} |
|
|
|
|
|
|
|
public void OnPointerEnter(PointerEventData eventData) |
|
|
|
{ |
|
|
|
resultDescription = Name.getGemResultDescription(result, resultValue); |
|
|
|
conditionDescription = Name.getGemConditionDescription(condition, conditionValue, nodesMark, nodesColor); |
|
|
|
resetConditionDes(); |
|
|
|
resetResultDes(); |
|
|
|
SetUpInforText(); |
|
|
|
isOn = true; |
|
|
|
} |
|
|
|
|
|
|
|
@ -935,7 +943,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
CardPictureManager.Instance.complete || |
|
|
|
(Time.time - waitStartTime > 15f) |
|
|
|
); |
|
|
|
if(resultDescription.Length != 0) |
|
|
|
if (resultDescription.Length != 0) |
|
|
|
{ |
|
|
|
inforTextGemImage.text = resultDescription; |
|
|
|
} |
|
|
|
@ -952,7 +960,7 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
Debug.Log("nodesColor是" + a); |
|
|
|
} |
|
|
|
gemImageIcon.sprite = CardManager.Instance.createGemImageByToolX(nodesMark, nodesColor); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void SetUpInforText() |
|
|
|
@ -1018,4 +1026,110 @@ public class WeaponNode : MonoBehaviour,IDragHandler, IBeginDragHandler, IEndDra |
|
|
|
bagWeaponNode.isGemImage = condition.Equals(Name.WeaponNodeCondition.node); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void resetConditionDes() |
|
|
|
{ |
|
|
|
if (!Name.WeaponNodeCondition.PlayerConvertSet.Contains(condition)) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
sb.Append(conditionDescription); |
|
|
|
string num = ""; |
|
|
|
switch (condition) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeCondition.everyNumNodeConvert: |
|
|
|
num = MapUnityManager.Instance.switchNodeNum.ToString(); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.everyRedNodeConvert: |
|
|
|
num = MapUnityManager.Instance.switchRedNodeNum.ToString(); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.everyBlueNodeConvert: |
|
|
|
num = MapUnityManager.Instance.switchBlueNodeNum.ToString(); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.everyYellowNodeConvert: |
|
|
|
num = MapUnityManager.Instance.switchYellowNodeNum.ToString(); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.bombbomb: |
|
|
|
num = settleCount.ToString(); |
|
|
|
break; |
|
|
|
} |
|
|
|
sb.Append("("); |
|
|
|
sb.Append(num); |
|
|
|
sb.Append(')'); |
|
|
|
conditionDescription=sb.ToString(); |
|
|
|
} |
|
|
|
|
|
|
|
public void resetResultDes() |
|
|
|
{ |
|
|
|
if (!(Name.WeaponNodeCondition.PlayerConvertSet.Contains(condition)||Name.WeaponNodeFunction.EveryResultSet.Contains(result))) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
sb.Append(resultDescription); |
|
|
|
string num = ""; |
|
|
|
int settleCoefficient = 1; |
|
|
|
if (settleCount != 0) |
|
|
|
{ |
|
|
|
settleCoefficient=settleCount; |
|
|
|
} |
|
|
|
switch (result) |
|
|
|
{ |
|
|
|
|
|
|
|
case Name.WeaponNodeFunction.everyRedNodeAddScore: |
|
|
|
int redNodeCount = getNodeTools.getNodesCount(Name.Color.Red); |
|
|
|
num = (settleCoefficient*redNodeCount / int.Parse(resultValue.Split("_")[0]) * int.Parse(resultValue.Split("_")[1])).ToString(); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.everyYellowNodeAddScore: |
|
|
|
int yellowNodeCount = getNodeTools.getNodesCount(Name.Color.Yellow); |
|
|
|
num = (settleCoefficient * yellowNodeCount / int.Parse(resultValue.Split("_")[0]) * int.Parse(resultValue.Split("_")[1])).ToString(); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.everyBlueNodeAddScore: |
|
|
|
int blueNodeCount = getNodeTools.getNodesCount(Name.Color.Blue); |
|
|
|
num = (settleCoefficient * blueNodeCount / int.Parse(resultValue.Split("_")[0]) * int.Parse(resultValue.Split("_")[1])).ToString(); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.everyBlackNodeAddScore: |
|
|
|
int blackNodeCount = getNodeTools.getNodesCount(Name.Color.Black); |
|
|
|
num = (settleCoefficient * blackNodeCount / int.Parse(resultValue.Split("_")[0]) * int.Parse(resultValue.Split("_")[1])).ToString(); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.everyHolyNodeAddScore: |
|
|
|
int holyNodeCount = getNodeTools.getNodesCount(Name.Color.Holy); |
|
|
|
num = (settleCoefficient * holyNodeCount / int.Parse(resultValue.Split("_")[0]) * int.Parse(resultValue.Split("_")[1])).ToString(); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.everyBombAddScore: |
|
|
|
int bombCount = 0; |
|
|
|
foreach (MapUnity nodeB in getNodeTools.getAllNodes()) |
|
|
|
{ |
|
|
|
if (nodeB.blockNode != null && nodeB.blockNode is Bomb) |
|
|
|
{ |
|
|
|
bombCount++; |
|
|
|
} |
|
|
|
} |
|
|
|
num = (bombCount * int.Parse(resultValue)).ToString(); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.everyBelieverAddScore: |
|
|
|
int believerCount = 0; |
|
|
|
foreach (MapUnity nodeC in getNodeTools.getAllNodes()) |
|
|
|
{ |
|
|
|
if (nodeC.blockNode != null && nodeC.blockNode is Believer) |
|
|
|
{ |
|
|
|
believerCount++; |
|
|
|
} |
|
|
|
} |
|
|
|
num = (believerCount / int.Parse(resultValue.Split("_")[0]) * int.Parse(resultValue.Split("_")[1])).ToString(); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.addScoreThisTurn: |
|
|
|
num=turnScore.ToString(); |
|
|
|
break; |
|
|
|
default: |
|
|
|
num = (settleCount * int.Parse(resultValue)).ToString(); |
|
|
|
break; |
|
|
|
} |
|
|
|
sb.Append("("); |
|
|
|
sb.Append(num); |
|
|
|
sb.Append(')'); |
|
|
|
resultDescription = sb.ToString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|