fix:1、添加sdk。2、修复bug
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ChillConnect;
|
||||
using System.Linq;
|
||||
using IgnoreOPS;
|
||||
using Spine.Unity;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
using ChillConnect;
|
||||
|
||||
public class CreatAnimalCard : MonoBehaviour
|
||||
{
|
||||
@@ -30,16 +30,13 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
}
|
||||
orthoCamera = GameObject.Find("GameCamera").GetComponent<Camera>();
|
||||
|
||||
float size = 52.4f;
|
||||
float size = (float)Math.Round(28.125f / ((float)Screen.width / Screen.height), 4);
|
||||
string type = SystemInfo.deviceModel.ToLower().Trim();
|
||||
// Debug.Log($"barry device type========={type} == {type.Substring(0, 3)}");
|
||||
if (type.Substring(0, 3) == "iph")
|
||||
// Debug.Log($"type==========={type}");
|
||||
if (type.Substring(0, 3) == "ipa")
|
||||
{//iPad机型
|
||||
size = (float)Math.Round(28.125f / ((float)Screen.width / Screen.height), 4);
|
||||
size = 49.9f;
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
size = (float)Math.Round(28.125f / ((float)Screen.width / Screen.height), 4);
|
||||
#endif
|
||||
|
||||
orthoCamera.orthographicSize = size;
|
||||
|
||||
@@ -65,21 +62,43 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
List<int> this_timetype_list = new List<int>();
|
||||
// Debug.Log(card_layer);
|
||||
card_item_list.Clear();
|
||||
// if (card_layer < extra_max)
|
||||
// {
|
||||
// card_layer = extra_max;
|
||||
// }
|
||||
|
||||
// ---------- 新增:先从0~15中挑选 card_type_max 个不同的类型 ----------
|
||||
List<int> allTypes = Enumerable.Range(0, 15).ToList(); // [0,1,2,...,15]
|
||||
List<int> chosenTypes = new List<int>();
|
||||
for (int i = 0; i < card_type_max; i++)
|
||||
{
|
||||
int idx = UnityEngine.Random.Range(0, allTypes.Count);
|
||||
chosenTypes.Add(allTypes[idx]);
|
||||
allTypes.RemoveAt(idx); // 确保不重复
|
||||
}
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
// 打印选出来的类型池
|
||||
Debug.Log($"[CreatCardNew] 随机选出的 {card_type_max} 个类型: {string.Join(",", chosenTypes)}");
|
||||
|
||||
for (int i = 0; i < all_card_numbers; i++)
|
||||
{
|
||||
int type = 0;
|
||||
if (GameHelper.IsGiftSwitch() && Random.Range(0, 100) < money_rate) type = 15;
|
||||
else type = Random.Range(0, card_type_max);
|
||||
if (!GameHelper.IsGiftSwitch() && type == 15)
|
||||
var randomNum = UnityEngine.Random.Range(0, 100);
|
||||
// Debug.Log($"[creat] money_rate------------ {randomNum}==={money_rate}");
|
||||
if (GameHelper.IsGiftSwitch() && randomNum < money_rate)
|
||||
{
|
||||
type = Random.Range(0, card_type_max - 1);
|
||||
type = 15; // 金币
|
||||
}
|
||||
else
|
||||
{
|
||||
// 在挑选好的类型池里再随机
|
||||
type = chosenTypes[UnityEngine.Random.Range(0, chosenTypes.Count)];
|
||||
}
|
||||
|
||||
// if (GameHelper.IsGiftSwitch() && type == 15)
|
||||
// {
|
||||
// type = UnityEngine.Random.Range(0, card_type_max - 1);
|
||||
// }
|
||||
#if UNITY_EDITOR
|
||||
// type = 1;
|
||||
#endif
|
||||
type_list.Add(type);
|
||||
type_list.Add(type);
|
||||
type_list.Add(type);
|
||||
@@ -128,7 +147,7 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
Card_item _tempObject = new();
|
||||
|
||||
int layer = getMaplayer(map_list);//确定层数
|
||||
int pos = Random.Range(0, map_list[layer].Count);
|
||||
int pos = UnityEngine.Random.Range(0, map_list[layer].Count);
|
||||
_tempObject.pos_x = map_list[layer][pos].x;
|
||||
_tempObject.pos_y = map_list[layer][pos].y;
|
||||
_tempObject._layer = layer;
|
||||
@@ -155,7 +174,7 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
last_posy = card_item_list[i][j].pos_y;
|
||||
}
|
||||
GameObject temp = Instantiate(card_item, new Vector3(card_item_list[i][j].pos_x, card_item_list[i][j].pos_y, 400 - card_item_list[i][j]._layer - z_offset), Quaternion.identity, gameObject.transform);
|
||||
index = Random.Range(0, type_list.Count);
|
||||
index = UnityEngine.Random.Range(0, type_list.Count);
|
||||
temp.GetComponent<SpriteRenderer>().sprite = img_list[type_list[index]];
|
||||
card_item_list[i][j].sheep_card = temp;
|
||||
card_item_list[i][j].card_type = type_list[index];
|
||||
@@ -183,7 +202,7 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
temp = Instantiate(card_item, new Vector3(card_item_list[i][j].pos_x, card_item_list[i][j].pos_y, 400 - card_item_list[i][j]._layer), Quaternion.identity, gameObject.transform);
|
||||
temp.GetComponent<SpriteRenderer>().sprite = img_list[card_item_list[i][j].card_type];
|
||||
card_item_list[i][j].sheep_card = temp;
|
||||
if (card_item_list[i][j].in_slot || card_item_list[i][j].is_out) temp.transform.localScale = new Vector3(4.68f, 4.68f, 1);
|
||||
if (card_item_list[i][j].in_slot || card_item_list[i][j].is_out) temp.transform.localScale = new Vector3(4.628f, 4.628f, 1);
|
||||
temp.gameObject.name = i + "-" + j;
|
||||
}
|
||||
}
|
||||
@@ -191,7 +210,7 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
}
|
||||
private GameObject Popup;
|
||||
|
||||
#if UNITY_EDITOR || UNITY_IOS
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
@@ -212,10 +231,13 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.card_click, hit.collider.gameObject.name);
|
||||
// 在此处添加点击物体后的逻辑
|
||||
}
|
||||
// Debug.Log("No hit");
|
||||
else
|
||||
{
|
||||
// Debug.Log("No hit");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private GameObject disappear01;
|
||||
private GameObject disappear02;
|
||||
public void creatSpine(int type, Vector3 vec3)
|
||||
@@ -226,7 +248,7 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
{
|
||||
SkeletonAnimation temp = Instantiate(disappear01, new Vector3(vec3.x, vec3.y, 110), Quaternion.identity, gameObject.transform).GetComponent<SkeletonAnimation>();
|
||||
temp.AnimationState.SetAnimation(0, "disappear01", true);
|
||||
temp.AnimationState.Complete += trackEntry =>
|
||||
temp.AnimationState.Complete += (trackEntry) =>
|
||||
{
|
||||
Destroy(temp.gameObject);
|
||||
};
|
||||
@@ -235,7 +257,7 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
{
|
||||
SkeletonAnimation temp = Instantiate(disappear02, new Vector3(vec3.x, vec3.y, 110), Quaternion.identity, gameObject.transform).GetComponent<SkeletonAnimation>();
|
||||
temp.AnimationState.SetAnimation(0, "disappear02", true);
|
||||
temp.AnimationState.Complete += trackEntry =>
|
||||
temp.AnimationState.Complete += (trackEntry) =>
|
||||
{
|
||||
Destroy(temp.gameObject);
|
||||
};
|
||||
@@ -246,7 +268,7 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
|
||||
int getMaplayer(List<List<Vector2>> map_list)
|
||||
{
|
||||
int layer = Random.Range(0, map_list.Count);//确定层数
|
||||
int layer = UnityEngine.Random.Range(0, map_list.Count);//确定层数
|
||||
if (map_list[layer].Count == 0)
|
||||
{
|
||||
layer = getMaplayer(map_list);
|
||||
|
||||
Reference in New Issue
Block a user